/usr/share/doc/xgridfit/html/cvt.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 | <!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="#control-values"><control-value></a>
<a href="#set-control-value"><set-control-value></a>
<a href="#set-control-value"><with-control-value></a>
<a href="#set-control-value-cut-in"><set-control-value-cut-in></a>
<a href="#set-control-value-cut-in"><with-control-value-cut-in></a>
<a href="#control-value-index"><control-value-index></a>
</div>
<div id="content">
<h1>Control Values</h1>
<p>
A control value is a specialized variable consulted by TrueType
instructions that position points precise distances from the grid
origin or from other points. The TrueType instructions that use
control values are MIRP and MIAP; the Xgridfit instructions that
use them are <mirp>, <miap>, <move> and
<diagonal-stem>.
</p>
<p>
All control values are global--visible to all functions and glyph
programs, and also the pre-program. (But see below.) Control
values are defined by <control-value> elements; these are
top-level elements (children of <xgridfit>).
</p>
<p>
A <control-value> element looks like this:
</p>
<pre>
<control-value name="lc-vert-stem" value="230"/></pre>
<p>
The <tt>name</tt> attribute names the control value, and
<tt>value</tt> is a distance in "font units," the units of the
grid on which the font was designed (for TrueType fonts, usually
2048 units per em, but frequently 1000, as in PostScript Type 1
fonts). Before any of your programming runs, the TrueType engine
converts all control values to the units of the current raster
grid. The numbers you supply must be integers; but by the time
your <pre-program> runs, they are "f26dot6" fixed-point
numbers. Your <pre-program> may make any necessary
adjustments by rounding these numbers, applying deltas to them, or
setting new values.
</p>
<p>
Put a control value to use by passing its <tt>name</tt> to a
TrueType instruction--in Xgridfit, usually via the
<tt>distance</tt> attribute of the <move> element:
</p>
<pre>
<move distance="lc-horz-thin-curve">
<reference>
<point num="top"/>
</reference>
<point num="top-below"/>
</move></pre>
<p>
This element moves the point "top-below" along the freedom vector
until it is positioned the distance "lc-horz-thin-curve" (as
measured along the projection vector) from the reference point
"top." Notice how the name "lc-horz-thin-curve" suggests a
standard measurement that is likely to occur repeatedly in a
font. In fact, the thin curves at the tops or bottoms of certain
characters (e.g. <b>0</b> and <b>o</b>) may differ slightly in
width; but at low resolutions such slight differences can get
magnified, causing the font to look blobby. One important
function of control values is to standardize such approximately
equal distances.
</p>
<h2 id="local">Simulating Local Control Values</h2>
<p>
Though all control values are global, you can simulate local
variables by reserving certain control values for local use and
assigning them names within the glyph program. For example, if you
want to reserve two control values for local use, define these
somewhere in your list of global control values:
</p>
<pre>
<control-value name="cvt-local-1" value="0"/>
<control-value name="cvt-local-2" value="0"/></pre>
<p>
These same two control values can be assigned different values by
various glyph programs. Simply rename them with <alias>
elements among the declarations at the top of the glyph program:
</p>
<pre>
<alias name="thin-diagonal" target="cvt-local-1"/>
<alias name="thick-diagonal" target="cvt-local-2"/></pre>
<p>
Now use <set-control-value> to assign values to these
control values. By default this element uses font units (the units
of the grid on which you designed your font--usually 1000 or 2048
units per em).
</p>
<pre>
<set-control-value name="thin-diagonal" value="64"/>
<set-control-value name="thick-diagonal" value="114"/></pre>
<p>
Now you can use the names you have assigned these control values
as you would the name of any control value.
</p>
<h2 id="cut-in-expl">The Control Value Cut-in</h2>
<p>
The normalizing function of the control value is desirable only at
low resolutions. Slight irregularities (assuming they are part of
the font's design) should be allowed to emerge at higher
resolutions. The mechanism for permitting this to take place is
the control value cut-in. The cut-in is an F26dot6 fixed-point
number, set via the <set-control-value-cut-in> and
<with-control-value-cut-in> elements; the <tt>cut-in</tt>
attribute of the <mirp>, <miap>, <move> and
<diagonal-stem> elements determines whether the cut-in is
consulted when executing those instructions. The cut-in is used
by default, so you only need to specify the <tt>cut-in</tt>
attribute when its value is "no."
</p>
<p>
When executing the MIRP or MIAP instruction, the TrueType engine
compares the cut-in to the difference between the distance in the
control value table and the distance in the original outline. If
this difference is greater than the value of the cut-in, the
original distance is used; otherwise the distance is that of the
control value.
</p>
<p>
For an illustration, let's return to the example of the
<move> element above. If executed with the default cut-in
value of 17/16 (1.0625) at 500 pixels per em, the original
distance is used in preference to the control value, and the
result is as in the leftmost figure (where the original outline is
in black and the gridfitted outline in green). If the cut-in is
set at 5.0p and the same instruction is executed, the control
value is used rather than the original distance, with the result
that the gridfitted outline differs significantly from the
original.
</p>
<table>
<tr><td>
<img alt="at 500 ppem with default cut-in" src="o-top-500-n.gif"/>
</td>
<td>
<img alt="at 500 ppem with cut-in of 5p" src="o-top-500-y.gif"/>
</td>
</tr>
</table>
<p>
By contrast, if we were to make the same experiment at 50 pixels
per em, the outlines would look the same, since the control value
would be used in both cases.
</p>
<h2>Elements Relating to Control Values</h2>
<p>
The <tt>name</tt> of a control value can be used in many
contexts. In an <a href="arithmetic.html">arithmetic</a> element,
the <tt>name</tt> always resolves to the actual value of the
control value. In an <a href="expressions.html">expression</a>, on
the other hand, it always resolves to the index of the control
value (its position in the table of control values; the number
that must be passed to the MIRP or MIAP instruction). You must use
the <tt>control-value()</tt> operator if you wish to reference the
actual value in an expression.
</p>
<p>
Probably the arithmetic element used most often to operate on a
control value is <round>. In the <pre-program> it is
common to round frequently used control values; this instruction
will do it:
</p>
<pre>
<round value="lc-vert-stem"/></pre>
<p>
That element does the same as this, which uses an <a
href="expressions.html">expression</a> in the <tt>source</tt>
attribute:
</p>
<pre>
<set-equal target="lc-vert-stem"
source="round(control-value(lc-vert-stem))"/></pre>
<p>
or this, which does essentially the same job:
</p>
<pre>
<set-control-value name="lc-vert-stem" unit="pixel"
value="round(control-value(lc-vert-stem))"/></pre>
<h3 id="control-values"><control-value></h3>
<p>
The font's Control Value Table is built from the
<control-value> elements. Each <control-value> has a
<tt>name</tt> (which must be unique) and a numerical
<tt>value</tt>. The index of the <control-value> is
generated by Xgridfit, and no attempt should be made to predict
it: Xgridfit instructions should use only the names of
<control-value>s, though the index may be derived and used
at run time.
</p>
<h3 id="set-control-value"><set-control-value><br/>
<with-control-value></h3>
<p>
You can assign a value to a control value anywhere: in the
<pre-program>, a <function>, or a <glyph>
program. The value you assign can be either in font units (the
units of the grid on which you designed the font) or in pixel
units (the grid on which the glyph is now being rasterized). To
specify which, include the attribute <tt>unit="font"</tt> or
<tt>unit="pixel"</tt> ("font" is the default). You must specify
the name of the control value with the <tt>name</tt> attribute and
the value (an integer in font units or an "F26Dot6" number in
pixel units) with the <tt>value</tt> attribute.
</p>
<p>
Use <with-control-value>, which takes attributes exactly
like those of <set-control-value>, to assign a control value
to be used only within the <with-control-value>
element. After this element, the value will be the same as it was
before.
</p>
<h3 id="set-control-value-cut-in"><set-control-value-cut-in><br/>
<with-control-value-cut-int></h3>
<p>
A distance in 64ths of a pixel. If the difference between a
distance from a <control-value> element and the original
distance is greater than this, the original distance is used. The
effect is generally to use the <control-value> distance at
low resolutions and the original distance at high
resolutions. This can be used to promote evenness at small sizes,
where a 1-pixel difference between the width of (say) p and b can
look bad. The default value is 17/16: that is, 1.0625p or 68.
</p>
<h3 id="control-value-index"><control-value-index></h3>
<p>
Assigns the index of a control value to a variable. Use this if
you need to get such an index for any reason, since the
<set-equal> instruction yields the value, not the index, of
a control value.
</p>
</div>
</body>
</html>
|