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

Add new fonts using dompdf/utils #1979

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Add new fonts using dompdf/utils #1979

wants to merge 3 commits into from

Conversation

roknicmilos
Copy link

Added 3 new fonts. Roboto supports many languages like Greek, Russian, German etc. Taviraj supports Thai language and ZCOOLXiaoWei supports Chinese language. These fonts have been tested in drupal project using drupal/entity_print module.

@roknicmilos
Copy link
Author

Last commit (3a3f600) was created because Roboto font supports many languages (their characters), much more than Halvetica font which is currently being used for 'sans-serif' font family.

@bsweeney
Copy link
Member

bsweeney commented Sep 7, 2019

I've been considering adding new fonts to the library but adding a font with support for CJK glyphs significantly increases the size of the download (relative to the base package). I'd like to investigate another way to handle expanded glyph support via variations of the standard package (e.g. Dompdf-0.8.1-cjk) so that the user can download what's relevant to them. Additionally, I'd like to use a single font if possible to simplify implementation (e.g. Noto) along with unicode range support so that we can tell people to just specify, for example, "Noto Sans" in their font-family tag.

Additionally, I don't know how I feel about the change to the "sans-serif" generic font family. First, Helvetica is a core PDF font (included with all PDF readers) and that's why we use it. If people need something more they should add a reference via CSS to a supporting font. Second, this change only impacts the sans-serif font family. If we're going to modify the generic font mappings we should do it for all of them (serif, monospace).

@roknicmilos
Copy link
Author

Thanks for the response. My knowledge about the fonts and how they work is minimal. This was just a workaround for an issue that I had with this library on a project that I'm working on. To be honest, I knew this was not going to be merged, and I just wanted to "hear" what you think about it. It would be great if you implement some (if not all) of the upgrades that you've mentioned. Thanks again.

@casperbakker
Copy link

Maybe there is some way to create separate packages like dompdf/dompdf-font-roboto which you can install next to dompdf itself to add extra font support without any configuration. That way you can support as many fonts as you like, while keeping the main package as small as possible.

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

Successfully merging this pull request may close these issues.

None yet

3 participants