Commit 02d4d59ac03aa79cafca124db6aa29030e6df55d

Werner Lemberg 2002-05-28T22:38:05

* builds/amiga/makefile, builds/amiga/smakefile, amiga/include/freetype/config/ftmodule.h: Updated to include support for BDF and Type42 drivers. * docs/modules.txt: Updated. * src/bdf/bdflib.c (_bdf_parse_glyphs): Replace floating point math with calls to `FT_MulDiv'.

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
diff --git a/ChangeLog b/ChangeLog
index b9558ca..adffe1e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,27 +1,36 @@
+2002-05-28  Detlef Würkner  <TetiSoft@apg.lahn.de>
+
+	* builds/amiga/makefile, builds/amiga/smakefile,
+	amiga/include/freetype/config/ftmodule.h: Updated to include
+	support for BDF and Type42 drivers.
+
+	* docs/modules.txt: Updated.
+
 2005-05-28  David Turner  <david@freetype.org>
 
-    * include/freetype/ftxf86.h, src/base/ftxf86.c: added a new API named
-    FT_Get_X11_Font_Format to return an X11-compatible string describing the
-    font format of a given face. This was put in a new optional base source
-    file, corresponding to a new public header (named FT_XFREE86_H since
-    this function should only be used within the XFree86 font server IMO).
+	* include/freetype/ftxf86.h, src/base/ftxf86.c: New files.
+	They provad a new API (FT_Get_X11_Font_Format) an X11-compatible
+	string describing the font format of a given face.  This was put in
+	a new optional base source file, corresponding to a new public
+	header (named FT_XFREE86_H since this function should only be used
+	within the XFree86 font server IMO).
 
-    * include/freetype/config/ftheader.h: adding FT_XFREE86_H, though it's
-    not documented yet.
+	* include/freetype/config/ftheader.h (FT_XFREE86_H): New macro (not
+	documented yet).
 
-    * include/freetype/t1tables.h, src/base/fttype1.c: adding two new APIs
-    named "FT_Get_PS_Font_Info" and "FT_Has_PS_Glyph_Names". This required
-    a new optional source in 'src/base' named "fttype1.c"
+	* src/base/fttype1.c: New file, provoding two new API functions
+	(FT_Get_PS_Font_Info and FT_Has_PS_Glyph_Names).
+	* include/freetype/t1tables.h: Updated.
 
-    * src/base/Jamfile, src/base/rules.mk, src/base/descrip.mms: updating
-    build control files for the new files "ftxf86.c" and "fttype1.c" in
-    src/base
+	* src/base/Jamfile, src/base/rules.mk, src/base/descrip.mms:
+	Updating build control files for the new files "ftxf86.c" and
+	"fttype1.c" in src/base.
 
-    * src/pshinter/pshglob.c (psh_blues_scale_zones): fixed a bug that
-    prevented family blue zones substitution from hapenning correctly
+	* src/pshinter/pshglob.c (psh_blues_scale_zones): Fixed a bug that
+	prevented family blue zones substitution from hapenning correctly.
 
-    * include/freetype/ftbdf.h: adding documentation comments for the
-    API reference describing the new function FT_Get_BDF_Charset_ID.
+	* include/freetype/ftbdf.h FT_Get_BDF_Charset_ID): Adding
+	documentation comment.
 
 2002-05-28  Werner Lemberg  <wl@gnu.org>
 
@@ -29,6 +38,9 @@
 	but FT_STREAM_READ.
 	Declare `stream' variable.
 
+	* src/bdf/bdflib.c (_bdf_parse_glyphs): Replace floating point math
+	with calls to `FT_MulDiv'.
+
 2002-05-28  David Turner  <david@freetype.org>
 
 	Fixing the SFNT name table loader to support various buggy fonts.
diff --git a/builds/amiga/include/freetype/config/ftmodule.h b/builds/amiga/include/freetype/config/ftmodule.h
index e93f1ce..6cdb81f 100644
--- a/builds/amiga/include/freetype/config/ftmodule.h
+++ b/builds/amiga/include/freetype/config/ftmodule.h
@@ -7,9 +7,12 @@
 //#define FT_USE_SMOOTH         // anti-aliasing rasterizer
 //#define FT_USE_TT             // truetype font driver
 //#define FT_USE_T1             // type1 font driver
-//#define FT_USE_T1CID          // cid-keyed type1 font driver  // no cmap support, useless
-//#define FT_USE_CFF            // opentype font driver         // does not work with TektonPro
+//#define FT_USE_T42            // type42 font driver           // yet unstable
+//#define FT_USE_T1CID          // cid-keyed type1 font driver  // no cmap support
+//#define FT_USE_CFF            // opentype font driver
+//#define FT_USE_BDF            // bdf bitmap font driver
 //#define FT_USE_PCF            // pcf bitmap font driver
+//#define FT_USE_PFR            // pfr font driver
 //#define FT_USE_WINFNT         // windows .fnt|.fon bitmap font driver
 #include "FT:src/base/ftinit.c"
 */
@@ -17,6 +20,10 @@
 // TetiSoft: make sure that needed support modules are built in.
 // Dependencies can be found by searching for FT_Get_Module.
 
+#ifdef FT_USE_T42
+#define FT_USE_TT
+#endif
+
 #ifdef FT_USE_TT
 #define FT_USE_SFNT
 #endif
@@ -65,10 +72,18 @@ FT_USE_MODULE(cff_driver_class)
 FT_USE_MODULE(t1cid_driver_class)
 #endif
 
+#ifdef FT_USE_BDF
+FT_USE_MODULE(bdf_driver_class)
+#endif
+
 #ifdef FT_USE_PCF
 FT_USE_MODULE(pcf_driver_class)
 #endif
 
+#ifdef FT_USE_PFR
+FT_USE_MODULE(pfr_driver_class)
+#endif
+
 #ifdef FT_USE_PSAUX
 FT_USE_MODULE(psaux_module_class)
 #endif
@@ -97,6 +112,10 @@ FT_USE_MODULE(tt_driver_class)
 FT_USE_MODULE(t1_driver_class)
 #endif
 
+#ifdef FT_USE_T42
+FT_USE_MODULE(t42_driver_class)
+#endif
+
 #ifdef FT_USE_WINFNT
 FT_USE_MODULE(winfnt_driver_class)
 #endif
diff --git a/builds/amiga/makefile b/builds/amiga/makefile
index 8846c66..7ca9ca7 100644
--- a/builds/amiga/makefile
+++ b/builds/amiga/makefile
@@ -11,15 +11,18 @@
 # Your programs source code should start with this
 # (uncomment the parts you do not need to keep the program small):
 # ---8<---
-#define FT_USE_AUTOHINT	// autohinter
-#define FT_USE_RASTER	// monochrome rasterizer
-#define FT_USE_SMOOTH	// anti-aliasing rasterizer
-#define FT_USE_TT	// truetype font driver
-#define FT_USE_T1	// type1 font driver
-#define FT_USE_T1CID	// cid-keyed type1 font driver
-#define FT_USE_CFF	// opentype font driver
-#define FT_USE_PCF	// pcf bitmap font driver
-#define FT_USE_WINFNT	// windows .fnt|.fon bitmap font driver
+#define FT_USE_AUTOHINT // autohinter
+#define FT_USE_RASTER   // monochrome rasterizer
+#define FT_USE_SMOOTH   // anti-aliasing rasterizer
+#define FT_USE_TT       // truetype font driver
+#define FT_USE_T1       // type1 font driver
+#define FT_USE_T42      // type42 font driver
+#define FT_USE_T1CID    // cid-keyed type1 font driver
+#define FT_USE_CFF      // opentype font driver
+#define FT_USE_BDF      // bdf bitmap font driver
+#define FT_USE_PCF      // pcf bitmap font driver
+#define FT_USE_PFR      // pfr font driver
+#define FT_USE_WINFNT   // windows .fnt|.fon bitmap font driver
 #include "FT:src/base/ftinit.c"
 # ---8<---
 #
@@ -151,15 +154,21 @@ type1.ppc.o: $(FTSRC)/type1/type1.c
 	$(CC) -c $(CFLAGS) -o $@ $<
 
 #
+# FreeType2 library Type42 font driver
+#
+type42.ppc.o: $(FTSRC)/type42/t42drivr.c
+	$(CC) -c $(CFLAGS) -o $@ $<
+
+#
 # FreeType2 library CID-keyed Type1 font driver
 #
 type1cid.ppc.o: $(FTSRC)/cid/type1cid.c
 	$(CC) -c $(CFLAGS) -o $@ $<
 
 #
-# FreeType2 library Windows FNT/FON bitmap font driver
+# FreeType2 library BDF bitmap font driver
 #
-winfnt.ppc.o: $(FTSRC)/winfonts/winfnt.c
+bdf.ppc.o: $(FTSRC)/bdf/bdf.c
 	$(CC) -c $(CFLAGS) -o $@ $<
 
 #
@@ -168,6 +177,18 @@ winfnt.ppc.o: $(FTSRC)/winfonts/winfnt.c
 pcf.ppc.o: $(FTSRC)/pcf/pcf.c
 	$(CC) -c $(CFLAGS) -o $@ $<
 
+#
+# FreeType2 library PFR font driver
+#
+pfr.ppc.o: $(FTSRC)/pfr/pfr.c
+	$(CC) -c $(CFLAGS) -o $@ $<
+
+#
+# FreeType2 library Windows FNT/FON bitmap font driver
+#
+winfnt.ppc.o: $(FTSRC)/winfonts/winfnt.c
+	$(CC) -c $(CFLAGS) -o $@ $<
+
 BASEPPC = ftbase.ppc.o ftglyph.ppc.o ftbbox.ppc.o ftmm.ppc.o ftsynth.ppc.o
 
 DEBUGPPC = ftdebug.ppc.o ftdebugpure.ppc.o
@@ -178,7 +199,8 @@ PSPPC = psaux.ppc.o psnames.ppc.o pshinter.ppc.o
 
 RASTERPPC = raster.ppc.o smooth.ppc.o
 
-FONTDPPC = cff.ppc.o type1.ppc.o type1cid.ppc.o truetype.ppc.o winfnt.ppc.o pcf.ppc.o
+FONTDPPC = cff.ppc.o type1.ppc.o type42.ppc.o type1cid.ppc.o truetype.ppc.o\
+	   bdf.ppc.o pcf.ppc.o pfr.ppc.o winfnt.ppc.o
 
 libft2_ppc.a:    $(BASEPPC) $(AHINTPPC) $(PSPPC) $(RASTERPPC) sfnt.ppc.o ftcache.ppc.o $(FONTDPPC)
 	$(AR) $@ $(BASEPPC) $(AHINTPPC) $(PSPPC) $(RASTERPPC) sfnt.ppc.o ftcache.ppc.o $(FONTDPPC)
diff --git a/builds/amiga/smakefile b/builds/amiga/smakefile
index e3dbaf5..ec91508 100644
--- a/builds/amiga/smakefile
+++ b/builds/amiga/smakefile
@@ -9,15 +9,18 @@
 # Your programs source code should start with this
 # (uncomment the parts you do not need to keep the program small):
 # ---8<---
-#define FT_USE_AUTOHINT	// autohinter
-#define FT_USE_RASTER	// monochrome rasterizer
-#define FT_USE_SMOOTH	// anti-aliasing rasterizer
-#define FT_USE_TT	// truetype font driver
-#define FT_USE_T1	// type1 font driver
-#define FT_USE_T1CID	// cid-keyed type1 font driver
-#define FT_USE_CFF	// opentype font driver
-#define FT_USE_PCF	// pcf bitmap font driver
-#define FT_USE_WINFNT	// windows .fnt|.fon bitmap font driver
+#define FT_USE_AUTOHINT // autohinter
+#define FT_USE_RASTER   // monochrome rasterizer
+#define FT_USE_SMOOTH   // anti-aliasing rasterizer
+#define FT_USE_TT       // truetype font driver
+#define FT_USE_T1       // type1 font driver
+#define FT_USE_T42      // type42 font driver
+#define FT_USE_T1CID    // cid-keyed type1 font driver
+#define FT_USE_CFF      // opentype font driver
+#define FT_USE_BDF      // bdf bitmap font driver
+#define FT_USE_PCF      // pcf bitmap font driver
+#define FT_USE_PFR      // pfr font driver
+#define FT_USE_WINFNT   // windows .fnt|.fon bitmap font driver
 #include "FT:src/base/ftinit.c"
 # ---8<---
 #
@@ -47,23 +50,12 @@ OBJSFNT = sfnt.o
 
 OBJCACHE = ftcache.o
 
-OBJOT = cff.o
-
-OBJT1 = type1.o
-
-OBJT1C = type1cid.o
-
-OBJTT = truetype.o
-
-OBJWINFNT = winfnt.o
-
-OBJPCF = pcf.o
-
 OBJPS = $(OBJPSAUX) $(OBJPSNAM) $(OBJPSHINT)
 
 OBJRASTER = $(OBJRAST) $(OBJSMOOTH)
 
-OBJFONTD = $(OBJOT) $(OBJT1) $(OBJT1C) $(OBJTT) $(OBJWINFNT) $(OBJPCF)
+OBJFONTD = cff.o type1.o type42.o type1cid.o\
+	   truetype.o winfnt.o bdf.o pcf.o pfr.o
 
 CORE = FT:src/
 
@@ -203,6 +195,12 @@ type1.o: $(CORE)type1/type1.c
 	sc $(SCFLAGS) objname=$@ $<
 
 #
+# FreeType2 library Type42 font driver
+#
+type42.o: $(CORE)type42/t42drivr.c
+	sc $(SCFLAGS) objname=$@ $<
+
+#
 # freetype library CID-keyed Type1 font driver
 #
 type1cid.o: $(CORE)cid/type1cid.c
@@ -214,9 +212,9 @@ type1cid.o: $(CORE)cid/type1cid.c
 #	sc $(SCFLAGS) objname=$@ $<
 
 #
-# freetype library Windows FNT/FON bitmap font driver
+# freetype library BDF bitmap font driver
 #
-winfnt.o: $(CORE)winfonts/winfnt.c
+bdf.o: $(CORE)bdf/bdf.c
 	sc $(SCFLAGS) objname=$@ $<
 
 #
@@ -224,3 +222,15 @@ winfnt.o: $(CORE)winfonts/winfnt.c
 #
 pcf.o: $(CORE)pcf/pcf.c
 	sc $(SCFLAGS) objname=$@ $<
+
+#
+# freetype library PFR font driver
+#
+pfr.o: $(CORE)pfr/pfr.c
+	sc $(SCFLAGS) objname=$@ $<
+
+#
+# freetype library Windows FNT/FON bitmap font driver
+#
+winfnt.o: $(CORE)winfonts/winfnt.c
+	sc $(SCFLAGS) objname=$@ $<
diff --git a/docs/modules.txt b/docs/modules.txt
index 74e64cd..04f4d12 100644
--- a/docs/modules.txt
+++ b/docs/modules.txt
@@ -9,5 +9,6 @@ Note that the use of `psnames' can be controlled in ftconfig.h
   cid          psaux, pshinter, psnames
   truetype     sfnt
   type1        psaux, pshinter, psnames
+  type42       truetype
   psaux        psnames
   sfnt         psnames
diff --git a/include/freetype/ftbdf.h b/include/freetype/ftbdf.h
index fe5f8b6..c33f9fc 100644
--- a/include/freetype/ftbdf.h
+++ b/include/freetype/ftbdf.h
@@ -45,25 +45,29 @@ FT_BEGIN_HEADER
 
  /**********************************************************************
   *
-  * @function: FT_Get_BDF_Charset_ID
+  * @function:
+  *    FT_Get_BDF_Charset_ID
   *
   * @description:
-  *    retrieves a BDF font character set identity, according to
-  *    the BDF specification
+  *    Retrieves a BDF font character set identity, according to
+  *    the BDF specification.
   *
   * @input:
-  *    face  :: handle to input face
+  *    face ::
+  *       handle to input face
   *
   * @output:
-  *    acharset_encoding :: charset encoding, as a C string owned by the face
-  *    acharset_registry :: charset register, as a C string owned by the face
+  *    acharset_encoding ::
+  *       Charset encoding, as a C string, owned by the face.
+  *
+  *    acharset_registry ::
+  *       Charset registry, as a C string, owned by the face.
   *
   * @return:
-  *   error code. 0 means success
+  *   FreeType rror code.  0 means success.
   *
   * @note:
-  *   this function will only work with BDF faces, it will return an
-  *   error otherwise.
+  *   This function only works with BDF faces, returning an error otherwise.
   */
   FT_EXPORT( FT_Error )
   FT_Get_BDF_Charset_ID( FT_Face       face,
diff --git a/include/freetype/t1tables.h b/include/freetype/t1tables.h
index 08f245f..660ea8a 100644
--- a/include/freetype/t1tables.h
+++ b/include/freetype/t1tables.h
@@ -323,50 +323,55 @@ FT_BEGIN_HEADER
 
  /************************************************************************
   *
-  * @function: FT_Has_PS_Glyph_Names
+  * @function:
+  *    FT_Has_PS_Glyph_Names
   *
   * @description:
-  *   returns true when a given face provides reliable Postscript glyph
-  *   names. This is similar to using the @FT_HAS_GLYPH_NAMES macro, except
-  *   that certain fonts (mostly TrueType) contain incorrect glyph name
-  *   tables.
+  *    Return true if a given face provides reliable Postscript glyph
+  *    names.  This is similar to using the @FT_HAS_GLYPH_NAMES macro,
+  *    except that certain fonts (mostly TrueType) contain incorrect
+  *    glyph name tables.
   *
-  *   when this function returns true, the caller is sure that the glyph
-  *   names returned by @FT_Get_Glyph_Name are reliable.
+  *    When this function returns true, the caller is sure that the glyph
+  *    names returned by @FT_Get_Glyph_Name are reliable.
   *
   * @input:
-  *   face  :: face handle
+  *    face ::
+  *       face handle
   *
   * @return:
-  *   boolean. true if glyph names are reliable
+  *    Boolean.  True if glyph names are reliable.
   */
   FT_EXPORT( FT_Int )
-  FT_Has_PS_Glyph_Names( FT_Face    face );
+  FT_Has_PS_Glyph_Names( FT_Face  face );
 
 
  /************************************************************************
   *
-  * @function: FT_Get_PS_Font_Info
+  * @function:
+  *    FT_Get_PS_Font_Info
   *
   * @description:
-  *   retrieve the @PS_FontInfoRec structure corresponding to a given
-  *   Postscript font.
+  *    Retrieve the @PS_FontInfoRec structure corresponding to a given
+  *    Postscript font.
   *
   * @input:
-  *   face  :: postscript face handle
+  *    face ::
+  *       Postscript face handle.
   *
   * @output:
-  *   afont_info :: output font info structure pointer
+  *    afont_info ::
+  *       Output font info structure pointer.
   *
   * @return:
-  *   error code. 0 means success
+  *    FreeType error code.  0 means success.
   *
   * @note:
-  *   the string pointers within the font info structure are owned by
-  *   the face and don't need to be freed by the caller.
+  *    The string pointers within the font info structure are owned by
+  *    the face and don't need to be freed by the caller.
   *
-  *   if the font's format is not Postscript-based, this function will
-  *   return the @FT_Err_Invalid_Argument error code.
+  *    If the font's format is not Postscript-based, this function will
+  *    return the @FT_Err_Invalid_Argument error code.
   */
   FT_EXPORT( FT_Error )
   FT_Get_PS_Font_Info( FT_Face          face,
diff --git a/src/bdf/bdflib.c b/src/bdf/bdflib.c
index d45a9ee..2baa498 100644
--- a/src/bdf/bdflib.c
+++ b/src/bdf/bdflib.c
@@ -32,6 +32,7 @@
 
 #include <ft2build.h>
 
+#include FT_FREETYPE_H
 #include FT_INTERNAL_DEBUG_H
 #include FT_INTERNAL_STREAM_H
 #include FT_INTERNAL_OBJECTS_H
@@ -1437,7 +1438,6 @@
     char*              s;
     unsigned char*     bp;
     unsigned long      i, slen, nibbles;
-    double             ps, rx, dw, sw;
 
     _bdf_line_func_t*  next;
     _bdf_parse_t*      p;
@@ -1740,11 +1740,10 @@
         /* the scalable width from the device width.                      */
         FT_TRACE2(( "_bdf_parse_glyphs: " ACMSG9, lineno ));
 
-        ps = (double)font->point_size;
-        rx = (double)font->resolution_x;
-        dw = (double)glyph->dwidth;
-
-        glyph->swidth = (unsigned short)( ( dw * 72000.0 ) / ( ps * rx ) );
+        glyph->swidth = (unsigned short)FT_MulDiv(
+                          glyph->dwidth, 72000L,
+                          (FT_Long)( font->point_size *
+                                     font->resolution_x ) );
       }
 
       p->flags |= _BDF_DWIDTH;
@@ -1791,11 +1790,11 @@
       if ( p->opts->correct_metrics != 0 )
       {
         /* Determine the point size of the glyph. */
-        ps = (double)font->point_size;
-        rx = (double)font->resolution_x;
-        dw = (double)glyph->dwidth;
+        unsigned short  sw = (unsigned short)FT_MulDiv(
+                               glyph->dwidth, 72000L,
+                               (FT_Long)( font->point_size *
+                                          font->resolution_x ) );
 
-        sw = (unsigned short)( ( dw * 72000.0 ) / ( ps * rx ) );
 
         if ( sw != glyph->swidth )
         {