Commit fed760b1bf633c3c3d97c704a0956afddd49d890

Werner Lemberg 2000-11-09T16:23:23

Revised.

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
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
diff --git a/docs/glyphs/glyphs-2.html b/docs/glyphs/glyphs-2.html
index 70ece64..06e9d98 100644
--- a/docs/glyphs/glyphs-2.html
+++ b/docs/glyphs/glyphs-2.html
@@ -62,7 +62,7 @@
   <tr bgcolor="#CCCCFF"
       valign=center><td>
     <h2>
-      II. Glyph Outlines
+      II. Glyph mutlines
     </h2>
   </td></tr>
   </table>
@@ -363,7 +363,7 @@
       </table>
     </center>
 
-    <p><hr></p>
+  <p><hr></p>
 
   <center>
   <table width="100%"
diff --git a/docs/glyphs/glyphs-3.html b/docs/glyphs/glyphs-3.html
index 4c5d316..d5e0503 100644
--- a/docs/glyphs/glyphs-3.html
+++ b/docs/glyphs/glyphs-3.html
@@ -1,12 +1,13 @@
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en"
+          "http://www.w3.org/TR/REC-html40/loose.dtd">
 <html>
 <head>
-   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-   <meta name="Author" content="blob">
-   <meta name="GENERATOR" content="Mozilla/4.5 [fr] (Win98; I) [Netscape]">
-   <title>FreeType Glyph Conventions</title>
+  <meta http-equiv="Content-Type"
+        content="text/html; charset=iso-8859-1">
+  <meta name="Author"
+        content="David Turner">
+  <title>FreeType Glyph Conventions</title>
 </head>
-<body>
 
 <body text="#000000"
       bgcolor="#FFFFFF"
@@ -14,296 +15,416 @@
       vlink="#51188E"
       alink="#FF0000">
 
-<center>
-<h1>
-FreeType Glyph Conventions</h1></center>
+<h1 align=center>
+  FreeType Glyph Conventions
+</h1>
 
-<center>
-<h2>
-version 2.1</h2></center>
+<h2 align=center>
+  Version&nbsp;2.1
+</h2>
 
-<center>
-<h3>
-Copyright 1998-2000 David Turner (<a href="mailto:david@freetype.org">david@freetype.org</a>)<br>
-Copyright 2000 The FreeType Development Team (<a href="devel@freetype.org">devel@freetype.org</a>)</h3></center>
-
-<center><table width=650><tr><td>
-
-<center><table width="100%" border=0 cellpadding=5><tr bgcolor="#CCFFCC" valign=center>
-<td align=center width="30%">
-<a href="glyphs-2.html">Previous</a>
-</td>
-<td align=center width="30%">
-<a href="index.html">Contents</a>
-</td>
-<td align=center width="30%">
-<a href="glyphs-4.html">Next</a>
-</td>
-</tr></table></center>
-
-<table width="100%"><tr valign=center bgcolor="#ccccff"><td><h2>
-III. Glyph metrics
-</h2></td></tr></table>
-
-<h3><a name="section-1">
-1. Baseline, Pens and Layouts
-</h3><blockquote>
-
-<p>The baseline is an imaginary line that is used to "guide" glyphs when
-rendering text. It can be horizontal (e.g. Roman, Cyrillic, Arabic, etc.)
-or vertical (e.g. Chinese, Japanese, Korean, etc). Moreover, to render
-text, a virtual point, located on the baseline, called the "pen position"
-or "origin", is used to locate glyphs.
-</p>
-
-<p>Each layout uses a different convention for glyph placement:</p>
-<ul>
-  <li>
-    with horizontal layout, glyphs simply "rest" on the baseline. Text
-    is rendered by incrementing the pen position, either to the right or
-    to the left.
-  </li>
-
-
-  <p>the distance between two successive pen positions is glyph-specific
-  and is called the <b>advance width</b>. Note that its value is _always_
-  positive, even for right-to-left oriented alphabets, like Arabic. This
-  introduces some differences in the way text is rendered.
-  </p>
-
-  <p>IMPORTANT NOTE:&nbsp; The pen position is always placed on the baseline.
-  </p>
-
-  <p><center><img SRC="Image1.png" height=179 width=458></center></p>
-
-
-  <li>with a vertical layout, glyphs are centered around the baseline:</li>
-
-  <p><center><img SRC="Image2.png" height=275 width=162></center></p>
-
-</ul>
-
-</blockquote><h3><a name="section-2">
-2. Typographic metrics and bounding boxes
-</h3><blockquote>
-
-<p>A various number of face metrics are defined for all glyphs in a given
-font.</p>
-
-<p><b>the ascent</b></p>
-<ul>
-<p>this is the distance from the baseline to the highest/upper grid coordinate
-used to place an outline point. It is a positive value, due to the grid's
-orientation with the Y axis upwards.
-</p>
-</ul>
-
-<p><br><b>the descent</b></p>
-<ul><p>
-the distance from the baseline to the lowest grid coordinate used to
-place an outline point. This is a negative value, due to the grid's
-orientation.
-</p></ul>
-
-<p><br><b>the linegap</b>
-<ul>the distance that must be placed between two lines of text. The baseline-to-baseline
-distance should be computed as:
-<center>
-<p><tt>ascent - descent + linegap</tt></center>
-if you use the typographic values.</ul>
-Other, simpler metrics are:
-<p><b>the glyph's bounding box</b>, also called "<b>bbox</b>"
-<ul>this is an imaginary box that encloses all glyphs from the font, as
-tightly as possible. It is represented by four fields, namely <tt>xMin</tt>,
-<tt>yMin</tt>,
-<tt>xMax</tt>,
-and <tt>yMax</tt>, that can be computed for any outline. Their values can
-be in font units (if measured in the original outline) or in fractional/integer
-pixel units (when measured on scaled outlines).
-<p>Note that if it wasn't for grid-fitting, you wouldn't need to know a
-box's complete values, but only its dimensions to know how big is a glyph
-outline/bitmap. However, correct rendering of hinted glyphs needs the preservation
-of important grid alignment on each glyph translation/placement on the
-baseline.</ul>
-<b>the internal leading</b>
-<ul>this concept comes directly from the world of traditional typography.
-It represents the amount of space within the "leading" which is reserved
-for glyph features that lay outside of the EM square (like accentuation).
-It usually can be computed as:
-<center>
-<p><tt>internal leading = ascent - descent - EM_size</tt></center>
-</ul>
-<b>the external leading</b>
-<ul>this is another name for the line gap.</ul>
-</ul>
-
-<h3><a name="section-3">
-3. Bearings and Advances</h3>
-
-<ul>Each glyph has also distances called "bearings" and "advances". Their
-definition is constant, but their values depend on the layout, as the same
-glyph can be used to render text either horizontally or vertically:
-<p><b>the left side bearing: a.k.a. bearingX</b>
-<ul>this is the horizontal distance from the current pen position to the
-glyph's left bbox edge. It is positive for horizontal layouts, and most
-generally negative for vertical one.</ul>
-
-<p><br><b>the top side bearing: a.k.a. bearingY</b>
-<ul>this is the vertical distance from the baseline to the top of the glyph's
-bbox. It is usually positive for horizontal layouts, and negative for vertical
-ones</ul>
-
-<p><br><b>the advance width: a.k.a. advanceX</b>
-<ul>is the horizontal distance the pen position must be incremented (for
-left-to-right writing) or decremented (for right-to-left writing) by after
-each glyph is rendered when processing text. It is always positive for
-horizontal layouts, and null for vertical ones.</ul>
-
-<p><br><b>the advance height: a.k.a. advanceY</b>
-<ul>is the vertical distance the pen position must be decremented by after
-each glyph is rendered. It is always null for horizontal layouts, and positive
-for vertical layouts.</ul>
-
-<p><br><b>the glyph width</b>
-<ul>this is simply the glyph's horizontal extent. More simply it is (bbox.xMax-bbox.xMin)
-for unscaled font coordinates. For scaled glyphs, its computation requests
-specific care, described in the grid-fitting chapter below.</ul>
-
-<p><br><b>the glyph height</b>
-<ul>this is simply the glyph's vertical extent. More simply, it is (bbox.yMax-bbox.yMin)
-for unscaled font coordinates. For scaled glyphs, its computation requests
-specific care, described in the grid-fitting chapter below.</ul>
-
-<p><br><b>the right side bearing</b>
-<ul>is only used for horizontal layouts to describe the distance from the
-bbox's right edge to the advance width. It is in most cases a non-negative
-number.</ul>
-
-<center><tt>advance_width - left_side_bearing - (xMax-xMin)</tt></center>
-
-<p>Here is a picture giving all the details for horizontal metrics :
-<center>
-<p><img SRC="Image3.png" height=253 width=388></center>
+<h3 align=center>
+  Copyright&nbsp;1998-2000 David Turner (<a
+  href="mailto:david@freetype.org">david@freetype.org</a>)<br>
+  Copyright&nbsp;2000 The FreeType Development Team (<a
+  href="mailto:devel@freetype.org">devel@freetype.org</a>)
+</h3>
 
