/usr/share/doc/xgridfit/html/tutorial2.html is in xgridfit-doc 2.3-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Xgridfit</title>
<link rel="stylesheet" href="oeg.css" media="screen" type="text/css" />
<link rel="stylesheet" href="parchment.css" media="screen"
type="text/css" title="parchment" />
<link rel="alternate stylesheet" href="legible.css" media="screen"
type="text/css" title="legible" />
<style type="text/css" media="print"> @import "oeg.print.css"; </style>
<meta name="AUTHOR" content="Peter S. Baker" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<div id="jumplist">
<a href="http://sourceforge.net"><img src="" width="125" height="37" border="0" alt="SourceForge.net Logo" /></a>
<a href="http://xgridfit.sourceforge.net/">Home Page</a>
<a href="http://sourceforge.net/projects/xgridfit">Project Page</a>
<a href="http://sourceforge.net/project/showfiles.php?group_id=159705">Download</a>
<a href="http://xgridfit.cvs.sourceforge.net/xgridfit/xgridfit/">CVS repository</a>
</div>
<div id="content">
<h1>Tutorial 2: Gentium's o</h1>
<p>
The o in Gentium Italic presents us with a slightly more complex
task than the period. The glyph shape itself is more complicated,
and the distances we need to regulate are less standardized. Here
is the glyph as it appears in FontForge: we have added names for
the points that will have to be explicitly positioned and
distances (in font units) for the stems that will have to be
regulated.
</p>
<table>
<tr>
<td>
<img src="Gentium_o.png" alt="Gentium period"/>
</td>
</tr>
</table>
<p>
Notice that the distances at the top and bottom of the glyph do
not quite match; the same is true of the left and right. In fact,
all of the lower-case letters with curves somewhat like that of o
(a, c, d, e, g, etc.) have curves of slightly different widths. In
a font of the quality of Gentium, it would be a mistake to assume
that this variation is inadvertent; rather, Victor Gaultney was
presumably aiming for optical rather than mathematical consistency
in his glyph outlines. What is true of the stems is also true of
the sidebearings: the left sidebearings of the lower-case letters
with rounded left sides are slightly different.
</p>
<p>
These minor differences can cause problems at low resolutions,
where a difference of a single pixel can make a character look
lopsided, or too bold, or too thin. At the same time, we want to
preserve the differences at higher resolutions, as on good laser
printers or imagesetters. This is not really a problem for us,
since the <a href="cvt.html#cut-in-expl">control-value cut in</a>
is intended to handle precisely this kind of situation. We need
only to choose a standard width for these curved stems; if we make
sure that the cut-in is always used, our standard width will be
used at low resolutions and the designer's widths at high
resolutions. We can experiment with the standard width and with
various settings for the cut-in at any time.
</p>
<p>
The x-height and the distance of the bottom point of a rounded
lower-case glyph from the baseline are consistent in this font.
We will add the following control values to the ones we defined
for the period:
</p>
<pre>
<control-value name="x-height" value="936"/>
<control-value name="lc-round-char-bottom" value="-41"/>
<control-value name="lc-vert-round-stem" value="143"/>
<control-value name="lc-horz-round-stem" value="115"/>
<control-value name="lc-round-char-left-side" value="55"/>
</pre>
<p>
And we will get ready to write the glyph program by creating the
<glyph> element and defining constants for the key point
numbers:
</p>
<pre>
<glyph ps-name="o">
<constant name="last" value="47"/>
<constant name="topa" value="43"/>
<constant name="topb" value="3"/>
<constant name="bottoma" value="30"/>
<constant name="bottomb" value="13"/>
<constant name="lefta" value="35"/>
<constant name="leftb" value="8"/>
<constant name="righta" value="0"/>
<constant name="rightb" value="20"/>
</glyph>
</pre>
<p>
For the <i>o</i>, we will nest <a
href="moves.html#move"><move></a> elements, building XML
structures to correspond to the visible features of the glyph: the
four rounded stems at the left, right, top and bottom. Remember
that when we nest a <move> inside a <move> element,
the point moved by the parent <move> is implicitly the
reference point for the child <move>. Here are the
horizontal and vertical moves:
</p>
<pre>
<with-vectors axis="x">
<move distance="lc-round-char-left-side">
<reference>
<point num="left-sidebearing"/>
</reference>
<point num="lefta"/>
<move distance="lc-vert-round-stem">
<point num="leftb"/>
</move>
</move>
<move>
<reference>
<point num="lefta"/>
</reference>
<point num="rightb"/>
<move distance="lc-vert-round-stem">
<point num="righta"/>
</move>
</move>
</with-vectors>
<with-vectors axis="y">
<move distance="lc-round-char-bottom">
<point num="bottoma"/>
<move distance="lc-horz-round-stem">
<point num="bottomb"/>
</move>
</move>
<move distance="x-height">
<point num="topa"/>
<move distance="lc-horz-round-stem">
<point num="topb"/>
</move>
</move>
</with-vectors>
<interpolate-untouched-points/>
</pre>
<p>
First we position point <tt>lefta</tt> relative to the
<tt>left-sidebearing</tt> point (defined in the last tutorial as a
global <constant> dependent on point <tt>last</tt>). Then we
position point <tt>leftb</tt> distance <tt>lc-vert-round-stem</tt>
from <tt>lefta</tt>. We do the same with the right side of the
glyph, but this time we start by positioning point <tt>rightb</tt>
relative to point <tt>lefta</tt>, and then we work from the right
side of the stem to the left. By omitting a <tt>distance</tt>
attribute from the outer <move>, we accept, but round, the
design width of the glyph. Later, if we find that one or more
other glyphs in the font are the same width as the <i>o</i>, we
can add a <control-value> for that measurement and a
<tt>distance</tt> attribute here.
</p>
<p>
For the y axis, the operations are similar to what we did on the x
axis. Here, however, we omit the reference points and position
points <bottoma> and <topa> at absolute positions on
the grid. If we go on writing instructions for this font, we will
use the control values <tt>x-height</tt> and
<tt>lc-round-char-bottom</tt> so frequently that it will make
sense to round them in the <pre-program>, saving the
TrueType engine the trouble of rounding them over and over while
executing glyph programs. So we add these lines to the
<pre-program>:
</p>
<pre>
<round value="x-height"/>
<round value="lc-round-char-bottom"/>
</pre>
<p>
And we add attributes <tt>round="no"</tt> and <tt>cut-in="no"</tt>
to the two outer <move> elements. (We don't need the cut-in
with such standard measurements; and for technical reasons it
makes sense to turn off rounding and the cut-in at the same time.)
Now the glyph program for <i>o</i> looks like this:
</p>
<pre>
<glyph ps-name="o">
<constant name="last" value="47"/>
<constant name="topa" value="43"/>
<constant name="topb" value="3"/>
<constant name="bottoma" value="30"/>
<constant name="bottomb" value="13"/>
<constant name="lefta" value="35"/>
<constant name="leftb" value="8"/>
<constant name="righta" value="0"/>
<constant name="rightb" value="20"/>
<with-vectors axis="x">
<move distance="lc-round-char-left-side">
<reference>
<point num="left-sidebearing"/>
</reference>
<point num="lefta"/>
<move distance="lc-vert-round-stem">
<point num="leftb"/>
</move>
</move>
<move>
<reference>
<point num="lefta"/>
</reference>
<point num="rightb"/>
<move distance="lc-vert-round-stem">
<point num="righta"/>
</move>
</move>
</with-vectors>
<with-vectors axis="y">
<move distance="lc-round-char-bottom" round="no" cut-in="no">
<point num="bottoma"/>
<move distance="lc-horz-round-stem">
<point num="bottomb"/>
</move>
</move>
<move distance="x-height" round="no" cut-in="no">
<point num="topa"/>
<move distance="lc-horz-round-stem">
<point num="topb"/>
</move>
</move>
</with-vectors>
<interpolate-untouched-points/>
</glyph>
</pre>
<p>
And now the <pre-program>, which we began to construct in
the last tutorial, looks like this:
</p>
<pre>
<pre-program>
<round value="period-height"/>
<round value="x-height"/>
<round value="lc-round-char-bottom"/>
<control-value-delta>
<delta-set size="11" distance="-8" cv="period-height"/>
</control-value-delta>
</pre-program>
</pre>
<p>
At 20 pixels per em, the grid-fitted glyph now looks like this:
</p>
<table>
<tr>
<td>
<img src="Gentium_o_fitted.png" alt="Gentium period"/>
</td>
</tr>
</table>
<p>
And here is how it looks at various resolutions from 30 ppem to
200 ppem. The pattern of pixels corresponds more closely to the
original outline as the resolution goes up:
</p>
<table>
<tr>
<td>
<img src="Gentium_o_cascade.png" alt="Gentium period"/>
</td>
</tr>
</table>
</div>
</body>
</html>
|