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

Oliver Schmidtmer updated PDFBOX-5806:
--------------------------------------
    Description: 
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}
 

 

  was:
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".

 
{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}
 

 


> 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-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: dev-h...@pdfbox.apache.org

Reply via email to