-
Notifications
You must be signed in to change notification settings - Fork 21
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
How to get the contours of a glyph? #38
Comments
We don't have anything that interprets the glyph outlines as drawing operations/normalises them to bezier/quadratic curves. However the raw glyph data is available through GlyfTable and CFF. In case it's helpful as an example GlyfTable::subset includes code that loops over the glyphs. Similarly CFF::subset for CFF char strings. Out of curiosity is this something that you were able to do in your previous implementation? If so, I'd be curious to look over the code as a reference. I also found font_to_svg which translates font outlines to SVG, perhaps that's useful as a reference. |
I've used and here: I want to migrate to allsorts so I can also add support for opentype and WOFF fonts. Since I need this anyway, I'll see if I can make a PR for adding a glyph outline parser. I've looked at the glyf table, doesn't seem that hard. |
Also the corresponding function in rusttype is here: https://docs.rs/rusttype/0.9.2/rusttype/struct.ScaledGlyph.html#method.build_outline |
If you can hold off a little while I'll be working on something similar today. I'm going to work on a test harness that allows allsorts to be run against the unicode text-rendering-tests, and this will probably require doing this at the same time. |
Are you still working on this, otherwise I'd go ahead in the next few days to just implement a parser for the glyf table |
I am, but I'm holidays until 6 Jan now. |
There is an implementation of a glyf parser in the rust-ttf-parser crate already and the crate author has given me permission to copy the glyf parser code. I have some time between the years, so I'll probably go ahead and just implement it, because I need it before I can release azul. Enjoy your holiday! |
Well this took longer to get into a release than expected but access to glyph contours is present in Allsorts 0.6: https://yeslogic.com/blog/allsorts-rust-font-shaping-engine-0-6/ |
I'm trying to extract the glyph as bezier curves /
LineTo
,QuadraticCurveTo
/CubicCurveTo
operations to render the glyph to an SVG file, is there a way to extract this information? Thanks.The text was updated successfully, but these errors were encountered: