m-abboud / fontverter Goto Github PK
View Code? Open in Web Editor NEWJava font converter library.
Home Page: http://mabboud.net
License: GNU Lesser General Public License v3.0
Java font converter library.
Home Page: http://mabboud.net
License: GNU Lesser General Public License v3.0
Hi.
While I'm using pdf2dom library to convert a PDF file into a web form, I get a stack trace printed out on the standard error, and I can't manage to remove it from the standard error to have it my logs instead. It seems to be because GlyphTable.java has a ex.printStackTrace() on line 77, instead of using the log.error() mechanism.
Is it possible to change this to remove any output to the standard error ?
The stack trace I get is the following:
org.mabb.fontverter.io.DataTypeSerializerException: org.mabb.fontverter.io.DataTypeSerializerException: org.mabb.fontverter.opentype.TtfGlyph
at org.mabb.fontverter.io.DataTypeBindingDeserializer.deserialize(DataTypeBindingDeserializer.java:47)
at org.mabb.fontverter.opentype.TtfGlyph.parse(TtfGlyph.java:80)
at org.mabb.fontverter.opentype.GlyphTable.readData(GlyphTable.java:74)
at org.mabb.fontverter.opentype.OpenTypeParser.readTableDataEntries(OpenTypeParser.java:75)
at org.mabb.fontverter.opentype.OpenTypeParser.parse(OpenTypeParser.java:47)
at org.mabb.fontverter.opentype.OpenTypeParser.parse(OpenTypeParser.java:35)
at org.mabb.fontverter.converter.PsType0ToOpenTypeConverter.getOtfFromDescendantFont(PsType0ToOpenTypeConverter.java:64)
at org.mabb.fontverter.converter.PsType0ToOpenTypeConverter.convert(PsType0ToOpenTypeConverter.java:43)
at org.mabb.fontverter.pdf.PdfFontExtractor.convertType0FontToOpenType(PdfFontExtractor.java:215)
at org.fit.pdfdom.FontTable$Entry.loadType0TtfDescendantFont(FontTable.java:192)
at org.fit.pdfdom.FontTable$Entry.getData(FontTable.java:145)
at org.fit.pdfdom.FontTable$Entry.isEntryValid(FontTable.java:161)
at org.fit.pdfdom.FontTable.addEntry(FontTable.java:48)
at org.fit.pdfdom.PDFBoxTree.processFontResources(PDFBoxTree.java:385)
at org.fit.pdfdom.PDFBoxTree.updateFontTable(PDFBoxTree.java:361)
at org.fit.pdfdom.PDFBoxTree.processPage(PDFBoxTree.java:206)
at org.apache.pdfbox.text.PDFTextStripper.processPages(PDFTextStripper.java:319)
at org.apache.pdfbox.text.PDFTextStripper.writeText(PDFTextStripper.java:266)
at xxx.pdf2formly.PDFFormlyTree.writeText(PDFFormlyTree.java:112)
at xxx.pdf2formly.PDFFormlyTreeTest.convertExistingForm(PDFFormlyTreeTest.java:77)
at xxx.pdf2formly.PDFFormlyTreeTest.convertForm1(PDFFormlyTreeTest.java:53)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:365)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:273)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:238)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:159)
at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:383)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:344)
at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:125)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:417)
Caused by: org.mabb.fontverter.io.DataTypeSerializerException: org.mabb.fontverter.opentype.TtfGlyph
at org.mabb.fontverter.io.DataTypeBindingDeserializer.deserialize(DataTypeBindingDeserializer.java:71)
at org.mabb.fontverter.io.DataTypeBindingDeserializer.deserialize(DataTypeBindingDeserializer.java:45)
... 46 more
Caused by: org.mabb.fontverter.io.DataTypeSerializerException: int org.mabb.fontverter.opentype.TtfGlyph.instructionLength org.mabb.fontverter.opentype.TtfGlyph
at org.mabb.fontverter.io.DataTypeBindingDeserializer.deserialize(DataTypeBindingDeserializer.java:65)
... 47 more
Caused by: java.io.EOFException
at java.io.DataInputStream.readUnsignedShort(DataInputStream.java:340)
at org.mabb.fontverter.io.DataTypeBindingDeserializer.readSingleValue(DataTypeBindingDeserializer.java:105)
at org.mabb.fontverter.io.DataTypeBindingDeserializer.deserializeProperty(DataTypeBindingDeserializer.java:92)
at org.mabb.fontverter.io.DataTypeBindingDeserializer.deserialize(DataTypeBindingDeserializer.java:63)
... 47 more
Starting to love the font domain :D. I have the same issue as reported here: https://stackoverflow.com/questions/5587956/make-adobe-fonts-work-with-css3-font-face-in-ie9, with the due exception that the error happens on IE11.
Basically, the font does not render in IE11 because the font does have a flag called installable embedding set with a restrictive level, which means that the font has restrictions in terms of where can be embedded/used.
Is there a way to change such flag value from the library programmatically?
If not available would this help to be taken as inspiration? https://github.com/hisdeedsaredust/ttembed
I'm unable to use the lib, because one it's dependency has vanished from Maven:
Error:Could not resolve org.jfrog.jade.plugins.common:jade-plugin-common:1.3.8.
Required by: net.mabboud.fontverter:FontVerter:1.2.18 > org.reflections:reflections-maven:0.9.9-RC2
hasExtractedFont stacktraces when font name is null.
Fixed with below. Overriding PdfFontExtractor class to fix the error at the moment.
protected boolean hasExtractedFont(PDFont font) {
for (PDFont fontOn : extractedFonts) {
if (fontOn == null || fontOn.getName() == null)
return false;
if (font == null || font.getName() == null)
return false;
if (fontOn.getName().equals(font.getName()) && fontOn.getClass() == font.getClass())
return true;
}
return false;
}
Hello
Could you help me please. Why converted woff is not valid?
public static byte[] convertTtf2Woff(byte[] ttfFont) throws IOException {
return FontVerter.convertFont(ttfFont, FontVerter.FontFormat.WOFF1).getData();
}
I've attached base ttf file in this ticket
Pacifico_ttf.zip
we found a rare case where Pdf2Dom throws an OutOfMemory exception when handling embedded fonts. The stack trace is
java.lang.OutOfMemoryError
java.lang.AbstractStringBuilder.hugeCapacity(AbstractStringBuilder.java:161)
java.lang.AbstractStringBuilder.newCapacity(AbstractStringBuilder.java:155)
java.lang.AbstractStringBuilder.ensureCapacityInternal(AbstractStringBuilder.java:125)
java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:448)
java.lang.StringBuilder.append(StringBuilder.java:136)
org.fit.pdfdom.PDFDomTree.createFontFace(PDFDomTree.java:564)
org.fit.pdfdom.PDFDomTree.createFontFaces(PDFDomTree.java:551)
org.fit.pdfdom.PDFDomTree.createGlobalStyle(PDFDomTree.java:533)
org.fit.pdfdom.PDFDomTree.endDocument(PDFDomTree.java:176)
org.apache.pdfbox.text.PDFTextStripper.writeText(PDFTextStripper.java:267)
org.fit.pdfdom.PDFDomTree.createDOM(PDFDomTree.java:218)
...
The actual accumulation of data is probably happening in Fontverter at
at org.mabb.fontverter.io.FontDataInputStream.readBytes(FontDataInputStream.java:56)
at org.mabb.fontverter.opentype.OpenTypeParser.readTableDataEntries(OpenTypeParser.java:73)
at org.mabb.fontverter.opentype.OpenTypeParser.parse(OpenTypeParser.java:47)
at org.mabb.fontverter.opentype.OpenTypeParser.parse(OpenTypeParser.java:35)
at org.mabb.fontverter.converter.PsType0ToOpenTypeConverter.getOtfFromDescendantFont(PsType0ToOpenTypeConverter.java:64)
at org.mabb.fontverter.converter.PsType0ToOpenTypeConverter.convert(PsType0ToOpenTypeConverter.java:43)
at org.mabb.fontverter.pdf.PdfFontExtractor.convertType0FontToOpenType(PdfFontExtractor.java:215)
at org.fit.pdfdom.FontTable$Entry.loadType0TtfDescendantFont(FontTable.java:192)
at org.fit.pdfdom.FontTable$Entry.getData(FontTable.java:145)
at org.fit.pdfdom.FontTable$Entry.isEntryValid(FontTable.java:161)
at org.fit.pdfdom.FontTable.addEntry(FontTable.java:48)
at org.fit.pdfdom.PDFBoxTree.processFontResources(PDFBoxTree.java:385)
at org.fit.pdfdom.PDFBoxTree.updateFontTable(PDFBoxTree.java:361)
at org.fit.pdfdom.PDFDomTree.updateFontTable(PDFDomTree.java:544)
at org.fit.pdfdom.PDFBoxTree.processPage(PDFBoxTree.java:206)
at org.apache.pdfbox.text.PDFTextStripper.processPages(PDFTextStripper.java:319)
at org.apache.pdfbox.text.PDFTextStripper.writeText(PDFTextStripper.java:266)
at org.fit.pdfdom.PDFDomTree.createDOM(PDFDomTree.java:218)
You can reproduce the issue with e.g. this PDF file:
http://files.danfoss.com/technicalinfo/dila/17/FRCC.ED.VZH170BG.A6.22.pdf
We were checking the sourcecode and it looks like there is some broken offset in the table, pointing far beyond the actual byte array length (the offset deserialized is 1.338.484.881).
In FontDataInputStream then an array of the length 1.594.834.165 bytes is allocated. Then the method tries to read the data from the stream and receives every time a -1 as result (because the stream is at EoF).
```
public byte[] readBytes(int length) throws IOException {
byte[] bytes = new byte[length];
for (int i = 0; i < bytes.length; i++)
bytes[i] = (byte) in.read();
return bytes;
}
This long array then later on causes issues in Pdf2Dom.
We propose a hotfix that introduces some range check into the readBytes() method, e.g.
```
public byte[] readBytes(int length) throws IOException {
if (in.available() == 0)
return new byte[0];
byte[] bytes = new byte[length];
for (int i = 0; i < bytes.length; i++)
{
byte b = (byte) in.read();
if (b>-1)
bytes[i] = b;
else
return Arrays.copyOf(bytes, i);
}
return bytes;
}
As OutOfMemory Exceptions are hard to deal with once they occured we would like to see a fix for this soon.
Have a nice day
I am trying to analyse fonts files (woff, otf and ttf) and extract metadata information such as font name. For instance, when analysing the attached file JustAFileName.zip, the below code is not able to retrieve the font name information:
FVFont font = FontVerter.readFont(file);
String fontName = font.getName(); // always returns null
So far I have been unable to get the font name for any font I tried to analyse, so my guess is that either there is a bug or all the fonts I tried are somehow "corrupted".
The following error is caught when converting font to WOFF2.
java.lang.NumberFormatException: Value out of range. Value:"11001010" Radix:2
at java.lang.Byte.parseByte(Byte.java:151) ~[?:1.8.0_162]
at org.mabb.fontverter.woff.WoffOutputStream.writeFlagByte(WoffOutputStream.java:67) ~[fontverter-1.2.20.jar:?]
at org.mabb.fontverter.woff.Woff2Font$Woff2Table.getDirectoryData(Woff2Font.java:122) ~[fontverter-1.2.20.jar:?]
at org.mabb.fontverter.woff.WoffFont.getTableDirectoryData(WoffFont.java:83) ~[fontverter-1.2.20.jar:?]
at org.mabb.fontverter.woff.WoffFont.getRawData(WoffFont.java:74) ~[fontverter-1.2.20.jar:?]
at org.mabb.fontverter.woff.Woff2Font.getRawData(Woff2Font.java:65) ~[fontverter-1.2.20.jar:?]
at org.mabb.fontverter.woff.WoffHeader.calculateValues(WoffHeader.java:93) ~[fontverter-1.2.20.jar:?]
at org.mabb.fontverter.woff.WoffFont.getData(WoffFont.java:58) ~[fontverter-1.2.20.jar:?]
It seems to be an issue with unsigned byte parsing. By default all byte values are signed in java, so the method java.lang.Byte.parseByte can not be used.
Hi,
The following line throws an exception for me
FVFont font = FontVerter.convertFont(ICON_FILE_WOFF2, FontFormat.TTF);
It throws the following exception
java.lang.NegativeArraySizeException at org.mabb.fontverter.io.FontDataInputStream.readBytes(FontDataInputStream.java:55) at org.mabb.fontverter.opentype.GlyphTable.readData(GlyphTable.java:72) at org.mabb.fontverter.converter.WoffToOtfConverter.readTables(WoffToOtfConverter.java:65) at org.mabb.fontverter.converter.WoffToOtfConverter.convertFont(WoffToOtfConverter.java:38) at org.mabb.fontverter.FontVerter.convertFont(FontVerter.java:65) at org.mabb.fontverter.FontVerter.convertFont(FontVerter.java:70) at org.mabb.fontverter.FontVerter.convertFont(FontVerter.java:80) at com.thakare.help_thumbnails.App.woff2ttf(App.java:56) at com.thakare.help_thumbnails.App.main(App.java:51) java.lang.ArrayIndexOutOfBoundsException: -1 at org.mabb.fontverter.opentype.TtfGlyph.getNumberOfPoints(TtfGlyph.java:251) at org.mabb.fontverter.opentype.TtfGlyph.readFlags(TtfGlyph.java:144) at org.mabb.fontverter.opentype.TtfGlyph.readSimpleGlyphData(TtfGlyph.java:139) at org.mabb.fontverter.opentype.TtfGlyph.parse(TtfGlyph.java:91) at org.mabb.fontverter.opentype.GlyphTable.readData(GlyphTable.java:74) at org.mabb.fontverter.converter.WoffToOtfConverter.readTables(WoffToOtfConverter.java:65) at org.mabb.fontverter.converter.WoffToOtfConverter.convertFont(WoffToOtfConverter.java:38) at org.mabb.fontverter.FontVerter.convertFont(FontVerter.java:65) at org.mabb.fontverter.FontVerter.convertFont(FontVerter.java:70) at org.mabb.fontverter.FontVerter.convertFont(FontVerter.java:80) at com.thakare.help_thumbnails.App.woff2ttf(App.java:56) at com.thakare.help_thumbnails.App.main(App.java:51) org.mabb.fontverter.io.DataTypeSerializerException: org.mabb.fontverter.io.DataTypeSerializerException: org.mabb.fontverter.opentype.TtfGlyph at org.mabb.fontverter.io.DataTypeBindingDeserializer.deserialize(DataTypeBindingDeserializer.java:47) at org.mabb.fontverter.opentype.TtfGlyph.parse(TtfGlyph.java:80) at org.mabb.fontverter.opentype.GlyphTable.readData(GlyphTable.java:74) at org.mabb.fontverter.converter.WoffToOtfConverter.readTables(WoffToOtfConverter.java:65) at org.mabb.fontverter.converter.WoffToOtfConverter.convertFont(WoffToOtfConverter.java:38) at org.mabb.fontverter.FontVerter.convertFont(FontVerter.java:65) at org.mabb.fontverter.FontVerter.convertFont(FontVerter.java:70) at org.mabb.fontverter.FontVerter.convertFont(FontVerter.java:80) at com.thakare.help_thumbnails.App.woff2ttf(App.java:56) at com.thakare.help_thumbnails.App.main(App.java:51) Caused by: org.mabb.fontverter.io.DataTypeSerializerException: org.mabb.fontverter.opentype.TtfGlyph at org.mabb.fontverter.io.DataTypeBindingDeserializer.deserialize(DataTypeBindingDeserializer.java:71) at org.mabb.fontverter.io.DataTypeBindingDeserializer.deserialize(DataTypeBindingDeserializer.java:45) ... 9 more Caused by: org.mabb.fontverter.io.DataTypeSerializerException: java.lang.Byte[] org.mabb.fontverter.opentype.TtfGlyph.instructions org.mabb.fontverter.opentype.TtfGlyph at org.mabb.fontverter.io.DataTypeBindingDeserializer.deserialize(DataTypeBindingDeserializer.java:65) ... 10 more Caused by: java.io.IOException: Array length ran over input data length. Index on: 14 Array Length: 1298 at org.mabb.fontverter.io.DataTypeBindingDeserializer.readArrayValue(DataTypeBindingDeserializer.java:156) at org.mabb.fontverter.io.DataTypeBindingDeserializer.deserializeProperty(DataTypeBindingDeserializer.java:90) at org.mabb.fontverter.io.DataTypeBindingDeserializer.deserialize(DataTypeBindingDeserializer.java:63) ... 10 more java.lang.ArrayIndexOutOfBoundsException: -1 at org.mabb.fontverter.opentype.TtfGlyph.getNumberOfPoints(TtfGlyph.java:251) at org.mabb.fontverter.opentype.TtfGlyph.readFlags(TtfGlyph.java:144) at org.mabb.fontverter.opentype.TtfGlyph.readSimpleGlyphData(TtfGlyph.java:139) at org.mabb.fontverter.opentype.TtfGlyph.parse(TtfGlyph.java:91) at org.mabb.fontverter.opentype.GlyphTable.readData(GlyphTable.java:74) at org.mabb.fontverter.converter.WoffToOtfConverter.readTables(WoffToOtfConverter.java:65) at org.mabb.fontverter.converter.WoffToOtfConverter.convertFont(WoffToOtfConverter.java:38) at org.mabb.fontverter.FontVerter.convertFont(FontVerter.java:65) at org.mabb.fontverter.FontVerter.convertFont(FontVerter.java:70) at org.mabb.fontverter.FontVerter.convertFont(FontVerter.java:80) at com.thakare.help_thumbnails.App.woff2ttf(App.java:56) at com.thakare.help_thumbnails.App.main(App.java:51) org.mabb.fontverter.io.DataTypeSerializerException: org.mabb.fontverter.io.DataTypeSerializerException: org.mabb.fontverter.opentype.TtfGlyph at org.mabb.fontverter.io.DataTypeBindingDeserializer.deserialize(DataTypeBindingDeserializer.java:47) at org.mabb.fontverter.opentype.TtfGlyph.parse(TtfGlyph.java:80) at org.mabb.fontverter.opentype.GlyphTable.readData(GlyphTable.java:74) at org.mabb.fontverter.converter.WoffToOtfConverter.readTables(WoffToOtfConverter.java:65) at org.mabb.fontverter.converter.WoffToOtfConverter.convertFont(WoffToOtfConverter.java:38) at org.mabb.fontverter.FontVerter.convertFont(FontVerter.java:65) at org.mabb.fontverter.FontVerter.convertFont(FontVerter.java:70) at org.mabb.fontverter.FontVerter.convertFont(FontVerter.java:80) at com.thakare.help_thumbnails.App.woff2ttf(App.java:56) at com.thakare.help_thumbnails.App.main(App.java:51) Caused by: org.mabb.fontverter.io.DataTypeSerializerException: org.mabb.fontverter.opentype.TtfGlyph at org.mabb.fontverter.io.DataTypeBindingDeserializer.deserialize(DataTypeBindingDeserializer.java:71) at org.mabb.fontverter.io.DataTypeBindingDeserializer.deserialize(DataTypeBindingDeserializer.java:45) ... 9 more Caused by: org.mabb.fontverter.io.DataTypeSerializerException: java.lang.Byte[] org.mabb.fontverter.opentype.TtfGlyph.instructions org.mabb.fontverter.opentype.TtfGlyph at org.mabb.fontverter.io.DataTypeBindingDeserializer.deserialize(DataTypeBindingDeserializer.java:65) ... 10 more Caused by: java.io.IOException: Array length ran over input data length. Index on: 52 Array Length: 1298 at org.mabb.fontverter.io.DataTypeBindingDeserializer.readArrayValue(DataTypeBindingDeserializer.java:156) at org.mabb.fontverter.io.DataTypeBindingDeserializer.deserializeProperty(DataTypeBindingDeserializer.java:90) at org.mabb.fontverter.io.DataTypeBindingDeserializer.deserialize(DataTypeBindingDeserializer.java:63) ... 10 more java.lang.NegativeArraySizeException at org.mabb.fontverter.io.FontDataInputStream.readBytes(FontDataInputStream.java:55) at org.mabb.fontverter.opentype.GlyphTable.readData(GlyphTable.java:72) at org.mabb.fontverter.converter.WoffToOtfConverter.readTables(WoffToOtfConverter.java:65) at org.mabb.fontverter.converter.WoffToOtfConverter.convertFont(WoffToOtfConverter.java:38) at org.mabb.fontverter.FontVerter.convertFont(FontVerter.java:65) at org.mabb.fontverter.FontVerter.convertFont(FontVerter.java:70) at org.mabb.fontverter.FontVerter.convertFont(FontVerter.java:80) at com.thakare.help_thumbnails.App.woff2ttf(App.java:56) at com.thakare.help_thumbnails.App.main(App.java:51) java.lang.NegativeArraySizeException at org.mabb.fontverter.io.FontDataInputStream.readBytes(FontDataInputStream.java:55) at org.mabb.fontverter.opentype.GlyphTable.readData(GlyphTable.java:72) at org.mabb.fontverter.converter.WoffToOtfConverter.readTables(WoffToOtfConverter.java:65) at org.mabb.fontverter.converter.WoffToOtfConverter.convertFont(WoffToOtfConverter.java:38) at org.mabb.fontverter.FontVerter.convertFont(FontVerter.java:65) at org.mabb.fontverter.FontVerter.convertFont(FontVerter.java:70) at org.mabb.fontverter.FontVerter.convertFont(FontVerter.java:80) at com.thakare.help_thumbnails.App.woff2ttf(App.java:56) at com.thakare.help_thumbnails.App.main(App.java:51) java.lang.ArrayIndexOutOfBoundsException: -1 at org.mabb.fontverter.opentype.TtfGlyph.getNumberOfPoints(TtfGlyph.java:251) at org.mabb.fontverter.opentype.TtfGlyph.readFlags(TtfGlyph.java:144) at org.mabb.fontverter.opentype.TtfGlyph.readSimpleGlyphData(TtfGlyph.java:139) at org.mabb.fontverter.opentype.TtfGlyph.parse(TtfGlyph.java:91) at org.mabb.fontverter.opentype.GlyphTable.readData(GlyphTable.java:74) at org.mabb.fontverter.converter.WoffToOtfConverter.readTables(WoffToOtfConverter.java:65) at org.mabb.fontverter.converter.WoffToOtfConverter.convertFont(WoffToOtfConverter.java:38) at org.mabb.fontverter.FontVerter.convertFont(FontVerter.java:65) at org.mabb.fontverter.FontVerter.convertFont(FontVerter.java:70) at org.mabb.fontverter.FontVerter.convertFont(FontVerter.java:80) at com.thakare.help_thumbnails.App.woff2ttf(App.java:56) at com.thakare.help_thumbnails.App.main(App.java:51) java.lang.ArrayIndexOutOfBoundsException: -1 at org.mabb.fontverter.opentype.TtfGlyph.getNumberOfPoints(TtfGlyph.java:251) at org.mabb.fontverter.opentype.TtfGlyph.readFlags(TtfGlyph.java:144) at org.mabb.fontverter.opentype.TtfGlyph.readSimpleGlyphData(TtfGlyph.java:139) at org.mabb.fontverter.opentype.TtfGlyph.parse(TtfGlyph.java:91) at org.mabb.fontverter.opentype.GlyphTable.readData(GlyphTable.java:74) at org.mabb.fontverter.converter.WoffToOtfConverter.readTables(WoffToOtfConverter.java:65) at org.mabb.fontverter.converter.WoffToOtfConverter.convertFont(WoffToOtfConverter.java:38) at org.mabb.fontverter.FontVerter.convertFont(FontVerter.java:65) at org.mabb.fontverter.FontVerter.convertFont(FontVerter.java:70) at org.mabb.fontverter.FontVerter.convertFont(FontVerter.java:80) at com.thakare.help_thumbnails.App.woff2ttf(App.java:56) at com.thakare.help_thumbnails.App.main(App.java:51) java.lang.ArrayIndexOutOfBoundsException: -1 at org.mabb.fontverter.opentype.TtfGlyph.getNumberOfPoints(TtfGlyph.java:251) at org.mabb.fontverter.opentype.TtfGlyph.readFlags(TtfGlyph.java:144) at org.mabb.fontverter.opentype.TtfGlyph.readSimpleGlyphData(TtfGlyph.java:139) at org.mabb.fontverter.opentype.TtfGlyph.parse(TtfGlyph.java:91) at org.mabb.fontverter.opentype.GlyphTable.readData(GlyphTable.java:74) at org.mabb.fontverter.converter.WoffToOtfConverter.readTables(WoffToOtfConverter.java:65) at org.mabb.fontverter.converter.WoffToOtfConverter.convertFont(WoffToOtfConverter.java:38) at org.mabb.fontverter.FontVerter.convertFont(FontVerter.java:65) at org.mabb.fontverter.FontVerter.convertFont(FontVerter.java:70) at org.mabb.fontverter.FontVerter.convertFont(FontVerter.java:80) at com.thakare.help_thumbnails.App.woff2ttf(App.java:56) at com.thakare.help_thumbnails.App.main(App.java:51) java.lang.ArrayIndexOutOfBoundsException: -1 at org.mabb.fontverter.opentype.TtfGlyph.getNumberOfPoints(TtfGlyph.java:251) at org.mabb.fontverter.opentype.TtfGlyph.readFlags(TtfGlyph.java:144) at org.mabb.fontverter.opentype.TtfGlyph.readSimpleGlyphData(TtfGlyph.java:139) at org.mabb.fontverter.opentype.TtfGlyph.parse(TtfGlyph.java:91) at org.mabb.fontverter.opentype.GlyphTable.readData(GlyphTable.java:74) at org.mabb.fontverter.converter.WoffToOtfConverter.readTables(WoffToOtfConverter.java:65) at org.mabb.fontverter.converter.WoffToOtfConverter.convertFont(WoffToOtfConverter.java:38) at org.mabb.fontverter.FontVerter.convertFont(FontVerter.java:65) at org.mabb.fontverter.FontVerter.convertFont(FontVerter.java:70) at org.mabb.fontverter.FontVerter.convertFont(FontVerter.java:80) at com.thakare.help_thumbnails.App.woff2ttf(App.java:56) at com.thakare.help_thumbnails.App.main(App.java:51) java.lang.ArrayIndexOutOfBoundsException: -1 at org.mabb.fontverter.opentype.TtfGlyph.getNumberOfPoints(TtfGlyph.java:251) at org.mabb.fontverter.opentype.TtfGlyph.readFlags(TtfGlyph.java:144) at org.mabb.fontverter.opentype.TtfGlyph.readSimpleGlyphData(TtfGlyph.java:139) at org.mabb.fontverter.opentype.TtfGlyph.parse(TtfGlyph.java:91) at org.mabb.fontverter.opentype.GlyphTable.readData(GlyphTable.java:74) at org.mabb.fontverter.converter.WoffToOtfConverter.readTables(WoffToOtfConverter.java:65) at org.mabb.fontverter.converter.WoffToOtfConverter.convertFont(WoffToOtfConverter.java:38) at org.mabb.fontverter.FontVerter.convertFont(FontVerter.java:65) at org.mabb.fontverter.FontVerter.convertFont(FontVerter.java:70) at org.mabb.fontverter.FontVerter.convertFont(FontVerter.java:80) at com.thakare.help_thumbnails.App.woff2ttf(App.java:56) at com.thakare.help_thumbnails.App.main(App.java:51) java.lang.ArrayIndexOutOfBoundsException: -1 at org.mabb.fontverter.opentype.TtfGlyph.getNumberOfPoints(TtfGlyph.java:251) at org.mabb.fontverter.opentype.TtfGlyph.readFlags(TtfGlyph.java:144) at org.mabb.fontverter.opentype.TtfGlyph.readSimpleGlyphData(TtfGlyph.java:139) at org.mabb.fontverter.opentype.TtfGlyph.parse(TtfGlyph.java:91) at org.mabb.fontverter.opentype.GlyphTable.readData(GlyphTable.java:74) at org.mabb.fontverter.converter.WoffToOtfConverter.readTables(WoffToOtfConverter.java:65) at org.mabb.fontverter.converter.WoffToOtfConverter.convertFont(WoffToOtfConverter.java:38) at org.mabb.fontverter.FontVerter.convertFont(FontVerter.java:65) at org.mabb.fontverter.FontVerter.convertFont(FontVerter.java:70) at org.mabb.fontverter.FontVerter.convertFont(FontVerter.java:80) at com.thakare.help_thumbnails.App.woff2ttf(App.java:56) at com.thakare.help_thumbnails.App.main(App.java:51) java.lang.ArrayIndexOutOfBoundsException: -1 at org.mabb.fontverter.opentype.TtfGlyph.getNumberOfPoints(TtfGlyph.java:251) at org.mabb.fontverter.opentype.TtfGlyph.readFlags(TtfGlyph.java:144) at org.mabb.fontverter.opentype.TtfGlyph.readSimpleGlyphData(TtfGlyph.java:139) at org.mabb.fontverter.opentype.TtfGlyph.parse(TtfGlyph.java:91) at org.mabb.fontverter.opentype.GlyphTable.readData(GlyphTable.java:74) at org.mabb.fontverter.converter.WoffToOtfConverter.readTables(WoffToOtfConverter.java:65) at org.mabb.fontverter.converter.WoffToOtfConverter.convertFont(WoffToOtfConverter.java:38) at org.mabb.fontverter.FontVerter.convertFont(FontVerter.java:65) at org.mabb.fontverter.FontVerter.convertFont(FontVerter.java:70) at org.mabb.fontverter.FontVerter.convertFont(FontVerter.java:80) at com.thakare.help_thumbnails.App.woff2ttf(App.java:56) at com.thakare.help_thumbnails.App.main(App.java:51) java.lang.ArrayIndexOutOfBoundsException: -1 at org.mabb.fontverter.opentype.TtfGlyph.getNumberOfPoints(TtfGlyph.java:251) at org.mabb.fontverter.opentype.TtfGlyph.readFlags(TtfGlyph.java:144) at org.mabb.fontverter.opentype.TtfGlyph.readSimpleGlyphData(TtfGlyph.java:139) at org.mabb.fontverter.opentype.TtfGlyph.parse(TtfGlyph.java:91) at org.mabb.fontverter.opentype.GlyphTable.readData(GlyphTable.java:74) at org.mabb.fontverter.converter.WoffToOtfConverter.readTables(WoffToOtfConverter.java:65) at org.mabb.fontverter.converter.WoffToOtfConverter.convertFont(WoffToOtfConverter.java:38) at org.mabb.fontverter.FontVerter.convertFont(FontVerter.java:65) at org.mabb.fontverter.FontVerter.convertFont(FontVerter.java:70) at org.mabb.fontverter.FontVerter.convertFont(FontVerter.java:80) at com.thakare.help_thumbnails.App.woff2ttf(App.java:56) at com.thakare.help_thumbnails.App.main(App.java:51) java.lang.ArrayIndexOutOfBoundsException: -1 at org.mabb.fontverter.opentype.TtfGlyph.getNumberOfPoints(TtfGlyph.java:251) at org.mabb.fontverter.opentype.TtfGlyph.readFlags(TtfGlyph.java:144) at org.mabb.fontverter.opentype.TtfGlyph.readSimpleGlyphData(TtfGlyph.java:139) at org.mabb.fontverter.opentype.TtfGlyph.parse(TtfGlyph.java:91) at org.mabb.fontverter.opentype.GlyphTable.readData(GlyphTable.java:74) at org.mabb.fontverter.converter.WoffToOtfConverter.readTables(WoffToOtfConverter.java:65) at org.mabb.fontverter.converter.WoffToOtfConverter.convertFont(WoffToOtfConverter.java:38) at org.mabb.fontverter.FontVerter.convertFont(FontVerter.java:65) at org.mabb.fontverter.FontVerter.convertFont(FontVerter.java:70) at org.mabb.fontverter.FontVerter.convertFont(FontVerter.java:80) at com.thakare.help_thumbnails.App.woff2ttf(App.java:56) at com.thakare.help_thumbnails.App.main(App.java:51) java.lang.ArrayIndexOutOfBoundsException: -1 at org.mabb.fontverter.opentype.TtfGlyph.getNumberOfPoints(TtfGlyph.java:251) at org.mabb.fontverter.opentype.TtfGlyph.readFlags(TtfGlyph.java:144) at org.mabb.fontverter.opentype.TtfGlyph.readSimpleGlyphData(TtfGlyph.java:139) at org.mabb.fontverter.opentype.TtfGlyph.parse(TtfGlyph.java:91) at org.mabb.fontverter.opentype.GlyphTable.readData(GlyphTable.java:74) at org.mabb.fontverter.converter.WoffToOtfConverter.readTables(WoffToOtfConverter.java:65) at org.mabb.fontverter.converter.WoffToOtfConverter.convertFont(WoffToOtfConverter.java:38) at org.mabb.fontverter.FontVerter.convertFont(FontVerter.java:65) at org.mabb.fontverter.FontVerter.convertFont(FontVerter.java:70) at org.mabb.fontverter.FontVerter.convertFont(FontVerter.java:80) at com.thakare.help_thumbnails.App.woff2ttf(App.java:56) at com.thakare.help_thumbnails.App.main(App.java:51) java.lang.ArrayIndexOutOfBoundsException: -1 at org.mabb.fontverter.opentype.TtfGlyph.getNumberOfPoints(TtfGlyph.java:251) at org.mabb.fontverter.opentype.TtfGlyph.readFlags(TtfGlyph.java:144) at org.mabb.fontverter.opentype.TtfGlyph.readSimpleGlyphData(TtfGlyph.java:139) at org.mabb.fontverter.opentype.TtfGlyph.parse(TtfGlyph.java:91) at org.mabb.fontverter.opentype.GlyphTable.readData(GlyphTable.java:74) at org.mabb.fontverter.converter.WoffToOtfConverter.readTables(WoffToOtfConverter.java:65) at org.mabb.fontverter.converter.WoffToOtfConverter.convertFont(WoffToOtfConverter.java:38) at org.mabb.fontverter.FontVerter.convertFont(FontVerter.java:65) at org.mabb.fontverter.FontVerter.convertFont(FontVerter.java:70) at org.mabb.fontverter.FontVerter.convertFont(FontVerter.java:80) at com.thakare.help_thumbnails.App.woff2ttf(App.java:56) at com.thakare.help_thumbnails.App.main(App.java:51) java.lang.ArrayIndexOutOfBoundsException: -1 at org.mabb.fontverter.opentype.TtfGlyph.getNumberOfPoints(TtfGlyph.java:251) at org.mabb.fontverter.opentype.TtfGlyph.readFlags(TtfGlyph.java:144) at org.mabb.fontverter.opentype.TtfGlyph.readSimpleGlyphData(TtfGlyph.java:139) at org.mabb.fontverter.opentype.TtfGlyph.parse(TtfGlyph.java:91) at org.mabb.fontverter.opentype.GlyphTable.readData(GlyphTable.java:74) at org.mabb.fontverter.converter.WoffToOtfConverter.readTables(WoffToOtfConverter.java:65) at org.mabb.fontverter.converter.WoffToOtfConverter.convertFont(WoffToOtfConverter.java:38) at org.mabb.fontverter.FontVerter.convertFont(FontVerter.java:65) at org.mabb.fontverter.FontVerter.convertFont(FontVerter.java:70) at org.mabb.fontverter.FontVerter.convertFont(FontVerter.java:80) at com.thakare.help_thumbnails.App.woff2ttf(App.java:56) at com.thakare.help_thumbnails.App.main(App.java:51) java.lang.NegativeArraySizeException at org.mabb.fontverter.io.FontDataInputStream.readBytes(FontDataInputStream.java:55) at org.mabb.fontverter.opentype.GlyphTable.readData(GlyphTable.java:72) at org.mabb.fontverter.converter.WoffToOtfConverter.readTables(WoffToOtfConverter.java:65) at org.mabb.fontverter.converter.WoffToOtfConverter.convertFont(WoffToOtfConverter.java:38) at org.mabb.fontverter.FontVerter.convertFont(FontVerter.java:65) at org.mabb.fontverter.FontVerter.convertFont(FontVerter.java:70) at org.mabb.fontverter.FontVerter.convertFont(FontVerter.java:80) at com.thakare.help_thumbnails.App.woff2ttf(App.java:56) at com.thakare.help_thumbnails.App.main(App.java:51) java.lang.NegativeArraySizeException at org.mabb.fontverter.io.FontDataInputStream.readBytes(FontDataInputStream.java:55) at org.mabb.fontverter.opentype.GlyphTable.readData(GlyphTable.java:72) at org.mabb.fontverter.converter.WoffToOtfConverter.readTables(WoffToOtfConverter.java:65) at org.mabb.fontverter.converter.WoffToOtfConverter.convertFont(WoffToOtfConverter.java:38) at org.mabb.fontverter.FontVerter.convertFont(FontVerter.java:65) at org.mabb.fontverter.FontVerter.convertFont(FontVerter.java:70) at org.mabb.fontverter.FontVerter.convertFont(FontVerter.java:80) at com.thakare.help_thumbnails.App.woff2ttf(App.java:56) at com.thakare.help_thumbnails.App.main(App.java:51) Exception in thread "main" org.mabb.fontverter.io.DataTypeSerializerException: Error serializing property: java.lang.Long[] org.mabb.fontverter.opentype.GlyphLocationTable.longOffsets at org.mabb.fontverter.io.DataTypeBindingSerializer.serialize(DataTypeBindingSerializer.java:41) at org.mabb.fontverter.io.DataTypeBindingSerializer.serialize(DataTypeBindingSerializer.java:30) at org.mabb.fontverter.opentype.OpenTypeTable.generateUnpaddedData(OpenTypeTable.java:147) at org.mabb.fontverter.opentype.OpenTypeTable.getUnpaddedData(OpenTypeTable.java:141) at org.mabb.fontverter.opentype.OpenTypeTable.getData(OpenTypeTable.java:129) at org.mabb.fontverter.opentype.OpenTypeFont.calculateOffsets(OpenTypeFont.java:271) at org.mabb.fontverter.opentype.OpenTypeFont.finalizeFont(OpenTypeFont.java:217) at org.mabb.fontverter.converter.WoffToOtfConverter.convertFont(WoffToOtfConverter.java:42) at org.mabb.fontverter.FontVerter.convertFont(FontVerter.java:65) at org.mabb.fontverter.FontVerter.convertFont(FontVerter.java:70) at org.mabb.fontverter.FontVerter.convertFont(FontVerter.java:80) at com.thakare.help_thumbnails.App.woff2ttf(App.java:56) at com.thakare.help_thumbnails.App.main(App.java:51) Caused by: java.lang.ArrayIndexOutOfBoundsException: 20 at org.mabb.fontverter.io.DataTypeBindingSerializer.writeArrayValue(DataTypeBindingSerializer.java:131) at org.mabb.fontverter.io.DataTypeBindingSerializer.serializeProperty(DataTypeBindingSerializer.java:73) at org.mabb.fontverter.io.DataTypeBindingSerializer.serialize(DataTypeBindingSerializer.java:39) ... 12 more
I have added the jars for jbrotli-0.5.0 and jbrotli-native-darwin-x86* as i am using a mac.
Kindly help me resolve this issue.
Thank you.
I have an PDF-Document (produced most likely by from LaTex) and the TTF-Fonts embedded there are using Format6SubTable
. Dumping them and loading in a browser fails because it looks like none of them supports.
I hacked a bit into your codebase and implemented a normalize()
step in CmapTable
who creates the standard sub-tables for Mac/Unix/Windows and now fonts are loading the browser.
I'll clean up my code and provide a PR
There are unclosed streams everywhere!
For example:
`
public byte[] getDirectoryData() throws IOException {
WoffOutputStream writer = new WoffOutputStream();
writer.writeString(tag);
writer.writeInt(offset);
writer.writeInt(getCompressedData().length - paddingAdded);
writer.writeInt(tableData.length);
writer.writeUnsignedInt((int) checksum);
return writer.toByteArray();
}
`
It should be like
`
WoffOutputStream writer = new WoffOutputStream();
try {
writer.writeString(tag);
writer.writeInt(offset);
writer.writeInt(getCompressedData().length - paddingAdded);
writer.writeInt(tableData.length);
writer.writeUnsignedInt((int) checksum);
return writer.toByteArray();
} finally {
IOUtils.closeQuietly(writer);
}
`
getting warning like
"WARN org.fit.pdfdom.FontTable - Error loading font 'FTBUET+Verdana-Bold' Message: FontVerter could not detect the input font's type. class java.io.IOException"
is there any solution for this.
Thank you
convert CFF to OTF using FontVerter and then base64 string and embed to font-face. but it can not work.
Anyone else met this problem?
Can this library read font from base64-encoded String?
CffFontAdapter returns invalid Encoding for following cff fonts:
I couldn't find the artifact on Maven Central. This page shows no search results: https://search.maven.org/search?q=g:org.fontverter%20AND%20a:FontVerter%20AND%20v:1.2.22
The Spring Plugins repository seems to include the artifacts of this project, but only some old versions: https://repo.spring.io/plugins-release/org/fontverter/FontVerter/
here is the pdf file, tks
倪海厦人纪系列之伤寒论.pdf
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.