twardoch/fonttools-opentype-feature-freezer

one feature in a set does not seem to be frozen

Closed this issue · 4 comments

According to the wiki page of Fira Code pyftfeatfreeze can be used to create a font that uses style sets permanently:

This works great for all style sets (features) but one (ss02). Since it works with all but ss02 I do not think it is an issue with the pyftfeatfreeze script, but maybe I'm wrong.

As you can see from the output, the script remapped also ss02:

$ pyftfeatfreeze.py -n -v -f 'ss02,ss03,ss04,ss05' FiraCode-Regular.otf out/FiraCode-Regular.otf
[featfreeze][info] [RemapByOTL] Running with options: Namespace(features='ss02,ss03,ss04,ss05', info=False, inpath='FiraCode-Regular.otf', lang=None, names=True, outpath='out/FiraCode-Regular.otf', rename=False, replacenames=u'', report=False, script='latn', usesuffix=u'', verbose=True, zapnames=False)
/Users/tessus/bin/pyftfeatfreeze.py:140: UserWarning: 'verbose' is deprecated; configure logging instead
  self.inpath, 0, verbose=False, recalcBBoxes=False)
[featfreeze][info] [openFont] Opened font: FiraCode-Regular.otf
[featfreeze][info] [filterFeatureIndex] FeatureIndex: [3, 19, 35, 51, 67, 93, 109, 125, 141, 157, 173, 189, 205, 221, 237, 253, 269, 285, 301, 317, 333]
[featfreeze][info] [filterLookupList] Features to apply: [u'ss02', u'ss03', u'ss04', u'ss05']
[featfreeze][info] [filterLookupList] Lookups: [174, 175, 176, 177, 178, 179]
[featfreeze][info] [applySubstitutions] Remap: 'dollar' -> 'dollar.ss05'
[featfreeze][info] [applySubstitutions] Remap: 'at' -> 'at.ss06'
[featfreeze][info] [applySubstitutions] Remap: 'ampersand' -> 'ampersand.ss03'
[featfreeze][info] [applySubstitutions] Remap: 'ampersand_ampersand.liga' -> 'ampersand.ss03'
[featfreeze][info] [applySubstitutions] Remap: 'greater_equal.liga' -> 'greater_equal.ss02'
[featfreeze][info] [applySubstitutions] Remap: 'less_equal.liga' -> 'less_equal.ss02'
dollar.ss05 at.ss06 ampersand.ss03 ampersand.ss03 greater_equal.ss02 less_equal.ss02
[featfreeze][info] [saveFont] Saved font: out/FiraCode-Regular.otf
[featfreeze][good] Finished processing.

However, the ligatures still look like image instead of image.

I'm sorry to open an issue, but I just want to make sure that this is not a bug with the script.

I can attach both files (before and after), if that helps somehow. Or pleaes let me know what other info is needed to narrow down the problem.

madig commented

Wild guess: the liga glyphs have no Unicode value assigned and this script works by switching out Unicode values, the substitution therefore does nothing.

That's correct. pyftfeafreeze only affects 1:1 substitutions where the source glyph has a Unicode codepoint. But if the source glyphs are results of a ligature substitutions, pyftfeafreeze won't have an effect.

Remapping whole chains of lookups is a much more ambitious and complicated task, world require a serious upgrade of the program’s logic. I don't have the resources to tackle it, but if someone contributes a PR, I'll gladly accept it.

Thank you very much for the info, but I don't really understand what that means. But I will forward your explanation to the developer of the font. Maybe he knows what to do.
SInce it worked for 3 out of the 4 substitutions, he might be able to change the font so that the lesser equal and greater equal signs are not liga glyphs. That should fix the issue.