1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205
|
<HTML>
<HEAD>
<!-- Created with AOLpress/2.0 -->
<!-- AP: Created on: 27-Jan-2003 -->
<!-- AP: Last modified: 15-Nov-2008 -->
<TITLE>More advanced features, ligatures, mark positioning, glyph variants</TITLE>
<LINK REL="icon" href="ffanvil16.png">
<LINK REL="stylesheet" TYPE="text/css" HREF="FontForge.css">
</HEAD>
<BODY>
<P ALIGN=CENTER>
<IMG SRC="fontforge-banner-420.jpeg" WIDTH=420 HEIGHT=80>
<DIV id="in">
<H1 ALIGN=Center>
Tutorial #6
</H1>
<UL>
<LI>
<A HREF="editexample.html#FontCreate">Font Creation</A>
<LI>
<A HREF="editexample.html#CharCreate">Creating a glyph (tracing outlines)</A>
<LI>
<A HREF="editspiro.html">Create glyph outlines using spiro points</A>
<LI>
<A HREF="importexample.html">Importing a glyph from Inkscape (or Illustrator,
or some other vector editor)</A>
<LI>
<A HREF="editexample2.html#Navigating">Navigating to other glyphs</A>
<LI>
<A HREF="editexample2.html#Creating-o">On to the next glyph (consistent
directions)</A>
<LI>
<A HREF="editexample3.html#consistent-stems">Consistent serifs and stem
widths</A>
<LI>
<A HREF="editexample4.html#accents">Building accented glyphs</A>
<LI>
<A HREF="editexample4.html#ligature">Building a ligature</A>
<LI>
<A HREF="editexample4.html#lookups">Lookups and features</A>
<LI>
<A HREF="editexample5.html#metrics">Examining metrics</A>
<LI>
<A HREF="editexample5.html#Kerning">Kerning</A>
<LI>
<A HREF="editexample6.html#Variants">Glyph variants</A>
<UL>
<LI>
<A HREF="editexample6.html#Conditional">Conditional variants</A>
</UL>
<LI>
<A HREF="editexample6.html#Marks">Anchoring marks</A>
<LI>
<A HREF="editexample6-5.html#Conditional">Conditional features</A>
<LI>
<A HREF="editexample7.html#checking">Checking your font</A>
<LI>
<A HREF="editexample7.html#generating">Generating it</A>
<LI>
<A HREF="editexample7.html#Families">Font Families</A>
<LI>
<A HREF="editexample7.html#summary">Final Summary</A>
<LI>
<A HREF="editexample8.html">Bitmap strikes</A>
<LI>
<A HREF="scripting-tutorial.html">Scripting Tutorial</A>
<LI>
<A HREF="scriptnotes.html#Special">Notes on various scripts</A>
<LI>
<FORM method=GET action="http://www.google.com/search">
Searching the documentation:
<INPUT type=hidden name="as_sitesearch" value="fontforge.sourceforge.net">
<INPUT type=text name="as_q">
<INPUT type=submit name="btnG" value="Search">(Powered by
<A HREF="http://www.google.com/">Google</A>)
</FORM>
</UL>
<H2>
<A NAME="Variants">Glyph</A> Variants
</H2>
<P>
In many scripts glyphs have several variant glyphs. In latin the most obvious
example is that every letter has both an upper case and a lower case variant.
A more esoteric example would be that in renaissance times the long-s variant
(of s) was used initially and medially in a word, while the short-s was only
used at the end of a word.
<P>
Most Arabic glyphs have four variants (initial, medial, final and isolated).
<P>
The digits often have several variants: tabular digits (where all digits
have the same advance width so that tables of numbers don't look ragged),
proportional digits (where each digit has a width appropriate to its shape)
and old-style or lower case digits
(<IMG SRC="lcdigits.png" WIDTH="76" HEIGHT="18" ALIGN="Middle">) where some
digits have descenders and others have ascenders.
<P>
Some of these variants are built into the encodings (the upper and lower
case distinction is), but in other cases you should provide extra information
in the font so that the word processor can be aware of the variants (Arabic
is midway between the two, the various forms are in the encoding, but you
need to provide extra information as well).
<P>
<IMG SRC="subtable-oldstyle.png" WIDTH="421" HEIGHT="287" ALIGN="Right">Let
us consider the case of the digits mentioned above. Assume that the glyph
called "one" contains the tabular variant of one, the glyph "one.prop" contains
the proportional variant and "one.oldstyle" contains the lower-case variant,
and so on for all the other digits. Before you do anything else you must
create two <A HREF="editexample4.html#lookups">lookups</A> and associated
subtables (I shan't go into that again. Here the lookup type is "Single
Substitution", and the features are "pnum" for Proportional Numbers and "onum"
for Oldstyle Figures. Also the digits aren't in any single script, but are
in many, so make this feature apply to multiple scripts (including "DFLT").
<P>
When FontForge brings up the dialog to fill in the oldstyle lookup subtable
notice that there is a button [Default Using Suffix:] followed by a text
field containing a suffix. Set the text field to "oldstyle" and press the
button. It will search through all glyphs in all the scripts of the feature
and find any "oldstyle" variants of them and populate the table with them.
<P>
<IMG SRC="glyphinfo-one.png" WIDTH="431" HEIGHT="310" ALIGN="Left">Sometimes
it makes more sense to think of all the substitutions available for a specific
glyph (rather than all substitutions in a specific lookup). So instead if
filling up the subtable dialog for "Proportional Numbers" let us instead
select "one" from the fontview,
<CODE><A HREF="charinfo.html#substitution">Element->Glyph Info</A></CODE>,
select the <CODE>Substitutions</CODE> tab and press the <CODE><New>
</CODE>button.
<P>
(Note: Type0, Type1 and Type3 PostScript fonts have no notation to handle
this. You need to be creating an OpenType or TrueType font for these variants
to be output).
<H3>
<A NAME="Conditional">Conditional</A> Variants
</H3>
<P>
FontForge supports OpenType's Contextual Substitution and Chaining Contextual
Substitution sub-tables, and to a lesser extent, Apple's contextual glyph
substitution sub-table. This means that you can insert conditional variants
into your font. <A HREF="editexample6-5.html#Conditional">The next page</A>
will go into this in greater detail.
<H2>
<A NAME="Marks">Anchoring</A> marks
</H2>
<P>
Some scripts (Arabic, Hebrew) need vowel marks placed around the main text
glyphs. Other scripts (some variants of Latin and Greek) have so many possible
accent combinations that having preassembled glyphs for all combinations
is unwieldy.
<P>
In OpenType (which includes MicroSoft's TrueType fonts) it is possible to
indicate on all base glyphs where marks should attach, and on all marks where
the base glyphs should attach. Thus one could put an anchor centered above
a lowercase-a indicating that all accents (acute, grave, umlaut, circumflex,
tilde, macron, ring, caron, ...) should attach there, and underneath all
the accents one could put another anchor so that when the two glyphs are
adjacent in the text the word-processor will know where to place the accent
so that it rides above the "a".
<TABLE>
<TR>
<TD><IMG SRC="a_with_anchor.png" WIDTH=104 HEIGHT=208></TD>
<TD>+</TD>
<TD><IMG SRC="grave_with_anchor.png" WIDTH=66 HEIGHT=208></TD>
<TD>=></TD>
<TD><IMG SRC="agrave_anchored.png" WIDTH=104 HEIGHT=208></TD>
</TR>
</TABLE>
<P>
Not all accents ride centered above the letter (the dot and ogonek ride below
the letter), so you may need more than one anchor for different styles of
attachment.
<P>
Finally some letters can have multiple attachments, unicode U+1EA4, for example,
is an A with a circumflex and an acute. Normally the circumflex and the acute
will attach at the same point, which would be ugly and confusing. Instead
we create a different kind of anchor, a mark to mark anchor, on the circumflex
and allow the acute accent to attach to that.
<P>
Before one can create an anchor in a glyph one must (of course) create a
lookup and subtable. This is another Glyph Positioning lookup (so you enter
it in the GPOS pane). Once you have created the subtable you will be presented
with another dialog asking for anchor classes, you must create an
<A HREF="overview.html#Anchors">anchor class</A> for each type of attachment
(thus in the case of A above with two types of attachments (one above and
one below) you would create two anchor classes.
<P>
Then for each glyph in which an attachment will be made, you should first
click at the point where the anchor is to be created and then bring up the
<CODE><A HREF="pointmenu.html#AddAnchor">Point->Add Anchor</A></CODE>
dialog.
<P>
You can examine (and correct) how a glyph fits to any others that combine
with it by using the
<CODE><A HREF="viewmenu.html#AnchorControl">View->Anchor
Control...</A></CODE> command.
<P>
<FONT COLOR="Red"><STRONG>A warning about mark attachments:</STRONG></FONT>
Not all software supports them. And even more confusing software may support
them for some scripts and not for others.
<P>
<P>
<P ALIGN=Center>
-- <A HREF="editexample5.html">Prev</A> -- <A HREF="overview.html">TOC</A>
-- <A HREF="editexample6-5.html">Next</A> --
</DIV>
</BODY></HTML>
|