-
Notifications
You must be signed in to change notification settings - Fork 31
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
Store font's Unicode ranges #3
Comments
Hello @RazrFalcon, is there any news on this? I am looking for a pure Rust library to use for font fallback, and identifying supported ranges will be critical. By the way, I really love rustybuzz! |
Well, it's "simply" a matter of adding this feature to Will look tomorrow. What API do you expect? A simple bitflags-like one?
Yeah, 8 months well spent... It's a bit dead now, though it should work just fine. |
Thanks for looking in to this, it looks to me like a u128 bitflag will cover all ranges. If you need help implementing this, I could take it on as well. |
I'm not sure how portable |
As someone who also interested in font fallback library, it seems like OS/2 Unicode ranges property is not enough. One would have to support the meta table as well, since it supports more ranges. See OS/2 comment:
And PS: I do have a rudimentary font fallback algorithm in one of my libraries, but it simply checks if a font has a glyph for the specified character. Which is obviously a bit slow. |
Checkout RazrFalcon/ttf-parser@2b0e0e5 Currently, the only API available is If you're looking for something else, let me know. |
Awesome, looking good so far! I am hoping to be able to use fontdb to query for fonts that support a range, for fallback. |
What do you mean by range? I can add There are also Unicode blocks, which have 327 variants instead of 123 in OS/2. So I would repeat my question again: what exactly do you want. The problem is not in implementing it, but actually understating what information is required. |
Storing the u128 for every font is probably necessary to fully implement font fallback. An alternative would be to only store a single font id for the first detected font that inplements that range. I don't really have opinions on the implementation, other than to say, it is nice to be able to search for a font that provides a specific unicode codepoint for font fallback. |
The only real way to do so is to call
My suggestion would be to handle it on your side. Call |
I will give that a try. |
Would there be interest in fontdb being able to return multiple fonts from a query? |
I implemented basic font fallback in kas-text. The problems are a little more complicated than just querying supported glyphs:
There is a lot more complexity, but you get the idea. If I were to start over, I would take a closer look at swash. |
@jackpot51 Which query? The current one should return just one font. That's the point. Maybe you want some sort of filtering instead? |
@dhardy I haven't looked into how As for |
@RazrFalcon I believe he is talking about the equivalent of this query (i.e. given font family, weight etc., return a listing of all possible matches). Note though that this does not use the raw font list of all available fonts on the system, but a (badly) curated list of a few fonts in a preferred order. I'm not sure myself if this functionality should be in
👍 |
Oh, I see. Yes, as mentioned above, the reason Sure, Honestly, forking |
I have decided to use fontdb for loading a list of system fonts, but then implement my own fallback on top of that. It will require no changes to fontdb. |
No description provided.
The text was updated successfully, but these errors were encountered: