How to reposition character before sequence of letters?

Get help with FontCreator here. Please do not post feature requests or bug reports here.
Post Reply
Bmeister
Posts: 9
Joined: Sun Sep 02, 2018 1:24 am

How to reposition character before sequence of letters?

Post by Bmeister » Sun Sep 02, 2018 1:49 am

Hello,

I'm trying to have a character reposition itself prior to a followed sequence of characters (no matter now many).

eg: Assume I've created a mark to base pairing of |^
With this pairing, I would like to be able to type in any sequence of characters before and after the ^ eg ABC ^EFG
This would then be followed by entering | (for my purposes, the | must be entered after the G)
I would want the character | to reposition itself before the ^ (as in its mark to base pairing) so that the sequence above results as ABC|^EFG

So in essence, I need to type ABC^EFG|
But need the result to display ABC|^EFG

Could someone please tell me if and how I could achieve the above with Font Creator?

Your help is very much appreciated
Font Creator 11.5
Windows 7 Pro

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

Re: How to reposition character before sequence of letters?

Post by Erwin Denissen » Sun Sep 02, 2018 4:06 pm

It looks like something that isn't meant to happen, but if it can be done with OpenType layout feature code, then I'm sure it can be done with FontCreator.

Why would you like to reorder?
Erwin Denissen
High-Logic
Proven Font Technology

Bmeister
Posts: 9
Joined: Sun Sep 02, 2018 1:24 am

Re: How to reposition character before sequence of letters?

Post by Bmeister » Sun Sep 02, 2018 5:29 pm

Erwin Denissen wrote:
Sun Sep 02, 2018 4:06 pm
It looks like something that isn't meant to happen, but if it can be done with OpenType layout feature code, then I'm sure it can be done with FontCreator.

Why would you like to reorder?
Hi,

Thanks for your reply.

I'm trying to define a rule whereby, if a ^ appears within a sequence of text, then place the | next to it (as in its mark to base setting)...no matter what letters follow.
So, for example. If I were to type ABCEFG|, then the | remains where it is and the rule would not apply. However, if I were to type ABC^EFG|, then I would need a rule to reposition (kern?) the | next to the ^ so that it displays ABC^|EFG. This is needed because the program I'm working with requires that the | character be typed last. The program needs to think the | character is last in the typing sequence. Yet I need it to display as stated above.

How would one approach this in Font Creator? I know it needs to be done in the open type designer, and I'm guessing maybe chained context positioning has something to do with it, although I'm not sure how to use this feature properly. The manual doesn't explain much here.

Appreciate your feedback
Font Creator 11.5
Windows 7 Pro

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

Re: How to reposition character before sequence of letters?

Post by Erwin Denissen » Mon Sep 03, 2018 12:20 pm

Given that your software supports OpenType layout features, this might work:

Code: Select all

script latn {
  feature ContextualAlternates;
}

feature ContextualAlternates calt {
  lookup ChainingContextReposition;
}

lookup ChainingContextReposition {
  context (A B C) asciicircum E F G bar;
  sub 0 MultipleSubstitutionCopy;
  sub 5 SingleSubstitutionHide;
}

lookup MultipleSubstitutionCopy {
  sub asciicircum -> asciicircum bar;
}

lookup SingleSubstitutionHide {
  sub bar -> ".null";
}
Erwin Denissen
High-Logic
Proven Font Technology

Bmeister
Posts: 9
Joined: Sun Sep 02, 2018 1:24 am

Re: How to reposition character before sequence of letters?

Post by Bmeister » Mon Sep 03, 2018 3:49 pm

Erwin Denissen wrote:
Mon Sep 03, 2018 12:20 pm
Given that your software supports OpenType layout features, this might work:

Code: Select all

script latn {
  feature ContextualAlternates;
}

feature ContextualAlternates calt {
  lookup ChainingContextReposition;
}

lookup ChainingContextReposition {
  context (A B C) asciicircum E F G bar;
  sub 0 MultipleSubstitutionCopy;
  sub 5 SingleSubstitutionHide;
}

lookup MultipleSubstitutionCopy {
  sub asciicircum -> asciicircum bar;
}

lookup SingleSubstitutionHide {
  sub bar -> ".null";
}
Hello,

Thanks once again for your reply.

