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 03:41:00 UTC

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

    [ https://issues.apache.org/jira/browse/PDFBOX-5806?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17838443#comment-17838443 ] 

Tilman Hausherr commented on PDFBOX-5806:
-----------------------------------------

This change may have to be limited to WingDings (and maybe Symbol) because it would mean that other fonts won't be replaced with a bold font where it makes sense. I got several rendering changes that I'll analyse later.

> Wrong font substitution for Wingdings
> -------------------------------------
>
>                 Key: PDFBOX-5806
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-5806
>             Project: PDFBox
>          Issue Type: Bug
>            Reporter: Oliver Schmidtmer
>            Priority: Major
>         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