Closed coastalwhite closed 1 week ago
Yes I can see how existing Font::outline
isn't ideal for this case.
I don't re-export ttf-parser in this crate to isolate it from upstream breaking changes.
The following approaches come to mind:
Add ttf-parser outline builder proxies to ab-glyph.
This is closest to your suggested solution + extra code to isolate from upstream breaks.
Add move & close variants to ab_glyph::OutlineCurve
.
This feels more correct as this is the crate's abstraction on ttf-parsers outline builder. It seems better to have just one way of getting outline data. The big downside is this would be a breaking change.
Advise using ttf-parser directly for custom outlining.
This is an approach that works now.
My initial thoughts are I'd like (2) but it might take a little longer to land as I'll want to bundle up some other potential breaking changes & I try to minimise these to minimise churn downstream.
So we could keep doing (3) until the next version is out with (2). Alternatively we add in (1) as a non-breaking addition and perhaps remove it in the next version. wdyt?
Thank you. I will file a PR for (1) which we can use until a major release and see if I can also add something for (2), but it would probably require changes to the rasterizer code which you should check since I am not very familiar with this process.
Sounds good. I've raised an issue for (2) that I can group with other breakers later.
(1) is actually quite a lot more complicated than I hoped. Since Font
is used as a trait object, we cannot use generics in the trait interface. I will see if I can find a workaround :disappointed:
How about #108?
How about #108?
I think it's okay.
Thanks. And can you describe your use case briefly, why does it help having this here instead of using ttf-parser directly?
I don't have enough info to merge this now, can reopen if that changes.
Would it be possible to utilize a custom
owned_ttf_parser::OutlineBuilder
to outline a glyph? The current implementation embeds theMoveTo
andClose
operations into the outline curves by adding extra points. This cannot be reliably extracted anymore, since f32s do not allow for reliable equalities. Therefore, it would be really handy to have aoutline_with_builder
method that provides similar behavior tooutline
however allows of use of a customOutlineBuilder
.Example
This is not currently possible with the current API. This should probably also include reexporting the
OutlineBuilder
fromowned_ttf_parser
.I apologize for filing yet another issue, but I feel like this could make the crate more useful in a wider range of use cases. If you feel like this is a welcome change, I would be happy to submit a PR for it.