You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by Matthew Self <ma...@mself.com> on 2017/11/16 19:21:27 UTC

How can I add to the list of font substitutions in pdfbox 2.0.7?

I'm new here, so I posted this question to stack overflow
<https://stackoverflow.com/questions/47320624/how-can-i-add-to-the-list-of-font-substitutions-in-pdfbox-2-0-7>.
But perhaps this mailing list is a better way to ask this question:

I'm using FontMapper.getTrueTypeFont() to find available fonts by name in
pdfbox 2.0.7. This has a feature to map fonts (by name) so that if I ask
for Symbol and my system only has SymbolMT it will return that as a
substitute.

But the default implementation doesn't map the other way. My system has
Symbol installed, but if I try to get SymbolMT it returns Helvetica as the
best match (which doesn't work very well).

The underlying FontMapperImpl class has an addSubstitute() method that lets
you add mappings, but the class is private to the package so I can't call
that (even though the method is marked public). The FontMapper interface
that FontMapperImpl implements does not include the addSubstitute() method.

In the Cookbook for pdfbox 1.8
<https://pdfbox.apache.org/1.8/cookbook/workingwithfonts.html> there is a
reference to using Resources/PDFBox_External_Fonts.properties to add
mappings, but this does not seem to be present in pdfbox 2.0.7.

Is there a way to add additional font mappings (by name) in pdfbox 2.0.7,
or do I need to build my own mapping layer outside of it? Thanks!

Re: How can I add to the list of font substitutions in pdfbox 2.0.7?

Posted by Tilman Hausherr <TH...@t-online.de>.
You might want to answer the question from the comment first.

I'd like to know what you really want to do. PDFBox 2.* is more 
restrictive about extending. Maybe your problem shows a bug, then this 
bug should be fixed instead of you extending something to work around it.

Tilman

Am 16.11.2017 um 20:21 schrieb Matthew Self:
> I'm new here, so I posted this question to stack overflow
> <https://stackoverflow.com/questions/47320624/how-can-i-add-to-the-list-of-font-substitutions-in-pdfbox-2-0-7>.
> But perhaps this mailing list is a better way to ask this question:
>
> I'm using FontMapper.getTrueTypeFont() to find available fonts by name in
> pdfbox 2.0.7. This has a feature to map fonts (by name) so that if I ask
> for Symbol and my system only has SymbolMT it will return that as a
> substitute.
>
> But the default implementation doesn't map the other way. My system has
> Symbol installed, but if I try to get SymbolMT it returns Helvetica as the
> best match (which doesn't work very well).
>
> The underlying FontMapperImpl class has an addSubstitute() method that lets
> you add mappings, but the class is private to the package so I can't call
> that (even though the method is marked public). The FontMapper interface
> that FontMapperImpl implements does not include the addSubstitute() method.
>
> In the Cookbook for pdfbox 1.8
> <https://pdfbox.apache.org/1.8/cookbook/workingwithfonts.html> there is a
> reference to using Resources/PDFBox_External_Fonts.properties to add
> mappings, but this does not seem to be present in pdfbox 2.0.7.
>
> Is there a way to add additional font mappings (by name) in pdfbox 2.0.7,
> or do I need to build my own mapping layer outside of it? Thanks!
>


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