Skip to content

[makeotf] aalt compilation does not follow lookups #1796

@frankrolf

Description

@frankrolf

Consider the following feature:

languagesystem DFLT dflt;

@LETTERS_LC     = [ a b c d e ];
@LETTERS_SC     = [ A.sc B.sc C.sc D.sc E.sc ];
@LETTERS_SUP    = [ a.sups b.sups c.sups d.sups e.sups ];
@FIG_DEFAULT    = [ zero.fit one.fit two.fit three.fit ];
@FIG_SUPERIOR   = [ zero.sups one.sups two.sups three.sups ];
@PUNCT_DEFAULT  = [ period comma hyphen parenleft parenright ];
@PUNCT_SUPERIOR = [ period.sups comma.sups hyphen.sups parenleft.sups parenright.sups ];


feature aalt {
    feature smcp;
    feature sups;
} aalt;


feature smcp {

    sub @LETTERS_LC by @LETTERS_SC;

} smcp;


feature ordn {

    lookup ORDN {
        sub @LETTERS_LC by @LETTERS_SUP;
    } ORDN;

} ordn;


feature sups {

    sub @FIG_DEFAULT by @FIG_SUPERIOR;
    sub @PUNCT_DEFAULT by @PUNCT_SUPERIOR;

    lookup ORDN;

} sups;

note that aalt contains only smcp and sups, the sups feature itself contains a ORDN lookup.

the resulting LookupList looks like this:

    <LookupList>
      <!-- LookupCount=4 -->
      <Lookup index="0">
        <LookupType value="1"/>
        <LookupFlag value="0"/>
        <!-- SubTableCount=1 -->
        <SingleSubst index="0">
          <Substitution in="a" out="A.sc"/>
          <Substitution in="b" out="B.sc"/>
          <Substitution in="c" out="C.sc"/>
          <Substitution in="comma" out="comma.sups"/>
          <Substitution in="d" out="D.sc"/>
          <Substitution in="e" out="E.sc"/>
          <Substitution in="hyphen" out="hyphen.sups"/>
          <Substitution in="one.fit" out="one.sups"/>
          <Substitution in="parenleft" out="parenleft.sups"/>
          <Substitution in="parenright" out="parenright.sups"/>
          <Substitution in="period" out="period.sups"/>
          <Substitution in="three.fit" out="three.sups"/>
          <Substitution in="two.fit" out="two.sups"/>
          <Substitution in="zero.fit" out="zero.sups"/>
        </SingleSubst>
      </Lookup>
      <Lookup index="1">
        <LookupType value="1"/>
        <LookupFlag value="0"/>
        <!-- SubTableCount=1 -->
        <SingleSubst index="0">
          <Substitution in="a" out="A.sc"/>
          <Substitution in="b" out="B.sc"/>
          <Substitution in="c" out="C.sc"/>
          <Substitution in="d" out="D.sc"/>
          <Substitution in="e" out="E.sc"/>
        </SingleSubst>
      </Lookup>
      <Lookup index="2">
        <LookupType value="1"/>
        <LookupFlag value="0"/>
        <!-- SubTableCount=1 -->
        <SingleSubst index="0">
          <Substitution in="a" out="a.sups"/>
          <Substitution in="b" out="b.sups"/>
          <Substitution in="c" out="c.sups"/>
          <Substitution in="d" out="d.sups"/>
          <Substitution in="e" out="e.sups"/>
        </SingleSubst>
      </Lookup>
      <Lookup index="3">
        <LookupType value="1"/>
        <LookupFlag value="0"/>
        <!-- SubTableCount=1 -->
        <SingleSubst index="0">
          <Substitution in="comma" out="comma.sups"/>
          <Substitution in="hyphen" out="hyphen.sups"/>
          <Substitution in="one.fit" out="one.sups"/>
          <Substitution in="parenleft" out="parenleft.sups"/>
          <Substitution in="parenright" out="parenright.sups"/>
          <Substitution in="period" out="period.sups"/>
          <Substitution in="three.fit" out="three.sups"/>
          <Substitution in="two.fit" out="two.sups"/>
          <Substitution in="zero.fit" out="zero.sups"/>
        </SingleSubst>
      </Lookup>
    </LookupList>

now, when we modify the aalt like this:

feature aalt {
    feature smcp;
    feature ordn;
    feature sups;
} aalt;

we get

    <LookupList>
      <!-- LookupCount=5 -->
      <Lookup index="0">
        <LookupType value="1"/>
        <LookupFlag value="0"/>
        <!-- SubTableCount=1 -->
        <SingleSubst index="0">
          <Substitution in="comma" out="comma.sups"/>
          <Substitution in="hyphen" out="hyphen.sups"/>
          <Substitution in="one.fit" out="one.sups"/>
          <Substitution in="parenleft" out="parenleft.sups"/>
          <Substitution in="parenright" out="parenright.sups"/>
          <Substitution in="period" out="period.sups"/>
          <Substitution in="three.fit" out="three.sups"/>
          <Substitution in="two.fit" out="two.sups"/>
          <Substitution in="zero.fit" out="zero.sups"/>
        </SingleSubst>
      </Lookup>
      <Lookup index="1">
        <LookupType value="3"/>
        <LookupFlag value="0"/>
        <!-- SubTableCount=1 -->
        <AlternateSubst index="0">
          <AlternateSet glyph="a">
            <Alternate glyph="A.sc"/>
            <Alternate glyph="a.sups"/>
          </AlternateSet>
          <AlternateSet glyph="b">
            <Alternate glyph="B.sc"/>
            <Alternate glyph="b.sups"/>
          </AlternateSet>
          <AlternateSet glyph="c">
            <Alternate glyph="C.sc"/>
            <Alternate glyph="c.sups"/>
          </AlternateSet>
          <AlternateSet glyph="d">
            <Alternate glyph="D.sc"/>
            <Alternate glyph="d.sups"/>
          </AlternateSet>
          <AlternateSet glyph="e">
            <Alternate glyph="E.sc"/>
            <Alternate glyph="e.sups"/>
          </AlternateSet>
        </AlternateSubst>
      </Lookup>
      <Lookup index="2">
        <LookupType value="1"/>
        <LookupFlag value="0"/>
        <!-- SubTableCount=1 -->
        <SingleSubst index="0">
          <Substitution in="a" out="A.sc"/>
          <Substitution in="b" out="B.sc"/>
          <Substitution in="c" out="C.sc"/>
          <Substitution in="d" out="D.sc"/>
          <Substitution in="e" out="E.sc"/>
        </SingleSubst>
      </Lookup>
      <Lookup index="3">
        <LookupType value="1"/>
        <LookupFlag value="0"/>
        <!-- SubTableCount=1 -->
        <SingleSubst index="0">
          <Substitution in="a" out="a.sups"/>
          <Substitution in="b" out="b.sups"/>
          <Substitution in="c" out="c.sups"/>
          <Substitution in="d" out="d.sups"/>
          <Substitution in="e" out="e.sups"/>
        </SingleSubst>
      </Lookup>
      <Lookup index="4">
        <LookupType value="1"/>
        <LookupFlag value="0"/>
        <!-- SubTableCount=1 -->
        <SingleSubst index="0">
          <Substitution in="comma" out="comma.sups"/>
          <Substitution in="hyphen" out="hyphen.sups"/>
          <Substitution in="one.fit" out="one.sups"/>
          <Substitution in="parenleft" out="parenleft.sups"/>
          <Substitution in="parenright" out="parenright.sups"/>
          <Substitution in="period" out="period.sups"/>
          <Substitution in="three.fit" out="three.sups"/>
          <Substitution in="two.fit" out="two.sups"/>
          <Substitution in="zero.fit" out="zero.sups"/>
        </SingleSubst>
      </Lookup>
    </LookupList>

Note that we’re now getting AlternateSets for a b c d e.


While the feature functionality is the same across both features, the omission of ordn in aalt may lead to unexpected ordering with the aalt feature.

In other words, the current feature parsing/aalt compilation doesn’t seem to follow what’s happening within referenced lookups.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions