Variable Origin and Virtual Master

Currently, one cannot assign the coordinates of a Virtual Master as the Variable Origin. Would it be possible to either enable this feature or add a “Custom” option in the Variable Origin menu to allow manual entry?

Why would you like to do that? The origin needs a full masters with metrics and all glyphs defined. A virtual masters usually isn’t.

I have a font with an optical size (opsz) axis. For each of my masters, I’ve added virtual masters with distinct opsz values. Additionally, I’ve incorporated bracket layers for every master and every glyph, mirroring the master layers but with tighter spacing.

I’d like to set the default value of the optical size (opsz) axis to match the value I’ve used in the bracket layers.

I’m aware that one option is to swap the MasterLayer with the bracket layer. However, this would necessitate extensive modifications to the file, which seems a bit excessive for that.

Instill don’t understand what you are trying to do ;(

I implemented an ‘opsz’ axis to change the spacing of my font. Instead of duplicating all my masters and modifying layers sidebearings, I wrote a script that creates a bracket layer with tighter spacing for each master. (Only sidebearings change; the outlines remain exactly the same)

With this method, I have a much lighter VF than if I had duplicated all my masters:

Does variable GPOS still not work?

I don’t thing it would make a difference in file size if you have full masters instead of the brace layers.

And Sebastian is right. It might be possible to do that with variable spacing. You have to write the feature code yourself.

I’ll experiment with real masters instead of virtual ones. I plan to use the ‘opsz’ axis for this purpose. I use it as a tracking axis since opsz value can be automatically set based on font size used.

File size are really differents in TTF:
2,3 MB VS 1,8 MB (with Virtual Masters) → File size increase by 28%

But much closer with WOFF2:
542 KB VS 530 KB (with Virtual Masters) → File size increase by 2%

Can you send me the two .glyphs files?

Unfortunately it’s a custom project under NDA, sorry :confused:

Maybe you can remove most glyphs and the protected outlines?

@GeorgSeifert, I have gathered more information about the differences in file size.

My font, which incorporates an OPSZ axis, only modifies sidebearings. This means all my masters are duplicated: opsz=12 has standard spacing, while opsz=8 has looser spacing.

I tested exporting the font with all masters and also tried converting these duplicate masters into brace layers, adding Virtual Masters. The “brace” font file size is slightly smaller than the “master” font.

Using TTX, I discovered the changes are primarily in the GDEF table, specifically in GDEF > VarStore > VarData. Here’s a comparison from both fonts:

Font made with masters only

<Item index="0" value="[-3, 7, -1, -7, -7, -5, 0, 5, 3, 2, 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]"/>
<Item index="1" value="[0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]"/>
<Item index="2" value="[0, 0, 0, 0, 6, -23, 3, 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]"/>

Font made with master and brace layers :

<Item index="0" value="[-3, 7, -1, -7, -7, -5, 0, 5, 3, 2, 21]"/>
<Item index="1" value="[0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0]"/>
<Item index="2" value="[0, 0, 0, 0, 6, -23, 3, 23, 0, 0, 0]"/>

I’m curious if the standard export process could be improved, or if the Virtual Masters method might have a bug.

I’ll look into the details you posted in a bit.

But if you really only like to change the spacing, you can use variable GPOS.

Can you explain a bit more your setup?

I know that solution, but I want to use opsz for web usage.

My glyphs file initially contains 12 masters. I duplicate each of these masters, altering the value of the opsz axis for each duplicate. Subsequently, I add extra spacing to all glyphs in these 12 newly generated masters. As a result, my file includes 24 masters, comprising the original 12 and the 12 duplicates with updated spacing.

To reduce the file size of the export, I can convert these 12 new masters into brace layers. For each brace layer, I will add a virtual master at specific locations.

The opsz axis in this context functions as a ‘spacing’ axis. This enables me to adjust the font spacing, either looser or tighter, depending on the font size being used.
(From me, the only big difference between theses two export setup is that with brace layers, I can’t add new kerning for theses)

Why does this change anything? It doesn’t matter if you use gvar or GPOS variation.

You can add a “Virtual Master” parameter to define the axis range on the opsz axis. Then add the GPOS as described here: Variable GPOS — Glyphs Handbook

1 Like

I didn’t know that it’s possible to specify the location within the design space using GPOS.
It work perfectly, thanks @GeorgSeifert, this will make my workflow much easier !

EDIT : With GPOS+Virtual master, the file size has been reduced by 7% (WOFF2)

Just for reference. here is a file that shows how to set it up:

Optical Variable GPOS.glyphs (1.6 KB)

3 Likes