Commit b1c8bf0683d2892bb9cb061b71add4b61da017f0

Werner Lemberg 2000-08-17T07:18:04

Minor formatting. Adding copyright/C++ guards to psaux files.

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
diff --git a/include/freetype/internal/psaux.h b/include/freetype/internal/psaux.h
index d840992..5eaeada 100644
--- a/include/freetype/internal/psaux.h
+++ b/include/freetype/internal/psaux.h
@@ -1,8 +1,34 @@
+/***************************************************************************/
+/*                                                                         */
+/*  psaux.h                                                                */
+/*                                                                         */
+/*    Auxiliary functions and data structures related to PostScript fonts  */
+/*    (specification).                                                     */
+/*                                                                         */
+/*  Copyright 1996-2000 by                                                 */
+/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
+/*                                                                         */
+/*  This file is part of the FreeType project, and may only be used,       */
+/*  modified, and distributed under the terms of the FreeType project      */
+/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
+/*  this file you indicate that you have read the license and              */
+/*  understand and accept it fully.                                        */
+/*                                                                         */
+/***************************************************************************/
+
+
 #ifndef PSAUX_H
 #define PSAUX_H
 
+
 #include <freetype/internal/ftobjs.h>
 
+
+#ifdef __cplusplus
+  extern "C" {
+#endif
+
+
   /*************************************************************************/
   /*************************************************************************/
   /*****                                                               *****/
@@ -119,7 +145,7 @@
   {
     FT_Byte*       start;   /* first character of token in input stream */
     FT_Byte*       limit;   /* first character after the token          */
-    T1_Token_Type  type;    /* type of token..                          */
+    T1_Token_Type  type;    /* type of token                            */
 
   } T1_Token;
 
@@ -239,17 +265,18 @@
   /*    T1_Parser                                                          */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    A T1_Parser is an object used to parse a Type 1 font very          */
-  /*    quickly.                                                           */
+  /*    A T1_Parser is an object used to parse a Type 1 font very quickly. */
   /*                                                                       */
   /* <Fields>                                                              */
-  /*    cursor       :: current position in text.                          */
-  /*    base         :: start of processed text.                           */
-  /*    limit        :: end of processed text.                             */
-  /*    error        :: last error returned.                               */
+  /*    cursor :: The current position in the text.                        */
   /*                                                                       */
-
-  typedef struct T1_Parser_
+  /*    base   :: Start of the processed text.                             */
+  /*                                                                       */
+  /*    limit  :: End of the processed text.                               */
+  /*                                                                       */
+  /*    error  :: The last error returned.                                 */
+  /*                                                                       */
+  typedef struct  T1_Parser_
   {
     FT_Byte*   cursor;
     FT_Byte*   base;
@@ -260,7 +287,7 @@
   } T1_Parser;
 
 
-  typedef struct T1_Parser_Funcs_
+  typedef struct  T1_Parser_Funcs_
   {
     void      (*init)          ( T1_Parser*  parser,
                                  FT_Byte*    base,
@@ -284,11 +311,11 @@
                                  FT_Int      power_ten );    
   
     void      (*to_token)      ( T1_Parser*  parser,
-                                 T1_Token   *token );
+                                 T1_Token*   token );
     void      (*to_token_array)( T1_Parser*  parser,
                                  T1_Token*   tokens,
                                  FT_UInt     max_tokens,
-                                 FT_Int     *pnum_tokens );
+                                 FT_Int*     pnum_tokens );
                                  
     FT_Error  (*load_field)    ( T1_Parser*       parser,
                                  const T1_Field*  field,
@@ -305,11 +332,10 @@
   } T1_Parser_Funcs;
 
 
-
   /*************************************************************************/
   /*************************************************************************/
   /*****                                                               *****/
-  /*****                            T1 BUILDER                         *****/
+  /*****                         T1 BUILDER                            *****/
   /*****                                                               *****/
   /*************************************************************************/
   /*************************************************************************/
@@ -330,10 +356,12 @@
   /*                                                                       */
   /*    glyph        :: The current glyph slot.                            */
   /*                                                                       */
-  /*    current      :: The current glyph outline.                         */
+  /*    loader       :: XXX                                                */
   /*                                                                       */
   /*    base         :: The base glyph outline.                            */
   /*                                                                       */
+  /*    current      :: The current glyph outline.                         */
+  /*                                                                       */
   /*    max_points   :: maximum points in builder outline                  */
   /*                                                                       */
   /*    max_contours :: Maximal number of contours in builder outline.     */
@@ -398,28 +426,28 @@
   } T1_Builder;
 
 
-  typedef  FT_Error  (*T1_Builder_Check_Points_Func)( T1_Builder*  builder,
-                                                      FT_Int       count );
+  typedef FT_Error  (*T1_Builder_Check_Points_Func)( T1_Builder*  builder,
+                                                     FT_Int       count );
                                                       
-  typedef  void      (*T1_Builder_Add_Point_Func) ( T1_Builder*  builder,
-                                                    FT_Pos       x,
-                                                    FT_Pos       y,
-                                                    FT_Byte      flag );    
+  typedef void  (*T1_Builder_Add_Point_Func)( T1_Builder*  builder,
+                                              FT_Pos       x,
+                                              FT_Pos       y,
+                                              FT_Byte      flag );    
   
-  typedef  void      (*T1_Builder_Add_Point1_Func)( T1_Builder*  builder,
-                                                    FT_Pos       x,
-                                                    FT_Pos       y );
+  typedef void  (*T1_Builder_Add_Point1_Func)( T1_Builder*  builder,
+                                               FT_Pos       x,
+                                               FT_Pos       y );
                                                     
-  typedef  FT_Error  (*T1_Builder_Add_Contour_Func)( T1_Builder*  builder );                                                    
+  typedef FT_Error  (*T1_Builder_Add_Contour_Func)( T1_Builder*  builder );                                                    
 
-  typedef  FT_Error  (*T1_Builder_Start_Point_Func)( T1_Builder*  builder,
-                                                     FT_Pos       x,
-                                                     FT_Pos       y );
+  typedef FT_Error  (*T1_Builder_Start_Point_Func)( T1_Builder*  builder,
+                                                    FT_Pos       x,
+                                                    FT_Pos       y );
 
-  typedef  void      (*T1_Builder_Close_Contour_Func)( T1_Builder*  builder );
+  typedef void  (*T1_Builder_Close_Contour_Func)( T1_Builder*  builder );
 
 
-  typedef struct T1_Builder_Funcs_
+  typedef struct  T1_Builder_Funcs_
   {
     FT_Error  (*init)( T1_Builder*   builder,
                        FT_Face       face,
@@ -437,6 +465,7 @@
   
   } T1_Builder_Funcs;
 
+
   /*************************************************************************/
   /*************************************************************************/
   /*****                                                               *****/
@@ -445,15 +474,20 @@
   /*************************************************************************/
   /*************************************************************************/
 
-
-
-  typedef struct PSAux_Interface_
+  typedef struct  PSAux_Interface_
   {
-    const T1_Table_Funcs*   t1_table_funcs;
-    const T1_Parser_Funcs*  t1_parser_funcs;
-    const T1_Builder_Funcs* t1_builder_funcs;
+    const T1_Table_Funcs*    t1_table_funcs;
+    const T1_Parser_Funcs*   t1_parser_funcs;
+    const T1_Builder_Funcs*  t1_builder_funcs;
 
   } PSAux_Interface;
 
 
+#ifdef __cplusplus
+  }
+#endif
+
 #endif /* PSAUX_H */
+
+
+/* END */
diff --git a/include/freetype/internal/t1types.h b/include/freetype/internal/t1types.h
index c5afb7c..a84ad83 100644
--- a/include/freetype/internal/t1types.h
+++ b/include/freetype/internal/t1types.h
@@ -87,7 +87,6 @@
 
   typedef struct  T1_Font_
   {
-
     /* font info dictionary */
     T1_FontInfo      font_info;
 
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
index acc7fc7..a9c9344 100644
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -1020,7 +1020,7 @@
     }
 
     /* now, transform the glyph image when needed */
-    if ( face->transform_flags && !(load_flags & FT_LOAD_NO_RECURSE))
+    if ( face->transform_flags && !( load_flags & FT_LOAD_NO_RECURSE ) )
     {
       /* get renderer */
       FT_Renderer  renderer = ft_lookup_glyph_renderer( slot );
diff --git a/src/psaux/psobjs.c b/src/psaux/psobjs.c
index af4ca1b..2912cde 100644
--- a/src/psaux/psobjs.c
+++ b/src/psaux/psobjs.c
@@ -1,6 +1,35 @@
+/***************************************************************************/
+/*                                                                         */
+/*  psobjs.c                                                               */
+/*                                                                         */
+/*    Auxiliary functions for PostScript fonts (body).                     */
+/*                                                                         */
+/*  Copyright 1996-2000 by                                                 */
+/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
+/*                                                                         */
+/*  This file is part of the FreeType project, and may only be used,       */
+/*  modified, and distributed under the terms of the FreeType project      */
+/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
+/*  this file you indicate that you have read the license and              */
+/*  understand and accept it fully.                                        */
+/*                                                                         */
+/***************************************************************************/
+
+
 #include <freetype/internal/psaux.h>
 #include <freetype/fterrors.h>
 
+#ifdef FT_FLAT_COMPILE
+
+#include "psobjs.h"
+
+#else
+
+#include <psaux/psobjs.h>
+
+#endif
+
+
   /*************************************************************************/
   /*************************************************************************/
   /*****                                                               *****/
@@ -15,7 +44,7 @@
   /*    T1_New_Table                                                       */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    Initialises a T1_Table.                                            */
+  /*    Initializes a T1_Table.                                            */
   /*                                                                       */
   /* <InOut>                                                               */
   /*    table  :: The address of the target table.                         */
@@ -43,7 +72,7 @@
       goto Exit;
 
     table->max_elems = count;
-    table->init      = 0xDEADBEEF;
+    table->init      = 0xDEADBEEFL;
     table->num_elems = 0;
     table->block     = 0;
     table->capacity  = 0;
@@ -157,7 +186,6 @@
   }
 
 
-
   /*************************************************************************/
   /*                                                                       */
   /* <Function>                                                            */
@@ -181,7 +209,7 @@
     FT_Byte*   old_base;
 
 
-    /* should never fail, as rec.cursor <= rec.size */
+    /* should never fail, because rec.cursor <= rec.size */
     old_base = table->block;
     if ( !old_base )
       return;
@@ -194,14 +222,13 @@
   }
 
 
-
   LOCAL_FUNC
   void  T1_Release_Table( T1_Table*  table )
   {
     FT_Memory  memory = table->memory;
 
 
-    if ( table->init == (FT_Long)0xDEADBEEF )
+    if ( table->init == 0xDEADBEEFL )
     {
       FREE( table->block );
       FREE( table->elements );
@@ -211,7 +238,6 @@
   }
 
 
-
   /*************************************************************************/
   /*************************************************************************/
   /*****                                                               *****/
@@ -220,6 +246,7 @@
   /*************************************************************************/
   /*************************************************************************/
 
+
 #define IS_T1_WHITESPACE( c )  ( (c) == ' '  || (c) == '\t' )
 #define IS_T1_LINESPACE( c )   ( (c) == '\r' || (c) == '\n' )
 
@@ -266,7 +293,6 @@
   }
 
 
-
   LOCAL_FUNC
   void  T1_ToToken( T1_Parser*  parser,
                     T1_Token*   token )
@@ -364,8 +390,8 @@
     T1_ToToken( parser, &master );
     if ( master.type == t1_token_array )
     {
-      FT_Byte*       old_cursor = parser->cursor;
-      FT_Byte*       old_limit  = parser->limit;
+      FT_Byte*   old_cursor = parser->cursor;
+      FT_Byte*   old_limit  = parser->limit;
       T1_Token*  cur        = tokens;
       T1_Token*  limit      = cur + max_tokens;
 
@@ -446,10 +472,10 @@
                        FT_Byte*   limit,
                        FT_Long    power_ten )
   {
-    FT_Byte* cur  = *cursor;
-    FT_Long  num, divider, result;
-    FT_Int   sign = 0;
-    FT_Byte  d;
+    FT_Byte*  cur  = *cursor;
+    FT_Long   num, divider, result;
+    FT_Int    sign = 0;
+    FT_Byte   d;
 
 
     if ( cur >= limit )
@@ -545,7 +571,7 @@
     if ( cur >= limit )
       goto Exit;
 
-    /* check for the beginning of an array. If not, only one number will */
+    /* check for the beginning of an array; if not, only one number will */
     /* be read                                                           */
     c     = *cur;
     ender = 0;
@@ -786,6 +812,7 @@
       FT_Long     val;
       FT_String*  string;
 
+
       switch ( field->type )
       {
       case t1_field_bool:
@@ -824,8 +851,9 @@
           FT_Memory  memory = parser->memory;
           FT_UInt    len    = limit-cur;
 
+
           if ( *(FT_String**)q )
-            /*  with synthetic fonts, it's possible to find a field twice  */
+            /* with synthetic fonts, it's possible to find a field twice */
             break;
 
           if ( ALLOC( string, len + 1 ) )
@@ -916,7 +944,7 @@
 
 
   LOCAL_FUNC
-  FT_Long  T1_ToInt  ( T1_Parser*  parser )
+  FT_Long  T1_ToInt( T1_Parser*  parser )
   {
     return t1_toint( &parser->cursor, parser->limit );
   }
@@ -970,10 +998,10 @@
 
 
   LOCAL_FUNC
-  void      T1_Init_Parser( T1_Parser*  parser,
-                            FT_Byte*    base,
-                            FT_Byte*    limit,
-                            FT_Memory   memory )
+  void  T1_Init_Parser( T1_Parser*  parser,
+                        FT_Byte*    base,
+                        FT_Byte*    limit,
+                        FT_Memory   memory )
   {
     parser->error  = 0;
     parser->base   = base;
@@ -984,11 +1012,12 @@
 
 
   LOCAL_FUNC
-  void      T1_Done_Parser( T1_Parser*  parser )
+  void  T1_Done_Parser( T1_Parser*  parser )
   {
-    FT_UNUSED(parser);
+    FT_UNUSED( parser );
   }
 
+
   /*************************************************************************/
   /*************************************************************************/
   /*****                                                               *****/
@@ -1193,6 +1222,7 @@
       FT_Vector*  p1    = outline->points + first;
       FT_Vector*  p2    = outline->points + outline->n_points - 1;
 
+
       if ( outline->n_contours > 1 )
       {
         first = outline->contours[outline->n_contours - 2] + 1;
@@ -1208,7 +1238,6 @@
   }
 
 
-
   /*************************************************************************/
   /*************************************************************************/
   /*****                                                               *****/
@@ -1218,10 +1247,6 @@
   /*************************************************************************/
 
 
-
-
-
-
   LOCAL_FUNC
   void  T1_Decrypt( FT_Byte*   buffer,
                     FT_Int     length,
@@ -1240,5 +1265,4 @@
   }
 
 
-
-
+/* END */
diff --git a/src/psaux/psobjs.h b/src/psaux/psobjs.h
index 84c4359..c321536 100644
--- a/src/psaux/psobjs.h
+++ b/src/psaux/psobjs.h
@@ -1,9 +1,32 @@
+/***************************************************************************/
+/*                                                                         */
+/*  psobjs.h                                                               */
+/*                                                                         */
+/*    Auxiliary functions for PostScript fonts (specification).            */
+/*                                                                         */
+/*  Copyright 1996-2000 by                                                 */
+/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
+/*                                                                         */
+/*  This file is part of the FreeType project, and may only be used,       */
+/*  modified, and distributed under the terms of the FreeType project      */
+/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
+/*  this file you indicate that you have read the license and              */
+/*  understand and accept it fully.                                        */
+/*                                                                         */
+/***************************************************************************/
+
+
 #ifndef PSOBJS_H
 #define PSOBJS_H
 
 #include <freetype/internal/psaux.h>
 
 
+#ifdef __cplusplus
+  extern "C" {
+#endif
+
+
   /*************************************************************************/
   /*************************************************************************/
   /*****                                                               *****/
@@ -31,7 +54,6 @@
   void  T1_Release_Table( T1_Table*  table );
 
 
-
   /*************************************************************************/
   /*************************************************************************/
   /*****                                                               *****/
@@ -72,7 +94,7 @@
                                  FT_ULong*        pflags );
  
   LOCAL_DEF
-  FT_Long  T1_ToInt  ( T1_Parser*  parser );
+  FT_Long  T1_ToInt( T1_Parser*  parser );
 
 
   LOCAL_DEF
@@ -93,14 +115,13 @@
 
 
   LOCAL_DEF
-  void      T1_Init_Parser( T1_Parser*  parser,
-                            FT_Byte*    base,
-                            FT_Byte*    limit,
-                            FT_Memory   memory );
+  void  T1_Init_Parser( T1_Parser*  parser,
+                        FT_Byte*    base,
+                        FT_Byte*    limit,
+                        FT_Memory   memory );
 
   LOCAL_DEF
-  void      T1_Done_Parser( T1_Parser*  parser )
-
+  void  T1_Done_Parser( T1_Parser*  parser )
 
 
   LOCAL_DEF
@@ -109,5 +130,12 @@
                     FT_UShort  seed );
 
 
+#ifdef __cplusplus
+  }
+#endif
+
+
 #endif /* PSOBJS_H */
 
+
+/* END */
diff --git a/src/type1z/z1load.c b/src/type1z/z1load.c
index 4a19402..dd70892 100644
--- a/src/type1z/z1load.c
+++ b/src/type1z/z1load.c
@@ -1080,14 +1080,14 @@
     (void)Z1_ToFixedArray( parser, 6, temp, 3 );
 
     /* we need to scale the values by 1.0/temp[3] */
-    if ( temp[3] != 0x10000 )
+    if ( temp[3] != 0x10000L )
     {
       temp[0] = FT_DivFix( temp[0], temp[3] );
       temp[1] = FT_DivFix( temp[1], temp[3] );
       temp[2] = FT_DivFix( temp[2], temp[3] );
       temp[4] = FT_DivFix( temp[4], temp[3] );
       temp[5] = FT_DivFix( temp[5], temp[3] );
-      temp[3] = 0x10000;
+      temp[3] = 0x10000L;
     }
 
     matrix->xx = temp[0];