-<p>And here is another one for the vertical metrics :
 <center>
-<p><img SRC="Image4.png" height=278 width=294></center>
-</ul>
-
-<h3><a name="section-4">
-4. The effects of grid-fitting</h3>
-
-<ul>Because hinting aligns the glyph's control points to the pixel grid,
-this process slightly modifies the dimensions of character images in ways
-that differ from simple scaling.
-<p>For example, the image of the lowercase "m" letter sometimes fits a
-square in the master grid. However, to make it readable at small pixel
-sizes, hinting tends to enlarge its scaled outline in order to keep its
-three legs distinctly visible, resulting in a larger character bitmap.
-<p>The glyph metrics are also influenced by the grid-fitting process. Mainly
-because :
-<br>&nbsp;
-<ul>
-<li>
-The image's width and height are altered. Even if this is only by one pixel,
-it can make a big difference at small pixel sizes</li>
-
-<li>
-The image's bounding box is modified, thus modifying the bearings</li>
-
-<li>
-The advances must be updated. For example, the advance width must be incremented
-when the hinted bitmap is larger than the scaled one, to reflect the augmented
-glyph width.</li>
-</ul>
-
-<p><br>Note also that :
-<br>&nbsp;
-<ul>
-<li>
-Because of hinting, simply scaling the font ascent or descent might not
-give correct results. A simple solution consists in keeping the ceiling
-of the scaled ascent, and floor of the scaled descent.</li>
-</ul>
-
-<ul>
-<li>
-There is no easy way to get the hinted glyph and advance widths of a range
-of glyphs, as hinting works differently on each outline. The only solution
-is to hint each glyph separately and record the returned values. Some formats,
-like TrueType, even include a table of pre-computed values for a small
-set of common character pixel sizes.</li>
-</ul>
-
-<ul>
-<li>
-Hinting depends on the final character width and height in pixels, which
-means that it is highly resolution-dependent. This property makes correct
-WYSIWYG layouts difficult to implement.</li>
-</ul>
-
-<p><br><b>IMPORTANT NOTE:</b>
-<br>Performing 2D transforms on glyph outlines is very easy with FreeType.
-However, when using translation on a hinted outlines, one should aways
-take care of&nbsp; <b>exclusively using integer pixel distances</b> (which
-means that the parameters to the FT_Translate_Outline API should all be
-multiples of 64, as the point coordinates are in 26.6 fixed float format).
-<p><b>Otherwise</b>, the translation will simply <b>ruin the hinter's work</b>,
-resulting in a very low quality bitmaps.
-<br>&nbsp;
-<br>&nbsp;</ul>
-
-<h3><a name="section-5">
-&nbsp;5. Text widths and bounding box :</h3>
-
-<ul>As seen before, the "origin" of a given glyph corresponds to the position
-of the pen on the baseline. It is not necessarily located on one of the
-glyph's bounding box corners, unlike many typical bitmapped font formats.
-In some cases, the origin can be out of the bounding box, in others, it
-can be within it, depending on the shape of the given glyph.
-<p>Likewise, the glyph's "advance width" is the increment to apply to the
-pen position during layout, and is not related to the glyph's "width",
-which really is the glyph's bounding width.
-<br>&nbsp;
-<p>The same conventions apply to strings of text. This means that :
-<br>&nbsp;
-<ul>
-<ul>
-<li>
-The bounding box of a given string of text doesn't necessarily contain
-the text cursor, nor is the latter located on one of its corners.</li>
-</ul>
-
-<ul>
-<li>
-The string's advance width isn't related to its bounding box's dimensions.
-Especially if it contains beginning and terminal spaces or tabs.</li>
-</ul>
-
-<ul>
-<li>
-Finally, additional processing like kerning creates strings of text whose
-dimensions are not directly related to the simple juxtaposition of individual
-glyph metrics. For example, the advance width of "VA" isn't the sum of
-the advances of "V" and "A" taken separately.</li>
-</ul>
-</ul>
-</ul>
-</ul>
-
-<center><table width="100%" border=0 cellpadding=5><tr bgcolor="#CCFFCC" valign=center>
-<td align=center width="30%">
-<a href="glyphs-2.html">Previous</a>
-</td>
-<td align=center width="30%">
-<a href="index.html">Contents</a>
-</td>
-<td align=center width="30%">
-<a href="glyphs-4.html">Next</a>
-</td>
-</tr></table></center>
-
-</td></tr></table></center>
+<table width="65%">
+<tr><td>
+
+  <center>
+  <table width="100%"
+         border=0
+         cellpadding=5>
+  <tr bgcolor="#CCFFCC"
+      valign=center>
+    <td align=center
+        width="30%">
+      <a href="glyphs-2.html">Previous</a>
+    </td>
+    <td align=center
+        width="30%">
+      <a href="index.html">Contents</a>
+    </td>
+    <td align=center
+        width="30%">
+      <a href="glyphs-4.html">Next</a>
+    </td>
+  </tr>
+  </table>
+  </center>
+
+  <p><hr></p>
+
+  <table width="100%">
+  <tr bgcolor="#CCCCFF"
+      valign=center><td>
+    <h2>
+      III. Glyph metrics
+    </h2>
+  </td></tr>
+  </table>
+
+    <a name="section-1">
+    <h3>
+      1. Baseline, pens and layouts
+    </h3>
+
+    <p>The baseline is an imaginary line that is used to "guide" glyphs when
+    rendering text.  It can be horizontal (e.g. Roman, Cyrillic, Arabic,
+    etc.) or vertical (e.g. Chinese, Japanese, Korean, etc).  Moreover, to
+    render text, a virtual point, located on the baseline, called the <em>pen
+    position</em> or <em>origin</em>, is used to locate glyphs.</p>
+
+    <p>Each layout uses a different convention for glyph placement:</p>
+
+    <ul>
+      <li>
+        <p>With horizontal layout, glyphs simply "rest" on the baseline. 
+        Text is rendered by incrementing the pen position, either to the
+        right or to the left.</p>
+
+        <p>The distance between two successive pen positions is
+        glyph-specific and is called the <em>advance width</em>.  Note that
+        its value is <em>always</em> positive, even for right-to-left
+        oriented alphabets, like Arabic.  This introduces some differences
+        in the way text is rendered.</p>
+
+        <p><em>The pen position is always placed on the baseline.</em></p>
+
+        <p><center>
+          <img src="Image1.png"
+               height=179 width=458
+               alt="horizontal layout">
+        </center></p>
+      </li>
+      <li>
+        <p>With a vertical layout, glyphs are centered around the
+        baseline:</p>
+
+        <p><center>
+          <img src="Image2.png"
+               height=275 width=162
+               alt="vertical layout">
+        </center></p>
+      </li>
+    </ul>
+
+
+    <a name="section-2">
+    <h3>
+      2. Typographic metrics and bounding boxes
+    </h3>
+
+    <p>A various number of face metrics are defined for all glyphs in a
+    given font.</p>
+
+    <ul>
+      <li>
+        <p><em>Ascent</em></p>
+
+        <p>The distance from the baseline to the highest/upper grid
+        coordinate used to place an outline point.  It is a positive value,
+        due to the grid's orientation with the <i>Y</i>&nbsp;axis
+        upwards.</p>
+      </li>
+
+      <li>
+        <p><em>Descent</em></p>
+
+        <p>The distance from the baseline to the lowest grid coordinate used
+        to place an outline point.  This is a negative value, due to the
+        grid's orientation.</p>
+      </li>
+
+      <li>
+        <p><em>Linegap</em></p>
+
+        <p>The distance that must be placed between two lines of text.  The
+        baseline-to-baseline distance should be computed as:
+
+        <center><p>
+          <tt>ascent - descent + linegap</tt>
+        </p></center>
+
+        <p>if you use the typographic values.</p>
+      </li>
+    </ul>
+
+    <p>Other, simpler metrics are:</p>
+
+    <ul>
+      <li>
+        <p><em>The glyph's bounding box</em>, also called <em>bbox</em></p>
+
+        <p>This is an imaginary box that encloses all glyphs from the font,
+        usually as tightly as possible.  It is represented by four fields,
+        namely <tt>xMin</tt>, <tt>yMin</tt>, <tt>xMax</tt>, and
+        <tt>yMax</tt>, that can be computed for any outline.  Their values
+        can be in font units (if measured in the original outline) or in
+        fractional/integer pixel units (when measured on scaled
+        outlines).</p>
+
+        <p>Note that if it wasn't for grid-fitting, you wouldn't need to
+        know a box's complete values, but only its dimensions to know how
+        big is a glyph outline/bitmap.  However, correct rendering of hinted
+        glyphs needs the preservation of important grid alignment on each
+        glyph translation/placement on the baseline.</p>
+      </li>
+
+      <li>
+        <p><em>Internal leading</em></p>
+
+        <p>This concept comes directly from the world of traditional
+        typography.  It represents the amount of space within the
+        <em>leading</em> which is reserved for glyph features that lay
+        outside of the EM square (like accentuation).  It usually can be
+        computed as:</p>
+
+        <center><p>
+          <tt>internal leading = ascent - descent - EM_size</tt>
+        </p></center>
+      </li>
+
+      <li>
+        <p><em>External leading</em></p>
+
+        <p>This is another name for the line gap.</p>
+      </li>
+    </ul>
+
+
+    <a name="section-3">
+    <h3>
+      3. Bearings and Advances
+    </h3>
+
+    Each glyph has also distances called <em>bearings</em> and
+    <em>advances</em>.  Their definition is constant, but their values
+    depend on the layout, as the same glyph can be used to render text
+    either horizontally or vertically:
+
+    <ul>
+      <li>
+        <p><em>Left side bearing</em> or <em>bearingX</em></p>
+
+        <p>The horizontal distance from the current pen position to the
+        glyph's left bbox edge.  It is positive for horizontal layouts, and
+        in most cases negative for vertical one.</p>
+      </li>
+
+      <li>
+        <p><em>Top side bearing</em> or <em>bearingY</em></p>
+
+        <p>The vertical distance from the baseline to the top of the glyph's
+        bbox.  It is usually positive for horizontal layouts, and negative
+        for vertical ones</p>
+      </li>
+
+      <li>
+        <p><em>Advance width</em> or <em>advanceX</em></p>
+
+        <p>The horizontal distance the pen position must be incremented (for
+        left-to-right writing) or decremented (for right-to-left writing) by
+        after each glyph is rendered when processing text.  It is always
+        positive for horizontal layouts, and null for vertical ones.</p>
+      </li>
+
+      <li>
+        <p><em>Advance height</em> <em>advanceY</em></p>
+
+        <p>The vertical distance the pen position must be decremented by
+        after each glyph is rendered.  It is always null for horizontal
+        layouts, and positive for vertical layouts.</p>
+      </li>
+
+      <li>
+        <p><em>Glyph width</em></p>
+
+        <p>The glyph's horizontal extent.  For unscaled font coordinates, it
+        is <tt>bbox.xMax-bbox.xMin</tt>.  For scaled glyphs, its computation
+        requests specific care, described in the grid-fitting chapter
+        below.</p>
+      </li>
+
+      <li>
+        <p><em>Glyph height</em>
+
+        <p>The glyph's vertical extent. For unscaled font coordinates, it is
+        <tt>bbox.yMax-bbox.yMin</tt>.  For scaled glyphs, its computation
+        requests specific care, described in the grid-fitting chapter
+        below.</p>
+      </li>
+
+      <li>
+        <p><em>Right side bearing</em></p>
+
+        <p>Only used for horizontal layouts to describe the distance from
+        the bbox's right edge to the advance width.  It is in most cases a
+        non-negative number:</p>
+
+        <p><center>
+          <tt>advance_width - left_side_bearing - (xMax-xMin)</tt>
+        </center></p>
+      </li>
+    </ul>
+
+    <p>Here is a picture giving all the details for horizontal metrics:
+
+    <center><p>
+      <img src="Image3.png"
+           height=253 width=388
+           alt="horizontal glyph metrics">
+    </p></center>
+
+    <p>And here is another one for the vertical metrics:</p>
+
+    <center><p>
+      <img src="Image4.png"
+           height=278 width=294
+           alt="vertical glyph metrics">
+    </p></center>
+
+
+    <a name="section-4">
+    <h3>
+      4. The effects of grid-fitting
+    </h3>
+
+    <p>Because hinting aligns the glyph's control points to the pixel grid,
+    this process slightly modifies the dimensions of character images in
+    ways that differ from simple scaling.</p>
+
+    <p>For example, the image of the lowercase "m" letter sometimes fits a
+    square in the master grid.  However, to make it readable at small pixel
+    sizes, hinting tends to enlarge its scaled outline in order to keep its
+    three legs distinctly visible, resulting in a larger character
+    bitmap.</p>
+
+    <p>The glyph metrics are also influenced by the grid-fitting process:
+
+    <ul>
+      <li>
+        The image's width and height are altered.  Even if this is only by
+        one pixel, it can make a big difference at small pixel sizes.
+      </li>
+      <li>
+        The image's bounding box is modified, thus modifying the bearings.
+      </li>
+      <li>
+        The advances must be updated.  For example, the advance width must
+        be incremented if the hinted bitmap is larger than the scaled one,
+        to reflect the augmented glyph width.
+      </li>
+    </ul>
+
+    <p>This has some implications:</p>
+
+    <ul>
+      <li>
+        Because of hinting, simply scaling the font ascent or descent might
+        not give correct results.  A possible solution is to keepthe ceiling
+        of the scaled ascent, and floor of the scaled descent.
+      </li>
+
+      <li>
+        There is no easy way to get the hinted glyph and advance widths of a
+        range of glyphs, as hinting works differently on each outline.  The
+        only solution is to hint each glyph separately and record the
+        returned values.  Some formats, like TrueType, even include a table
+        of pre-computed values for a small set of common character pixel
+        sizes.
+      </li>
+      <li>
+        Hinting depends on the final character width and height in pixels,
+        which means that it is highly resolution-dependent.  This property
+        makes correct WYSIWYG layouts difficult to implement.
+      </li>
+    </ul>
+
+
+    <em>
+      <p>Performing 2D transformations on glyph outlines is very easy with
+      FreeType.  However, when using translation on a hinted outlines, one
+      should aways take care of <b>exclusively using integer pixel
+      distances</b> (which means that the parameters to the
+      <tt>FT_Translate_Outline()</tt> API should all be multiples
+      of&nbsp;64, as the point coordinates are in 26.6&nbsp;fixed float
+      format).</p>
+
+      <p>Otherwise, the translation will simply <em>ruin the hinter's
+      work</em>, resulting in a very low quality bitmaps!</p>
+    </em>
+
+
+    <a name="section-5">
+    <h3>
+      5. Text widths and bounding box
+    </h3>
+
+    <p>As seen before, the "origin" of a given glyph corresponds to the
+    position of the pen on the baseline.  It is not necessarily located on
+    one of the glyph's bounding box corners, unlike many typical bitmapped
+    font formats.  In some cases, the origin can be out of the bounding box,
+    in others, it can be within it, depending on the shape of the given
+    glyph.</p>
+
+    <p>Likewise, the glyph's "advance width" is the increment to apply to
+    the pen position during layout, and is not related to the glyph's
+    "width", which really is the glyph's bounding width.
+
+    <p>The same conventions apply to strings of text.  This means that:
+
+    <ul>
+      <li>
+        The bounding box of a given string of text doesn't necessarily
+        contain the text cursor, nor is the latter located on one of its
+        corners.
+      </li>
+
+      <li>
+        The string's advance width isn't related to its bounding box
+        dimensions.  Especially if it contains beginning and terminal spaces
+        or tabs.
+      </li>
+      <li>
+        Finally, additional processing like kerning creates strings of text
+        whose dimensions are not directly related to the simple
+        juxtaposition of individual glyph metrics.  For example, the advance
+        width of "VA" isn't the sum of the advances of "V" and "A" taken
+        separately.
+      </li>
+    </ul>
+
+  <p><hr></p>
+
+  <center>
+  <table width="100%"
+         border=0
+         cellpadding=5>
+  <tr bgcolor="#CCFFCC"
+      valign=center>
+    <td align=center
+        width="30%">
+      <a href="glyphs-2.html">Previous</a>
+    </td>
+    <td align=center
+        width="30%">
+      <a href="index.html">Contents</a>
+    </td>
+    <td align=center
+        width="30%">
+      <a href="glyphs-4.html">Next</a>
+    </td>
+  </tr>
+  </table>
+  </center>
+
+</td></tr>
+</table>
+</center>
 
 </body>
 </html>