Jump to content
  • Add support for iText FontSelector

    Assigned User teodord
    CategoryFeature request


    It's common in Japanese to have EUDC (End User Defined Characters, Gaiji) fonts. These are fonts defined for Unicode's private section starting at \uE000. It's not specific to Japanese... it's just that it's common in that language.

    Normally this means there will be 2 fonts involved: MyStandardFont.ttf and MyEUDC.ttf.

    In the case of a generated HTML report, JR simply puts the correct characters into the report. The browser then handles the magic of deciding that a character cannot be rendered in MyStandardFont, so it automatically uses MyEUDC which is presumably installed somewhere on the system.

    But PDF poses a special problem. If you specify a text field with the font MyStandardFont then itext will not export the private characters because they do not have glyphs in that font.



    iText has a class/feature called FontSelector. This allows you to use multiple fonts as if they are one logical font. It would use MyStandardFont for all characters that it could, but then it would use MyEUDC for other fonts.


    Complete solution:

    I'm not really sure _how_ JR could add support for FontSelectors. But it seems that such a mechanism could be added.

    User Feedback

    Recommended Comments



    Given the current support for font extensions in JR, the only way I could think of to leverage the FontSelection feature would be to wrap together into a FontSelection instance, all the fonts that come from font families with the same name, but different locales.

    For example, if I define a TeodorsFont family several times, but with different locales, in my font extension, then the PDF exporter will wrap all of those families into a FontSection instance, so that they really act like a single font, in case characters inside the phrase come from different character ranges.






    Link to comment
    Share on other sites

    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now

  • Create New...