/usr/share/doc/xgridfit/html/arithmetic.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 | <!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">Do\wnload</a>
      <a href="http://xgridfit.cvs.sourceforge.net/xgridfit/xgridfit/">CVS repository</a>
<hr/>
<a href="#add"><add></a>
<a href="#subtract"><subtract></a>
<a href="#multiply"><multiply></a>
<a href="#divide"><divide></a>
<a href="#set-equal"><set-equal></a>
<a href="#absolute"><absolute></a>
<a href="#negate"><negate></a>
<a href="#floor"><floor></a>
<a href="#ceiling"><ceiling></a>
<a href="#minimum"><minimum></a>
<a href="#maximum"><maximum></a>
<a href="#round"><round></a>
<a href="#no-round"><no-round></a>
<a href="#control-value-index"><control-value-index></a>
<a href="#formula"><formula></a>
</div>
<div id="content">
          <h1>Arithmetic</h1>
          <p>Xgridfit has a number of elements corresponding to the arithmetic
                    instructions of TrueType. While it is generally best to use
                    Xgridfit's <a href="expressions.html">expression</a> syntax
                    for arithmetic, these elements
                    may occasionally come in handy and so are mentioned here.
                    The <set-equal> and <round> elements are
                    especially likely to be useful.</p>
          <p>Arithmetic elements generally have one or two attributes for
                    operands and a <tt>result-to</tt> attribute for the place to
                    store the result. The <tt>result-to</tt> attribute can be
                    the name of a variable, an entry in the Control Value Table,
                    or one of the graphics state variables that can be written
                    to. If one of the operands is missing, Xgridfit assumes that
                    the missing value can be found on the run-time stack. If the
                    <tt>result-to</tt> attribute is missing, Xgridfit attempts
                    to write the result to the operand that normally appears on
                    the left in an arithetic expression. Failing that, Xgridfit
                    issues a warning and generates code that leaves the
                    result on the stack. The behavior of an arithmetic element
                    is somewhat different when it is the child of a <a
                    href="expressions.html#formulas"><formula></a>
                    element.</p>
          <h3 id="add"><add></h3>
          <p>Adds <tt>value1</tt> to <tt>value2</tt>. If there is no
                    <tt>result-to</tt> attribute, Xgridfit attempts to write the
                    result to <tt>value1</tt>.</p>
          
          <h3 id="subtract"><subtract></h3>
          
          <p>Subtracts <tt>minuend - subtrahend</tt>. If <tt>result-to</tt> is not
                    specified, Xgridfit attempts to write the result to
                    <tt>minuend</tt>.</p>
          <h3 id="multiply"><multiply></h3>
          <p>Multiplies <tt>value1</tt> by <tt>value2</tt>. If there is no
                    <tt>result-to</tt> attribute, Xgridfit attempts to write the
                    result to <tt>value1</tt>.</p>
          <h3 id="divide"><divide></h3>
          <p>Divides <tt>dividend</tt> by <tt>divisor</tt>. If
                    <tt>result-to</tt> is not specified, Xgridfit attempts to
                    write the result to <tt>dividend</tt>.</p>
          <h3 id="set-equal"><set-equal></h3>
          <p>Set <tt>target</tt> (variable, control value, or any of the
                    graphics state variables that Xgridfit can write to) equal
                    to <tt>source</tt>, which can be an expression or any number
                    type that Xgridfit can handle.</p>
          <h3 id="absolute"><absolute></h3>
          <p>Converts negative to positive numbers; positive numbers
                    stay positive.</p>
          <h3 id="negate"><negate></h3>
          <p>Converts positive to negative numbers; negative numbers
                    stay negative.</p>
<pre>
<!ELEMENT    negate                    EMPTY>
<!ATTLIST    negate
             value           CDATA                #IMPLIED
             result-to       CDATA                #IMPLIED>
</pre>
          <h3 id="floor"><floor></h3>
          <p>Yields the greatest integer less than or equal to <tt>value</tt>,
                    which is either an integer representing 64ths of a pixel or
                    a fixed-point number. The returned value, if looked at as
                    an integer, is either zero or a multiple of 64.</p>
          <h3 id="ceiling"><ceiling></h3>
          <p>Yields the smallest integer greater than or equal to
                    <tt>value</tt>.</p>
          <h3 id="minimum"><minimum></h3>
          <p>Yields the lesser of the two values <tt>value1</tt> and
                    <tt>value2</tt>.</p>
          <h3 id="maximum"><maximum></h3>
          
          <p>Yields the greater of the two values <tt>value1</tt> and
                    <tt>value2</tt>.</p>
          <h3 id="round"><round></h3>
          <p>Rounds a distance (expressed by <tt>value</tt>) according to the
                    current round state, applies whatever correction is
                    appropriate for the "color" of the distance, and returns the
                    result.</p>
          
          <h3 id="no-round"><no-round></h3>
          <p>Like round, but without the rounding. That is, it may apply a
                    correction for the "color" of the distance, but it will not
                    round the distance.</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>
          
          <h4>Attributes</h4>
          <dl>
                    <dt>value</dt>
                    <dd>Name of the <control-value> element for which we
                              want the index. No other kind of value is
                              recognized here.</dd>
                    <dt>result-to</dt>
                    <dd>Name of a variable in which to store the control value
                              index. Only a variable is permitted here--not, for
                              example, the name of another control value.</dd>
          </dl>
          <h3 id="formula"><formula></h3>
          <p>A formula is a block containing arithmetical instruction
                    elements. Within the <formula> the behavior of these
                    elements is modified slightly: when a result-to attribute is
                    missing, they do not attempt to write their result back to
                    one of the values passed to them, but rather leave it on the
                    stack, thus making it available to the following instruction
                    element. Further, while Xgridfit normally issues a warning
                    when an arithmetic element takes a value from the stack or
                    leaves a result on the stack, within a formula this is the
                    expected behavior and so the warning is suppressed. The
                    instructions within the formula should be chained, the
                    result of one operation being used as an argument for the
                    following one; this results in tight code being generated.
                    Example:</p> 
<pre>
<formula result-to="minimum-distance">
  <round value="lc-vert-stem"/>
  <multiply value2="0.8p"/>
</formula>
</pre>
          <p>This rounds the control-value "lc-vert-stem," multiplies it by
                    0.8, and sets the minimum distance in the graphics state to
                    the result. The original entry in the control-value table is
                    unchanged. By contrast, if this <round> element were
                    not the child of a <formula>, the result would be
                    written back to the control-value table.</p>
</div>
</body>
</html>
 |