I don't quite understand what all this code means or where I need to put it. I thought the solution could be achieved with the graphical interface within Font Creator?
In any case, if I'm understanding what your code says to some extent, are you specifying a particular context of characters (i.e. ABCEFG)? I don't want to filter particular characters for this to work. Only to specify that whenever a ^ is among the sequence of any set of characters, that the | be positioned beside it.

I apologize if I didn't make this clear.

Thank you once again
Font Creator 11.5
Windows 7 Pro

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

Re: How to reposition character before sequence of letters?

Post by Erwin Denissen » Wed Sep 05, 2018 8:47 am

Here is some more complex code that should do it, but unfortunately it isn't working within the OpenType Designer preview.

It uses (the undocumented :oops: ) class0 which is a special class that contains all glyphs except the ones used within the context.

Code: Select all

script latn {
  feature ContextualAlternates;
}

feature ContextualAlternates calt {
  lookup ChainingContextReposition;
}

lookup ChainingContextReposition {
  context (A B C) asciicircum @class0 @class0 @class0 bar;
  sub 0 MultipleSubstitutionCopy;
  sub 5 SingleSubstitutionHide;
}

lookup MultipleSubstitutionCopy {
  sub asciicircum -> asciicircum bar;
}

lookup SingleSubstitutionHide {
  sub bar -> ".null";
}
So here class0 is all glyphs except asciicircum and bar. So
^EF|| won't work, but ^EFQ| will work.

You can use the Code Editor button at the bottom of the OpenType Designer to use this code. It will then be shown visually, it is just an easy way to exchange OpenType layout feature code.
class0.png
class0.png (52.37 KiB) Viewed 878 times
Erwin Denissen
High-Logic
Proven Font Technology

Bmeister
Posts: 9
Joined: Sun Sep 02, 2018 1:24 am

Re: How to reposition character before sequence of letters?

Post by Bmeister » Tue Sep 11, 2018 3:32 am

Thank you for all your help.
Although I tried entering your code, it didn't work somehow.

Strangely, I did succeed in getting what I needed through a simple multiple substitution (at least within Font Creator itself). Sadly though, my application doesn't recognize anything within a gsub table.
Can what I'm looking for be done with just the gpos method? Through chained context positioning? If so, what does this look in the designer window?

Again, thank you kindly!
Font Creator 11.5
Windows 7 Pro

Bmeister
Posts: 9
Joined: Sun Sep 02, 2018 1:24 am

Re: How to reposition character before sequence of letters?

Post by Bmeister » Mon Sep 24, 2018 10:37 pm

I believe I've found the solution to my problem through the use of chained context positioning and simply substituting single glyph adjustments.
However, while the exported font with these settings works well on Windows, it's not properly recognized on Mac.

Is there a program setting I need to check so that the Mac platform will recognize these subs properly?

Thank you kindly
Font Creator 11.5
Windows 7 Pro

Bmeister
Posts: 9
Joined: Sun Sep 02, 2018 1:24 am

Re: How to reposition character before sequence of letters?

Post by Bmeister » Tue Sep 25, 2018 2:14 am

Bmeister wrote:
Mon Sep 24, 2018 10:37 pm
I believe I've found the solution to my problem through the use of chained context positioning and simply substituting single glyph adjustments.
However, while the exported font with these settings works well on Windows, it's not properly recognized on Mac.

Is there a program setting I need to check so that the Mac platform will recognize these subs properly?

Thank you kindly
Problem solved.
For those who wish to know, I had set the contextual positioning with ss01 tags. These needed to be calt instead. These now work on both Windows and Mac.

Thank you all for reading.
Font Creator 11.5
Windows 7 Pro

Bmeister
Posts: 9
Joined: Sun Sep 02, 2018 1:24 am

Re: How to reposition character(s) in a sequence?

Post by Bmeister » Fri Dec 07, 2018 4:59 am

Hello again,

I've removed my previous post as I think I found a way of getting the results I'm after.
The attached image below is part of a script I'm testing.

I'm looking for a way to condense it. Particularly, I'm trying to reduce the number of multiple subs I have to address the letters following the bar, as I'll need to add several more letter combinations here (not just the three ABC caps abc smalls in my script). I tried combining classes, but the results were negative. Please take a look at the script below. I welcome your comments on whether, if and how, the code can be condensed.

Many thanks

Code: Select all

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>;
}
Attachments
BM test multiple sub.PNG
BM test multiple sub.PNG (8.4 KiB) Viewed 26 times
Font Creator 11.5
Windows 7 Pro

Post Reply