programming ligatures

Primary tabs

17 posts / 0 new
Last post
matt yow's picture
Offline
Joined: 8 Mar 2010 - 9:35pm
programming ligatures
0

Hi all,
First off, I have zero experience with coding and syntax for proper output.

I have just finished a typeface with the usual ligatures (fl, fi, ffl, ffi, even st & ct) and I want to make the ligatures automatic instead of being forced to navigate to the glyphs palette and manually apply ligatures.

I know the answer is in Robofab or Python but I do not have any experience with them and can't find a decent walk-through in the context of type design, specifically ligatures (since Python does all sorts of applications, type design being one).

Is there not a standard snippet of code that applies to all typefaces that automates the ligatures? "when U+0066 & U+0066 appear consecutively with U+FB00"?
I presume not.

Also, I use Fontographer 5.

Thanks in advance.

Nick Curtis's picture
Offline
Joined: 21 Apr 2005 - 8:16am
0

In a simple text editor, declare the liga feature in aalt:

feature aalt{
feature liga;
} aalt;

Then program the ligatures thus:

feature liga {
# Latin
sub f i by fi;
sub f l by fl;
sub X X by XX;
etc.
} liga;

Then, SAVE AS your_file_name.fea. In FOG5, navigate to Element > Font Info > Encoding, then select the radio button for an external feature file, and browse for and select your feature file.

Blank's picture
Offline
Joined: 25 Sep 2006 - 2:15pm
0

I know the answer is in Robofab or Python…

Nick’s answer is correct, but just to elaborate, character substitution is done with OpenType features. Robofab and Python are used to automate font design tasks; they don’t actually introduce any code into a font.

Adam Twardoch's picture
Offline
Joined: 3 Dec 2002 - 7:36pm
0

Also, I'll mention that recommended glyph names for ligatures are "f_l", "f_i", "f_f", "s_t", "f_adieresis" etc.

So your code would look like

feature liga {
# Latin
sub f i by f_i;
sub f l by f_l;
sub f f by f_f;
sub s t by s_t;
# etc.
} liga;

(after "sub" you type in sequences of glyph names that should be replaced, after "by" you type in the glyph name that is inserted).

A.

Blank's picture
Offline
Joined: 25 Sep 2006 - 2:15pm
0

Adam, can Freefont pro be opened in Fog?

Adam Twardoch's picture
Offline
Joined: 3 Dec 2002 - 7:36pm
0

Dunwich/James,

it's VFB, so it can — but since FOG doesn't have any UI for displaying the font features, the code won't be visible/accessible.

I do recommend installing the demo version of FontLab Studio along Fontographer 5. The demo version of FL Studio is free, and serves as an excellent in-depth font viewer. If you open an OpenType font in the FontLab Studio demo, you can export the font feature definitions from the OpenType panel into a .fea text file, edit it in a text editor and then use it in FOG 5 when generating the font.

FontLab Studio 5 can only export font feature definitions in the older AFDKO 1.6 syntax. If you want to export font feature definitions including things like mark attachment, ie. in the AFDKO 2.5 syntax, you need to use a different tool, such as DTL OTMaster, which is also available from fontlab.com.

Best,
Adam

matt yow's picture
Offline
Joined: 8 Mar 2010 - 9:35pm
0

I knew the answer would be as simple as this.
Let me apply this text and see what my output is, etc and get back with more questions.

Thanks so much all

matt yow's picture
Offline
Joined: 8 Mar 2010 - 9:35pm
0

ok, a basic problem I'm running into now. I have TextEdit, Adobe Reader & MSWord and none of them Save As... .fea
What program or application can save a file as such?

Riccardo Sartori's picture
Joined: 13 Jul 2009 - 4:20am
0

What program or application can save a file as [.fea]?

Use TextEdit, save as text, then change the extension from .txt to .fea in the name of the file.

Reynir Heiðberg Stefánsson's picture
Joined: 19 Nov 2010 - 11:15am
0

On a Windows system, you will likely have to set the directory display to show file endings. M$Vim defaults to hiding them.

Adam Twardoch's picture
Offline
Joined: 3 Dec 2002 - 7:36pm
0

Matt,

in TextEdit, you need to choose Format / Make Plain Text before saving.

Theunis de Jong's picture
Offline
Joined: 22 Apr 2008 - 5:06pm
0

Té, "TextEdit" is a dead giveaway :-)

Matt, when using TextEdit, make sure to select menu "Format", then choose "Make Plain Text". Otherwise, you'll be looking in vain for the "Save as plain text" option ... (You'll get to choose what character encoding you want to use, but I'm guessing the default "UTF-8" is just fine for the plain text file that a .fea is.)

matt yow's picture
Offline
Joined: 8 Mar 2010 - 9:35pm
0

thanks riccard0,
I saved it as a .fea, then applied to the encoding section.

my text is exactly:

feature aalt{
feature liga;
} aalt;

feature liga {
# Latin

sub f i by f_i;
sub f l by f_l;
sub f f l by f_f_l;
sub f f i by f_f_i;
sub s t by s_t;

# etc.

} liga;

and upon trying to Generate Font File,
"cannon generate open type file due to an error in feature definition file."
are the underscores necessary or will spaces clear the issue? (sub f i by fi;)

I'll try copy/pasting the code from an established typeface with the ligature features until I know more.

santiago orozco's picture
Offline
Joined: 12 Jul 2009 - 12:47pm
0
Nick Curtis's picture
Offline
Joined: 21 Apr 2005 - 8:16am
0

#etc. should NOT be in your code: it was included in the examples only to show that the same format should be followed for any other ligatures you wished to include. The glyphnames for the ligatures should be EXACTLY the same as those entered in your feature file.

Charles Ellertson's picture
Joined: 3 Nov 2004 - 11:00am
0

The glyphnames for the ligatures should be EXACTLY the same as those entered in your feature file.

Exactly. So, if your glyph in the font is named fi, it will have to be so named in the feature file.

Better to change the name to f_i in the font -- and of course, use f_i in the feature file (as Adam suggested). The "fi" glyph hangs around in some fonts, and is in Unicode, to accommodate legacy issues. Sort of like corsets . . .

Reynir Heiðberg Stefánsson's picture
Joined: 19 Nov 2010 - 11:15am
0

@theunis - I suspected a Windows box when I saw MSWord in the list, but TextEdit could just as well be a Mac program, as far as I'm concerned. Now, Notepad or Wordpad...

Aside: I generally use only two editors: mewin (though it's not eight-bit clean) and mcedit. Meaning? Count me out of any editor jihad.