/usr/share/doc/xgridfit/html/deltas.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 | <!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="#delta"><delta></a>
<a href="#control-value-delta"><control-value-delta></a>
<a href="#delta-set"><delta-set></a>
<a href="#set-delta-base"><set-delta-base></a>
<a href="#set-delta-base"><with-delta-base></a>
<a href="#set-delta-shift"><set-delta-shift></a>
<a href="#set-delta-shift"><with-delta-shift></a>
</div>
<div id="content">
          <h1>Deltas</h1>
          <p>
                    A delta is an instruction that operates only at a specific
                    resolution. There are two kinds of delta, invoked by two
                    Xgridfit elements: a <delta> element moves points, and
                    a <control-value-delta> element edits the Control
                    Value Table.
          </p>
          <p>
                    Use delta instructions when the non-resolution-specific
                    parts of your programming have failed for some reason.
                    Here are some situations
                    in which deltas typically make sense:
          </p>
          <ul>
                    <li>Rounding of a distance has produced an unattractive
                              result. (If the distance was from the Control
                              Value Table, consider using 
                              <control-value-delta>.)</li>
                    <li>A feature does not render well at particular sizes, and
                              you wish to remove or modify it. (But programming
                              can also be made to operate at a range of sizes
                              using an <if> construction.)</li>
                    <li>Components of a composite glyph are poorly positioned
                              relative to each other.</li>
          </ul>
          <p>
                    In addition, you may wish to use a delta to smooth a curve
                    that has developed a kink, or to turn a pixel on or off.
                    Before you use a delta, however, you should make sure that
                    the problem you are correcting is not the result of your own
                    careless programming: failure to use control values
                    correctly, for example, or failure to think through the
                    problems presented by a complex feature. It may well be less
                    trouble to write a great many deltas than to think
                    intensively about the intersection of two diagonals. But
                    once you have written non-size-specific code that addresses
                    a problem, it can easily be adapted to handle similar
                    problems in the same or another font. The same can rarely be
                    said of deltas. So think of the delta as a last resort or a
                    finishing touch.
          </p>
          <p>
                    Another situation that may tempt you to use deltas arises
                    when the original glyph outline contains small
                    irregularities that show up only at certain low resolutions.
                    When an <b>o</b> is not quite symmetrical, for example, it
                    may appear lopsided at times. In this case you should
                    consider whether the glyph's lack of symmetry is a feature
                    you wish to preserve or an error you should correct. The
                    best time to consider such issues as this is before you
                    start writing the glyph program.
          </p>
          <p>
                    If you have used a graphical hinter like the one in FontLab,
                    it may have left you in some confusion about where deltas
                    can and should come in the sequence of a glyph program.
                    Deltas may come anywhere, but they should generally be
                    placed so as to correct any problems in the positioning of a
                    point as early as possible. The letter <b>q</b> in the
                    left-hand figure below illustrates. (The black lines show the
                    original shape of the glyph and the green lines the
                    grid-fitted shape; the brown squares show which pixels are
                    on. The black vertical line shows the original right
                    margin, and the green vertical line shows the
                    grid-fitted one.)
          </p>
          <table>
            <tr>
            <td>
              <img alt="q without delta" src="q-no-delta.gif"/>
            </td>
            <td>
              <img alt="q with delta" src="q-delta.gif"/>
            </td>
            </tr>
          </table>
          <p>
                    The <b>q</b> on the left is too wide, and it bumps into the
                    right margin. The problem arises after the left-hand curve
                    has been hinted; then the overall width of the glyph is
                    regulated by positioning point <tt>b</tt> relative to point
                    <tt>a</tt>:
          </p>
<pre>
  <move distance="bdpq-width">
    <reference>
      <point num="a"/>
    </reference>
    <point num="b"/>
  </move>
</pre>
          <p>
                    The problem is that the distance "bdpq-width" gets rounded
                    <i>up</i> at 15 ppem when it would be better visually
                    for it to be rounded <i>down</i>. If you waited till the end
                    of the glyph program to address this problem, you would need
                    deltas to correct the position not only of <tt>b</tt>, but
                    also of <tt>c</tt>, <tt>d</tt>, and several other points not
                    shown here--for example, those that control the horizonal
                    positions of the serif ends. All of these points are
                    positioned relative to point <tt>b</tt>, so if you correct
                    the position of <tt>b</tt> immediately after the execution
                    of the instruction above, thus:
          </p>
<pre>
  <delta>
    <delta-set size="6" distance="-8">
      <point num="b"/>
    </delta-set>
  </delta>
</pre>
          <p>
                    then the position of the others will automatically
                    incorporate the correction, and the result will be the much
                    better glyph on the right.
          </p>
          <p>
                    We can correct the problem even earlier than this, however.
                    Notice that the <control-value> that controls the
                    width of the <b>q</b> is named "bdpq-width": this is because
                    that single entry controls the width of <b>b</b>, <b>d</b>
                    and <b>p</b> as well as <b>q</b>. As the following figure
                    demonstrates, the width of all four characters is wrong at
                    15 ppem:
          </p>
          <table>
            <tr>
              <td>
                <img alt="b d p q with incorrect width" src="bdpq-no-delta.png"/>
              </td>
            </tr>
          </table>
          <p>
                    We can correct this problem most efficiently with a
                    <control-value-delta> instruction in the
                    <pre-program>. First we round the distance, then
                    execute the delta instruction:
          </p>
