Discussion:
[Fontforge-users] New AddAnchorClass syntax.
p***@umich.edu
2008-05-22 03:42:50 UTC
Permalink
Hello,

I recently upgraded to the latest version of FontForge. I noticed that
a lot of my scripts no longer work due to the changes to the syntax of
the AddAnchorClass command. Moreover, I cannot figure out what the
appropriate syntax might be.

The old syntax

AddAnchorClass(name,type,script-lang,tag,flags,merge-with)

has been replaced with

AddAnchorClass(name,type,lookup-subtable-name)

An example of my old code is:

AddAnchorClass("sub","default","deva{dflt}","blwm",-1,"")
AddAnchorClass("top","default","deva{dflt}","abvm",-1,"")

Could someone kindly please advise me of the valid options for
lookup-subtable-name?

Thank you.

Regards,
Anshuman
George Williams
2008-05-22 04:22:44 UTC
Permalink
Post by p***@umich.edu
The old syntax
AddAnchorClass(name,type,script-lang,tag,flags,merge-with)
has been replaced with
AddAnchorClass(name,type,lookup-subtable-name)
AddAnchorClass("sub","default","deva{dflt}","blwm",-1,"")
AddAnchorClass("top","default","deva{dflt}","abvm",-1,"")
Could someone kindly please advise me of the valid options for
lookup-subtable-name?
ff's internal representation of GPOS/GSUB moved from a feature based
system to a lookup based system about a year and a half ago.

It used to be that an anchor class was attached to a feature ("blwm" and
script "deva{dflt}")
Now anchor classes live in lookup subtables which live in lookups which
are attached to features.

In other words ff now represents things the same way GPOS does.

So if you are starting with a blank font then the first thing you must
do is create a lookup
AddLookup("belowbaseline","gpos_mark2base",0,
[["blwm",[["deva",["dflt"]]]]])
then in that lookup you need to create (at least one) subtable
AddLookupSubtable("belowbaseline", "belowbasesub")
then in that subtable you create your anchor class
AddAnchorClass("sub","default","belowbasesub")
If you have more than one anchor class in the "blwm" feature it can live
in the same lookup subtable.

But your anchor class "top" is in a different feature, and it needs its
own lookup and lookup-subtable.

I'm sorry this is so complicated. But that's the way OpenType works. I
tried to hide some of the complexity when I first did things, but came
to realize the complexity was needed and had to scrap the earlier
methodology.
p***@umich.edu
2008-05-22 07:02:53 UTC
Permalink
In several of my scripts I used the deprecated AddATT command:

AddATT("Ligature","deva{dflt}","abvs",-1,"glyph_a glyph_b")

ff reports that AddATT has been replaced by AddPosSub:

AddPosSub(subtable-name,variant-glyph-name(s))
AddPosSub(subtable-name,dx,dy,dadv_x,dadv_y)
AddPosSub(subtable-name,other-glyph-name,dx1,dy1,
dadv_x1,dadv_y1,dx2,dy2,dadv_x2,dadv_y2)

I am not quite sure how to go about migrating the AddATT command to
the new AddPosSub. I appreciate any advice regarding this matter.

Regards,
Anshuman
George Williams
2008-05-23 02:57:48 UTC
Permalink
Post by p***@umich.edu
AddATT("Ligature","deva{dflt}","abvs",-1,"glyph_a glyph_b")
AddPosSub(subtable-name,variant-glyph-name(s))
AddPosSub(subtable-name,dx,dy,dadv_x,dadv_y)
AddPosSub(subtable-name,other-glyph-name,dx1,dy1,
dadv_x1,dadv_y1,dx2,dy2,dadv_x2,dadv_y2)
I am not quite sure how to go about migrating the AddATT command to
the new AddPosSub. I appreciate any advice regarding this matter.
Er... The answer is pretty much the same as the one I gave you
yesterday. If that didn't make it clear I'm not sure what I could say to
improve matters.
Perhaps it would help to look at
http://fontforge.sf.net/fontinfo.html#Lookups
http://fontforge.sf.net/lookups.html
these describe the basic philosophy behind lookups.

Once again you will need to create a lookup and then a subtable with in
it.
AddLookup("above-ligs","gsub_ligature",0,
[["abvs",[["deva",["dflt"]]]]])
AddLookupSubtable("above-ligs", "above-ligs-sub")
AddPosSub("above-ligs-sub","glyph_a glyph_b")

Anshuman Pandey
2008-05-22 23:07:25 UTC
Permalink
Dear George,
Post by George Williams
So if you are starting with a blank font then the first thing you must
do is create a lookup
AddLookup("belowbaseline","gpos_mark2base",0,
[["blwm",[["deva",["dflt"]]]]])
then in that lookup you need to create (at least one) subtable
AddLookupSubtable("belowbaseline", "belowbasesub")
then in that subtable you create your anchor class
AddAnchorClass("sub","default","belowbasesub")
If you have more than one anchor class in the "blwm" feature it can live
in the same lookup subtable.
Ok. This makes sense. I set up the lookup subtables in my script and
everything works as expected.
Post by George Williams
I'm sorry this is so complicated. But that's the way OpenType works. I
tried to hide some of the complexity when I first did things, but came
to realize the complexity was needed and had to scrap the earlier
methodology.
Ah, it's bound to end up this way! :) Thanks for the prompt advice on how
to set up the lookup subtable and declaring anchor classes. I will look
into the OpenType specification later. I'm trying to create TrueType fonts
from TeX bitmaps that supplement new Indic scripts that I've proposed for
inclusion in Unicode.

Now, I'm struggling with the AddPosSub syntax that replaced AddATT.

Regards,
Anshuman
Loading...