OpenPDF icon indicating copy to clipboard operation
OpenPDF copied to clipboard

Exception when registering Unicode Font

Open dbschema-pro opened this issue 3 years ago • 2 comments

I got an exception registering an unicode.ttf font, FontFactory.register( LOCAL_FONT_FILE.getAbsolutePath(), "Unicode");

Do you have any idea which could be the reason? This happens only on one system, a MacOS with a Chinese locale. Eventually, I can add the unicode.ttf file.

java.lang.IllegalArgumentException: newPosition > limit: (15891762 > 5325824) at java.base/java.nio.Buffer.createPositionException(Buffer.java:337) at java.base/java.nio.Buffer.position(Buffer.java:312) at java.base/java.nio.ByteBuffer.position(ByteBuffer.java:1381) at java.base/java.nio.MappedByteBuffer.position(MappedByteBuffer.java:295) at java.base/java.nio.MappedByteBuffer.position(MappedByteBuffer.java:70) at com.lowagie.text.pdf.MappedRandomAccessFile.seek(MappedRandomAccessFile.java:167) at com.lowagie.text.pdf.RandomAccessFileOrArray.seek(RandomAccessFileOrArray.java:329) at com.lowagie.text.pdf.TrueTypeFont.getBaseFont(TrueTypeFont.java:518) at com.lowagie.text.pdf.TrueTypeFont.process(TrueTypeFont.java:673) at com.lowagie.text.pdf.TrueTypeFont.(TrueTypeFont.java:386) at com.lowagie.text.pdf.BaseFont.getAllFontNames(BaseFont.java:1475) at com.lowagie.text.FontFactoryImp.register(FontFactoryImp.java:535) at com.lowagie.text.FontFactory.register(FontFactory.java:362)

dbschema-pro avatar Mar 03 '22 06:03 dbschema-pro

What is the size of the font file? From the error, it sounds like the font file itself is corrupted.

testn avatar Mar 21 '22 11:03 testn

The font is 16Mb large. Here is a link to it: https://dbschema.com/fonts/unifont.ttf The software also downloads it from the website. It is also possible that the download was broken.

dbschema-pro avatar Mar 21 '22 12:03 dbschema-pro