-
Notifications
You must be signed in to change notification settings - Fork 24
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
Drawing offset curves #75
Comments
I don't personally have any plans for such support no. ab_glyph_rasterizer seems lower level that this concept since i just draws the curves it is given. I guess the missing piece is the logic to generate the offset outline curves from the original glyph outline curves. This could be done outside of ab_glyph & ab_glyph_rasterizer. I'm not 100% sure how you see outlined-text working. Do you want to rasterize both the glyph and then the modified bigger glyph, then render them one on top of the other? If so that does seems possible already. |
I was asking about this since the crate seems to rasterize glyphs by decomposing the outline into line segments, which happen to be easy to offset compared to quadratic and cubic Bézier curves. |
Yes that is an interesting point and reason to bake it into ab-glyph-rasterizer. Might be worth a PR. I guess the only downside would be complicating the rasterizer, but allowing configurable offset without too much extra complexity seems nice to have. |
Offsetting the outlines would require storing the list of line segments so that segments that were originally connected stay connected to each other. I think a separate struct that retains such a list instead of drawing them to a buffer might be the best approach, so that pub trait CurveDrawer {
fn draw_line(&mut self, p0: Point, p1: Point);
fn draw_quad(&mut self, p0: Point, p1: Point, p2: Point) { ... }
fn draw_cubic(&mut self, p0: Point, p1: Point, p2: Point, p3: Point) { ... }
} Then those who just want to rasterize the original outline could use |
It's definitely worth some experimentation. My main worry is if the complexity will be worth it, compared to external logic calculating the offset curves and just keeping ab_glyph_rasterizer as something that can draw the curves. |
Are there plans to support drawing offset curves for font outlines? I’m currently using
ab_glyph_rasterizer
for rasterizing glyphs from a font and would like to support outlined text as well.The text was updated successfully, but these errors were encountered: