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

PDF::Builder font selection #32

Open
PhilterPaper opened this issue Jan 8, 2024 · 2 comments
Open

PDF::Builder font selection #32

PhilterPaper opened this issue Jan 8, 2024 · 2 comments

Comments

@PhilterPaper
Copy link

I saw your comments in https://github.polettix.it/ETOOBUSY/2023/05/06/font-in-pdf-builder/ about selecting a font in PDF::Builder (a Perl package I maintain). Just a reminder that the font() call is not the only way to select a font to use. In both PDF::API2 and PDF::Builder you can open a specific type of font (e.g., a TTF font with ttfont(). In fact, this is the older way, and font() is just a recent convenience function. In addition, in PDF::Builder (only) there is a recently added "FontManager" subsystem to make it a bit easier to select a font, and more importantly, switch among variants (normal text to italic to normal to bold, etc.). Whereas with font() you need to know each variant file's name and explicitly open it (if not already opened), with FontManager you deal with the "face" (typeface or type family, such as Times), and "bold" and "italic" flags. Only when you change the typeface do you need to give the "face" -- the rest of the time you can just turn the bold and italic flags on and off. In addition, FontManager opens fonts as necessary and keeps track of what fonts have been opened and caches them for the whole document, minimizing the waste of repeatedly creating another font object for a given variant.

If you have any questions about PDF::Builder or want to report a problem or request a new feature, feel free to open an issue on PhilterPaper/Perl-PDF-Builder.

@polettix
Copy link
Owner

polettix commented Jan 8, 2024

Hi @PhilterPaper - thanks for stopping by!

Thanks also for the hints. Reading the post now, it's clear (to me myself!) that I had hit some directory-related wall, possibly due to using the same program in Linux and Windows on different computers, so I wanted to take some notes for future me.

I think your observations are worth adding anyway, I'll try to do an update in the coming days. Thanks!

@PhilterPaper
Copy link
Author

Glad to help, and happy to see someone else using PDF::Builder. You can go ahead and close this ticket if you have nothing further to add to it.

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