Ligatures - two simple questions

Get help with FontCreator here. Please do not post feature requests or bug reports here.
Bageder
Posts: 17
Joined: Mon Apr 15, 2024 7:00 pm

Re: Ligatures - two simple questions

Post by Bageder »

I think I'm understanding better, but I think what I am trying to do cannot be achieved in any simple way.

This is what I'm trying to do...

Given classes:

@joinright = [a c-e h i k-n u z];
@joinleft = [e f i j m-p r-y];
@caltclass = [a.calt c.calt d.calt e.calt h.calt i.calt k.calt l.calt m.calt n.calt u.calt z.calt];

every time a glyph from @joinright is followed by a glyph from @joinleft, the "joinright" glyph is replaced by the corresponding glyph from @caltclass.

In a sort of pseudocode, it would look something like:

for each char as glyph in @joinright {
sub {char @joinleft.*} by {@caltclass.char @joinleft.*}
}

That would deal with the 192 (=12*16) glyph pairs.

=====

So, if that doesn't exist, I'm thinking of listing all 192 pairs as ligatures, and I see two possible ways of doing it.

Firstly, simply using the glyphs from @caltclass linked to glyphs from @leftjoin, and ...

alternatively, by abandoning @caltclass and defining a new glyph called join, that represents the actual join. Then, perhaps, I could make 192 three-glyph ligatures of the form "a join c", "a join d" etc.

Please can you give me some advice, as I don't want to launch myself into this mammoth task only to find it's no good.

Regards
Bageder
Bageder
Posts: 17
Joined: Mon Apr 15, 2024 7:00 pm

Re: Ligatures - two simple questions

Post by Bageder »

I'm pleased to report that I have made some progress over the weekend by firing questions at an AI system. The following code works, but there is much more to do:

@lowdiagright = [a c-e h i k-n u z];
@lowdiagleft = [e f i j m-p r-y];

lookup SingleSubstitution1 { # GSUB lookup type SingleSubstitution
sub a by a.calt;
sub c by c.calt;
sub d by d.calt;
sub e by e.calt;
sub h by h.calt;
sub i by i.calt;
sub k by k.calt;
sub l by l.calt;
sub m by m.calt;
sub n by n.calt;
sub u by u.calt;
sub z by z.calt;
} SingleSubstitution1;

#
# Feature definitions
#

feature calt { # Contextual Alternates
sub @lowdiagright' lookup SingleSubstitution1 @lowdiagleft;
} calt;

Regards
Bageder
Erwin Denissen
Moderator
Moderator
Posts: 11200
Joined: Fri Oct 04, 2002 12:41 am
Location: Bilthoven, The Netherlands
Contact:

Re: Ligatures - two simple questions

Post by Erwin Denissen »

Great to know you have made progress!

Nothing to add right now, but let us know if you need more help from us.
Erwin Denissen
High-Logic
Proven Font Technology
Bageder
Posts: 17
Joined: Mon Apr 15, 2024 7:00 pm

Re: Ligatures - two simple questions

Post by Bageder »

I feel very happy at the moment. Thanks for your help.
Bageder
Posts: 17
Joined: Mon Apr 15, 2024 7:00 pm

Re: Ligatures - two simple questions

Post by Bageder »

I've got a problem with a huge number of glyph pairs (including contextual alternatives) that need to be spaced properly.
I have several classes of contextual alternatives working, except for spacing. These alternatives are wider than the glyphs they replace, but should take up the same amount of space. They overlap into the space of the following glyph.

For example, when a is followed by b, there is no join, but when a is followed by c, a is replaced by a.calt.
a.calt joins to c by an "extension" added to a. (See attached)

Because there are hundreds of these pairs, I'm looking for a swifter method of adjusting the space between...

What I want to try
is to place a "joining glyph" of a consistent shape between glyphs of one class and glyphs of another. Is that possible in FontCreator 15 Professional?
Attachments
ab-ac.jpg
ab-ac.jpg (14.21 KiB) Viewed 292 times
Erwin Denissen
Moderator
Moderator
Posts: 11200
Joined: Fri Oct 04, 2002 12:41 am
Location: Bilthoven, The Netherlands
Contact:

Re: Ligatures - two simple questions

Post by Erwin Denissen »

Yes, that is possible.

Here is some feature code that should get you started:

Code: Select all

lookup MultipleSubstitution1 { # GSUB lookup type MultipleSubstitution
    sub A by A horizontalbar;
} MultipleSubstitution1;

feature calt { # Contextual Alternates
    sub A' lookup MultipleSubstitution1 C;
} calt;
It adds a horizontalbar between A and C.
Erwin Denissen
High-Logic
Proven Font Technology
Bageder
Posts: 17
Joined: Mon Apr 15, 2024 7:00 pm

Re: Ligatures - two simple questions

Post by Bageder »

Thank you.
I'll give it a try.
Bageder
Posts: 17
Joined: Mon Apr 15, 2024 7:00 pm

Re: Ligatures - two simple questions

Post by Bageder »

This is good news. It will save me a lot of time and effort.
I tested it with whole classes instead of single characters, and it worked.
Here's the code, in case someone else finds it useful...

@horiz_right = [o r v w t];
@horiz_left = [a c f g i j m-s u-y];

lookup MultipleSubstitution1 { # GSUB lookup type MultipleSubstitution
sub @horiz_right by @horiz_right ringcomb; # used ringcomb in this quick test
} MultipleSubstitution1;

feature calt { # Contextual Alternates
sub @horiz_right' lookup MultipleSubstitution1 @horiz_left;
} calt;
Erwin Denissen
Moderator
Moderator
Posts: 11200
Joined: Fri Oct 04, 2002 12:41 am
Location: Bilthoven, The Netherlands
Contact:

Re: Ligatures - two simple questions

Post by Erwin Denissen »

Yes, glyph classes are very useful this way.
Erwin Denissen
High-Logic
Proven Font Technology
Post Reply