googlefonts / oxidize

Notes on moving tools and libraries to Rust.
Apache License 2.0
173 stars 7 forks source link

API proposal for color outlines #48

Open dfrg opened 1 year ago

dfrg commented 1 year ago

Proposed interface for implementation of color outlines in skrifa.

rendered

khaledhosny commented 1 year ago

FWIW, the corresponding HarfBuzz API https://harfbuzz.github.io/harfbuzz-hb-paint.html

dfrg commented 1 year ago

FWIW, the corresponding HarfBuzz API https://harfbuzz.github.io/harfbuzz-hb-paint.html

Thanks for this! It looks like there are a lot of similarities, particularly around how composite nodes are handled.

drott commented 10 months ago

Separately, as discussed in b/301562314 and as the HarfBuzz API does it, it is probably useful to add a bitmap drawing / placement method to the ColorPen interface - but that can be a separate step.

dfrg commented 10 months ago

Separately, as discussed in b/301562314 and as the HarfBuzz API does it, it is probably useful to add a bitmap drawing / placement method to the ColorPen interface - but that can be a separate step.

Since landing googlefonts/fontations#609 and googlefonts/fontations#637 I have some ideas about how to support this. Let’s discuss f2f.

drott commented 10 months ago

@dfrg please feel free to amend, quick summary for this particular topic off the top of my head from our f2f:

Among the reasons for keeping the callback interface restricted to COLR:

dfrg commented 10 months ago

@drott thanks for the summary. This all sounds good to me.

drott commented 9 months ago

Regarding the stop normalization, it turns out we can only do that level of stop normalization and preparation that does not involve color interpolation.

dfrg commented 9 months ago

Per f2f, this sounds like a great compromise to provide as many useful transformations as possible without doing color interpolation.

Discussion also touched on using a SmallVec like container to avoid some allocations for the color stop array. Skrifa already has one that might be useful, possibly with modifications.