Problem building a variable font with contextual kerning #4077
|
With the font Namdhinggo The command used is The output is I can build a variable font by copying The issue (when the feature files are not identical) comes from the IkarKWid lookup. The positioning rules are contextual, and I can build a variable font , if I have some subset of the rules. To illustrate, using only the rules towards the end of the lookup (content below is from the the ExtraBold master UFO) Does not compile, the error is But if I remove the line with A chat with Claude Haiku 4.5 using Copilot Free in VS Code suggested reducing the number of glyphs that needed kerning, or reducing the number of different kerning amounts by grouping some glyphs together. Reasonable questions to ask for a Nastaliq font, but for Namdhinggo, the GPOS is not that complicated. And I suspect I have encountered this issue with other fonts. After a bit more chat Claude provided a clue
With the short example from the ExtraBold master shown above ( A variable font build can still work even if both If I build the static fonts (compiled with fontTools), and dump them to JSON using
Interesting that the first difference, mentioning lookups 19 and 5, match the first error message in this issue. I can understand if I was trying to merge the static fonts into a variable fonts that Especially surprised considering that fontmake/fontTools can infer kerning values even if the lookups don't match up between masters, as mentioned in an issue on fontc. |
Replies: 8 comments
|
Does any of those kern pairs happen to have 0 value in the default? |
|
No. The FEA in the UFOs is generated from a different source file, and there is a conditional that only outputs the positioning rule if the kerning is greater than zero. |
That sounds it might be the problem though, no? The feature files should be structurally identical across masters. The merger knows how to deal with differences in kern lookups, but not in contextual lookups. |
|
The conditional might be an issue, and that leads to another question. First, though, for Namdhinggo, in the IkarKWid lookup, I think the FEA is currently structurally identical across masters. Between the masters the following is true
What is not structurally identical across masters, if I understand that term correctly, is the implicitly generated GPOS Type 1 lookups that hold the actual kern values, since those lookups get re-used if another rule (in the same master) has the same kern value. That re-use seems like a good optimization for building static fonts, for building variable fonts, can that re-use be turned off (or applied after the features are merged) in fontTools? The second question could be relevant to Namdhinggo. It is a judgment call (so could go either way), but it is very plausible that one of the masters would need an extra rule in the FEA to kern one additional consonant (compared to the other master). Then the FEA would not be structurally identical across masters. Could fontTools, after detecting that situation, output additional lookups that did no kerning (in the master without the additional rule) so that the generated lookups would be structurally identical? |
|
As I said, fonttools does that for simple (pair & class) kerning. Matching contextual lookups though is very complicated task and unnecessary, given that we are moving the workflows to use variable .fea syntax. The optimization you point out is indeed problematic though, if it's happening that way. I'm not sure. |
|
feaLib will certainly reuse implicit lookups whenever possible (and when it doesn't, that is usually considered a bug). Your two options is to either 1) not use implicit lookups 2) use variable scalars so that fotmake/ufo2ft cimpile the layout tables once, instead of one master at a time then merging the binary tables. |
|
Thank you both for your very helpful comments. Where can I read about
or are those two different names for the same concept? I see discussions about variable FEA syntax, but it is not clear to me what is implemented and therefore usable. |
|
They are the same thing. The syntax that feaLib currently supports is documented here: https://github.com/adobe-type-tools/afdko/pulls |

feaLib will certainly reuse implicit lookups whenever possible (and when it doesn't, that is usually considered a bug). Your two options is to either 1) not use implicit lookups 2) use variable scalars so that fotmake/ufo2ft cimpile the layout tables once, instead of one master at a time then merging the binary tables.