-
Notifications
You must be signed in to change notification settings - Fork 28
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
Could rustybuzz be ported to run on fontations? #956
Comments
I'm planning on taking a look at this, unless someone else already is. |
I’ve done a local exploration of this with most lookups (non-chaining contextuals aren’t done) running through fontations with all tests passing. It’s a bit of a Frankensteinish hack because the transition is incremental but it does work. I’ll find some time soon to bring my fork up to current and publish the code so you can take a look. We’re still missing AAT support but I have a PR up for the initial pieces at #964 Also, thank you for taking the time to bring RustyBuzz up to date! |
Oh, that's awesome! I just looked at it very briefly, but something that was missing for me was access to phantom points as well as non-Unicode cmaps. But it's possible that I just missed the right API for them. |
So far I’ve only focused on the lookups so the rest of the logic still runs through ttf-parser. Skrifa should do the correct thing wrt phantom points and symbol cmaps but ideally, that logic would be moved to read-fonts. |
That would be amazing! We have to finish landing Skrifa (https://chromestatus.com/feature/5717358869217280) before we put too much focus elsewhere. |
I pushed a branch here: https://github.com/dfrg/rustybuzz/tree/fontate We don’t currently support cmap0 with the Mac Roman encoding so a few tests failed when I hooked up our cmap but that’s an easy fix. As Rod said, we don’t have any scheduled time to work on this yet but I’ll hack at it occasionally and any contributions would be appreciated! |
It now uses fontations for cmap and I merged your benchmarking changes. I’ll probably spend some time over the long weekend and isolate ttf-parser usage to just the AAT tables. |
Sounds good! |
Not sure how to phrase it with less confrontation, but why? Even more, I would love to see an in-depth Am I interested in swapping As for rustybuzz, TrueType parsing is a tip of an iceberg. By switching TL;DR: show me benchmarks |
For context I'm the eng lead for Google Fonts and the ... sponsor is perhaps the right word ... of our efforts to migrate to Rust. The rationale for the overall effort is outlined in https://github.com/googlefonts/oxidize. Ultimately we would like text processing to not require a sandbox under the rule of 2.
I appreciate the question and do not see it as confrontational. @behdad will confirm that I'm guilty of asking why myself :D
We are working toward shipping Skrifa in Chrome (https://chromestatus.com/feature/5717358869217280). Skrifa is built on read-fonts, as is our new font compiler, as is our nascent rewrite of hb-subset. If I ship rustybuzz on ttf-parser I now have two implementations of font parsing (read-fonts and ttf-parser) shipping to users. I have to maintain both, fuzz both, implement new features in both, etc. My hypothesis is that it's worth the effort to avoid this state so I have to pick a winner. Maybe I'm guilty of NIH but the winner I currently choose is read-fonts.
We volunteer! Concretely, I suggest that we:
I would be very interested in your thoughts on what would be different in a better solution. Bear in mind that the more the api or results differ from harfbuzz the harder it will be to migrate clients.
I agree wrt this being the hard part. I think with @behdad on board we can do this. I hope we can make it easier to understand but that remains to be seen. |
Maybe I can share some of the advantages I see in both crates. Advantages of
|
@rsheeter as the man in charge from the Google side I will ask you directly, because I'm super curious: why not
Maybe I'm missing something big? I would love to know. In the end,
Well,
That's was my goal with ttf-parser + rustybuzz as well. But unlike
I'm sorry, but isn't this just NIH? If
Once again, swapping Not to mention that
By a "better solution" I do not mean architecture wise. I'm not a shaping expert to criticize harfbuzz for its shaping logic.
Luckily for us the harfbuzz API is trivial. And no one really uses it directly, so only the wrapper libraries would have to adapt. Not an issue. In the end, all I care about is to have a good shaping library written in Rust that I can use in resvg. And right now, my only option is unfortunately I would love to see a PR that would swap |
Ugh... None of my projects will ever use or depend on proc-macros. I will die on this hill. Also, one of the main reasons why many people use/prefer
Well, the difference is tiny and
Well, while I had basically zero free time in the past couple of years, I will not argue that a company-backed development is more favorable, but it can randomly halt as well.
Is it? I genuinely have no idea how hinting works. And I do not know which one Again, this discussion boils down to: we have two implementations of a very complicated file format and we have no idea how to compare them, because one side doesn't know anything about the other one. |
From what I understood it should support everything that
Shaping indeed hasn't started, but I think the whole point is to use
Again, isn't that exactly what
I agree, that's why I pointed it out as a clear disadvantage for
That's why I passed
I know, that's why I wrote there is no guarantee it will stay this way.
I don't know either, but considering the amount of code that was necessery to implement it, it does look pretty complex. But it seems to support both, CFF and glyf hints. But perhaps it's just best to defer more in-depth discussion until there is a working fork of rustybuzz running on fontations. |
I never said
No one will be swapping HB with RB in Chrome. Unless someone will be able to prove it has an identical output, which would be very hard.
Ok, "rewrite" was a vague word. I meant replace. Aka there should be no HB in C.
Strange. There is no reason for ttf-parser to be bigger.
Damn... Half of it seems to be tests, but still a lot. |
FreeType is a bigger pain point for me than HarfBuzz. That is why FreeType => Skrifa is our first step, meant to ship in the not too distant future (https://chromestatus.com/feature/5717358869217280).
We specifically want to reach a position where this is plausible. We aren't there yet but we can get there. If we start from RustyBuzz we can get there significantly faster than if we start from scratch. To make swapping HB for RB plausible I believe we need to:
@RazrFalcon I appreciate your arguments wrt ttf-parser vs read-fonts. I suggest we simply agree to disagree, I don't really see either of us convincing the other. IMHO testing and performance are likely to be where the bulk of the remaining work is. I'm optimistic we can get both done and intend to invest in it after Skrifa lands. |
For future reference, here is what I recently did to test correctness and find bugs, maybe it can serve as a source of inspiration for whatever you plan on trying once you get to it: harfbuzz/rustybuzz#126 (comment) :) I was able to find quite a few bugs this way and there are still a few unfixed ones remaining, although I don't know when I'll have time to continue working on it. |
Will wait for |
https://github.com/RazrFalcon/rustybuzz has done a lot of the work to port HarfBuzz. Some of the dependencies, most notably ttf-parser, would have to go (https://github.com/RazrFalcon/rustybuzz/blob/master/Cargo.toml).
Probably worth taking a swing at to see if we find a hard blocker.
The text was updated successfully, but these errors were encountered: