-
Notifications
You must be signed in to change notification settings - Fork 2
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 fallbacks: lists and per-char selection #47
Conversation
Currently font lists have a single entry and faces are resolved once, so this doesn't do anything yet.
Yes, multi-language font queries are not supported. Mainly because I have no idea how exactly it should be done. CSS spec doesn't mentions this, afaik. Also, you cannot detect a font language by Family Name. It's stored separately, if stored at all (can't remember where). fontconfig support this for sure.
Is it? I think at least font-config doesn't support this. Not sure about Windows and macOS. PS: currently, fontdb is a bare-minimum pure-rust font-kit alternative. It's good enough for resvg, but it general very primitive. I'm open for new additions, but I would prefer if they follow some spec or something. Or at least replicate the common behaviour of typical system libraries. So we could explain why fontdb works in a way it works. |
My guess is that eventually we (the Rust ecosystem) will need some way of reading fontconfig files and similar for other platforms. I'm also not quite sure if font matching should use the font |
Closes #40: rustybuzz support is merged here. KAS can now do font fallback and shaping without extra C library dependencies: |
I've tried to do this, but it's basically undocumented. It would take a lot of time to implement. |
This (roughly) implements font fallbacks.
But: on my system it resolves "Noto Sans" as the default font, however does not resolve international variants: my system includes "Noto Sans CJK HK", "Noto Sans CJK JP", "Noto Sans Sinhala", ...
@RazrFalcon may I ask, is there some way of resolving these variants from the base family name, "Noto Sans"? I cannot simply use
starts_with
since that would include "Noto Sans Black", "Noto Sans Mono" etc, thus I don't see a way from the information available infontdb
(attached). Or is it expected that the font-config list all variants of "Noto Sans"?CSS font style matching step 4 must happen once per font (e.g. "Noto Sans CJK HK"), so e.g. "Noto Sans Black" must be excluded.
Also @RazrFalcon do you see some of this logic moving to fontdb?
find_best_match
is copied from there and something likeFontSelector::select
could be added as something likeDatabase::query_multiple
. Theset_serif_family
etc. methods are not useful here since "serif" may resolve to multiple fonts.