Gradient transform

I’m trying to import COLRv1 layers into Glyphs Color layers. I’m currently facing issue with radial gradients looking different in Glyphs than in the original font. I’m suspecting gradient transformation is the culprit, since I’m not sure how to apply them. Any suggestions are welcome.

2 Likes

Also, there does not seem to be any documentation for the gradient path attribute.

The definition of gradients are quite a bit more complex in COLRv1 than what the default drawing routines can handle. So it might be that what you are trying to do is simply not supported.

I’ll have a look at the documentation. Until then, set up a gradient manually and then have a look what you get in the attributes.

My gradient currently looks like this:

gradient = {
colors = (
(
(0,0,0,255),
0
),
(
(0,0,0,0),
1
)
);
end = (0,0);
start = (1.115,0.4799);
type = circle;
};

And this is how it is rendered in Glyphs:


The SVG gradient is defined as (the center point is absolute, in Glyphs it is relative):

<radialGradient id="radialGradient2532_0" cx="492.929258" cy="188.531134" r="81.390862" gradientTransform="matrix(0.267693 1.832957 0.942408 -0.137634 0 0)" gradientUnits="userSpaceOnUse">
 <stop offset="0" stop-color="#000000" stop-opacity="1"/>
 <stop offset="1" stop-color="#000000" stop-opacity="0"/>
</radialGradient>

And this is how the original SVG looks in Inkscape:

Two things from SVG gradient I don’t know how to represent in Glyphs, the radius (r) and the radiant transformation (gradientTransform). My question is there a way to represent these, and if yes how?

Can you send me the source data and the .glyphs file?

And can you make a .svg how you like it to be?

Here are the SVGs, the COLRv1 font (ReemKufiInk-Regular.otf) built from the SVGs with nonnoemoji, the B&W Glyphs source (ReemKufi.glyphs) and the one I generated with Color layers (ReemKufiInk.glyphs) and the import script used as:

python import-colrv1.py ReemKufi.glyphs ReemKufiInk-Regular.otf ReemKufiInk.glyphs

My end goal is to have a Glyphs file I can generate functionally equivalent ReemKufiInk-Regular.otf from (using fontmake) so I can work on the bold master and eventually build a variable font.

COLRv1-Test.zip (226.4 KB)

2 Likes

FWIW, here is how black-renderer applies these gradients using CoreGraphics: black-renderer/coregraphics.py at 62afec9eb299bb6075e4cd5be48a23171ae009ad · BlackFoundryCom/black-renderer · GitHub

We are working on COLRv1 right now. So your font are helpful test material.

And thanks for the link to that script. This is very helpful.

3 Likes

Hi there, any update on this? :slight_smile:

I have a project similar to Khaled’s. My gradients were created using native Color within Glyphs3. Exporting a variable font that shows visible gradient is possible using fontmake or gftools builder. The issue is that the gradient itself is not variable.

Right now, the color axis in the font info panel has to equal ‘0’ on each master, which kind of also blocks it from having a variable axis. Would it be possible to separate these on the masters as well as define the gradient points on them?

This is what it looks like:
Large GIF (762x490)

Why do you have a “Color” axis?

Good question. I set up this axis last year initially based on this Glyphs tutorial since I thought it was a requirement for using COLR. I just checked and exporting works the same without axis.