Commit 7f2425fb4f7d77d8e43907451d26b466b1c4d349

Werner Lemberg 2007-10-20T16:15:07

Formatting, improving documentation.

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
diff --git a/ChangeLog b/ChangeLog
index e3aac5a..81ed2e8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,15 +1,33 @@
 2007-10-18  David Turner  <david@freetype.org>
 
-	* include/freetype/freetype.h, src/base/ftobjs.c: renamed
-	cmap14-related new APIs to the FT_Object_ActionName scheme.
-	update the documentation for these APIs
-
-	* src/sfnt/ttcmap.c: stronger cmap 14 validation, make the
-	code a little more consistent with FreeType coding conventions
-	and modify the cmap14 functions that returned a newly allocated
-	array to use a persistent vector from the TT_CMap14 object
+	* include/freetype/freetype.h, src/base/ftobjs.c: Rename API
+	functions related to cmap type 14 support to the
+	`FT_Object_ActionName' scheme:
+
+	  FT_Get_Char_Variant_index     -> FT_Face_GetCharVariantIndex
+	  FT_Get_Char_Variant_IsDefault -> FT_Face_GetCharVariantIsDefault
+	  FT_Get_Variant_Selectors      -> FT_Face_GetVariantSelectors
+	  FT_Get_Variants_Of_Char       -> FT_Face_GetVariantsOfChar
+	  FT_Get_Chars_Of_Variant       -> FT_Face_GetCharsOfVariant
+
+	Update documentation accordingly.
+
+	* src/sfnt/ttcmap.c: Stronger cmap 14 validation.
+	Make the code a little more consistent with FreeType coding
+	conventions and modify the cmap14 functions that returned a newly
+	allocated array to use a persistent vector from the TT_CMap14 object
 	instead.
 
+	(TT_CMap14Rec): Provide array and auxiliary data for result.
+	(tt_cmap14_done, tt_cmap14_ensure): New functions.
+
+	(tt_cmap14_init, tt_cmap14_validate, tt_cmap14_char_map_def_binary,
+	tt_cmap14_char_map_nondef_binary, tt_cmap14_find_variant,
+	tt_cmap14_char_var_index, tt_cmap14_variants,
+	tt_cmap14_char_variants, tt_cmap14_def_char_count,
+	tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
+	tt_cmap14_variant_chars, tt_cmap14_class_rec): Updated and improved.
+
 2007-10-15  George Williams  <gww@silcom.com>
 
 	Add support for cmap type 14.
diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h
index 8efc560..4399c8e 100644
--- a/include/freetype/freetype.h
+++ b/include/freetype/freetype.h
@@ -2995,6 +2995,147 @@ FT_BEGIN_HEADER
   /*************************************************************************/
   /*                                                                       */
   /* <Function>                                                            */
+  /*    FT_Get_Name_Index                                                  */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    Return the glyph index of a given glyph name.  This function uses  */
+  /*    driver specific objects to do the translation.                     */
+  /*                                                                       */
+  /* <Input>                                                               */
+  /*    face       :: A handle to the source face object.                  */
+  /*                                                                       */
+  /*    glyph_name :: The glyph name.                                      */
+  /*                                                                       */
+  /* <Return>                                                              */
+  /*    The glyph index.  0 means `undefined character code'.              */
+  /*                                                                       */
+  FT_EXPORT( FT_UInt )
+  FT_Get_Name_Index( FT_Face     face,
+                     FT_String*  glyph_name );
+
+
+  /*************************************************************************
+   *
+   * @macro:
+   *   FT_SUBGLYPH_FLAG_XXX
+   *
+   * @description:
+   *   A list of constants used to describe subglyphs.  Please refer to the
+   *   TrueType specification for the meaning of the various flags.
+   *
+   * @values:
+   *   FT_SUBGLYPH_FLAG_ARGS_ARE_WORDS ::
+   *   FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES ::
+   *   FT_SUBGLYPH_FLAG_ROUND_XY_TO_GRID ::
+   *   FT_SUBGLYPH_FLAG_SCALE ::
+   *   FT_SUBGLYPH_FLAG_XY_SCALE ::
+   *   FT_SUBGLYPH_FLAG_2X2 ::
+   *   FT_SUBGLYPH_FLAG_USE_MY_METRICS ::
+   *
+   */
+#define FT_SUBGLYPH_FLAG_ARGS_ARE_WORDS          1
+#define FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES      2
+#define FT_SUBGLYPH_FLAG_ROUND_XY_TO_GRID        4
+#define FT_SUBGLYPH_FLAG_SCALE                   8
+#define FT_SUBGLYPH_FLAG_XY_SCALE             0x40
+#define FT_SUBGLYPH_FLAG_2X2                  0x80
+#define FT_SUBGLYPH_FLAG_USE_MY_METRICS      0x200
+
+
+  /*************************************************************************
+   *
+   * @func:
+   *   FT_Get_SubGlyph_Info
+   *
+   * @description:
+   *   Retrieve a description of a given subglyph.  Only use it if
+   *   `glyph->format' is @FT_GLYPH_FORMAT_COMPOSITE, or an error is
+   *   returned.
+   *
+   * @input:
+   *   glyph ::
+   *     The source glyph slot.
+   *
+   *   sub_index ::
+   *     The index of subglyph.  Must be less than `glyph->num_subglyphs'.
+   *
+   * @output:
+   *   p_index ::
+   *     The glyph index of the subglyph.
+   *
+   *   p_flags ::
+   *     The subglyph flags, see @FT_SUBGLYPH_FLAG_XXX.
+   *
+   *   p_arg1 ::
+   *     The subglyph's first argument (if any).
+   *
+   *   p_arg2 ::
+   *     The subglyph's second argument (if any).
+   *
+   *   p_transform ::
+   *     The subglyph transformation (if any).
+   *
+   * @return:
+   *   FreeType error code.  0 means success.
+   *
+   * @note:
+   *   The values of `*p_arg1', `*p_arg2', and `*p_transform' must be
+   *   interpreted depending on the flags returned in `*p_flags'.  See the
+   *   TrueType specification for details.
+   *
+   */
+  FT_EXPORT( FT_Error )
+  FT_Get_SubGlyph_Info( FT_GlyphSlot  glyph,
+                        FT_UInt       sub_index,
+                        FT_Int       *p_index,
+                        FT_UInt      *p_flags,
+                        FT_Int       *p_arg1,
+                        FT_Int       *p_arg2,
+                        FT_Matrix    *p_transform );
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Section>                                                             */
+  /*    glyph_variants                                                     */
+  /*                                                                       */
+  /* <Title>                                                               */
+  /*    Glyph Variants                                                     */
+  /*                                                                       */
+  /* <Abstract>                                                            */
+  /*    The FreeType 2 interface to Unicode Ideographic Variation          */
+  /*    Sequences (IVS), using the SFNT cmap format 14.                    */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    Many CJK characters have variant forms.  They are a sort of grey   */
+  /*    area somewhere between being totally irrelevant and semantically   */
+  /*    distinct; for this reason, the Unicode consortium decided to       */
+  /*    introduce Ideographic Variation Sequences (IVS), consisting of a   */
+  /*    Unicode base character and one of 240 variant selectors            */
+  /*    (U+E0100-U+E01EF), instead of further extending the already huge   */
+  /*    code range for CJK characters.                                     */
+  /*                                                                       */
+  /*    An IVS is registered and unique; for further details please refer  */
+  /*    to Unicode Technical Report #37, the Ideographic Variation         */
+  /*    Database.  To date (October 2007), the character with the most     */
+  /*    variants is U+908A, having 8 such IVS.                             */
+  /*                                                                       */
+  /*    Adobe and MS decided to support IVS with a new cmap subtable       */
+  /*    (format 14).  It is an odd subtable because it is not a mapping of */
+  /*    input code points to glyphs, but contains lists of all variants    */
+  /*    supported by the font.                                             */
+  /*                                                                       */
+  /*    A variant may be either `default' or `non-default'.  A default     */
+  /*    variant is the one you will get for that code point if you look it */
+  /*    up in the standard Unicode cmap.  A non-default variant is a       */
+  /*    different glyph.                                                   */
+  /*                                                                       */
+  /*************************************************************************/
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Function>                                                            */
   /*    FT_Face_GetCharVariantIndex                                        */
   /*                                                                       */
   /* <Description>                                                         */
@@ -3023,10 +3164,13 @@ FT_BEGIN_HEADER
   /*    the file.  This is done to ensure that value 0 always corresponds  */
   /*    to the `missing glyph'.                                            */
   /*                                                                       */
-  /* <Note>                                                                */
-  /*    This function is only meaningful if:                               */
-  /*      a) the font has a variation selector cmap sub table              */
-  /*      b) the current charmap has a Unicode encoding                    */
+  /*    This function is only meaningful if                                */
+  /*      a) the font has a variation selector cmap sub table,             */
+  /*    and                                                                */
+  /*      b) the current charmap has a Unicode encoding.                   */
+  /*                                                                       */
+  /* <Since>                                                               */
+  /*    2.3.6                                                              */
   /*                                                                       */
   FT_EXPORT( FT_UInt )
   FT_Face_GetCharVariantIndex( FT_Face   face,
@@ -3061,6 +3205,9 @@ FT_BEGIN_HEADER
   /*    This function is only meaningful if the font has a variation       */
   /*    selector cmap subtable.                                            */
   /*                                                                       */
+  /* <Since>                                                               */
+  /*    2.3.6                                                              */
+  /*                                                                       */
   FT_EXPORT( FT_Int )
   FT_Face_GetCharVariantIsDefault( FT_Face   face,
                                    FT_ULong  charcode,
@@ -3077,16 +3224,20 @@ FT_BEGIN_HEADER
   /*    in the font.                                                       */
   /*                                                                       */
   /* <Input>                                                               */
-  /*    face :: A handle to the source face object.                        */
+  /*    face ::                                                            */
+  /*      A handle to the source face object.                              */
   /*                                                                       */
   /* <Return>                                                              */
   /*    A pointer to an array of selector code points, or NULL if there is */
   /*    no valid variant selector cmap subtable.                           */
   /*                                                                       */
   /* <Note>                                                                */
-  /*    the last item in the array is 0. the array is owned by the FT_Face */
-  /*    but can be overwritten or released on the next call to a FreeType  */
-  /*    function.                                                          */
+  /*    The last item in the array is 0; the array is owned by the         */
+  /*    @FT_Face object but can be overwritten or released on the next     */
+  /*    call to a FreeType function.                                       */
+  /*                                                                       */
+  /* <Since>                                                               */
+  /*    2.3.6                                                              */
   /*                                                                       */
   FT_EXPORT( FT_UInt32* )
   FT_Face_GetVariantSelectors( FT_Face  face );
@@ -3114,9 +3265,12 @@ FT_BEGIN_HEADER
   /*    is empty.                                                          */
   /*                                                                       */
   /* <Note>                                                                */
-  /*    the last item in the array is 0. the array is owned by the FT_Face */
-  /*    but can be overwritten or released on the next call to a FreeType  */
-  /*    function.                                                          */
+  /*    The last item in the array is 0; the array is owned by the         */
+  /*    @FT_Face object but can be overwritten or released on the next     */
+  /*    call to a FreeType function.                                       */
+  /*                                                                       */
+  /* <Since>                                                               */
+  /*    2.3.6                                                              */
   /*                                                                       */
   FT_EXPORT( FT_UInt32* )
   FT_Face_GetVariantsOfChar( FT_Face   face,
@@ -3145,9 +3299,12 @@ FT_BEGIN_HEADER
   /*    is no valid cmap or the variant selector is invalid.               */
   /*                                                                       */
   /* <Note>                                                                */
-  /*    the last item in the array is 0. the array is owned by the FT_Face */
-  /*    but can be overwritten or released on the next call to a FreeType  */
-  /*    function.                                                          */
+  /*    The last item in the array is 0; the array is owned by the         */
+  /*    @FT_Face object but can be overwritten or released on the next     */
+  /*    call to a FreeType function.                                       */
+  /*                                                                       */
+  /* <Since>                                                               */
+  /*    2.3.6                                                              */
   /*                                                                       */
   FT_EXPORT( FT_UInt32* )
   FT_Face_GetCharsOfVariant( FT_Face   face,
@@ -3156,108 +3313,6 @@ FT_BEGIN_HEADER
 
   /*************************************************************************/
   /*                                                                       */
-  /* <Function>                                                            */
-  /*    FT_Get_Name_Index                                                  */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Return the glyph index of a given glyph name.  This function uses  */
-  /*    driver specific objects to do the translation.                     */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    face       :: A handle to the source face object.                  */
-  /*                                                                       */
-  /*    glyph_name :: The glyph name.                                      */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    The glyph index.  0 means `undefined character code'.              */
-  /*                                                                       */
-  FT_EXPORT( FT_UInt )
-  FT_Get_Name_Index( FT_Face     face,
-                     FT_String*  glyph_name );
-
-
-  /*************************************************************************
-   *
-   * @macro:
-   *   FT_SUBGLYPH_FLAG_XXX
-   *
-   * @description:
-   *   A list of constants used to describe subglyphs.  Please refer to the
-   *   TrueType specification for the meaning of the various flags.
-   *
-   * @values:
-   *   FT_SUBGLYPH_FLAG_ARGS_ARE_WORDS ::
-   *   FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES ::
-   *   FT_SUBGLYPH_FLAG_ROUND_XY_TO_GRID ::
-   *   FT_SUBGLYPH_FLAG_SCALE ::
-   *   FT_SUBGLYPH_FLAG_XY_SCALE ::
-   *   FT_SUBGLYPH_FLAG_2X2 ::
-   *   FT_SUBGLYPH_FLAG_USE_MY_METRICS ::
-   *
-   */
-#define FT_SUBGLYPH_FLAG_ARGS_ARE_WORDS          1
-#define FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES      2
-#define FT_SUBGLYPH_FLAG_ROUND_XY_TO_GRID        4
-#define FT_SUBGLYPH_FLAG_SCALE                   8
-#define FT_SUBGLYPH_FLAG_XY_SCALE             0x40
-#define FT_SUBGLYPH_FLAG_2X2                  0x80
-#define FT_SUBGLYPH_FLAG_USE_MY_METRICS      0x200
-
-
-  /*************************************************************************
-   *
-   * @func:
-   *   FT_Get_SubGlyph_Info
-   *
-   * @description:
-   *   Retrieve a description of a given subglyph.  Only use it if
-   *   `glyph->format' is @FT_GLYPH_FORMAT_COMPOSITE, or an error is
-   *   returned.
-   *
-   * @input:
-   *   glyph ::
-   *     The source glyph slot.
-   *
-   *   sub_index ::
-   *     The index of subglyph.  Must be less than `glyph->num_subglyphs'.
-   *
-   * @output:
-   *   p_index ::
-   *     The glyph index of the subglyph.
-   *
-   *   p_flags ::
-   *     The subglyph flags, see @FT_SUBGLYPH_FLAG_XXX.
-   *
-   *   p_arg1 ::
-   *     The subglyph's first argument (if any).
-   *
-   *   p_arg2 ::
-   *     The subglyph's second argument (if any).
-   *
-   *   p_transform ::
-   *     The subglyph transformation (if any).
-   *
-   * @return:
-   *   FreeType error code.  0 means success.
-   *
-   * @note:
-   *   The values of `*p_arg1', `*p_arg2', and `*p_transform' must be
-   *   interpreted depending on the flags returned in `*p_flags'.  See the
-   *   TrueType specification for details.
-   *
-   */
-  FT_EXPORT( FT_Error )
-  FT_Get_SubGlyph_Info( FT_GlyphSlot  glyph,
-                        FT_UInt       sub_index,
-                        FT_Int       *p_index,
-                        FT_UInt      *p_flags,
-                        FT_Int       *p_arg1,
-                        FT_Int       *p_arg2,
-                        FT_Matrix    *p_transform );
-
-
-  /*************************************************************************/
-  /*                                                                       */
   /* <Section>                                                             */
   /*    computations                                                       */
   /*                                                                       */
diff --git a/include/freetype/ftbbox.h b/include/freetype/ftbbox.h
index 5f79c32..050194c 100644
--- a/include/freetype/ftbbox.h
+++ b/include/freetype/ftbbox.h
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType exact bbox computation (specification).                     */
 /*                                                                         */
-/*  Copyright 1996-2001, 2003 by                                           */
+/*  Copyright 1996-2001, 2003, 2007 by                                     */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -61,7 +61,7 @@ FT_BEGIN_HEADER
   /*    Computes the exact bounding box of an outline.  This is slower     */
   /*    than computing the control box.  However, it uses an advanced      */
   /*    algorithm which returns _very_ quickly when the two boxes          */
-  /*    coincide.  Otherwise, the outline Bézier arcs are walked over to   */
+  /*    coincide.  Otherwise, the outline Bézier arcs are traversed to     */
   /*    extract their extrema.                                             */
   /*                                                                       */
   /* <Input>                                                               */
diff --git a/include/freetype/ftchapters.h b/include/freetype/ftchapters.h
index 9f1eb3f..4c61824 100644
--- a/include/freetype/ftchapters.h
+++ b/include/freetype/ftchapters.h
@@ -32,6 +32,7 @@
 /*    version                                                              */
 /*    basic_types                                                          */
 /*    base_interface                                                       */
+/*    glyph_variants                                                       */
 /*    glyph_management                                                     */
 /*    mac_specific                                                         */
 /*    sizes_management                                                     */
diff --git a/include/freetype/ftcid.h b/include/freetype/ftcid.h
index f46b73e..f0387f0 100644
--- a/include/freetype/ftcid.h
+++ b/include/freetype/ftcid.h
@@ -73,10 +73,14 @@ FT_BEGIN_HEADER
    *       The supplement.
    *
    * @return:
-   *   FreeType error code.  0 means success.
+   *    FreeType error code.  0 means success.
    *
    * @note:
-   *   This function only works with CID faces, returning an error otherwise.
+   *    This function only works with CID faces, returning an error
+   *    otherwise.
+   *
+   * @since:
+   *    2.3.6
    */
   FT_EXPORT( FT_Error )
   FT_Get_CID_Registry_Ordering_Supplement( FT_Face       face,
diff --git a/include/freetype/ftotval.h b/include/freetype/ftotval.h
index 419190d..8733882 100644
--- a/include/freetype/ftotval.h
+++ b/include/freetype/ftotval.h
@@ -56,7 +56,7 @@ FT_BEGIN_HEADER
   /*                                                                       */
   /* <Description>                                                         */
   /*    This section contains the declaration of functions to validate     */
-  /*    some OpenType tables (BASE, GDEF, GPOS, GSUB, JSTF).               */
+  /*    some OpenType tables (BASE, GDEF, GPOS, GSUB, JSTF, MATH).         */
   /*                                                                       */
   /*************************************************************************/
 
diff --git a/src/sfnt/ttcmap.c b/src/sfnt/ttcmap.c
index 3370399..dac23a8 100644
--- a/src/sfnt/ttcmap.c
+++ b/src/sfnt/ttcmap.c
@@ -2295,10 +2295,10 @@
     TT_CMapRec  cmap;
     FT_ULong    num_selectors;
 
-   /* this array is used to store the results of various
-    * cmap 14 query functions. its content is overwritten
-    * on each call to these functions
-    */
+    /* This array is used to store the results of various
+     * cmap 14 query functions.  The data is overwritten
+     * on each call to these functions.
+     */
     FT_UInt     max_results;
     FT_UInt32*  results;
     FT_Memory   memory;
@@ -2311,8 +2311,9 @@
   {
     FT_Memory  memory = cmap->memory;
 
+
     cmap->max_results = 0;
-    if (memory != NULL && cmap->results != NULL)
+    if ( memory != NULL && cmap->results != NULL )
       FT_FREE( cmap->results );
   }
 
@@ -2326,7 +2327,7 @@
     FT_Error  error   = 0;
 
 
-    if (num_results > cmap->max_results)
+    if ( num_results > cmap->max_results )
     {
        cmap->memory = memory;
 
@@ -2335,6 +2336,7 @@
 
        cmap->max_results = num_results;
     }
+
     return error;
   }
 
@@ -2368,9 +2370,9 @@
 
     /* check selectors, they must be in increasing order */
     {
-     /* we start lastVarSel at 1 because a variant selector value of 0
-      * isn't legal.
-      */
+      /* we start lastVarSel at 1 because a variant selector value of 0
+       * isn't valid.
+       */
       FT_ULong  n, lastVarSel = 1;
 
 
@@ -2398,7 +2400,8 @@
           FT_ULong  i;
           FT_ULong  lastBase  = 0;
 
-          if ( defp + numRanges*4 > valid->limit )
+
+          if ( defp + numRanges * 4 > valid->limit )
             FT_INVALID_TOO_SHORT;
 
           for ( i = 0; i < numRanges; ++i )
@@ -2424,7 +2427,7 @@
           FT_ULong  i, lastUni = 0;
 
 
-          if ( ndp + numMappings*4 > valid->limit )
+          if ( ndp + numMappings * 4 > valid->limit )
             FT_INVALID_TOO_SHORT;
 
           for ( i = 0; i < numMappings; ++i )
@@ -2553,6 +2556,7 @@
       else
         return TT_PEEK_USHORT( p );
     }
+
     return 0;
   }
 
@@ -2596,9 +2600,9 @@
                             FT_ULong  charcode,
                             FT_ULong  variantSelector)
   {
-    FT_Byte*   p = tt_cmap14_find_variant( cmap->data + 6, variantSelector );
-    FT_ULong   defOff;
-    FT_ULong   nondefOff;
+    FT_Byte*  p = tt_cmap14_find_variant( cmap->data + 6, variantSelector );
+    FT_ULong  defOff;
+    FT_ULong  nondefOff;
 
 
     if ( !p )
@@ -2628,9 +2632,9 @@
                                 FT_ULong  charcode,
                                 FT_ULong  variantSelector )
   {
-    FT_Byte*   p = tt_cmap14_find_variant( cmap->data + 6, variantSelector );
-    FT_ULong   defOff;
-    FT_ULong   nondefOff;
+    FT_Byte*  p = tt_cmap14_find_variant( cmap->data + 6, variantSelector );
+    FT_ULong  defOff;
+    FT_ULong  nondefOff;
 
 
     if ( !p )
@@ -2652,7 +2656,7 @@
   }
 
 
-  FT_CALLBACK_DEF( FT_UInt32 * )
+  FT_CALLBACK_DEF( FT_UInt32* )
   tt_cmap14_variants( TT_CMap    cmap,
                       FT_Memory  memory )
   {
@@ -2662,7 +2666,8 @@
     FT_UInt32*  result;
     FT_UInt     i;
 
-    if ( tt_cmap14_ensure( cmap14, (count + 1), memory ) )
+
+    if ( tt_cmap14_ensure( cmap14, ( count + 1 ), memory ) )
       return NULL;
 
     result = cmap14->results;
@@ -2688,7 +2693,7 @@
     FT_UInt32*  q;
 
 
-    if ( tt_cmap14_ensure( cmap14, (count + 1), memory ) )
+    if ( tt_cmap14_ensure( cmap14, ( count + 1 ), memory ) )
       return NULL;
 
     for ( q = cmap14->results; count > 0; --count )
@@ -2747,21 +2752,21 @@
     cnt       = tt_cmap14_def_char_count( p );
     numRanges = TT_NEXT_ULONG( p );
 
-    if ( tt_cmap14_ensure( cmap14, (cnt + 1), memory ) )
+    if ( tt_cmap14_ensure( cmap14, ( cnt + 1 ), memory ) )
       return NULL;
 
     for ( q = cmap14->results; numRanges > 0; --numRanges )
     {
       FT_UInt  uni = TT_NEXT_UINT24( p );
-      FT_UInt  cnt = FT_NEXT_BYTE( p ) + 1;
 
+
+      cnt = FT_NEXT_BYTE( p ) + 1;
       do
       {
         q[0]  = uni;
         uni  += 1;
         q    += 1;
-      }
-      while ( --cnt != 0 );
+      } while ( --cnt != 0 );
     }
     q[0] = 0;
 
@@ -2782,7 +2787,7 @@
 
     numMappings = TT_NEXT_ULONG( p );
 
-    if ( tt_cmap14_ensure( cmap14, (numMappings + 1), memory ) )
+    if ( tt_cmap14_ensure( cmap14, ( numMappings + 1 ), memory ) )
       return NULL;
 
     ret = cmap14->results;
@@ -2820,9 +2825,11 @@
       return NULL;
 
     if ( defOff == 0 )
-      return tt_cmap14_get_nondef_chars( cmap, cmap->data + nondefOff, memory );
+      return tt_cmap14_get_nondef_chars( cmap, cmap->data + nondefOff,
+                                         memory );
     else if ( nondefOff == 0 )
-      return tt_cmap14_get_def_chars( cmap, cmap->data + defOff, memory );
+      return tt_cmap14_get_def_chars( cmap, cmap->data + defOff,
+                                      memory );
     else
     {
       /* Both a default and a non-default glyph set?  That's probably not */
@@ -2845,11 +2852,13 @@
       numRanges   = TT_NEXT_ULONG( dp );
 
       if ( numMappings == 0 )
-        return tt_cmap14_get_def_chars( cmap, cmap->data + defOff, memory );
+        return tt_cmap14_get_def_chars( cmap, cmap->data + defOff,
+                                        memory );
       if ( dcnt == 0 )
-        return tt_cmap14_get_nondef_chars( cmap, cmap->data + nondefOff, memory );
+        return tt_cmap14_get_nondef_chars( cmap, cmap->data + nondefOff,
+                                           memory );
 
-      if ( tt_cmap14_ensure( cmap14, (dcnt + numMappings + 1), memory ) )
+      if ( tt_cmap14_ensure( cmap14, ( dcnt + numMappings + 1 ), memory ) )
         return NULL;
 
       ret  = cmap14->results;
@@ -2940,6 +2949,7 @@
       (FT_CMap_DoneFunc)     tt_cmap14_done,
       (FT_CMap_CharIndexFunc)tt_cmap14_char_index,
       (FT_CMap_CharNextFunc) tt_cmap14_char_next,
+
       /* Format 14 extension functions */
       (FT_CMap_CharVarIndexFunc)    tt_cmap14_char_var_index,
       (FT_CMap_CharVarIsDefaultFunc)tt_cmap14_char_var_isdefault,