/usr/share/doc/xgridfit/html/points.html is in xgridfit-doc 2.3-2.
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 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 | <!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>
<hr/>
<a href="#point"><point></a>
<a href="#line"><line></a>
<a href="#range"><range></a>
<a href="#set"><set></a>
<a href="#contour"><contour></a>
<a href="#zone"><zone></a>
</div>
<div id="content">
<h1>Points and Collections of Points</h1>
<p>
The points that define outlines in TrueType are numbered
sequentially from zero, as illustrated in the figure below,
which shows both on-line points (those that a line must pass
through), and off-line points (those that determine the
curvature of a line):
</p>
<table>
<tr>
<td>
<img src="o-bold.gif" alt="boldface o"/>
</td>
</tr>
</table>
<p>
"Raw" TrueType instructions refer to points only by
number. For example, the following code positions point 20 in
the <b>o</b> relative to point 12:
</p>
<pre>
PUSHB_1[ ]
12
SRP0[ ]
PUSHB_2[ ]
20 5
MIRP[01101]</pre>
<p>
Code of this kind, with references to points scattered through
as number literals, is very hard to maintain: even a small
change in the outline (the addition or deletion of a point)
would require that one tediously search through the glyph
program locating and revising all the point numbers.
</p>
<p>
Xgridfit, on the other hand, encourages the programmer to name
key points in the glyph and store the names in
<constant> elements at the top of the glyph
program. Here is a set of names for the <b>o</b> illustrated
above:
</p>
<pre>
<constant name="left-sidebearing" value="32"/>
<constant name="bottom" value="4"/>
<constant name="bottom-inside" value="28"/>
<constant name="top" value="12"/>
<constant name="top-inside" value="20"/>
<constant name="left-stem-left" value="8"/>
<constant name="left-stem-right" value="24"/>
<constant name="right-stem-right" value="0"/>
<constant name="right-stem-left" value="16"/>
</pre>
<p>
Then all instructions that change or refer to points do so by
including <point> elements with <tt>num</tt> attributes
that can use these names (though they can also use number
literals, variables or function parameters). Unnamed points
can be referred to by naming a nearby point and adding or
subtracting an offset. For example, these elements refer to
the top point of the <b>o</b> and the off-line point
immediately to the left of it:
</p>
<pre>
<point num="top"/>
<point num="top - 1"/></pre>
<p>
An alternative to this syntax is to use the <tt>offset</tt>
attribute of the <point> element:
</p>
<pre>
<point num="top"/>
<point num="top" offset="-1"/></pre>
<p>
However, this attribute is deprecated, and an addition or
subtraction expression in the <tt>num</tt> attribute should be
preferred.
</p>
<p>
The Xgridfit equivalent of the TrueType instructions that
moved point 20 looks like this (<tt>lc-horz-thin-curve</tt> is
a reference to the control value table):
</p>
<pre>
<move distance="lc-horz-thin-curve">
<reference>
<point num="top"/>
</reference>
<point num="top-inside"/>
</move></pre>
<p>
If the outline changes slightly this code will need no
revision; only the constants will have to be edited.
</p>
<p>
Xgridfit defines various collections of points. A
<line>, defined by two points, is often used to set <a
href="vectors.html">vectors</a>. A <range> is a
collection of contiguous points defined by two end-points. A
<set> is an arbitrary collection of points. The
<line>, <range> and <set> can be defined in
one place and then referred to by name; thus collections that
define complex features need be defined only once, even if
they are used several times.
</p>
<p>
A glyph consists of one or more contours numbered sequentially
(the one with the lowest-numbered points is 0). One TrueType
instruction operates on contours, and accordingly Xgridfit has
a <contour> element for this instruction. Xgridfit also
contains a <zone> element for an instruction that
operates on an entire zone.
</p>
<h3 id="point"><point></h3>
<p>
The <point> element defines a point. It is used in all
instructions that manipulate or refer to points.
</p>
<h4>Attributes</h4>
<dl>
<dt>num</dt>
<dd>
Required. The number of a point. This may be a number
literal, the name of a <constant>, a variable, or a
function parameter. To refer to a point in a glyph other
than the one whose glyph program is currently running (as
you may have occasion to do when instructing composite
glyphs), use the syntax "g/p", where g is the ps-name of the
glyph, and p is the point being referred to (it should be
the name of a <constant>).
</dd>
<dt>offset</dt>
<dd>
Number (can be positive or negative) to add to the point
identified in <tt>num</tt>. If <tt>num</tt> is a variable or
function parameter, Xgridfit will generate code to add it at
run time. Otherwise Xgridfit will add it at compile
time. <tt>Offset</tt> must be a number literal or a
<constant>. It may, like <tt>num</tt>, refer to a
<constant> declared in another glyph via "g/p"
syntax. This element is deprecated. You should ins tead use
an addition or subtraction expression in the <tt>num</tt>
attribute.
</dd>
<dt>zone</dt>
<dd>
The zone that contains this point. Instructions will take
note of this attribute, when present, and adjust the zone
pointers appropriately. The glyph zone is always the default
zone. When a point is in the glyph zone it is generally
redundant to include an attribute zone="glyph," and doing so
may also cause unnecessary (though harmless) code to be
generated. N.B. For instructions that deal with lists of
points, include the zone attribute only in the first.
</dd>
</dl>
<h3 id="line"><line></h3>
<p>
A <line> is defined by its two end-points. These points
need not be adjacent. For example, in the <b>W</b> illustrated
here,
</p>
<table>
<tr>
<td>
<img src="W.gif" alt="Capital W"/>
</td>
</tr>
</table>
<p>
it is perfectly all right for points <b>a</b> and <b>b</b> to
be the end-points of a line:
</p>
<pre>
<line>
<point num="b"/>
<point num="a"/>
</line></pre>
<p>
Points <b>c</b> and <b>d</b> can be aligned so that they are
on the line defined by those two points:
</p>
<pre>
<with-projection-vector to-line="orthogonal"/>
<line>
<point num="b"/>
<point num="a"/>
</line>
<align>
<reference>
<point num="b"/>
</reference>
<point num="c"/>
<point num="d"/>
</align>
</with-projection-vector></pre>
<p>
When a <line> has a <tt>name</tt> attribute, another
<line> may refer to it by name. You may name the
<line> the first time you use it or declare it by
placing a <line> element among the declarations at the
beginning of the <glyph> element. For example, if you
declare the line thus:
</p>
<pre>
<line name="line-2b">
<point num="b"/>
<point num="a"/>
</line></pre>
<p>
then you can use an abbreviated form whenever you need it:
</p>
<pre>
<set-freedom-vector>
<line ref="line-2b"/>
</set-freedom-vector></pre>
<p>
If both points that define a <line> are in the same
zone, you may use the optional <tt>zone</tt> attribute on the
<line> to indicate this. Most instructions that take a
<line> as an argument allow one point to be in one zone
and the other point in the other: in such cases place the
<tt>zone</tt> attributes on the <point>s. The exception
is the <move-point-to-intersection> instruction, which
requires that each of the two lines it takes as arguments be
entirely in a zone. For this instruction, place the
<tt>zone</tt> attributes on the <line>s, never on the
<point>s.
</p>
<h3 id="range"><range></h3>
<p>
A <range> is a collection of contiguous points defined
by its end-points. It can be used in any instruction that
operates on more than one point: <shift>, <align>,
<interpolate>, <shift-absolute>,
<toggle-points>. The order of points in the
<range> is not significant. Example:
</p>
<pre>
<align>
<reference>
<point num="bottom"/>
</reference>
<range>
<point num="bottom - 2"/>
<point num="bottom + 2"/>
</range>
</align></pre>
<p>
If "bottom" is point 17, the <range> begins with 15 and
ends with 19. But any reference point in the parent element of
the <range> is excluded from the <range>, so this
<range> actually represents points 15, 16, 18 and
19. The same is true of implicit reference points supplied by
a <move> element that is the parent of the parent of the
<range>:
</p>
<pre>
<move>
<point num="bottom"/>
<align>
<range>
<point num="bottom - 2"/>
<point num="bottom + 2"/>
</range>
</align>
</move></pre>
<p>
Here the points in the <range> are aligned with "bottom"
after it has been moved by the <move> instruction; but
"bottom" itself is not part of the <range>. The code
above is functionally identical to this:
</p>
<pre>
<move>
<point num="bottom"/>
<align>
<point num="bottom - 2"/>
<point num="bottom - 1"/>
<point num="bottom + 1"/>
<point num="bottom + 2"/>
</align>
</move></pre>
<p>
The latter generates more efficient code than the example with
the <range>, but the <range> is more flexible,
since its endpoints, its size, and the points to be excluded
need not be known until run-time. This makes the <range>
ideal for use in functions.
</p>
<p>
All the points in a <range> must be in the same zone,
determined by the optional <tt>zone</tt> attribute on the
<range> element. Any <tt>zone</tt> attributes on the
<point>s within the <range> are ignored.
</p>
<p>
As with <line>, you may declare a <range> in one
place with points and a <tt>name</tt> attribute and then refer
to that with a <range> element containing a <tt>ref</tt>
attribute:
</p>
<pre>
<range ref="r"/></pre>
<h3 id="set"><set></h3>
<p>
A <set> is an arbitrary collection of points, which can
be used by all elements that can operate on more than one
point. Like a <line> and a <range>, the
<set> can be defined in one place and invoked by name
elsewhere.
</p>
<p>
As with the <range>, points in the <set> are
excluded when they match the reference point(s) for the
instructions that use them.
</p>
<p>
The <set> has several limitations. It is available only
for elements in the <glyph> program, and in macros. All
points in the <set> must be defined by constants or
number literals: variables are not permitted. Similarly,
reference points must be defined by constants or number
literals, or they will not be excluded.
</p>
<p>
A <set> used in a <macro> may refer to a
<set> defined in a <glyph> program when the name
of the <set> is passed to the <macro> as a
parameter. This set, defined in a <glyph>
</p>
<pre>
<set name="bottom-points">
<point num="bottom-a"/>
<point num="bottom-b"/>
</set>
</pre>
<p>
can be passed to this macro
</p>
<pre>
<macro id="align-to-baseline">
<param name="pt"/>
<param name="al" value="0"/>
<move distance="baseline" round="no" cut-in="no">
<point num="pt"/>
<align compile-if="nan(al)">
<set ref="al"/>
</align>
</move>
</macro>
</pre>
<p>
with this call:
</p>
<pre>
<call-macro macro-id="align-to-baseline">
<with-param name="pt" value="bottom"/>
<with-param name="al" value="bottom-points"/>
</call-macro>
</pre>
<p id="nan-test">
Notice that the <tt>compile-if</tt> attribute (on the
<align> element in the macro) tests whether the "al"
parameter has been passed by determining whether it is a
number using the <tt>nan</tt> (not a number) operator, which
returns true if the operator is not a number and false if it
is. The name of a set is never a number, but the default value
for the "al" param is the number zero.
</p>
<h3 id="contour"><contour></h3>
<p>
Specifies a contour to be shifted by a <shift>
instruction.
</p>
<h4>Attributes</h4>
<dl>
<dt>num</dt>
<dd>
The number of this contour or a name associated with it via
a constant.
</dd>
<dt>zone</dt>
<dd>
The zone that contains this contour. As a rule, you do not
need this attribute when the contour is in the glyph
zone. In fact, it must be very rare indeed that a whole
contour is in the twilight zone.
</dd>
</dl>
<h3 id="zone"><zone></h3>
<p>
A zone to be shifted by a <shift> instruction.
</p>
</div>
</body>
</html>
|