How does one combine contextual gsub with gpos

Primary tabs

5 posts / 0 new
Last post
Martin Wenzel's picture
Offline
Joined: 25 May 2006 - 11:49am
How does one combine contextual gsub with gpos
0

Hi,

I've tried but had no luck finding any references for what I'm trying to do: combining contextual gsub with gpos.

I know that the following code example doesn't work but it should illustrate what I'm aiming for.

feature calt {
# if a is followed by by b, shift a 100u y direction
sub a' b by pos a <0 100 0 0>;
} calt;

Does anyone have a hint if/how this can be done.

Thanks,
Martin

John Hudson's picture
Offline
Joined: 21 Dec 2002 - 11:00am
0

GSUB and GPOS are independently processed, with all GSUB being performed before any GPOS is applied. It is technically possible to mix GSUB and GPOS lookups in the same feature, and to include GPOS lookups in a GSUB feature such as ‘calt’, but this is very strongly discouraged. You can't rely on layout engines applying GPOS lookups that occur in a GSUB feature, because if the engine considers e.g. ‘calt’ to be a GSUB feature, as the feature description in the OT spex appendix indicates it to be, then that feature might not be processed during GPOS operations.

What you seem to be describing is a GPOS operation involving a contextual single adjustment. I would experiment with putting this in the ‘kern’ feature, since it is fundamentally an adjustment involving the spatial relationship of two base glyphs. I don't use the Adobe FDK or FontLab for OTL work, so I don't know what limitations or assumptions might exist for the ‘kern’ feature in those tools, e.g. if they might presume all kerning lookups to be pair adjustments. I do know that in VOLT it is no problem to include any kind of GPOS lookup within ‘kern’, and I regularly use contextual single adjustments in that feature.

Karsten Luecke's picture
Offline
Joined: 6 Aug 2005 - 8:41am
0

Yes, like in VOLT you can add a separate lookup to the kern feature, but need to compile with either the new AFDKO (not from within FLS5) or OTMaster.

   feature kern {

      lookup kern_jumpingGlyphs {
          pos a' <0 100 0 0> b;
      } kern_jumpingGlyphs;

   } kern;

The marked glyph is the input glyph to be repositioned, and the value record needs to follow immediately.

But you need to be careful: Substitution can be executed only once on an input glyph (after substitution it does not exist any more in the glyph string). But if you reposition the same glyph again in other lookups, all of these adjustments will add up.

Karsten

Martin Wenzel's picture
Offline
Joined: 25 May 2006 - 11:49am
0

Hi John, Hi Karsten,

thanks for your very concise explanation.

Very much appreciated,
Martin

Chris Lozos's picture
Offline
Joined: 25 Feb 2004 - 11:00am
0

.

ChrisL