OpenPDF icon indicating copy to clipboard operation
OpenPDF copied to clipboard

Font embedded setting may not work

Open takotakot opened this issue 3 years ago • 3 comments

Describe the bug Font embedded config may not work. I tried: https://github.com/LibrePDF/OpenPDF/wiki/Multi-byte-character-language-support-with-TTF-fonts with Jaldi-Regular.ttf in https://github.com/LibrePDF/OpenPDF/tree/master/openpdf/src/test/resources/fonts/jaldi .

To Reproduce Code to reproduce the issue

  1. Copy https://github.com/LibrePDF/OpenPDF/wiki/Multi-byte-character-language-support-with-TTF-fonts
  2. Change font file to Jaldi-Regular.ttf, name to Jaldi-Regular
  3. Try embedded value both true and false

Both generates 6508 byte HelloWorld.pdf .

Expected behavior PDF size changes.

System (please complete the following information):

  • OS: Mac OS Big Sur
  • openjdk 15.0.2
  • library:
    • com.github.librepdf:openpdf:1.3.26
    • org.apache.xmlgraphics:fop:2.3
    • org.apache.xmlgraphics:xmlgraphics-commons:2.3
  • Used Font: Jaldi-Regular

takotakot avatar May 24 '21 02:05 takotakot

Pull requests are welcome.

asturio avatar May 25 '21 09:05 asturio

@asturio Hi, if no one takes it, I want to try it.

ObsisMc avatar Mar 10 '22 07:03 ObsisMc

@takotakot you only replace font name in following code in https://github.com/LibrePDF/OpenPDF/wiki/Multi-byte-character-language-support-with-TTF-fonts, but "Identity-H" will force embedded to be true. document.add(new Chunk( "नमस्ते", FontFactory.getFont("nirmala ui", "Identity-H",false,10,0,null)));

I don't know whether it is a wrong usage and I think @codecracker2014 can give us a help since maybe the feature is done by him according to #297.

ObsisMc avatar Mar 14 '22 04:03 ObsisMc