Adding OpenType features: Long GSUB Strings

I have just this morning noticed the recent updates to this thread and am interested to know that you are producing FontCreator 7 and the statement that “with that release FontCreator lets you add OpenType Layout Features.”.

As it happens I have been thinking about the way to try to get my ideas about localizable sentences implemented and I was thinking yesterday about whether a GSUB in a liga table would be able to handle a sequence of seven characters and substitute a glyph.

So, recognising that answering this question does not imply an opinion at all one way or the other about my research ideas, can you say please if having a sequence of seven characters in a GSUB is possible (in the sense that, say, an ffi ligature has three characters in a GSUB - unfortunately I do not know the correct parlance for what I am trying to express here) and with FontCreator 7 in particular and will programs like the Firefox browser and Serif PagePlus handle such a long sequence even if it is in the font?

I know that this might be an extreme use of a GSUB in a liga table, but if it is possible to do this it would be helpful for my research.

William Overington

25 April 2013

Try it and see if it works — let us know your results.

Longer strings must come before shorter ones:

f f i → ffi
will be processed before
f f - >

If the order is wrong, f f i will never get processed.

I tried it in FontCreator 7, and it worked in the Font Test window.

sub f a c s i m i l e → uni213B

FontCreator 7 is awesome!
Font Test Long GSUB.png

Thank you for trying a long GSUB string in FontCreator 7.

Excellent.

I wondered at first why there was a space between facsimil and e in the image.

Then I realized that if there had not been a space then it would have shown the FAX symbol!

So, I am thinking that, after the GSUB had been set up, in order to produce the diagram the text that was entered was

facsimil e → facsimile

and the software did the conversion automatically using the information in the GSUB table.

That is great.

Thank you.

William

Why don’t you give it a try:
http://www.high-logic.com/font-editor/fontcreator.html

I am trying to produce a glyph substitution, using FontCreator 7, evaluation version.

I have added glyphs for A through to Z and for a through to z to the font.

I noticed that the evaluation version allows only certain characters to be exported, so I am trying an experiment within those limits so as to try to produce a font so as to test if a substitution for a long GSUB string can be used satisfactorily in Serif PagePlus 5.

I thought that I would start with a string of 4 characters so as to make sure that I can first carry out the FontCreator 7 part of the process satisfactorily before thrying a longer string.

I have added a glyph for z to the fi ligature cell at uniF001.

I then used

Font
OpenType Layout Features

and added the following to the upper panel

sub t e s t → uniF001

I am trying to making it so that keying the word test will display a glyph for z instead,

Using the menu commands

Action
Compile

gives

[Error] (1,1): Syntax error: Unexpected keyword “sub”

When I tried to look in the documentation, I used, from the main menu bar,

Help
Contents and Index…
Contents
Editing Fonts
Format
OpenType Layout Features

I could only get a blank page headed OpenType Layout Features.

I am wondering if somewhere I need to include an indication that I am using the liga table or something like that.

William Overington

29 April 2013

Its not that simple, and as you discovered the help file is not complete yet. Please read the tutorial thread first, or look at the example scripts on my FontCreator Review page.

First you need to define the feature, then the lookup tables, then the substitutions. The syntax must be correct too:

script latn {
feature Ligatures;
}
feature Ligatures liga {
lookup ligaSub;
} lookup ligaSub {
sub t e s t → zero;
}

Even then, I am not sure uniF001 will be exported, so try with

sub t e s t → zero;

That compiles correctly.

The help files will be fixed by a maintenance release later today but this should get you started

script latn {
  feature Ligatures;
}

feature Ligatures liga {
  lookup LigaLookup;
}

lookup LigaLookup {
  sub t e s t -> fi;
}

Edit: Seems Bhikkhu Pesala beat me to it again :smiley:

Many thanks to both of you.

I tried the script by Bhikkhu Pesala and it compiled.

I then exported a font and opened it in fontviewer so as to install it temporarily and then tried it in Serif PagePlus X5 (which is not the latest version).

I cannot get the ligature substitution to work at the present time.

Does the evaluation version export the OpenType feature, or have I not used the font correctly in Serif PagePlus X5?

William

it will only work when mapped to the fi or fl substitutes in the trial version. Also, some applications require you to explicitly enable certain features for a selected piece of text.

If you are on Windows Vista or 7, you can also use the font test dialog (F5) to test your ligature.

Thank you for your reply.

I note that your script mentions fi whereas the postscript name in use in the font is uniF001.

The OpenType rule will not compile as it stands.

I am trying to change the postscript name of the glyph but it does not seem to be by the same method as in FontCreator 5.6 and I cannot find how to change the postscript name from uniF001 to become fi.

I am using Windows xp.

William

