-
Notifications
You must be signed in to change notification settings - Fork 13
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 support for woff2 fonts #1
Comments
Hi @bramp. What's your timeframe for wanting this? Are you looking for a solution ASAP, or is this more of a general long-term feature request? This happens to be something I've started working on recently, and I have a working prototype. It's still in early stages, but as of yesterday, it's successfully parsing a Go font woff2 file that I've been testing with. I want to make further progress before pushing the code, and when it's done, I was considering sending a PR here (after finding out whether this repository is still actively maintained or not). If you want it sooner @bramp, I can share unfinished code. |
I'm in no rush, but I came across this because I wanted to use the library to extract the Features the OpenType font support (such as Ligatures, Lining Figures, Small Capitals, etc). I've actually spent my afternoon adding parsing of the features from the font (a PR will be coming shortly). However, always happy to review unfinished code, if you want another pair of eyes on it. |
Awesome! I’d love the feature extraction code. Woff2 is a nice to have, I was waiting for someone else to port the compression algorithm over, as it uses a relatively obscure scheme there was no go library at the time.
P.S. Superhuman is hiring iOS engineers — k now anyone? $1947 referral bonus. Learn more ( https://superhuman.com/jobs ).
Sent via Superhuman iOS ( https://sprh.mn/[email protected] )
…On Sat, Jan 20 2018 at 11:51 PM, Bhavesh Kakadiya < ***@***.*** > wrote:
I'm in no rush, but I came across this because I wanted to use the library
to extract the Features the OpenType font support (such as Ligatures,
Lining Figures, Small Capitals, etc).
I've actually spent my afternoon adding parsing of the features from the
font (a PR will be coming shortly).
However, always happy to review unfinished code, if you want another pair
of eyes on it.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub (
#1 (comment) ) , or
mute the thread (
https://github.com/notifications/unsubscribe-auth/AAFwQBRQv-Sl9HovHoJ2MEXNhg0tJH_9ks5tMux2gaJpZM4RloNf
).
|
Et voila: https://github.com/dsnet/compress |
Great, thanks! I will clean it up myself first, and send it for review when it's ready.
Yep, |
I have an update. I've cleaned up the code and it's ready for review. The implemented functionality so far is enough to parse all Go font family woff2 files that I was able to throw at it. It's definitely incomplete and not 100% spec compliant regarding validation of errors, etc. But one step at a time; it should be enough to resolve this issue. I wanted to get it to this point first and work on the rest in future changes. However, I'll be transparent, one of the reasons I'm working on the woff2 package is because I want to use it as a pet project to test out a custom code review tool for Go that I'm (slowly) working on. To that end, I plan to self-host this woff2 decoder package (similar to https://dmitri.shuralyov.com/kebabcase) and do development there. In other words, I know it'd be easier to just put it on GitHub and use pull requests, but that's not my goal with this project. Another factor is that it might make sense for this library/repository to just contain the woff2-related code inside. There's some stuff around tags that can be reused. It'd be easier to be able to change all relevant code with 1 PR rather than having send changes 2 separate repos. But I do like the idea of having a dedicated woff2 decoder (and in the future, encoder) package, similar to how there are standalone packages for various image formats, such as So, how we proceed is largely up to you @ConradIrwin and @bramp:
|
@shurcooL hey! Absolutely fine if you want to host the woff2 decoder — we should probably start tagging dependency versions ourselves. What would the diff look like to read woff2 files? If I remember rightly, woff2 files are just a different container for sfnt, including some crazy compression rules. Does it makes sense to do woff2 -> sfnt and then re-use the sfnt parser in this library, or would it make sense to define a very basic common interface so that we can re-use the table parsing logic from this library, but rely on woff2 to extract and decompress each table?
|
Great! Let me send a PR to this repo to give you a better idea of what it'll look like, and you can review that. (Edit: Sent PR #14.)
Yes, woff2 is very similar to sfnt and woff1. The compression rules are quite simple, they basically replace zlib with Brotli, that's about it. However, there are quite a few rules in https://www.w3.org/TR/WOFF2/ about what counts as invalid woff2 files that a spec-compliant parser must reject, e.g.:
My goal with the
Yes, that is the general direction I wish to follow. Inspiration for me is the A good first step IMO is to resolve this issue—to add support for parsing woff2 files to |
This change uses the font/woff2 package for parsing WOFF2 font files. Update all parts of the documentation, usage, etc., to say that WOFF2 fonts are now supported. Add test .woff2 file to testdata and run smoke test on it. Add benchmarks for parsing WOFF2 font files. Fix minor Go style and documentation issues. Resolves #1.
This change uses the font/woff2 package for parsing WOFF2 font files. Update all parts of the documentation, usage, etc., to say that WOFF2 fonts are now supported. Add test .woff2 file to testdata and run smoke test on it. Add benchmarks for parsing WOFF2 font files. Fix minor Go style and documentation issues. E.g., "Woff" should be "WOFF" because of https://golang.org/s/style#initialisms. Resolves #1.
Currently woff2 fonts return "unsupported font format". Please support woff2.
The text was updated successfully, but these errors were encountered: