[
https://issues.apache.org/jira/browse/PDFBOX-2467?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14214641#comment-14214641
]
Cornelis Hoeflake commented on PDFBOX-2467:
-------------------------------------------
Ok, the problem was somewhat different than I described, I apologize.
I have the TrueType Arial Bold font, the PDF uses the TrueType Arial,Bold font.
My provider has no alias for Arial,Bold to Arial-Bold. I thought that would be
done by the windowsToPs function. But... First all substitutes are tried. There
is an alias to Helvetica-Bold for Arial,Bold, here is the trouble starting.
This causes directly an issue when you have Helvetica-Bold True Type (not my
case, not very commin).
Due to the standard 14 adding mechanism in ExternalFonts, now for Arial,Bold
all substitutes of Helvetica-Bold are added. Also Arial-BoldMT.
That is my issue. I have the True Type Arial-BoldMT, so that font is returned.
Now I fixed it by added an alias in my fontprovider: Arial,Bold for Arial-Bold.
Now my font provider directly returns Arial Bold font upon the first request.
> Remove substitute logic from ExternalFonts
> ------------------------------------------
>
> Key: PDFBOX-2467
> URL: https://issues.apache.org/jira/browse/PDFBOX-2467
> Project: PDFBox
> Issue Type: Improvement
> Affects Versions: 2.0.0
> Reporter: Cornelis Hoeflake
> Assignee: John Hewson
> Fix For: 2.0.0
>
> Attachments: patch1.diff, patch2.diff
>
>
> The ExternalFonts class does some substitute logic for fonts. There is a
> static map which holds the substitutes and is loaded in the ExternalClass
> file and some substitutes are got from Standards14.
> Next that map also contains some substitutes for registry fonts (I don't know
> what it is), but it feels a bit like misusing the substitutes mechanism (with
> prepending a $ to omit conflicts).
> As user of PDFBox I want to have the control over substitutes. For example
> when a PDF has font TrueType Arial,Bold (windows style), and my font provider
> has only a Type1 font for Arial Bold, the current mechanism returns the
> Helvetica Bold font True Type font (if have one in my fontprovider).
> So I wrote a patch which allows you to wrap a fontprovider in a
> SubstituteFontProvider. That SubstituteFontProvider does the substitute logic
> like ExternalFonts did before. The user is in control to wrap (or let
> ExternalFonts wrap) his own fontprovider in the SubstituteFontProvider.
> The registry fonts issue is kept in ExternalFonts and uses an own map.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)