You can edit the name in the Glyph Properties Toolwindow (F3). Don’t forget to click the apply button after entering the new name.

Thank you.

I changed the glyph name to fi, and the OpenType rule then compiled alright.

I exported the font and then opened the font in fontviewer and then I started PagePlus X5.

Well it still did not work in PagePlus X5, though PagePlus X5 was listing the glyph as in liga.

So, on a hunch, I keyed fi and a z glyph was displayed.

William

There appears to be an override in PagePlus X5 so as to give an fi and an ffi ligature automatically, even from a TrueType font. I have just found that, when ligatures are turned on, PagePlus X5 substitues glyphs for fi and ffi when I am using my Sonnet to a Renaissance Lady font that is a TrueType font that I have not altered for some time.

When I tried Quest Text, which is a TrueType font and has ligature glyphs that are designed to show that they are ligature glyphs by having a joining line in them, I found that ff fi fl ffi ffl are all supported in that way, though st is not. So it appears that PagePlus X5 has an internal override to give some liga facilities even if the font is TrueType, as long as the font has the glyphs in the right places!

That is good in general, but it appears that I cannot carry out the test in PagePlus X5, unless deep within the options is some way to turn the override off and use the rules that are in the font.

William

Its not very deep — just look at the Format, Character dialogue.
OpenType Features.png

I am reminded of the saying that was used as a subtitle to a work by Chaucer, perhaps not by him but by a scribe, of “Bread and milk for children”.

So, having found that page before and tried various combinations, though perhaps not all of the combinations that are possible, could you possibly say what exactly I would need to do please?

William

I think Bhikkhu Pesala wants you to set the check boxes which are marked “yellow”.

I think you’re right, but ‘Format > Character… > Font > Ligatures’ in PPX5 apparently only enables standard ligatures (liga), not discretionary ligatures (dlig), so although ff, fi, fl, ffi and ffl are all substituted, ct and st are not. For more options, we need to choose '‘Format > Character… > OpenType > Details’ and use the checkboxes there.
PPX5_OpenType_dlig.png

Since the previous posts in this thread I have now purchased a licence for FontCreator 7 professional edition and I am updated to version 7.0.0 (build 368).

I have gained a little experience of making OpenType fonts and I have gained experience of using Serif PagePlus X5 (which is not the latest version) to try the fonts in an application. Much of it from the great fun of the thread of last Monday, 20 May 2013.

http://forum.high-logic.com:9080/t/open-type-question/3825/1

Earlier today I made a font Ligatures 004, which worked well on some ligatures but not on the longer extreme examples that I was trying for my research on communication through the language barrier.

So I made a copy of the project file as Ligatures 004a and added some extra lines so as to test what is happening.

Here is the font.
Ligatures 004.otf (21.4 KB)
Here is the OpenType code copied from the project file.

script latn {
  feature Ligatures;
}

feature Ligatures liga {
  lookup LigaLookup;
}

lookup LigaLookup {
  sub f f i -> ffi;
  sub f f l -> ffl;
  sub f f -> ff;
  sub f i -> fi;
  sub f l -> fl;
  sub longs t -> longst;
  sub s t -> st;
  sub c t -> c_t;
  sub f j -> f_j;
  sub d a -> d_a;
  sub colon colon 3 4 5 6 7 8 9 -> big9;
  sub colon colon 3 4 5 6 7 8 -> big8;
  sub colon colon 3 4 5 6 7 -> big7;
  sub colon colon 3 4 5 6 -> big6;
  sub colon colon 3 4 5 -> big5;
  sub colon colon 3 4 -> big4;
  sub colon colon 3 -> big3;
  sub colon colon 1 0 0 1 6 colon semicolon -> ls10016;
  sub colon colon 1 0 0 1 7 colon semicolon -> ls10017;
  sub colon colon -> lsmbob;
  sub colon semicolon -> lsmbcb;
}

I am wondering just how long a substitution the font will store and how long a substitution PagePlus X5 will accept.

I am still learning so I accept that I may not have got it all correct.

I managed to get the sub colon colon → lsmbob; substitution to work in PagePlus X5 and the sub colon colon 3 → big3; seems to have been recognized in some way as, although the big3 glyph did not become displayed on the screen in PagePlus X5 at first, when I was deleting something it suddenly became displayed and I do not know how!

I wonder if readers could test the font with whatever OpenType-aware applications they have please.

I appreciate that I am pushing the envelope on this, and I may need to just abandon the idea, but perhaps trying to understand what is happening might be of benefit to learning more about OpenType generally.

William Overington

22 May 2013

I’m not sure the above script compiles without errors, but still fails to work.

For now use the actual glyph names like:
sub colon colon three four five → big5;

I just realized the numbers are glyph indexes… It is always best to use glyph names.