<pre>
  <round value="bdpq-width"/>
  <control-value-delta>
    <delta-set cv="bdpq-width" size="6" distance="-8"/>
  </control-value-delta>
</pre>
          <p>
                    And now, as the figure below shows, the width of all four
                    characters has been corrected without resorting to the use
                    of delta instructions in the glyph programs themselves.
          </p>
          <table>
            <tr>
              <td>
                <img alt="b d p q with correct width" src="bdpq-delta.png"/>
              </td>
            </tr>
          </table>
          <h2>Elements Relating to Deltas</h2>
          <p>
                    In addition to the following elements, you should know about
                    the <tt>delta-base</tt> and <tt>delta-shift</tt> graphics
                    variables, which you may both read and write to.
          </p>
          <h3 id="delta"><delta></h3>
          <p>
                    A delta instruction moves points at particular
                    sizes.  The <delta> element may contain any
                    number of <delta-set> elements. When all of
                    the <delta-set> elements in a <delta>
                    move the same point, it may be convenient to make
                    the first element a <point>. This is the
                    default <point>, which every
                    <delta-set> will move unless it contains its
                    own <point>.
          </p>
          <p>
                    The direction of the move is determined by the current
                    setting of the freedom vector. The available
                    specifications are fuzzy as to the details. You will
                    experience no surprises when the vectors are set to x or y;
                    you may experiment with the vectors set at other angles.
          </p>
          <h3 id="control-value-delta"><control-value-delta></h3>
          <p>
                    The <control-value-delta> element works like the
                    <delta> element, but operates on the Control 
                    Value Table rather than on a point. Each <delta-set>
                    inside a control-value-delta element must have <tt>cv</tt>,
                    <tt>size</tt> and <tt>distance</tt> attributes, but it
                    may not contain a point.
          </p>
          <p>
                    The setting of the vectors has no effect on the
                    <control-value-delta>. Rather, the <delta-set>
                    specifies an amount to add to or subtract from the value
                    stored there.
          </p>
          <h3 id="delta-set"><delta-set></h3>
          <p>
                    The <delta-set> element encapsulates the essential
                    information about a single delta move or adjustment: the
                    resolution at which to apply the delta, the magnitude of the
                    adjustment, and the point or control value that will be
                    affected.
          </p>
          <p>
                    The resolution is determined by the <tt>size</tt> attribute,
                    which can be a number from 0 to 47. It is added to
                    the value set by the <set-delta-base> or
                    <with-delta-base> instruction to
                    obtain the resolution (in pixels per em) at which the move
                    should take place. The default delta base is 9; if
                    you don't change it, a <tt>size</tt> of "0" means 9 ppem,
                    "9" means 18 ppem, and so forth up to "47," which means 56
                    ppem.
          </p>
          <p>
                    The <tt>distance</tt> attribute is the distance to shift the
                    point along the freedom vector, or the amount to add to or
                    subtract from the control value. Legal values are from -8
                    to 8 (excluding 0). When moving points, negative numbers
                    shift against the
                    direction of the freedom vector (generally down or
                    left) and positive numbers shift in the direction of the
                    freedom vector.
          </p>
          <p>
                    The default unit by which pixels are moved and control
                    values adjusted is 1/8 pixel.
                    The unit is controlled by means of the
                    <set-delta-shift> or the <with-delta-shift>
                    instruction.
          </p>
          <p>
	    A <delta-set> that is the child of a <delta>
	    will normally contain a single <point>.  However,
	    the <point> may be omitted in either of two
	    circumstances: First, when the <delta> is the child
	    of a <move> element, the <point>, when not
	    specified, is implicitly the <point> that is the
	    child of the parent <move>. Second, when the first
	    child element of the <delta> is <point>, that
	    point will be moved by any <delta-set> that lacks a
	    child <point>. These two deltas are equivalent:
          </p>
          <pre>
            <delta>
              <delta-set size="3" distance="4">
                <point num="p"/>
              </delta-set>
              <delta-set size="8" distance="-7">
                <point num="p"/>
              </delta-set>
            </delta>
            <delta>
              <point num="p"/>
              <delta-set size="3" distance="4"/>
              <delta-set size="8" distance="-7"/>
            </delta>
          </pre>
          <p>
                    All attribute values in a <delta-set> and a child
                    <point> must be capable of being resolved to numerical
                    values at compile time. Variables and function parameters
                    are not permitted.
          </p>
          <h3 id="set-delta-base"><set-delta-base><br/><with-delta-base></h3>
          <p>
                    Sets the number that is added to the "size" attribute of a
                    <delta-set> element to get the resolutioni at which an
                    adjustment should take place. The default value is 9, and
                    that rarely needs to be changed.
          </p>
          <h3 id="set-delta-shift"><set-delta-shift><br/><with-delta-shift></h3>
          <p>
                    The unit by which a delta instruction shifts a point. If the
                    unit is "2," the smallest shift is half a pixel; if "4," it
                    is a quarter of a pixel; if "8" (the default) it is one
                    eighth, and so on.
          </p>
</div>
</body>
</html>
 |