Open slikts opened 4 years ago
I've edited this line:
ctx.fillColor([color.red, color.green, color.blue], color.alpha / 255 * 100);
Into this:
ctx.fillStyle = `rgba(${color.red}, ${color.green}, ${color.blue}, ${color.alpha / 255 * 100})`;
But it forces it into an infinite loop, since apparently COLR glyphs be nested in their layers.
Apparently COLRGlyph.layer
is returning a circular reference (glyph.layers[0].glyph === glyph
). This is probably outside of my ability to fix/debug.
Ah yeah. This was designed for use with PDFKit, which uses the function API. Perhaps we need some kind of adapter for different drawing surfaces?
ctx.fillStyle
is one part of the fix, but fontkit is also not calling ctx.beginPath()
, so the last color is used for all of the paths. I looked at PDFKit's Document
and I don't think it's compatible at all with CanvasRenderingContext2D
. An adapter interface would be nice to have.
Apparently
COLRGlyph.layer
is returning a circular reference (glyph.layers[0].glyph === glyph
). This is probably outside of my ability to fix/debug.
I think the infinite looping is a separate issue: #232. It doesn't happen with the fonts in test/data
, but it does with a version of Segoe UI Emoji I found on the web.
glyph.render(ctx, size)
with COLR glyphs produces the errorctx.fillColor is not a function
, even thoughctx
is an instanceCanvasRenderingContext2D
(usingnode-canvas
).COLR glyphs are also missing the
glyph.getImageForSize()
method, even though it's mentioned in the docs (it's only implemented for SBIX glyphs).