Creating OpenType Fonts: simplified
Short Description
In Fontographer and FontLab, you can make OpenType fonts with hundreds of additional characters. The process is confusin...
Description
t t b y s
g
Creating OpenType Fonts SIMPLIFIED
b y
David Bergsland Mankato, Minnesota
Scribd Version © David Bergsland, November 2011 All rights reserved. Copy may be used with a clear attribution to:
The Skilled Workman: http://bergsland.org or David Bergsland: http://bergsland.org
Contents
OpenType Simplified ........................................................................................................................
1
No way to edit that feature file in Fontographer 1 No easy way to add the characters in FOG 1 Here’s the real problem
2
OpenType is for the Creative Suite 3 The fun part of the new OpenType capabilities 3 There are two different areas of a feature file 4
What is an OpenType feature? 4 Feature names
4
How a feature works
5
A discretionary ligature feature
6
Writing an OpenType feature
8
Writing classes
8
Make a copy and Find & Replace
9
Adding OpenType numbers 10 The feature tags used
10
Using classes
12
Adding ligatures
13
Saving your feature sets
15
Adding features to our new font 16 For FontLab 5
16
Forr Fontographer Fo Fontographer 5.1 & FontLab: free templates 17 Doing it all in Fontographer 5.1
18
Acknowledgments I produced this little booklet in response to a request made by Andrew Meit—who was a great encouragement while I was writing the Fontographer: Practical Font Design for Graphic Designers book. He’s been helping with Fontographer Fontographer [originally [orig inally at Altsys] since the first version, I believe. His enthusiasm was very helpful as I started this book and throughout its production and release.
OpenType Simplified In two words, it’s confusing. FontLab has good, professional tools for developing OpenType OpenType fonts but difficult and confusing implementation. Fontographer really does not deal well with OpenType OpenT ype at all. Having said that, if you have have a feature file, you can use it in Fontographer 5.1. You link to it in the font info in fo dialog box on the Encoding page. Fontographer will use that feature file to build your OpenType font when you generate it.
No way to edit ed it that feature file in Fontographer Fontographer does not provide any way to edit the file. You must have one already written and use it. There is no interface within Fontographer to do that. However, it is raw text so you can do your feature file fi le in TextEdit, TextEdit, NotePad, No tePad, whatever app you have to edit text only files, or do it in FontLab. The main thing is that you need to save it with the .fea extension instead of the default .txt extension. Yes, this is writing code and
it is a pain.
No easy way to add the characters in FOG As you will see, we will be adding several hundred characters to make even a modest OpenType font. Fontographer has two problems here. First, there is no interface to control where characters are added. It is very important that glyphs are added in a consistent order for substitution lists like small caps and so on. If you miss one, the font will just not work. work. We We should be able to compile our feature file and have the new glyphs added automatically. We’ll talk about that more at the end of this booklet. booklet. Secondly, unless there is a Unicode listing for your new character, Fontographer will show it as ** in the Font Window because there is no way to View By Name. You need to bug FontLab on the forums to add View By Name in the Font
1
It is really a big deal when we start working with 2 Window. OpenType and all the glyphs which are considered variants of the original characters.
Here’s the real problem
I still remember the first time I took a look at a feature file. It was overwhelming. At that time, Adobe fonts were the only OpenType OpenType fonts to which I had access. As I recall I opened Jenson first and about fell on the floor. I was in FontLab, so it was a little easier as it has a panel that lists the features on top in a separate window from the classes. But if you open a
Click here for the View by Name feature request.
feature file in your text editor, it will probably look quite a bit like what you see to the left. It’s not nearly as bad as it looks!
OpenType is for the Creative Suite It also works to some degree in Apple’s publishing suite, like Pages and Keynote. In addition, it is beginning to work on the Web. Web. I took a brief overview course online a few weeks ago from Thomas Phinney showing how FireFox FireFox 4+ supported suppor ted OpenType. It will be showing up in more and more places as people become more sophisticated typographically and its advantages become obvious to the masses..
The fun part of the new OpenType capabilities Here’s my version of a disclaimer. Here’s disclaimer. Adding OpenType features is very easy in some ways and very difficult in others. For me, there is the fact that I have a fairly severe coding challenge. It’s not that I can’t do it if I have to. The problem is that coding is so boring I make stupid mistakes and the documentation for coding is so boring I have great difficulty reading read ing it and the font simply will not work work if there is a single typo in the file. So, this will not be an exercise in coding efficiently. I will give you some basics and I will provide several features files, with which you can start as you begin adding features. I have three free templates posted on the Fontographer page of the Hackberry Font Foundry’s Foundry’s Website Website and three more on an OpenT OpenType ype page linked to the Fontographer page. My hope is that Fontographer will make this all easy one day. But until that happens I will just bumble along trying to make features files that work. The good news? Once you have a file, you can use it regularly
Your feature file and feature set will just naturally grow as you add features to your OpenType fonts. Virtually every font
3
4
works better if it has oldstyle figures, for example. example. Small caps is also a real need. Add other features as needed.
There are two different areas of a feature file ❦
Classes: these are lists of characters which are swapped for other lists. For For example, I have a class listing Proportional Lining numbers. I have have an identical list with the same characters and the same order of listing plus a .oldstyle extension extension for my oldstyle figures. I have an identical list with the same characters and the same order of listing plus a .lining extension for my tabular linin g figures. I have an identical list with the same characters and the same order of listing plus a .sc extension extension for my small cap figures. The wall of characters seen on page two are a list of classes classes.. More on that in a bit.
Features: These have a rigid coding style which tells the software to substitute one class for another or letter combinations for a ligature, or a regular letter for an ending form, and so on. We’ll start with features, but you should know that they are listed after the classes in your text file with the .fea extension. ❦
What is an OpenType feature? At its simplest, it is a substitution list. It basically tells your software that when this feature is activated all the glyphs in the first side are to be swapped out with all the characters in the second group. The simplest, in concept, is the swap from lining figures to oldstyle figures—or capital numbers to lowercasee numbers. But we have to develop classes to do that. lowercas So, let’s begin with a standalone feature.
Feature names There is a huge list somewhere on Wikipedia, but it does not show you how to write OpenT OpenType ype features. The list is found here: http://en.wikipedia.org/wiki/OpenType_feature_tag_list
Obviously, this is not of much help. However Obviously, However,, Adobe has complete instructions on their developer Website Website which could be found here when I was writing this chapter. chapter. I just Googled Goog led OpenType Feature grammar and this page came up as the first link. It is a huge page that will give you all the rules, whys, whys, and wherefore wherefores: s: http://www.adobe.com/devnet/opentype/ afdko/topic_feature_file_syntax.html#1
As always, I started reading through the instructions. I’m not a stupid man, but within within a couple of entries they were were making statements that that included a huge set of assumptions— basically the assumption that you were a professional programmer and that that all all of this stuff stuff is part part of some type type of langua language ge you speak fluently. I don’t. So, very quickly, I came to things that could not be figured out without a lot of research. After the research I find out that I would never use that feature anyway. There is a lot of good and necessary information here, here, but it is not easy to simply read and add to your repertoire. You can make all of this very complex, and there is a lot of control. You You can deal with different languages. For For languages like Arabic, for example, you you can set up the different dif ferent forms used if a letter is in the beginning, middle, middle, or end of a word. You You can set up diacritical marks for Eastern European languages, and much more.
5
6
How a feature works A feature description feature {¶ has a specific structure, # lookups go here¶ which you can see to sub by ¶ the left—stripped to the } ;¶ bare essentials.
Essential code feature Because I am defining a feature, the code starts with the word feature. feature Then the four letter name of the feature (without the angle brackets)
{ The left brace begins the listing listing of the lookups # A number sign indicates the start of a comment which continues until the next paragraph return. Comments do not affect the feature feature.. sub The acceptable abbreviation for substitute. This normally has spaces to the left but they are not required typ ed or a class. by is the characters typed is the character or class that is substituted.
} The right brace ends the lookups Then the four letter name of the feature feature (without the angle brackets) finishes the feature As you can see, the structure is very simple. The complexity only comes from the sheer amount of things that must be looked up and substituted. Next I’ll show you a portion of the dlig feature I use. In its entirety, I commonly have twenty lookups or more.
I’ll talk more about how to set up a feature like this in a few pages. For For now just look at the construction of the feature conceptually.
A discretionary ligature feature feature On the next page you see a feature (actually (actually part of one) that I used in my OpenType feature set for 2010. I make a new one every year adding features and classes as I go to make it as comprehensive as I think it needs to be. Lately I’ve been pulling back a bit unless it is a font I will be using personally. Then I really like a lot of ligatures. feature dlig: The dlig tag tells your software feature dlig {¶ that this font has the Discretionary Ligatures # Discretionary Ligatures¶ feature. It is followed by a braceleft characsub s t y by s _ t _ y;¶ ter that opens the definition block that this sub c h by by c _ h;¶ feature will use. sub c k by by c _ k;¶ # Discretionary Ligatures: The numbersub c t by by c _ t;¶ sign character tells the software that the rest sub g g by by g _ g;¶ of the line is just a comment. comment. Adding a numnumsub b b by by b _ b;¶ bersign always means that the rest of the line sub t t by by t _ t;¶ has nothing to do with the feature. It is just sub s p by by s _ p;¶ a comment to help you figure out what the sub s t by by s _ t;¶ feature is doing. sub s h by by s _ h;¶ sub c h by c_h; : in the definition block the } dlig;¶ sub keyword tells the software to substitute the characters before the by with the characters after the by. In the dlig feature above, I have have shown you nine substitusub stitutions. In the feature I actually used for 2010 I had 22 substitutions. I really like discretionary ligatures so I continue to add them to my standard list. The problem is that very few have Unicode numbers. Only ff, , , f, f, ft, & st are included in the ofcial ligature list—the ampersand, æ and œ are also listed there.
7
8
Naming the ligatures
As you can see, the ones in the Unicode list have no spaces or special characters. chara cters. I’ve seen some people say that you must have have an _ (underscore) between the parts of the ligature as in f_f_j, but ffj seems to work fine. Because they are not part of Unicode it really does not matter on a practical level. (However, (However, on typophile I saw a posting that Acrobat requires the underscores between all letters letters of a ligature for some reason reason in some sort of printing situation. So—I So—I guess I better recommend the underscore for ligatures ligatures if you are going to sell your fonts;-) fonts;-) Let me know if you need this and I’ll modify the free templates. templates.
This is code so typos break the function There is no doubt that this is tedious stuff. In addition, unless you like code your results will be limited. Over the years I have added many features. I think I have gotten to the place where I can do this stuff without too many bugs. bugs. But for me, this is always Neverland—a strange place where I am not sure enough of the rules to predict the outcome. However,, if you are careful and build slowly, However slowly, you can develop a very good feature set for your OpenType OpenType fonts. The good news is that the Fontographer manual has good documentation for building OpenType feature files.
Writing an OpenType feature This is straight forward, but again it needs to be perfect. I am only going to show you features that work in the so-called Latin group—which as far as I know includes all of the European languages based on Latin. As I look at features for sophisticated fonts I find many entries for Cyrillic (think Russian), Greek, Turkish, and so on. I do not speak those languages.. If I ever had a request for a feature guages feature like this I would hire someone to do it. My features are characterized by several personal aspects. First of all, I try to make things in English as much much as possible. possible.
Feature sets written by programmers are commonly filled with classes that are mere numbers and very difficult to figure out (open an Adobe font and check out its features).
Writing classes A class enables you to substitute substitute a very large set of characters with another very large set. Classes are a method of applying a feature to a long list of characters. You You make a class by starting the paragraph with the at (@) glyph followed by up to 30 characters with no spaces. The name cannot start with a period or a number number.. Then you type a space equal space bracketleft and then list all the glyphs you want to use in that class. You You can use letters, numbers, period, and underscore— nothing else. You You finish the th e class description with a bracketright semicolon. Here’s an example:
@normalnumbers = [slash zero one two three four five six seven eight nine comma period parenleft parenright dollar numbersign cent yen sterling Euro];¶ The characters are written with the name shown when the character is selected in the Font Font Window. Window. If you do not have Names showing, add them by clicking on the little littl e plus (+) with a circle around it in the t he top bar of the Font Font Window. Window. That’s why we use five five instead of 5, for example. These names must be spelled exactly—and they are case-sensitive I strongly suggest that you name the class something somethi ng that makes easy and obvious sense so you remember what it is next year or the year after that.
Class warnings: Boy that sounds bigoted, doesn’t it? Make sure that class substitutions have exactly the same number of glyphs in each, in the same order with no extra or missing spaces. For example, in the lowercase class is the
9
10
agrave glyph and the agrave.sc glyph is in the lowercasesmcaps class. Tedious does not begin to describe the writing needed.
Make a copy and Find & Replace The easiest way to make a new class (which is a modification of the original class) is to find and replace the new extensions for all the characters in the class. That way everything stays in the same order and you you do not miss any of the glyphs. Just J ust search for space and replace with extension space. If you already have an extension, search for dot extension and replace with the new dot extension. I find that I need four versions of my numbers classes: ❦
@normalnumbers: These are the 8-bit numbers plus the parentheses, period, comma, & the currency cur rency characters.
❦
@liningnumbers: This is a copy of normalnumbers with .lining after every glyph.
❦
@oldstylenumbers: This is a copy of normalnumbers with .oldstyle after every glyph.
❦
@smcapnumbers: This is a copy of normalnumbers with .sc after every glyph.
Adding OpenType numbers As I have already mentioned in passing, OpenType offers four numbering choices in the Creative Suite. Suite. ❦
Proportional Oldstyle: This is what Proportional we would call lowercase numbers.
❦
Proportional Lining: These are the uppercase Proportional numbers, with proportional widths.
❦
Tabular Oldstyle: These would be lowercase figures with the same width.
❦
Tabular Lining: These are capital figures with the same width. [I haven‘t haven‘t added these to any of the free templates yet. Let me know if you need them.]
Small cap figures are just part of the small caps feature
These are not common at all yet, but they should be. Both oldstyle and lining figures look terrible with small cap copy. You need to do this. ❦
Small caps figures: These are numbers to use with small caps.
The feature tags used I usually put the default choice first. I used to have trouble with the order o rder,, but now they seem to t o work no matter what. wh at. Proportional Lining: The feature tag for this is pnum— These are usually the “normal” numbers. For this I use the class @normalnumbers. However, there are many fonts which have numbers that are all the same width by default.(what we would call lining numbers). feature pnum {¶ # proportional lining figures¶ sub @oldstylenumbers by @normalnumbers;¶ sub @liningnumbers by @normalnumbers;¶ } pnu m; m;¶ ¶
Oldstyle figures (Proportional Oldstyle): The feature tag for this is onum—I use the class @oldstylenumbers @oldstylenumber s for this. But I have to include all possibilities. So, I include a substitution for both normal nor mal numbers and lining numbers. You You need to cover all bases carefully. feature onum {¶ # proportional prop ortional oldstyle oldstyle figures¶ figur es¶ sub @normalnumbers by @oldstylenumbers;¶ sub @liningnumbers by @oldstylenumbers;¶ } onum; onu m;¶ ¶
11
12
Tabular Lining: The feature tag for this is tnum—I use the class @liningnumbers for this. feature tnum {¶ # tabular ta bular lining figures¶ sub @normalnumb @normalnu mbers ers by @liningnum @liningnum bers bers; ;¶ sub @oldstylenumbers by @liningnumbers;¶ } tnum;¶
Tabular Oldstyle: What kind of abomination is this? I don’t don’t use it. The small cap figures: These are added as part of the smcp and c2sc features covered briefly next. On the next page you can see that feature. This one works really well—you simply must kern it cleanly. I also have a class called @lowercase which includes a-z, æ, œ, ø, Ð, Lslash, Þ and all the accented lowercase glyphs. (I include the Eth, Lslash, and Thorn characters because I’ll I’ ll need small cap versions of them for the small cap lowercase.) I have have a copy of @lowercase named @lowercasesmcaps with the .sc extension after all the characters. characters. If we take these classes and use them in a small caps feature, it looks like this: The small caps feature
feature smcp { # Small Capitals ¶ sub @normalnumbers @normalnum bers by @smcapnum @smcapnumbers bers; ;¶ sub @oldstylenumbers by @smcapnumbers; ¶ sub @liningnumbers @liningnum bers by @smcapnumbers @smcapnumb ers; ;¶ sub @l @lowercase owercase by @lowercasesmcaps; @lowercasesmcaps; ¶ } smcp;¶ In this example above, you can see that I have four substitutions going on. One that substitutes normal numbers (caps) with small cap numbers, another that substitutes oldstyle numbers (lowercase) with small cap numbers. Another one that substitutes lining numbers with small cap numbers. And yet
another that substitutes a class of lower lowercase case letters with a small cap version of that class. You You need to cover all the bases carefully, and test it to see that it works. The All Small Caps feature
Here we have the OpenType All Small Caps choice in Case for paragraph or character styles. The feature tag for this one is c2sc and requires a caps version of the lowercase class. class. So you must add an additional lookup.
sub @caps by @lowercasesmcaps;¶ @caps has all the same glyphs in the same order as @lowercase, @lower case, but it uses the uppercase letters.
Adding lig ligatures atures I know I’ve already shown you a smaller dlig feature as our first example of code. But I wanted to talk talk about ligatures a bit more. The first thing about ligatures is to separate in your mind “normal” ligatures and discretionary ligatures. The fact of the matter is that ligatures are not accepted by by the general public (i.e. your clients and readers) when used in body copy. However, they can be a great addition to a display font. Normal ligatures are fi, fl, ffi, and ffl. ff l. I would also include fj, and ffj. Plus Æ, æ, Œ, and œ began as ligatures in Latin but have developed into individual letters in various languages. So, they are not listed in the liga feature set. So, basically we are dealing with two features: liga and dlig.. The liga feature is straight forward and prescribed. dlig feature liga {¶ # Standard Ligatures ¶ sub f f i by f _ f _ i;¶ sub f f l by f _ f _ l;¶ sub f f j by f _ f _ j;¶ sub f f by f _ f;¶ sub f i by fi;¶ sub f l by fl;¶
13
14
sub f j by f _ j;¶ } liga;¶ As I mentioned fj and ffj are usually not included. If they are included, the glyph names are usually f_j and f_f_j but that is your decision to make. Make sure you put the three letter ligs on top—especially top—especially if your ff lig is different than the ff used in in ffj. Obviously, you can add anything you want to your liga feature set. This is the set turned on in the Character panel of InDesign or the Basic Character Formats Formats page of the Paragraph Style dialog box. Be careful not to add ligatures ligatures here that would be offensive to the ignorant.
About fi & fl: the semi-official advice on typophile is to make two characters for the ligatures named fi and fl and another identical pair named f_i and f_l—because fi & fl have keystroke access from the Mac keyboard. I don’t bother with that, but you should be aware that these issues exist.
Discretionary Discretion ary ligatur ligatures: es: On the other hand, dligs are completely up to you. Some fonts have have hundreds of ligatures. This is especially true of scripts. However, However, making massive and overlapping numbers of ligatures work correctly and automatically is far beyond beyond my capabilities as a coder. Take a look at all the options available in Zapfino, for example. This is not an OpenType font, and programming all the options would appear to be impossible to me (but a coding whiz could probably do it). I wish I could use a font which showed you some ligatures, but the ePUB format does not allow it. The only warning that I have found is to put the longest ones at the top of the list. In other words, words, o_f_f_i would would be
above f_f_i. It would be above f_i or f_f. In this way the ligature l igature is already made before the shorter lookups can affect it.
feature dlig {¶ # Discretionary Ligatures ¶ sub u f f y by u _ f _ f _ y;¶ sub f f y by f _ f _ y;¶ sub f y by f _ y;¶ sub M E by M _ E;¶ sub N E by N _ E;¶ sub c h by c _ h;¶ sub c k by c _ k;¶ sub t y by t _ y;¶ sub c t by c _ t;¶ sub g g by g _ g;¶ sub b b by b _ b;¶ sub t t by t _ t;¶ sub s p by s _ p;¶ sub s t by s _ t;¶ sub f t by f _ t;¶ sub T h by T _ h;¶ sub W h by W _ h;¶ sub M.sc M.sc E. E.sc by M _ E.sc sc; ;¶ sub N. N.sc E. E.sc by N _ E.sc sc; ;¶ } dlig;¶
To make any feature file work in Fontographer: I had to add a special language line below the classes and above the features. Otherwise it wouldn’t work—at all. This is what I used. languagesystem lang uagesystem latn dfl d flt t;¶
15
16
Saving your feature sets OpenType feature files must be saved as text files with a .fea extension into a standard folder you can keep track of. A good place on your Mac might be: > Library>> Application Support>> FontLab>> Fontographer 5>> Features. It is easy to find them there when you want to add one to your font. I find that I am gradually g radually adding specific feature files for different types of fonts. I have have my normal file for text files that will be used for normal body copy work. I have a display set. I plan to build a set for scripts. You You need to set up the features that are important to you.
Adding features to your new font For FontLab FontLab 5 Over the years I have developed a system that adds the additional glyphs I want—simply. want—simply. It also adds many of the components I’ll be using to help put these glyphs together. together.
❦
Open the OpenType panel: it is found under the Window menu. Once you have it open, choose the Open Features File… command as you see above. Navigate to your feature file (as mentioned, I store mine in the Features folder in the FontLab Studio
folder in FontLab in Applications Support in Library in [the default location f or FontLab 5]). Click on that file and click Open. The T he app will ask you if you are sure you really want to do that because it will wipe out all existing features. You You do. The features you have written will appear in the left column. T he code for the selected feature in the top right window. window. The classes will be listed in the lower right window window.. ❦
Compile your features: Click the icon in the OpenType OpenT ype panel that looks like a short shor t stack of paper with with a down arrow arrow on top of it. This will read the features and classes into your font. More importantly, it will open an alert that lets you add any glyphs used by the features that are not in your fonts already. already. This saves an incredible amount of time and energy energy on your part. Plus FontLab tries the best it can to add the compo nents of those new glyphs to the new glyph slots. slots.
You’ll need to decide how far you will go to prepare your font for compiling: For example, several of the new glyph windows will w ill be blank. This is due to the fact that the original glyphs are composites. For example, there will be no components in the aacute.sc slot because
17
18
aacute in the original 8-bit set is already a composite. Now,, it is true that I can decompose all the 8-bit glyphs Now and all these other windows will have components in them. But I have found found that if I do this, I loose the auto-updating ability ability of the composited characters in the 8-bit set as I continue to modify the original glyphs that are used as components. It’s your decision.
For Fontographer 5.1 & FontLab: free templates I have set up several OpenType templates with feature files on the hackberry-fonts.com site. They are found on the Fontographer page (/fontographer-practical-font-design.html) for the templates used in the Fontographer: Practical Font Design for Graphic Designers book. Plus I have added two new templates on the OpenType page (/fontographer-opentype-sample-fonts. html).. html) One has a decent set of ligatures and discretionary ligaligatures. The other has oldstyle figures and small caps. These downloads are zipped folders which include a FontLab version with the .vfb extension, the Fontographer version with the .fog extension, and the feature file with the .fea extension. You You can use them however you like—except it would be gross thievery to try to sell them or claim they are yours. Use them to make your own fonts.
Doing it all in Fontographer 5.1 To add the additional ad ditional OpenT OpenType ype glyphs glyp hs within Fontographer 5.1, you are forced to make up your basic 8-bit (256-character) font then add the glyphs for the OpenT OpenType ype features one at a time. You You open Font Info and change the number of slots available in the Glyph Repertoire field in the Encoding page to the number of slots needed. Then you go to the first slot added, selected it, type Command+I to Get Info on that slot
and change the name. You You will need to do that one by one until all the new glyphs are named and drawn. With the templates I’m giving you, the slots are there and a nd named. Plus, I have left you sample characters with composites co mposites to help you see what is needed so you can add the new glyphs required by the feature file as easily as possible. The spacing is not correct, but all the glyphs are there so you can see them, plus all the components are in place to make it easy for you.
19
20 This booklet is a supplement to:
This is the book for Fontographer users It’s geared toward designers who have been wanting to design a font for years and are finally biting the bullet. I present a simplified walk inside my head as I design a few fonts to show you how it works. This is not a dull du ll academic work, but a journal of a font designer relearning his favorite favorite software software application after nearly a decade in another program which is more professional but not nearly as much fun.
It’s available at the standard places In print for $19.95 at Amazon and Lulu As an ebook at iBooks iBooks,, NookBooks NookBooks,, Kindle Kindle,, and Lulu for $9.99 At my Website, there’s a downloadable PDF which I will email to you upon receipt, for only $7.77
Buy a copy today! You’ll enjoy it.
11/11/11
View more...
Comments