Mark to Base on Ligatured glyphs

Options
I have ligatured glyphs ( above base ) and I want to adjust the kerning by Mark ( ligatured glyph ) to Base ( Base Glyph ). In the first case, I want to adjust the ligatured glyph at the middle of base glyph. In a second case I want to adjust ligatured glyph to the right edge of the post base glyph. I tried with Mark to Base and that did not seem to work ( I put the first glyph as base and ligatured glyph as Mark ). Unless I create two ligatured glyphs ( using different position ) and call upon the right one with back/match/ahead lookup. My question is - ligatured glyph does not act on mark to Base no matter you switch the mark/base to ligatured glyph, Why is that? Second question is what is the best way to adjust them without  adding same ligatured glyphs? Thanks
Tagged:

Comments

  • Simon Cozens
    Options
    The way I handle this is to put two anchors on the bases and switch between two mark-to-base lookups contextually.
  • WAY KYI
    WAY KYI Posts: 130
    Options
    Mr. Simon Cozens, thank you very much for your suggestion. Sorry, I was a bit busy with other things. Do you mean, I use GSUB ( Contextual Substitution ) feature to call GPOS ( Mark to Base )? I haven't done like this before, so I may need a little sample if you have one. Thanks
  • John Hudson
    John Hudson Posts: 3,054
    edited December 2022
    Options
    Do you mean, I use GSUB ( Contextual Substitution ) feature to call GPOS ( Mark to Base )?
    No, contextual GPOS. Mark anchor positioning lookups are inherently substitutive: the mark ends up on the last anchor that is specified in the lookups, so you can have a default anchor—where the mark is located in most situations—but also one or more additional anchors on each base to which the mark will move in particular contexts. The context rules work similarly to how they do in GSUB, but instead of performing glyph substitutions they are effectively performing anchor subsitutions, saying ‘In this context, use this anchor instead of the previous anchor’.
  • WAY KYI
    WAY KYI Posts: 130
    Options
    Do you mean, I use GSUB ( Contextual Substitution ) feature to call GPOS ( Mark to Base )?
    No, contextual GPOS. Mark anchor positioning lookups are inherently substitutive: the mark ends up on the last anchor that is specified in the lookups, so you can have a default anchor—where the mark is located in most situations—but also one or more additional anchors on each base to which the mark will move in particular contexts. The context rules work similarly to how they do in GSUB, but instead of performing glyph substitutions they are effectively performing anchor subsitutions, saying ‘In this context, use this anchor instead of the previous anchor’.
    How anchor substitution work? Do you have any written document I can reference? They are points in the glyph and how to use them in substitution? By their names? or how? Thanks 
  • John Hudson
    John Hudson Posts: 3,054
    Options
    I use Microsoft’s VOLT tool for most of my OpenType Layout development, so I may not be able to provide direct advise on how to achieve this in other tools. One of the reasons I use VOLT is that a lot of other tools that are based around Adobe’s AFDKO feature code model really don’t easily accomodate contextual positioning.

    Anchor positioning GPOS is naturally substitutive: the layout engine will work its way through the GPOS mark positioning lookups, and the marks will end up in the position determined by the last lookup that processes them. This means that you can have different lookups for the same mark on the same base, and each lookup can have context rules. As the layout engine steps through the lookups, it may first find a match for an uncontextual position (what I think of as the default position), but then in a subsequent lookup it will find a match in the context rule and will relocate the mark to the anchor specified in that lookup. It will keep moving the mark to different anchors until it ceases to find a match in the context rule.



  • Simon Cozens
    Simon Cozens Posts: 727
    edited July 2023
    Options
    It's very difficult to do contextual anchoring in AFDKO. It's one of the reasons why FEZ is much better for complex scripts:
    Routine DoReattachAnusvaraLig {
      Attach &top &_alternate bases;
    };
    
    Feature mark {
      Routine NormalTopAttach {
        Attach &top &_top bases;
      };
      Routine ReattachAnusvaraLigatures {
        Chain (/_anusvara/ ^DoReattachAnusvaraLig) @w1 @abovemarks;
      };
      # ...
    };
    
  • WAY KYI
    WAY KYI Posts: 130
    Options
    It's very difficult to do contextual anchoring in AFDKO. It's one of the reasons why FEZ is much better for complex scripts:
    Routine DoReattachAnusvaraLig {
      Attach &top &_alternate bases;
    };
    
    Feature mark {
      Routine NormalTopAttach {
        Attach &top &_top bases;
      };
      Routine ReattachAnusvaraLigatures {
        Chain (/_anusvara/ ^DoReattachAnusvaraLig) @w1 @abovemarks;
      };
      # ...
    };
    
    Am I seeing unfamiliar codes here? Like how do you defind &top and &_alternate bases, these are anchor classes, right? Feature Routine is FEZ feature? 
    OR can I just simply use Kerning by classes after initial anchoring is done? 

    Anyway, I really appreciate both of you for giving me directions. I checked VOLT before and it was easy to follow. FEZ is all new to me and I want the easiest way. Thanks

  • WAY KYI
    WAY KYI Posts: 130
    Options
    I have a question with positioning with marks. Are they fixed and can not be reposition?

  • John Hudson
    John Hudson Posts: 3,054
    Options
    Anchor positions cannot be changed, but marks can be repositioned onto other anchors. This can happen any number of times, so you can set up series of lookups that move marks around depending on different contexts. The final position of the mark will be on the last anchor that is matched in a lookup. There are a couple of ways this can be managed in the lookups: 

    1. Start with a lookup that applies default position (without context); then apply subsequent lookups with contextual rules, generally moving from shorter to longer contexts.

    2. Use subtable structures to order the contextual lookups first, from longest to shortest, followed by a final contextless lookup to position any remaining marks on bases; this method is more efficient in terms of processing, because as soon as a match is found and applied all subsequent subtable lookups are ignored. [I think this may still not be possible in AFDKO, where subtables were limited to the kern feature when last I looked.]

    can I just simply use Kerning by classes after initial anchoring is done? 
    Interaction between anchor positioning and kerning is really difficult to manage. As I explained above, anchor positioning is substitutive: each lookup replaces the result of the previous lookup. But kerning is additive — each lookup is applied on top of the results of the previous lookup. And kerning affects the relative position of everything that follows in the text string.

    Generally, you want to avoid getting marks involved in kerning unless you are dealing with a script like Telugu where it is unavoidable in some situations.

  • WAY KYI
    WAY KYI Posts: 130
    Options
     anchor positioning is substitutive: each lookup replaces the result of the previous lookup. But kerning is additive — each lookup is applied on top of the results of the previous lookup. And kerning affects the relative position of everything that follows in the text string.

    So, I can basically create another lookup with second anchor which will replace the first anchor one if the right mark & base glyphs are present, right???
  • John Hudson
    John Hudson Posts: 3,054
    Options
    Correct.