Commit e67e349a0bb0bb0514f1c90baecc44022c73a12b

Werner Lemberg 2000-10-13T21:00:36

More fixes to the tutorial. Added artificial Type 1 pid/eid paors to ttnameid.h.

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
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
diff --git a/docs/tutorial/step1.html b/docs/tutorial/step1.html
index fc66b12..94fa25b 100644
--- a/docs/tutorial/step1.html
+++ b/docs/tutorial/step1.html
@@ -37,7 +37,7 @@
     Introduction
   </h2>
 
-  <p>This is the first section of the FreeType&nbsp;2 tutorial.  It will
+  <p>This is the first part of the FreeType&nbsp;2 tutorial.  It will
   teach you to do the following:</p>
 
   <ul>
@@ -55,7 +55,7 @@
       1. Header files
     </h3>
 
-    <p>To include the main FreeType header file, simply say</p>
+    <p>To include the main FreeType header file, say</p>
 
     <font color="blue">
     <pre>
@@ -64,7 +64,8 @@
 
     <p>in your application code.  Note that other files are available in the
     FreeType include directory, most of them being included by
-    <tt>freetype.h</tt>.  They will be described later in this tutorial.</p>
+    <tt>freetype.h</tt> and other (internal) files.  Some of them will be
+    described later in this tutorial.</p>
 
     <hr>
 
@@ -104,15 +105,15 @@
       <li>
         Load each module that FreeType knows about in the library.  This
         means that by default, your new <tt>library</tt> object is able to
-        handle TrueType, Type&nbsp;1, CID-keyed & OpenType/CFF fonts
-        gracefully.
+        handle TrueType, Type&nbsp;1, Windows FON, CID-keyed & OpenType/CFF
+        fonts gracefully.
       </li>
     </ul>
 
     <p>As you can see, the function returns an error code, like most others
     in the FreeType API.  An error code of&nbsp;0 <em>always</em> means that
     the operation was successful; otherwise, the value describes the error,
-    and <tt>library</tt> is set to NULL.</p>
+    and <tt>library</tt> is set to <tt>NULL</tt>.</p>
 
     <hr>
 
@@ -150,7 +151,7 @@
     else if ( error )
     {
       ... another error code means that the font file could not
-      ... be opened or read, or simply that it is broken
+      ... be opened or read, or that it is broken
     }</pre>
       </font>
 
@@ -160,24 +161,24 @@
       <table cellpadding=5>
         <tr valign="top">
           <td>
-            <tt><b>library</b></tt>
+            <tt>library</tt>
           </td>
           <td>
-            <p>a handle to the FreeType library instance where the face
+            <p>A handle to the FreeType library instance where the face
             object is created</p>
           </td>
         </tr>
         <tr valign="top">
           <td>
-            <tt><b>filepathname</b></tt>
+            <tt>filepathname</tt>
           </td>
           <td>
-            <p>the font file pathname (standard C string).</p>
+            <p>The font file pathname (a standard C string).</p>
           </td>
         </tr>
         <tr valign="top">
           <td>
-            <tt><b>face_index</b></tt>
+            <tt>face_index</tt>
           </td>
           <td>
             <p>Certain font formats allow several font faces to be embedded
@@ -191,13 +192,13 @@
         </tr>
         <tr valign="top">
           <td>
-            <tt><b>face</b></tt>
+            <tt>face</tt>
           </td>
           <td>
             <p>A <em>pointer</em> to the handle that will be set to describe
             the new face object.</p>
 
-            <p>It is set to NULL in case of error.</p>
+            <p>It is set to <tt>NULL</tt> in case of error.</p>
           </td>
         </tr>
       </table>
@@ -232,9 +233,9 @@
     if ( error ) { ... }</pre>
       </font>
 
-      <p>As you can see, <tt>FT_New_Memory_Face()</tt> simply takes a
-      pointer to the font file buffer and its size in bytes instead of a
-      file pathname.  Other than that, it has exactly the same semantics as
+      <p>As you can see, <tt>FT_New_Memory_Face()</tt> takes a pointer to
+      the font file buffer and its size in bytes instead of a file pathname. 
+      Other than that, it has exactly the same semantics as
       <tt>FT_New_Face()</tt>.</p>
 
       <h4>
@@ -242,14 +243,14 @@
       </h4>
 
       <p>There are cases where using a file pathname or preloading the file
-      in memory is simply not enough.  With FreeType&nbsp;2, it is possible
-      to provide your own implementation of i/o&nbsp;routines.</p>
+      in memory is not sufficient.  With FreeType&nbsp;2, it is possible to
+      provide your own implementation of I/O&nbsp;routines.</p>
 
       <p>This is done through the <tt>FT_Open_Face()</tt> function, which
       can be used to open a new font face with a custom input stream, select
       a specific driver for opening, or even pass extra parameters to the
       font driver when creating the object.  We advise you to refer to the
-      FreeType&nbsp;2 reference manual in order to learn how to use it.</p>
+      FreeType&nbsp;2 API reference in order to learn how to use it.</p>
 
       <p>Note that providing a custom stream might also be used to access a
       TrueType font embedded in a Postscript Type&nbsp;42 wrapper.</p>
@@ -267,7 +268,7 @@
     <table cellpadding=5>
       <tr valign="top">
         <td>
-          <tt><b>face->num_glyphs</b></tt>
+          <tt>face->num_glyphs</tt>
         </td>
         <td>
           <p>Gives the number of <em>glyphs</em> available in the font face.
@@ -277,7 +278,7 @@
       </tr>
       <tr valign="top">
         <td>
-          <tt><b>face->flags</b></tt>
+          <tt>face->flags</tt>
         </td>
         <td>
           <p>A 32-bit integer containing bit flags used to describe some
@@ -290,7 +291,7 @@
       </tr>
       <tr valign="top">
         <td>
-          <tt><b>face->units_per_EM</b></tt>
+          <tt>face->units_per_EM</tt>
         </td>
         <td>
           <p>This field is only valid for scalable formats (it is set
@@ -300,7 +301,7 @@
       </tr>
       <tr valign="top">
         <td>
-          <tt><b>face->num_fixed_sizes</b></tt>
+          <tt>face->num_fixed_sizes</tt>
         </td>
         <td>
           <p>This field gives the number of embedded bitmap <em>strikes</em>
@@ -313,7 +314,7 @@
       </tr>
       <tr valign="top">
         <td>
-          <tt><b>face->fixed_sizes</b></tt>
+          <tt>face->fixed_sizes</tt>
         </td>
         <td>
           <p>This is a pointer to an array of <tt>FT_Bitmap_Size</tt>
@@ -376,7 +377,7 @@
       <li>
         The character width and heights are specified in 1/64th of points.
         A point is a <em>physical</em> distance, equaling 1/72th of an inch;
-        it's not a pixel.
+        it is not a pixel.
       </li>
       <li>
         Horizontal and vertical device resolutions are expressed in
@@ -397,7 +398,7 @@
       </li>
       <li>
         The first argument is a handle to a face object, not a size object.
-        That's normal, and must be seen as a convenience.
+        This behaviour must be seen as a convenience.
       </li>
     </ul>
 
@@ -409,9 +410,9 @@
     <font color="blue">
     <pre>
     error = FT_Set_Pixel_Sizes(
-              face,   /* handle to face object            */
-              0,      /* pixel_width                      */
-              16 );   /* pixel_height                     */</pre>
+              face,   /* handle to face object */
+              0,      /* pixel_width           */
+              16 );   /* pixel_height          */</pre>
     </font>
 
     <p>This example will set the character pixel sizes to 16x16&nbsp;pixels.
@@ -421,7 +422,7 @@
     <p>Note that both functions return an error code.  Usually, an error
     occurs with a fixed-size font format (like FNT or PCF) when trying to
     set the pixel size to a value that is not listed in the
-    <tt>face->fixed_sizes></tt> array.</p>
+    <tt>face->fixed_sizes</tt> array.</p>
 
     <hr>
 
@@ -436,7 +437,7 @@
       <p>Usually, an application wants to load a glyph image based on its
       <em>character code</em>, which is a unique value that defines the
       character for a given <em>encoding</em>.  For example, the character
-      code&nbsp;65 represents the `A' in ASCII encoding.</p>
+      code&nbsp;65 in ASCII encoding represents letter `A'.</p>
 
       <p>A face object contains one or more tables, called
       <em>charmaps</em>, that are used to convert character codes to glyph
@@ -468,10 +469,10 @@
       face.
 
       <p>Note that this is one of the rare FreeType functions that do not
-      return an error code.  However, when a given character code has no
-      glyph image in the face, the value&nbsp;0 is returned.  By convention,
-      it always corresponds to a special glyph image called the <b>missing
-      glyph</b>, which usually is represented as a box or a space.</p>
+      return an error code.  If a given character code has no glyph image in
+      the face, the value&nbsp;0 is returned.  By convention, it always
+      corresponds to a special glyph image called the <em>missing
+      glyph</em>, which usually is represented as a box or a space.</p>
 
       <h4>
         b. Loading a glyph from the face
@@ -481,8 +482,8 @@
       image.  The latter can be stored in various formats within the font
       file.  For fixed-size formats like FNT or PCF, each image is a bitmap.
       Scalable formats like TrueType or Type&nbsp;1 use vectorial shapes,
-      named <em>outlines</em> to describe each glyph.  Some formats may have
-      even more exotic ways of representing glyph (e.g. MetaFont).
+      named <em>outlines</em>, to describe each glyph.  Some formats may have
+      even more exotic ways of representing glyphs (e.g. MetaFont).
       Fortunately, FreeType&nbsp;2 is flexible enough to support any kind of
       glyph format through a simple API.</p>
 
@@ -513,10 +514,10 @@
       <ul>
         <li>
           <p>If a bitmap is found for the corresponding glyph and pixel
-          size, it will be loaded into the slot (embedded bitmaps are always
-          favored over native image formats, because we assume that they are
-          higher-quality versions of the same glyph.  This can be changed by
-          using the <tt>FT_LOAD_NO_BITMAP</tt> flag)</p>
+          size, it will be loaded into the slot.  Embedded bitmaps are
+          always favored over native image formats, because we assume that
+          they are higher-quality versions of the same glyph.  This can be
+          changed by using the <tt>FT_LOAD_NO_BITMAP</tt> flag.</p>
         </li>
         <li>
           <p>Otherwise, a native image for the glyph will be loaded.  It
@@ -554,8 +555,8 @@
       position (on the baseline) to the top-most border of the glyph bitmap.
       <em>It is positive to indicate an upwards distance</em>.</p>
 
-      <p>The second part of the tutorial will describe the contents of a
-      glyph slot and how to access specific glyph information (including
+      <p>The second part of the tutorial describes the contents of a glyph
+      slot and how to access specific glyph information (including
       metrics).</p>
 
       <h4>
@@ -563,18 +564,18 @@
       </h4>
 
       <p>As said before, when a new face object is created, it will look for
-      a Unicode, Latin-1, or ASCII charmap and select it.  The currently
+      a Unicode, Latin-1, or ASCII charmap and select it. The currently
       selected charmap is accessed via <tt>face->charmap</tt>.  This field
-      is NULL if no charmap is selected, which typically happens when you
-      create a new <tt>FT_Face</tt> object from a font file that doesn't
-      contain an ASCII, Latin-1, or Unicode charmap (rare stuff).</p>
+      is <tt>NULL</tt> if no charmap is selected, which typically happens
+      when you create a new <tt>FT_Face</tt> object from a font file that
+      doesn't contain an ASCII, Latin-1, or Unicode charmap (rare
+      stuff).</p>
 
       <p>There are two ways to select a different charmap with
       FreeType&nbsp;2.  The easiest is if the encoding you need already has
-      a corresponding enumeration defined in
-      <tt>&lt;freetype/freetype.h&gt;</tt>, as <tt>ft_encoding_big5</tt>.
-      In this case, you can simply call <tt>FT_Select_CharMap()</tt> as
-      in</p>
+      a corresponding enumeration defined in <tt>freetype/freetype.h</tt>,
+      as <tt>ft_encoding_big5</tt>.  In this case, you can simply call
+      <tt>FT_Select_CharMap()</tt> as in</p>
 
       <font color="blue"><pre>
     error = FT_Select_CharMap(
@@ -582,12 +583,12 @@
               ft_encoding_big5 );   /* encoding           */</pre>
       </font>
 
-      <p>Another way is to manually parse the list of charmaps for the face,
+      <p>Another way is to manually parse the list of charmaps for the face;
       this is accessible through the fields <tt>num_charmaps</tt> and
-      <tt>charmaps</tt> (notice the final 's') of the face object.  As you
-      could expect, the first is the number of charmaps in the face, while
-      the second is <em>a table of pointers to the charmaps</em> embedded in
-      the face.</p>
+      <tt>charmaps</tt> (notice the final 's') of the face object.  As
+      expected, the first is the number of charmaps in the face, while the
+      second is <em>a table of pointers to the charmaps</em> embedded in the
+      face.</p>
 
       <p>Each charmap has a few visible fields used to describe it more
       precisely.  Mainly, one will look at <tt>charmap->platform_id</tt> and
@@ -595,16 +596,20 @@
       be used to describe the charmap in a rather generic way.</p>
 
       <p>Each value pair corresponds to a given encoding.  For example, the
-      pair (3,1) corresponds to Unicode.  A list of such pairs is defined in
-      the TrueType specification, but you can also use the file
-      <tt>&lt;freetype/ftnameid.h&gt;</tt> which defines several helpful
-      constants to deal with them.</p>
+      pair (3,1) corresponds to Unicode (on the Windows platform).  A list
+      of such pairs is defined in the TrueType specification, but you can
+      also use the file <tt>&lt;freetype/ttnameid.h&gt;</tt> which defines
+      several helpful constants to deal with them.</p>
+
+      <p>Note that some pid/eid pairs are <em>artificial</em>; such values
+      have been created by FreeType to identify platforms resp. encodings
+      not covered by the original TrueType specification.</p>
 
       <p>To look up a specific encoding you need to find a corresponding
-      value pair in the specification, then look for it in the charmaps
-      list.  Bear in mind that some encodings correspond to several values
-      pairs (yes, it's a real mess, but blame Apple and Microsoft on such
-      stupidity).  Here some code to do it:</p>
+      value pair in the specification, then look for it in the
+      <tt>charmaps</tt> list.  Bear in mind that some encodings correspond
+      to several values pairs (yes, it's a real mess, but blame Apple and
+      Microsoft on such stupidity).  Here some code to do it:</p>
 
       <font color="blue">
       <pre>
@@ -654,26 +659,26 @@
       </font>
 
       <p>This function will set the current transformation for a given face
-      object.  Its second parameter is a pointer to a <tt>FT_Matrix</tt>
-      structure that describes a 2x2 affine matrix.  The third parameter is
-      a pointer to a <tt>FT_Vector</tt> structure that describes a simple 2d
-      vector that is used to translate the glyph image <em>after</em> the
-      2x2 transformation.</p>
+      object.  Its second parameter is a pointer to an <tt>FT_Matrix</tt>
+      structure that describes a 2x2&nbsp;affine matrix.  The third
+      parameter is a pointer to an <tt>FT_Vector</tt> structure that
+      describes a simple 2d&nbsp;vector that is used to translate the glyph
+      image <em>after</em> the 2x2&nbsp;transformation.</p>
 
-      <p>Note that the matrix pointer can be set to NULL, in which case the
-      identity transformation will be used.  Coefficients of the matrix are
-      otherwise in 16.16 fixed float units.</p>
+      <p>Note that the matrix pointer can be set to <tt>NULL</tt>, in which
+      case the identity transformation will be used.  Coefficients of the
+      matrix are otherwise in 16.16 fixed float units.</p>
 
-      <p>The vector pointer can also be set to NULL in which case a delta
-      vector of (0,0) will be used.  The vector coordinates are expressed in
-      1/64th of a pixel (also known as 26.6 fixed floats).</p>
+      <p>The vector pointer can also be set to <tt>NULL</tt> in which case a
+      delta vector of (0,0) will be used.  The vector coordinates are
+      expressed in 1/64th of a pixel (also known as 26.6 fixed floats).</p>
 
       <p><em>The transformation is applied to every glyph that is loaded
       through <tt>FT_Load_Glyph()</tt> and is <b>completely independent of
       any hinting process.</b> This means that you won't get the same
       results if you load a glyph at the size of 24&nbsp;pixels, or a glyph
       at the size at 12&nbsp;pixels scaled by&nbsp;2 through a
-      transformation, because the hints will have been computed differently
+      transformation, because hints will have been computed differently
       (unless hints have been disabled, of course).</em></p>
 
       <p>If you ever need to use a non-orthogonal transformation with
@@ -692,9 +697,8 @@
       7. Simple text rendering
     </h3>
 
-    <p>We will now present you with a very simple example used to render a
-    string of 8-bit Latin-1 text, assuming a face that contains a Unicode
-    charmap</p>
+    <p>We will now present a very simple example used to render a string of
+    8-bit Latin-1 text, assuming a face that contains a Unicode charmap</p>
 
     <p>The idea is to create a loop that will, on each iteration, load one
     glyph image, convert it to an anti-aliased bitmap, draw it on the target
@@ -764,9 +768,9 @@
           truncated to integer pixels on each iteration.
         </li>
         <li>
-          The function <tt>my_draw_bitmap()</tt> is not part of FreeType,
-          but must be provided by the application to draw the bitmap to the
-          target surface.  In this example, it takes a pointer to a
+          The function <tt>my_draw_bitmap()</tt> is not part of FreeType but
+          must be provided by the application to draw the bitmap to the
+          target surface.  In this example, it takes a pointer to an
           <tt>FT_Bitmap</tt> descriptor and the position of its top-left
           corner as arguments.
         </li>
@@ -834,8 +838,8 @@
           equivalent.</p>
 
           <p>Note that you can also specify that you want a monochrome
-          bitmap instead by using the additional <tt>FT_LOAD_MONOCHROME</tt>
-          load flag.</p>
+          bitmap by using the <tt>FT_LOAD_MONOCHROME</tt> load flag
+          instead.</p>
         </li>
       </ul>
 
@@ -850,7 +854,7 @@
     FT_Matrix     matrix;              /* transformation matrix */
     FT_UInt       glyph_index;
     FT_Vector     pen;                 /* untransformed origin */
-    int           pen_x, pen_y, n;
+    int           n;
 
 
     .. initialize library ..
@@ -896,8 +900,8 @@
           multiplication.  The position is expressed in cartesian space.
         </li>
         <li>
-          Glyph images are always loaded, transformed, and described in the
-          cartesian coordinate system in FreeType (which means that
+          In FreeType, glyph images are always loaded, transformed, and
+          described in the cartesian coordinate system (which means that
           increasing&nbsp;Y corresponds to upper scanlines), unlike the
           system typically used for bitmaps (where the top-most scanline has
           coordinate&nbsp;0).  We must thus convert between the two systems
@@ -905,8 +909,8 @@
           position of the bitmap.
         </li>
         <li>
-          We set the transformation on each glyph to indicate the rotation
-          matrix, as well as a delta vector that will move the transformed
+          We apply the transformation matrix on each glyph to indicate
+          rotation as well as a delta vector that will move the transformed
           image to the current pen position (in cartesian space, not bitmap
           space).
         </li>
@@ -931,13 +935,12 @@
       Conclusion
     </h3>
 
-    <p>In this first section, you have learned the basics of
-    FreeType&nbsp;2, as well as sufficient knowledge how to render rotated
-    text.</p>
+    <p>In this first section, you have learned the basics of FreeType&nbsp;2
+    as well as sufficient knowledge how to render rotated text.</p>
 
     <p>The next part will dive into more details of the API in order to let
-    you access glyph metrics and images directly, as well as how to deal
-    with scaling, hinting, kerning, etc.</p>
+    you access glyph metrics and images directly, how to deal with scaling,
+    hinting, kerning, etc.</p>
 
     <p>The third part will discuss issues like modules, caching, and a few
     other advanced topics like how to use multiple size objects with a
diff --git a/docs/tutorial/step2.html b/docs/tutorial/step2.html
index 2425463..1c8c94d 100644
--- a/docs/tutorial/step2.html
+++ b/docs/tutorial/step2.html
@@ -37,8 +37,8 @@
     Introduction
   </h2>
 
-  <p>This is the second section of the FreeType&nbsp;2 tutorial.  It will
-  teach you the following:</p>
+  <p>This is the second part of the FreeType&nbsp;2 tutorial.  It will teach
+  you the following:</p>
 
   <ul>
     <li>how to retrieve glyph metrics</li>
@@ -69,8 +69,8 @@
 
     <p>Note that only a few font formats provide vertical metrics.  You can
     test wether a given face object contains them by using the macro
-    <tt>FT_HAS_VERTICAL(face)</tt>, which is true if has vertical
-    metrics.</p>
+    <tt>FT_HAS_VERTICAL(face)</tt>, which is true if vertical metrics are
+    available.</p>
 
     <p>Individual glyph metrics can be accessed by first loading the glyph
     in a face's glyph slot, then using the <tt>face->glyph->metrics</tt>
@@ -85,7 +85,7 @@
       </td>
       <td>
         This is the width of the glyph image's bounding box.  It is
-        independent of layout direction.
+        independent of the layout direction.
       </td>
     </tr>
     <tr valign=top>
@@ -94,7 +94,7 @@
       </td>
       <td>
         This is the height of the glyph image's bounding box.  It is
-        independent of layout direction.
+        independent of the layout direction.
       </td>
     </tr>
     <tr valign=top>
@@ -165,8 +165,8 @@
     should not be considered reliable if <tt>FT_HAS_VERTICAL(face)</tt> is
     false.</em></p>
 
-    <p>The following graphics illustrate the metrics more clearly.  First,
-    for horizontal metrics, where the baseline is the horizontal axis:</p>
+    <p>The following graphics illustrate the metrics more clearly.  First
+    horizontal metrics, where the baseline is the horizontal axis:</p>
 
     <center>
       <img src="metrics.png"
@@ -221,7 +221,7 @@
         multiple of&nbsp;64) by the font driver used to load the glyph
         image.  <tt>linearHoriAdvance</tt> is a 16.16 fixed float number
         that gives the value of the original glyph advance width in
-        1/65536th of pixels.  It can be use to perform pseudo
+        1/65536th of pixels.  It can be used to perform pseudo
         device-independent text layouts.
       </td>
     </tr>
@@ -250,9 +250,9 @@
     glyph image, the previous one is erased from the glyph slot.</p>
 
     <p>There are times, however, where you may need to extract this image
-    from the glyph slot, in order to cache it within your application, and
-    even perform additional transformations and measures on it before
-    converting it to a bitmap.</p>
+    from the glyph slot.  For example, you want to cache images within your
+    application, or you want to apply additional transformations and
+    measures on it before converting it to a bitmap.</p>
 
     <p>The FreeType&nbsp;2 API has a specific extension which is capable of
     dealing with glyph images in a flexible and generic way.  To use it, you
@@ -297,11 +297,11 @@
         <li>
           loaded the glyph image normally in the face's glyph slot.  We did
           not use <tt>FT_LOAD_RENDER</tt> because we want to grab a scalable
-          glyph image, in order to transform it later,
+          glyph image in order to transform it later,
         </li>
         <li>
           copied the glyph image from the slot into a new <tt>FT_Glyph</tt>
-          object, by calling <tt>FT_Get_Glyph()</tt>.  This function returns
+          object by calling <tt>FT_Get_Glyph()</tt>.  This function returns
           an error code and sets <tt>glyph</tt>.
         </li>
       </ul>
@@ -313,25 +313,25 @@
 
       <p>You can access the field <tt>glyph->format</tt> if you want to know
       exactly how the glyph is modeled and stored.  A new glyph object can
-      be destroyed with a call to <tt>FT_Done_Glyph</tt>.</p>
+      be destroyed with a call to <tt>FT_Done_Glyph()</tt>.</p>
 
-      <p>The glyph object contains exactly one glyph image and a 2d vector
-      representing the glyph's advance in 16.16 fixed float coordinates.
-      The latter can be accessed directly as <tt>glyph->advance</tt>.</p>
+      <p>The glyph object contains exactly one glyph image and a
+      2d&nbsp;vector representing the glyph's advance in 16.16 fixed float
+      coordinates.  The latter can be accessed directly as
+      <tt>glyph->advance</tt>.</p>
 
       <p><em>Note that unlike other FreeType objects, the library doesn't
       keep a list of all allocated glyph objects.  This means you will need
       to destroy them yourself, instead of relying on
-      <tt>FT_Done_FreeType()</tt> doing all the clean-up.</em></p>
+      <tt>FT_Done_FreeType()</tt> to do all the clean-up.</em></p>
 
       <h4>
         b. Transforming & copying the glyph image
       </h4>
 
       <p>If the glyph image is scalable (i.e., if <tt>glyph->format</tt> is
-      not equal to <tt>ft_glyph_format_bitmap</tt>), it is possible to
-      transform the image anytime by a call to
-      <tt>FT_Glyph_Transform()</tt>.</p>
+      not <tt>ft_glyph_format_bitmap</tt>), it is possible to transform the
+      image anytime by a call to <tt>FT_Glyph_Transform()</tt>.</p>
 
       <p>You can also copy a single glyph image with
       <tt>FT_Glyph_Copy()</tt>.  Here some example code:</p>
@@ -362,18 +362,20 @@
     matrix.yx = 0.12 * 0x10000L;
     matrix.yy = 0x10000L;
 
-    FT_Glyph_Transform( glyph2, &amplmatrix, 0 );</pre>
+    FT_Glyph_Transform( glyph2, &amp;matrix, 0 );</pre>
       </font>
 
-      <p>Note that the 2x2 transform matrix is always applied to the 16.16
-      advance vector in the glyph; you thus don't need to recompute it.</p>
+      <p>Note that the 2x2&nbsp;transformation matrix is always applied to
+      the 16.16 advance vector in the glyph; you thus don't need to
+      recompute it.</p>
 
       <h4>
         c. Measuring the glyph image
       </h4>
 
       <p>You can also retrieve the control (bounding) box of any glyph image
-      (scalable or not), using the <tt>FT_Glyph_Get_CBox</tt> function:</p>
+      (scalable or not), using the <tt>FT_Glyph_Get_CBox()</tt>
+      function:</p>
 
       <font color="blue">
       <pre>
@@ -386,8 +388,8 @@
 
       <p>Coordinates are relative to the glyph origin, i.e. (0,0), using the
       Y&nbsp;upwards convention.  This function takes a special argument,
-      the <em>bbox mode</em>, to indicate how box coordinates are expressed.
-      If <tt>bbox_mode</tt> is set to <tt>ft_glyph_bbox_subpixels</tt>, the
+      <tt>bbox_mode</tt>, to indicate how box coordinates are expressed.  If
+      <tt>bbox_mode</tt> is set to <tt>ft_glyph_bbox_subpixels</tt>, the
       coordinates are returned in 26.6 pixels (i.e. 1/64th of pixels).
 
       <p>Note that the box's maximum coordinates are exclusive, which means
@@ -412,10 +414,10 @@
     bbox.yMax = CEILING(bbox.yMax)</pre>
       </font>
 
-      <p>The default value for the bbox mode is
+      <p>The default value for <tt>bbox_mode</tt> is
       <tt>ft_glyph_bbox_pixels</tt> (i.e. integer, grid-fitted pixel
-      coordinates).  Please check the API reference for
-      <tt>FT_Glyph_Get_CBox()</tt> other possible values</p>
+      coordinates).  Please check the API reference of
+      <tt>FT_Glyph_Get_CBox()</tt> for other possible values.</p>
 
       <h4>
         d. Converting the glyph image to a bitmap
@@ -430,7 +432,7 @@
     FT_Vector  origin;
 
 
-    origin.x = 32;   /* 1/2 pixel in 26.26 format */
+    origin.x = 32;   /* 1/2 pixel in 26.6 format */
     origin.y = 0;
 
     error = FT_Glyph_To_Bitmap( &amp;glyph,
@@ -455,12 +457,12 @@
           or <tt>ft_render_mode_mono</tt> for a 1-bit monochrome bitmap.
         </li>
         <li>
-          The third parameter is a pointer to a 2d vector that is used to
-          translate the source glyph image before the conversion.  Note that
-          the source image will be translated back to its original position
-          (and will thus be left unchanged) after the call.  If you do not
-          need to translate the source glyph before rendering, set this
-          pointer to&nbsp;0.
+          The third parameter is a pointer to a 2d&nbsp;vector that is used
+          to translate the source glyph image before the conversion.  Note
+          that the source image will be translated back to its original
+          position (and will thus be left unchanged) after the call.  If you
+          do not need to translate the source glyph before rendering, set
+          this pointer to&nbsp;0.
         </li>
         <li>
           The last parameter is a Boolean to indicate whether the source
@@ -530,13 +532,12 @@
       <p>For scalable formats, all global metrics are expressed in font
       units in order to be later scaled to device space, according to the
       rules described in the last chapter of this part of the tutorial.  You
-      can access them directly as simple fields of a <tt>FT_Face</tt>
-      handle.</p>
+      can access them directly as fields of an <tt>FT_Face</tt> handle.</p>
 
       <p>However, you need to check that the font face's format is scalable
-      before using them.  One can do it by using the macro
-      <tt>FT_IS_SCALABLE(face)</tt> which returns true if we have a
-      scalable format.</p>
+      before using them.  This can be done with the macro
+      <tt>FT_IS_SCALABLE(face)</tt> which returns true if we have a scalable
+      format.</p>
 
       <p>In this case, you can access the global design metrics as</p>
 
@@ -659,7 +660,7 @@
         b. Scaled global metrics
       </h4>
 
-      <p>Each size object also contains a scaled versions of some of the
+      <p>Each size object also contains scaled versions of some of the
       global metrics described above.  They can be accessed directly through
       the <tt>face->size->metrics</tt> structure.</p>
 
@@ -749,7 +750,10 @@
     if ( error ) { ... }
 
     error = FT_Attach_File( face, "/usr/shared/fonts/cour.afm" );
-    if ( error ) { .. could not read kerning and additional metrics .. }</pre>
+    if ( error )
+    {
+      .. could not read kerning and additional metrics ..
+    }</pre>
       </font>
 
       <p>Note that <tt>FT_Attach_Stream()</tt> is similar to
@@ -785,10 +789,9 @@
       a pointer to a destination vector that receives the corresponding
       distances.</p>
 
-      <p>The kerning mode is very similar to the <em>bbox mode</em>
-      described in a previous part.  It is an enumeration value that
-      indicates how the kerning distances are expressed in the target
-      vector.</p>
+      <p>The kerning mode is very similar to <tt>bbox_mode</tt> described in
+      a previous part.  It is an enumeration value that indicates how the
+      kerning distances are expressed in the target vector.</p>
 
       <p>The default value <tt>ft_kerning_mode_default</tt> (which has
       value&nbsp;0) corresponds to kerning distances expressed in 26.6
@@ -808,8 +811,8 @@
 
       <p>Note that the "left" and "right" positions correspond to the
       <em>visual order</em> of the glyphs in the string of text.  This is
-      important for bi-directional text, or simply when writing
-      right-to-left text.</p>
+      important for bidirectional text, or when writing right-to-left
+      text.</p>
 
     <hr>
 
@@ -817,10 +820,9 @@
       4. Simple text rendering: kerning + centering
     </h3>
 
-    <p>In order to show off what we have just learned, we will now show how
-    to modify the example code that was provided in the first part to render
-    a string of text, and enhance it to support kerning and delayed
-    rendering.</p>
+    <p>In order to show off what we have just learned, we will now modify
+    the example code that was provided in the first part to render a string
+    of text, and enhance it to support kerning and delayed rendering.</p>
 
       <h4>
         a. Kerning support
@@ -828,9 +830,9 @@
 
       <p>Adding support for kerning to our code is trivial, as long as we
       consider that we are still dealing with a left-to-right script like
-      Latin.  We simply need to retrieve the kerning distance between two
-      glyphs in order to alter the pen position appropriately.  The code
-      looks like</p>
+      Latin.  We need to retrieve the kerning distance between two glyphs in
+      order to alter the pen position appropriately.  The code looks
+      like</p>
 
       <font color="blue">
       <pre>
@@ -913,7 +915,7 @@
         <li>
           We do not check the error code returned by
           <tt>FT_Get_Kerning()</tt>.  This is because the function always
-          set the content of <tt>delta</tt> to (0,0) when an error occurs.
+          set <tt>delta</tt> to (0,0) when an error occurs.
         </li>
       </ul>
 
@@ -1000,7 +1002,7 @@
     }</pre>
       </font>
 
-      <p>As you see, this is a very simple variation of our previous code
+      <p>As you see, this is a very slight variation of our previous code
       where we extract each glyph image from the slot, and store it, along
       with the corresponding position, in our tables.</p>
 
@@ -1020,7 +1022,7 @@
       bbox.xMax = bbox.yMax = -32000;
 
       /* for each glyph image, compute its bounding box, */
-      /* translateit, and grow the string bbox           */
+      /* translate it, and grow the string bbox          */
       for ( n = 0; n &lt; num_glyphs; n++ )
       {
         FT_BBox  glyph_bbox;
@@ -1111,7 +1113,7 @@
           We call <tt>FT_Glyph_To_Bitmap()</tt> with the <tt>destroy</tt>
           parameter set to&nbsp;0 (false), in order to avoid destroying the
           original glyph image.  The new glyph bitmap is accessed through
-          <tt>image</tt> after the call and is typecasted to a
+          <tt>image</tt> after the call and is typecast to an
           <tt>FT_BitmapGlyph</tt>.
         </li>
         <li>
@@ -1304,7 +1306,7 @@
       </h4>
 
       <p>However, directly transforming the glyphs in our sequence is not a
-      useful idea if we want to re-use them in order to draw the text string
+      useful idea if we want to reuse them in order to draw the text string
       with various angles or transforms.  It is better to perform the affine
       transformation just before the glyph is rendered, as in the following
       code:</p>
@@ -1403,8 +1405,8 @@
       </ul>
 
       <p>It is possible to call this function several times to render the
-      string width different angles, or even change the way <tt>start</tt>
-      is computed in order to move it to different place.</p>
+      string with different angles, or even change the way <tt>start</tt>
+      is computed in order to move it to a different place.</p>
 
       <p>This code is the basis of the FreeType&nbsp;2 demonstration program
       named <tt>ftstring.c</tt>.  It could be easily extended to perform
@@ -1421,15 +1423,15 @@
     <hr>
 
     <h3>
-      6. Accessing metrics in design font units, and scaling them
+      6. Accessing metrics in design font units and scaling them
     </h3>
 
     <p>Scalable font formats usually store a single vectorial image, called
-    an <em>outline</em>, for each in a face.  Each outline is defined in an
-    abstract grid called the <em>design space</em>, with coordinates
+    an <em>outline</em>, for each glyph in a face.  Each outline is defined
+    in an abstract grid called the <em>design space</em>, with coordinates
     expressed in nominal <em>font units</em>.  When a glyph image is loaded,
     the font driver usually scales the outline to device space according to
-    the current character pixel size found in a <tt>FT_Size</tt> object.
+    the current character pixel size found in a <tt>FT_Size</tt> object. 
     The driver may also modify the scaled outline in order to significantly
     improve its appearance on a pixel-based surface (a process known as
     <em>hinting</em> or <em>grid-fitting</em>).</p>
@@ -1494,10 +1496,10 @@
           <tt>x_ppem</t>
         </td>
         <td>
-          Which stands for "X Pixels Per EM"; this is the size in integer
-          pixels of the EM square, which also is the <em>horizontal
-          character pixel size</em>, called <tt>pixel_size_x</tt> in the
-          above example.
+          This is the size in integer pixels of the EM square, which also is
+          the <em>horizontal character pixel size</em>, called
+          <tt>pixel_size_x</tt> in the above example.  <tt>x_ppem</tt> means
+          "x&nbsp;pixels per EM".
         </td>
       </tr>
       <tr valign=top>
@@ -1505,10 +1507,10 @@
           <tt>y_ppem</tt>
         </td>
         <td>
-          Which stands for "Y Pixels Per EM"; this is the size in integer
-          pixels of the EM square, which also is the <em>vertical character
-          pixel size</em>, called <tt>pixel_size_y</tt> in the above
-          example.
+          This is the size in integer pixels of the EM square, which also is
+          the <em>vertical character pixel size</em>, called
+          <tt>pixel_size_y</tt> in the above example.  <tt>y_ppem</tt> means
+          "y&nbsp;pixels per EM".
         </td>
       </tr>
       <tr valign=top>
@@ -1532,9 +1534,9 @@
       </table>
       </center>
 
-      <p>Basically, this means that you can scale a distance expressed in
-      font units to 26.6 pixels directly with the help of the
-      <tt>FT_MulFix()</tt> function, as in:</p>
+      <p>You can scale a distance expressed in font units to 26.6 pixels
+      directly with the help of the <tt>FT_MulFix()</tt> function, as
+      in:</p>
 
       <font color="blue">
       <pre>
@@ -1567,12 +1569,12 @@
         b. Accessing design metrics (glyph & global)
       </h4>
 
-      <p>You can access glyph metrics in font units simply by specifying the
+      <p>You can access glyph metrics in font units by specifying the
       <tt>FT_LOAD_NO_SCALE</tt> bit flag in <tt>FT_Load_Glyph()</tt> or
       <tt>FT_Load_Char()</tt>.  The metrics returned in
       <tt>face->glyph->metrics</tt> will then all be in font units.</p>
 
-      <p>You can access unscaled kerning data using the
+      <p>Unscaled kerning data can be retrieved using the
       <tt>ft_kerning_mode_unscaled</tt> mode.</p>
 
       <p>Finally, a few global metrics are available directly in font units
@@ -1590,9 +1592,8 @@
     render text much more intelligently (kerning, measuring, transforming
     & caching).</p>
 
-    <p>You have now sufficient knowledge to build a pretty decent text
-    service on top of FreeType&nbsp;2, and you could possibly stop there if
-    you want.</p>
+    <p>With this knowledge you can build a pretty decent text service on top
+    of FreeType&nbsp;2, and you could possibly stop there if you want.</p>
 
     <p>The next section will deal with FreeType&nbsp;2 internals (like
     modules, vector outlines, font drivers, renderers), as well as a few
diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h
index d3ae752..dc22eb9 100644
--- a/include/freetype/freetype.h
+++ b/include/freetype/freetype.h
@@ -359,9 +359,8 @@
   /* <Fields>                                                              */
   /*    face        :: A handle to the parent face object.                 */
   /*                                                                       */
-  /*    flags       :: A set of bit flags used to describe the charmap.    */
-  /*                   Each bit indicates that a given encoding is         */
-  /*                   supported.                                          */
+  /*    encoding    :: A tag which identifies the charmap.  Use this with  */
+  /*                   FT_Select_Charmap().                                */
   /*                                                                       */
   /*    platform_id :: An ID number describing the platform for the        */
   /*                   following encoding ID.  This comes directly from    */
diff --git a/include/freetype/ttnameid.h b/include/freetype/ttnameid.h
index e76ff61..6bd0815 100644
--- a/include/freetype/ttnameid.h
+++ b/include/freetype/ttnameid.h
@@ -35,6 +35,9 @@
 #define TT_PLATFORM_ISO            2 /* deprecated */
 #define TT_PLATFORM_MICROSOFT      3
 
+  /* artificial values defined ad-hoc by FreeType */
+#define TT_PLATFORM_ADOBE          7
+
 
   /*************************************************************************/
   /*                                                                       */
@@ -120,6 +123,19 @@
 
   /*************************************************************************/
   /*                                                                       */
+  /* possible values of the platform specific encoding identifier field in */
+  /* the name records of the TTF `name' table if the `platform' identifier */
+  /* code is TT_PLATFORM_ADOBE.                                            */
+  /*                                                                       */
+  /* These are artificial values defined ad-hoc by FreeType.               */
+  /*                                                                       */
+#define TT_ADOBE_ID_STANDARD  0
+#define TT_ADOBE_ID_EXPERT    1
+#define TT_ADOBE_ID_CUSTOM    2
+
+
+  /*************************************************************************/
+  /*                                                                       */
   /* Possible values of the language identifier field in the name records  */
   /* of the TTF `name' table if the `platform' identifier code is          */
   /* TT_PLATFORM_MACINTOSH.                                                */
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
index bfa440e..f812110 100644
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -2230,8 +2230,8 @@
   /*    decoding.                                                          */
   /*                                                                       */
   /* <Input>                                                               */
-  /*    face     :: A handle to the source face object.                    */
-  /*    charmap  :: A handle to the selected charmap.                      */
+  /*    face    :: A handle to the source face object.                     */
+  /*    charmap :: A handle to the selected charmap.                       */
   /*                                                                       */
   /* <Return>                                                              */
   /*    FreeType error code.  0 means success.                             */