Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support default fonts for text without font embedding #5

Closed
rototor opened this issue Sep 14, 2017 · 2 comments
Closed

Support default fonts for text without font embedding #5

rototor opened this issue Sep 14, 2017 · 2 comments

Comments

@rototor
Copy link
Owner

rototor commented Sep 14, 2017

@FabioVassallo requires text rendered as fonts using the default PDF fonts without embedding any font file. His workaround/quickfix for that problem should be extended to handle more default font families correct.

PdfBoxGraphics2DFontTextDrawer fontTextDrawer = new PdfBoxGraphics2DFontTextDrawer() {
           @Override
           protected PDFont mapFont(final Font font, final IFontTextDrawerEnv env) throws IOException, FontFormatException
           {
               return PDFFont.INTERNAL_PD_FONT_SANS_PLAIN;
           }
       };

This requires a test driver which uses the different default font families first.

@FabioVassallo
Copy link
Contributor

FabioVassallo commented Sep 14, 2017 via email

rototor added a commit that referenced this issue Oct 8, 2017
always uses default fonts if no matching font is registered.
@rototor
Copy link
Owner Author

rototor commented Oct 8, 2017

I've just released version 0.8 which provides a PdfBoxGraphics2DFontTextDrawerDefaultFonts class. Using that PdfBoxGraphics2dFontTextDrawer you always get some default font, but it tries to map the font style to the correct font. (i.e. Bold to PDType1Font.HELVETICA_BOLD and so on).

@FabioVassallo You might now use this one instead of your custom PdfBoxGraphics2dFontTextDrawer.

@rototor rototor closed this as completed Oct 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants