Uploaded image for project: 'PDFBox'
  1. PDFBox
  2. PDFBOX-5806

Wrong font substitution for Wingdings

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0.31, 3.0.2 PDFBox
    • 2.0.32, 3.0.3 PDFBox, 4.0.0
    • Rendering
    • None

    Description

      On the attached PDF the non embedded font "Wingdings,Bolt" is not found and replaced by another font.

      Is:

      Expected:

      There are more fonts that are not found. For those Acrobat also seems to use an replacement, "Adobe Sans MM". Those should be ok.

       

       Warning  [PDTrueTypeFont] Using fallback font CourierNewPS-BoldMT for Wingdings,Bold
       Warning  [PDTrueTypeFont] Using fallback font CourierNewPSMT for CorporateACon
       Warning  [PDTrueTypeFont] Using fallback font CourierNewPSMT for CorpoSLig

      I propose an addition to the FontMapperImpl in findFont:

       

       

      @@ -441,6 +441,16 @@ final class FontMapperImpl implements FontMapper
                   return info.getFont();
               }
       
      +        if (postScriptName.contains(",")) {
      +            postScriptName = postScriptName.substring(0, postScriptName.indexOf(","));
      +            // try cutting font style and getting the basefont, eg. for "Wingdings,Bolt" to "Wingding-Regular" (including the following step)
      +            info = getFont(format, postScriptName);
      +            if (info != null)
      +            {
      +                return info.getFont();
      +            }
      +        }
      +
               // try appending "-Regular", works for Wingdings on windows
               info = getFont(format, postScriptName + "-Regular");
               if (info != null)

       

       

      Attachments

        1. test.pdf
          6 kB
          Oliver Schmidtmer
        2. screenshot-2.png
          12 kB
          Oliver Schmidtmer
        3. screenshot-1.png
          8 kB
          Oliver Schmidtmer

        Activity

          People

            tilman Tilman Hausherr
            Schmidor Oliver Schmidtmer
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: