alexheretic / ab-glyph

Rust API for loading, scaling, positioning and rasterizing OpenType font glyphs
Apache License 2.0
369 stars 24 forks source link

Custom font colors #93

Closed morn-0 closed 11 months ago

morn-0 commented 12 months ago

my context: it's based on a tiny-skia pixmap getting pixels_mut for the operation. Hello, I am trying to customize the rendering color of a font. I've tried a few options and they don't seem to work very well

alexheretic commented 12 months ago

The ab_glyph rasterizer provides just coverage values for each pixel. You can colour them any way you like.

For instance, the image example colours the glyphs dark red.

morn-0 commented 12 months ago

image image

use color(150, 0, 0); maybe not work

morn-0 commented 12 months ago

i use tiny-skia

alexheretic commented 12 months ago

i use tiny-skia

I'm not familiar with that lib myself. But as long you are getting the correct coverage values for the glyphs I don't think this is an issue for ab_glyph.