Discussion:
[fontforge-users] [Python API] Cleaning up lookup subtables
Abraham Lee
2016-10-05 19:01:00 UTC
Permalink
All,

I have an semi-automated process that goes something like this:

1. Open a font that contains lots more glyphs than I will create (as a
template)
2. Edit the glyphs I want to change
3. Remove the glyphs I didn't change
4. Generate the OTF

Everything works just as I expect except for one thing. While in the
process of generating OTF files (step #4), I get the following error (line
593 in "fontforge/lookups.c"):

"Lookup subtable contains unused glyph [XYZ] making the whole subtable
invalid"

The larger font that has lots of lookups. However, since I only edit a
subset of the original glyphs and remove the others, some of the lookups
end up containing ligature substitution data that no longer is valid.

My question is this: Is there a fast way to clean up the lookup subtables
prior to so that any reference to now non-existent glyphs can be removed?
I'd like to be able to do this via the Python API since I'll be doing this
quite a few times with different fonts.

Thanks in advance,
Abraham

P.S. Perhaps the error should specifically mention that it is a "ligature"
subtable? That would at least help in pin-pointing the problem faster.
Frank Trampe
2016-10-05 19:23:02 UTC
Permalink
Sorry about that. This is not a difficult problem to fix, and I think that
we ought to add a general "Clean References" function that does this. I'm
way behind on real work from the recent release, but it is on my list.

In the interim, running RemovePosSub
<https://fontforge.github.io/scripting-alpha.html#RemovePosSub>("*") on
each glyph before removing it might work.
Post by Abraham Lee
All,
1. Open a font that contains lots more glyphs than I will create (as a
template)
2. Edit the glyphs I want to change
3. Remove the glyphs I didn't change
4. Generate the OTF
Everything works just as I expect except for one thing. While in the
process of generating OTF files (step #4), I get the following error (line
"Lookup subtable contains unused glyph [XYZ] making the whole subtable
invalid"
The larger font that has lots of lookups. However, since I only edit a
subset of the original glyphs and remove the others, some of the lookups
end up containing ligature substitution data that no longer is valid.
My question is this: Is there a fast way to clean up the lookup subtables
prior to so that any reference to now non-existent glyphs can be removed?
I'd like to be able to do this via the Python API since I'll be doing this
quite a few times with different fonts.
Thanks in advance,
Abraham
P.S. Perhaps the error should specifically mention that it is a "ligature"
subtable? That would at least help in pin-pointing the problem faster.
------------------------------------------------------------
------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
fontforge-users mailing list
https://lists.sourceforge.net/lists/listinfo/fontforge-users
http://fontforge.10959.n7.nabble.com/User-f8781.html
Abraham Lee
2016-10-05 21:37:23 UTC
Permalink
Post by Frank Trampe
Sorry about that. This is not a difficult problem to fix, and I think that
we ought to add a general "Clean References" function that does this. I'm
way behind on real work from the recent release, but it is on my list.
That's wonderful! I didn't know I needed that until now.
Post by Frank Trampe
In the interim, running RemovePosSub
<https://fontforge.github.io/scripting-alpha.html#RemovePosSub>("*") on
each glyph before removing it might work.
I tried that, but for some reason the error kept happening. In any case, I
can move forward for now by doing that for ALL glyphs. Thanks for the help!

- Abraham

Loading...