The Wayback Machine - https://web.archive.org/web/20201127045612/https://github.com/litehtml/litehtml/issues/90
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

font-family fallbacks #90

Open
mmanyen opened this issue Jun 20, 2019 · 0 comments
Open

font-family fallbacks #90

mmanyen opened this issue Jun 20, 2019 · 0 comments

Comments

@mmanyen
Copy link

@mmanyen mmanyen commented Jun 20, 2019

litehtml does not handle CSS font family fallbacks. Consider the fragment:

<div style="font-family: Georgia, serif; color: #00FFFF; font-weight: 750;font-size: 16px; font-style: italic; display: inline;">

The call to "create_font" gets faceName = "Georgia, serif". Which suggests that font family selection is an exercise for the user, and I am fine with that, but consider the following:

<div style="font-family: NoFont, Georgia, serif; color: #00FFFF; font-weight: 750;font-size: 16px;  font-style: italic; display: inline;">

The exact same font would be created since NoFont does not exist, but it would register as a different font in the document::get_font function because the map key is built from the strings.

Further, the following:

<div style="font-family: serif; color: #00FFFF; font-weight: 750;font-size: 16px; font-style: italic; display: inline;">

Would create yet another font containing the same data if Georgia was not found in the original fragment.

I would suggest that litehtml should try the options in order and call a new document function that takes the single font family name and returns if it can be created. Then the init_font function could call get_font with the successful name, which would make the map key string work better.

Background: I am writing an OpenGL ES 2.0 container to run on an embedded device. I am using freetype to deal with fonts and not an operating system that would deal directly with the passed string.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.