Menu

CJK Fonts

Help
2013-07-19
2013-07-25
  • Steve Hannah

    Steve Hannah - 2013-07-19

    I'm trying to write Chinese, Japanese, and Korean characters to a PDF. Based on other threads, I understand that CKJ support hasn't been tested. I'm keen to try to get this working, and I'm looking for some insight into where the pitfalls may be.

    I am testing Japanese using some Japanese fonts in OS X. The first problem I faced was that loading font using Font.get() causes a null pointer exception due to the fontName being null.

    I traced this to the getName() method of the OpenFontParser class. It appears to only look for name entries with Platform "Microsoft", language "US English", and name type "Postscript Name". Got around this by changing it to also look for "Macintosh" platform, alternate languages, and alternately look for other name fields (e.g. Full name).

    This got me past step 1, but when I attempt to write chinese, it seems to be rendering the wrong characters to the PDF.

    I'm using the PrimitiveComposer's showText() method for writing the text. It is writing CJK characters to the PDF. Only the wrong ones.

    My guess at this point is that PDFClown is set to use standard Unicode character codes for encoding characters from the font, but the fonts I am using are using a non-standard code mapping - but I may be way off.

    Can you offer any pointers on what may be the problem, and where I should be looking to try to solve this problem?

    Any tips greatly appreciated.

    Steve

     
  • Steve Hannah

    Steve Hannah - 2013-07-25

    To answer my own query, I've developed a CJK fonts library for PDFClown using CID0 non-embedded fonts.
    https://github.com/shannah/PDFClownCJKFont

     

Log in to post a comment.