ICEpdf
  1. ICEpdf
  2. PDF-609

Font substitution cannot be mapped if font name contains space

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 5.0.2
    • Fix Version/s: 5.0.3
    • Component/s: None
    • Labels:
      None
    • Environment:
      JAI
    • Salesforce Case Reference:

      Description

      Here is the user's description of the issue:

      I have two fonts: "GRR Fonts" and "GRR Fonts 2". Both fonts could not be found during image rendering and Lucida Bright was used as substitution.

      The following are the ICEPdf logs that I found:

      May 31, 2013 4:10:48 PM org.icepdf.core.pobjects.fonts.FontManager findFont
      FINER: ----> Found font: lucidabright family: Plain for: lucidabright- Plain
      May 31, 2013 4:10:48 PM org.icepdf.core.pobjects.fonts.FontManager getInstance
      FINE: Font Substitution: Found java font: LucidaBright for named font GRR\u00onFonts2

      May 31, 2013 4:10:48 PM org.icepdf.core.pobjects.fonts.FontManager findFont
      FINER: ----> Found font: lucidabright family: Plain for: lucidabright- Plain
      May 31, 2013 4:10:48 PM org.icepdf.core.pobjects.fonts.FontManager getInstance
      FINE: Font Substitution: Found java font: LucidaBright for named font GRR\u00onFonts

      The following items are attached:
      1. PDF document that contains characters in GRR Fonts and GRR Fonts 2
      2. ICEPdf log
      1. 12199-icepdf.log
        3.78 MB
        Tyler Johnson
      2. 12199-pdfviewerfontcache.properties
        6 kB
        Tyler Johnson

        Activity

        Hide
        Patrick Corless added a comment -

        The font name is represented as a name object "/GRR#20Fonts#202". Name objects have special escaping for certain characters like ( or ' but can also represent unicode values.

        The Name code that we currently had would convert #20 hex to /u0020 in unicode but instead the code should have been converting the #20 to (char)32 or a space. I've updated the conversion code to convert anything < 127 to a character code and everything else Uniocde.

        The patch makes sure that in this case the #20 gets correctly converted to a space and for substitution, the space is removed when comparing to the font properties names.

        Show
        Patrick Corless added a comment - The font name is represented as a name object "/GRR#20Fonts#202". Name objects have special escaping for certain characters like ( or ' but can also represent unicode values. The Name code that we currently had would convert #20 hex to /u0020 in unicode but instead the code should have been converting the #20 to (char)32 or a space. I've updated the conversion code to convert anything < 127 to a character code and everything else Uniocde. The patch makes sure that in this case the #20 gets correctly converted to a space and for substitution, the space is removed when comparing to the font properties names.

          People

          • Assignee:
            Patrick Corless
            Reporter:
            Tyler Johnson
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: