Help needed to condense multiple subs, chained contexts and liga scripts.

Bernie CossentinoBernie Cossentino Posts: 19
edited December 2018 in Technique and Theory
Hello,

I'm working on some GSUB scripts for a test font. In part, the code substitutes and repositions three glyphs: bar, Capital letter, small letter. 

But while I've got it working the way I need, I am hoping to acquire some guidance for the following 3 points:

1 - I'm finding it difficult to condense the amount of Multiple subs, chained contexts and ligatures applied. As you can see from the "input string, output" image, part of the code addresses the letters following the bar, and I'll need to add several more letter combinations here (not just the three ABC caps abc smalls in my code). I tried creating and applying classes, but the results were not favorable.

2 - When the glyphs |Aa are substituted and repositioned, the side effect is that the parenleft is, understandably,  shifted over 3 spaces. In an attempt to remedy this, I've applied a single adjustment offset to reestablish the parenleft's original position. This works well for the most part. However, the parenleft's offset position will certainly vary by several units depending on the substituted letters' varying side bearing values.

Is there a way to reestablish the parenleft's position i.e. to get back the 3 spaces it lost, without using a GPOS offset?


If you're wondering, yes...the input string shown above must remain in tact. The order cannot and must not be modified.

3 - What options are available to allow for the output, all output, to remain aligned above the baseline, as shown below?


Admittedly, I'm a newbie on the typography scene. So please excuse my rookie questions. I don't necessarily want to be spoon-fed the answers. I would, however, like very much to learn how and why your thoughts and solutions work.

Thanks for taking the time to read my post.
Here's the code:
</code><code>script latn {
  feature StandardLigatures1;
  feature CursivePositioning1;
}

class @numbers [zero-nine];
class @ABC [A-C];
class @abc [a-c];

feature StandardLigatures1 liga {
  lookup ChainingContext1;
}

feature CursivePositioning1 curs {
  lookup SingleAdjustment1;
  lookup ChainedContextPositioning1;
  lookup CursiveAttachment1;
  lookup CursiveAttachment2;
}

lookup ChainingContext1 {
  context parenleft @numbers @numbers parenright bar A a;
  sub 0 MultipleSubstitution_Aa;
  sub 7 Ligature1;
  context parenleft @numbers @numbers parenright bar A b;
  sub 0 MultipleSubstitution_Ab;
  sub 7 Ligature2;
  context parenleft @numbers @numbers parenright bar A c;
  sub 0 MultipleSubstitution_Ac;
  sub 7 Ligature3;
  context parenleft @numbers @numbers parenright bar B a;
  sub 0 MultipleSubstitution_Ba;
  sub 7 Ligature1;
  context parenleft @numbers @numbers parenright bar B b;
  sub 0 MultipleSubstitution_Bb;
  sub 7 Ligature2;
  context parenleft @numbers @numbers parenright bar B c;
  sub 0 MultipleSubstitution_Bc;
  sub 7 Ligature3;
  context parenleft @numbers @numbers parenright bar C a;
  sub 0 MultipleSubstitution_Ca;
  sub 7 Ligature1;
  context parenleft @numbers @numbers parenright bar C b;
  sub 0 MultipleSubstitution_Cb;
  sub 7 Ligature2;
  context parenleft @numbers @numbers parenright bar C c;
  sub 0 MultipleSubstitution_Cc;
  sub 7 Ligature3;
}

lookup MultipleSubstitution_Aa {
  sub parenleft -> bar A a parenleft;
}

lookup MultipleSubstitution_Ab {
  sub parenleft -> bar A b parenleft;
}

lookup MultipleSubstitution_Ac {
  sub parenleft -> bar A c parenleft;
}

lookup MultipleSubstitution_Ba {
  sub parenleft -> bar B a parenleft;
}

lookup MultipleSubstitution_Bb {
  sub parenleft -> bar B b parenleft;
}

lookup MultipleSubstitution_Bc {
  sub parenleft -> bar B c parenleft;
}

lookup MultipleSubstitution_Ca {
  sub parenleft -> bar C a parenleft;
}

lookup MultipleSubstitution_Cb {
  sub parenleft -> bar C b parenleft;
}

lookup MultipleSubstitution_Cc {
  sub parenleft -> bar C c parenleft;
}

lookup Ligature1 {
  sub bar @ABC a -> ".null";
}

lookup Ligature2 {
  sub bar @ABC b -> ".null";
}

lookup Ligature3 {
  sub bar @ABC c -> ".null";
}

lookup SingleAdjustment1 {
  pos bar <250 -2200 0 0>;
}

lookup ChainedContextPositioning1 {
  context (@abc) parenleft;
  sub 0 SingleAdjustment2;
}

lookup CursiveAttachment1 {
  cursive A entry -700 400;
  cursive B entry -700 400;
  cursive C entry -700 400;
  cursive bar exit 0 0;
}

lookup CursiveAttachment2 {
  cursive a entry -1300 0;
  cursive b entry -1300 0;
  cursive c entry -1300 0;
  cursive A exit 0 0;
  cursive B exit 0 0;
  cursive C exit 0 0;
}

lookup SingleAdjustment2 {
  pos parenleft <-3250 0 -3250 0>;
}
Sign In or Register to comment.