You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Tilman Hausherr (Jira)" <ji...@apache.org> on 2024/04/18 08:20:00 UTC

[jira] [Resolved] (PDFBOX-5806) Wrong font substitution for Wingdings

     [ https://issues.apache.org/jira/browse/PDFBOX-5806?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tilman Hausherr resolved PDFBOX-5806.
-------------------------------------
    Fix Version/s: 2.0.32
                   4.0.0
                   3.0.3 PDFBox
         Assignee: Tilman Hausherr
       Resolution: Fixed

Thanks for the contribution!

> Wrong font substitution for Wingdings
> -------------------------------------
>
>                 Key: PDFBOX-5806
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-5806
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Rendering
>    Affects Versions: 2.0.31, 3.0.2 PDFBox
>            Reporter: Oliver Schmidtmer
>            Assignee: Tilman Hausherr
>            Priority: Major
>             Fix For: 2.0.32, 4.0.0, 3.0.3 PDFBox
>
>         Attachments: screenshot-1.png, screenshot-2.png, test.pdf
>
>
> On the attached PDF the non embedded font "Wingdings,Bolt" is not found and replaced by another font.
> Is:
> !screenshot-2.png!
> Expected:
> !screenshot-1.png!
> There are more fonts that are not found. For those Acrobat also seems to use an replacement, "Adobe Sans MM". Those should be ok.
>  
> {code:java}
>  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{code}
> I propose an addition to the FontMapperImpl in findFont:
>  
>  
> {code:java}
> @@ -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){code}
>  
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org