Commit 17dd0634f240030b2d59a8e5985cae251ca237b9

David Turner 2003-09-21T16:04:05

* include/freetype/internal/ftserv.h, include/freetype/internal/service/svpfr.h, include/freetype/internal/pfr.h, src/base/ftpfr.c: migrating the functions of "ftpfr.h" to the new service-base internal API * src/cff/cffobjs.c, src/cid/cidobjs.c, src/pfr/pfrsbit.c, src/psaux/psobjs.c, src/sfnt/sfdriver.c, src/sfnt/sfobjs.c, src/truetype/ttobjs.c, src/type1/t1driver.c, src/type1/t1objs.c, src/type42/t42objs.c, src/winfonts/winfnt.c: removing various compiler warnings

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
diff --git a/ChangeLog b/ChangeLog
index e26253a..18a0550 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+2003-09-21  David Turner  <david@freetype.org>
+
+        * include/freetype/internal/ftserv.h,
+        include/freetype/internal/service/svpfr.h,
+        include/freetype/internal/pfr.h,
+        src/base/ftpfr.c:
+
+          migrating the functions of "ftpfr.h" to the new
+          service-base internal API
+
+        * src/cff/cffobjs.c, src/cid/cidobjs.c, src/pfr/pfrsbit.c,
+        src/psaux/psobjs.c, src/sfnt/sfdriver.c, src/sfnt/sfobjs.c,
+        src/truetype/ttobjs.c, src/type1/t1driver.c, src/type1/t1objs.c,
+        src/type42/t42objs.c, src/winfonts/winfnt.c:
+
+          removing various compiler warnings
+
+
+
 2003-09-19  David Bevan  <dbevan@emtex.com>
 
 	* src/type1/t1parse.c (pfb_tag_fields): Removed.
@@ -117,7 +136,7 @@
 	* src/base/ftbdf.c: Include FT_SERVICE_BDF_H.
 	(test_font_type): Removed.
 	(FT_Get_BDF_Charset_ID, FT_Get_BDF_Property): Use services
-	provided in `FT_SERVICE_ID_BDF' 
+	provided in `FT_SERVICE_ID_BDF'
 
 	* src/base/ftmm.c: Include FT_SERVICE_MULTIPLE_MASTERS_H.
 	(ft_face_get_mm_service): New auxiliary function to get services
diff --git a/include/freetype/internal/ftserv.h b/include/freetype/internal/ftserv.h
index 4e498ad..f02a1c6 100644
--- a/include/freetype/internal/ftserv.h
+++ b/include/freetype/internal/ftserv.h
@@ -78,16 +78,16 @@ FT_BEGIN_HEADER
   /*****                                                               *****/
   /*************************************************************************/
   /*************************************************************************/
- 
+
   /*
    *  The following structure is used to _describe_ a given service
    *  to the library.  This is useful to build simple static service lists.
-   */  
+   */
   typedef struct  FT_ServiceDescRec_
   {
     const char*  serv_id;     /* service name         */
     const void*  serv_data;   /* service pointer/data */
-  
+
   } FT_ServiceDescRec;
 
   typedef const FT_ServiceDescRec*  FT_ServiceDesc;
@@ -114,7 +114,7 @@ FT_BEGIN_HEADER
   /*****                                                               *****/
   /*************************************************************************/
   /*************************************************************************/
- 
+
   /*
    *  This structure is used to store a cache for several frequently used
    *  services.  It is the type of `face->internal->services'.  You
@@ -128,7 +128,8 @@ FT_BEGIN_HEADER
     FT_Pointer  postscript_name;
     FT_Pointer  multi_masters;
     FT_Pointer  glyph_dict;
-    
+    FT_Pointer  pfr_metrics;
+
   } FT_ServiceCacheRec, *FT_ServiceCache;
 
 
@@ -196,13 +197,14 @@ FT_BEGIN_HEADER
   /*
    *  The header files containing the services.
    */
- 
+
 #define FT_SERVICE_MULTIPLE_MASTERS_H  <freetype/internal/services/svmm.h>
-#define FT_SERVICE_POSTSCRIPT_NAME_H   <freetype/internal/services/svpostnm.h> 
+#define FT_SERVICE_POSTSCRIPT_NAME_H   <freetype/internal/services/svpostnm.h>
 #define FT_SERVICE_GLYPH_DICT_H        <freetype/internal/services/svgldict.h>
 #define FT_SERVICE_BDF_H               <freetype/internal/services/svbdf.h>
 #define FT_SERVICE_XFREE86_NAME_H      <freetype/internal/services/svxf86nm.h>
 #define FT_SERVICE_SFNT_H              <freetype/internal/services/svsfnt.h>
+#define FT_SERVICE_PFR_H               <freetype/internal/services/svpfr.h>
 
 
 FT_END_HEADER
diff --git a/include/freetype/internal/pfr.h b/include/freetype/internal/pfr.h
deleted file mode 100644
index 51be620..0000000
--- a/include/freetype/internal/pfr.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/***************************************************************************/
-/*                                                                         */
-/*  pfr.h                                                                  */
-/*                                                                         */
-/*    Internal PFR service functions (specification only).                 */
-/*                                                                         */
-/*  Copyright 2002, 2003 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 __PFR_H__
-#define __PFR_H__
-
-#include <ft2build.h>
-#include FT_FREETYPE_H
-
-
-FT_BEGIN_HEADER
-
-  typedef FT_Error  (*FT_PFR_GetMetricsFunc)( FT_Face    face,
-                                              FT_UInt   *aoutline,
-                                              FT_UInt   *ametrics,
-                                              FT_Fixed  *ax_scale,
-                                              FT_Fixed  *ay_scale );
-
-  typedef FT_Error  (*FT_PFR_GetKerningFunc)( FT_Face     face,
-                                              FT_UInt     left,
-                                              FT_UInt     right,
-                                              FT_Vector  *avector );
-
-  typedef FT_Error  (*FT_PFR_GetAdvanceFunc)( FT_Face   face,
-                                              FT_UInt   gindex,
-                                              FT_Pos   *aadvance );
-
-
-  typedef struct  FT_PFR_ServiceRec_
-  {
-    FT_PFR_GetMetricsFunc  get_metrics;
-    FT_PFR_GetKerningFunc  get_kerning;
-    FT_PFR_GetAdvanceFunc  get_advance;
-
-  } FT_PFR_ServiceRec, *FT_PFR_Service;
-
-#define FT_PFR_SERVICE_NAME  "pfr"
-
-
-FT_END_HEADER
-
-#endif /* __PFR_H__ */
-
-
-/* END */
diff --git a/include/freetype/internal/services/svpfr.h b/include/freetype/internal/services/svpfr.h
new file mode 100644
index 0000000..e47cb6c
--- /dev/null
+++ b/include/freetype/internal/services/svpfr.h
@@ -0,0 +1,59 @@
+/***************************************************************************/
+/*                                                                         */
+/*  svpfr.h                                                                */
+/*                                                                         */
+/*    Internal PFR service functions (specification only).                 */
+/*                                                                         */
+/*  Copyright 2002, 2003 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 __SVPFR_H__
+#define __SVPFR_H__
+
+#include FT_INTERNAL_SERVICE_H
+
+FT_BEGIN_HEADER
+
+#define  FT_SERVICE_ID_PFR_METRICS   "pfr-metrics"
+
+  typedef FT_Error  (*FT_PFR_GetMetricsFunc)( FT_Face    face,
+                                              FT_UInt   *aoutline,
+                                              FT_UInt   *ametrics,
+                                              FT_Fixed  *ax_scale,
+                                              FT_Fixed  *ay_scale );
+
+  typedef FT_Error  (*FT_PFR_GetKerningFunc)( FT_Face     face,
+                                              FT_UInt     left,
+                                              FT_UInt     right,
+                                              FT_Vector  *avector );
+
+  typedef FT_Error  (*FT_PFR_GetAdvanceFunc)( FT_Face   face,
+                                              FT_UInt   gindex,
+                                              FT_Pos   *aadvance );
+
+
+  FT_DEFINE_SERVICE( PfrMetrics )
+  {
+    FT_PFR_GetMetricsFunc  get_metrics;
+    FT_PFR_GetKerningFunc  get_kerning;
+    FT_PFR_GetAdvanceFunc  get_advance;
+
+  };
+
+ /* */
+
+FT_END_HEADER
+
+#endif /* __SVPFR_H__ */
+
+
+/* END */
diff --git a/src/base/ftpfr.c b/src/base/ftpfr.c
index a23dcab..57e21eb 100644
--- a/src/base/ftpfr.c
+++ b/src/base/ftpfr.c
@@ -16,34 +16,20 @@
 /***************************************************************************/
 
 #include <ft2build.h>
-#include FT_INTERNAL_PFR_H
 #include FT_INTERNAL_OBJECTS_H
+#include FT_SERVICE_PFR_H
 
 
   /* check the format */
-  static FT_Error
-  ft_pfr_check( FT_Face          face,
-                FT_PFR_Service  *aservice )
+  static FT_Service_PfrMetrics
+  ft_pfr_check( FT_Face  face )
   {
-    FT_Error  error = FT_Err_Bad_Argument;
+    FT_Service_PfrMetrics  service;
 
+    FT_FACE_LOOKUP_SERVICE( face, FT_Service_PfrMetrics, service,
+                            pfr_metrics, FT_SERVICE_ID_PFR_METRICS );
 
-    if ( face && face->driver )
-    {
-      FT_Module    module = (FT_Module) face->driver;
-      const char*  name   = module->clazz->module_name;
-
-
-      if ( name[0] == 'p' &&
-           name[1] == 'f' &&
-           name[2] == 'r' &&
-           name[3] == 0 )
-      {
-        *aservice = (FT_PFR_Service) module->clazz->module_interface;
-        error = 0;
-      }
-    }
-    return error;
+    return service;
   }
 
 
@@ -54,12 +40,12 @@
                       FT_Fixed  *ametrics_x_scale,
                       FT_Fixed  *ametrics_y_scale )
   {
-    FT_Error        error;
-    FT_PFR_Service  service;
+    FT_Error               error;
+    FT_Service_PfrMetrics  service;
 
 
-    error = ft_pfr_check( face, &service );
-    if ( !error )
+    service = ft_pfr_check( face );
+    if ( service )
     {
       error = service->get_metrics( face,
                                     aoutline_resolution,
@@ -67,6 +53,26 @@
                                     ametrics_x_scale,
                                     ametrics_y_scale );
     }
+    else if ( face )
+    {
+      FT_Fixed  x_scale, y_scale;
+
+      /* this is not a PFR font */
+      *aoutline_resolution = face->units_per_EM;
+      *ametrics_resolution = face->units_per_EM;
+
+      x_scale = y_scale = 0x10000L;
+      if ( face->size )
+      {
+        x_scale = face->size->metrics.x_scale;
+        y_scale = face->size->metrics.y_scale;
+      }
+      *ametrics_x_scale = x_scale;
+      *ametrics_y_scale = y_scale;
+    }
+    else
+      error = FT_Err_Invalid_Argument;
+
     return error;
   }
 
@@ -77,15 +83,22 @@
                       FT_UInt     right,
                       FT_Vector  *avector )
   {
-    FT_Error        error;
-    FT_PFR_Service  service;
+    FT_Error               error;
+    FT_Service_PfrMetrics  service;
 
 
-    error = ft_pfr_check( face, &service );
-    if ( !error )
+    service = ft_pfr_check( face );
+    if ( service )
     {
       error = service->get_kerning( face, left, right, avector );
     }
+    else if ( face )
+    {
+      error = FT_Get_Kerning( face, left, right, FT_KERNING_UNSCALED, avector );
+    }
+    else
+      error = FT_Err_Invalid_Argument;
+
     return error;
   }
 
@@ -95,15 +108,19 @@
                       FT_UInt   gindex,
                       FT_Pos   *aadvance )
   {
-    FT_Error        error;
-    FT_PFR_Service  service;
+    FT_Error               error;
+    FT_Service_PfrMetrics  service;
 
 
-    error = ft_pfr_check( face, &service );
-    if ( !error )
+    service = ft_pfr_check( face );
+    if ( service )
     {
       error = service->get_advance( face, gindex, aadvance );
     }
+    else
+     /* XXX: TODO: PROVIDE ADVANCE-LOADING METHOD TO ALL FONT DRIVERS */
+      error = FT_Err_Invalid_Argument;
+
     return error;
   }
 
diff --git a/src/cff/cffobjs.c b/src/cff/cffobjs.c
index f0700d1..9dad6c3 100644
--- a/src/cff/cffobjs.c
+++ b/src/cff/cffobjs.c
@@ -396,8 +396,8 @@
         else
           root->units_per_EM = 1000;
 
-        root->underline_position  = dict->underline_position >> 16;
-        root->underline_thickness = dict->underline_thickness >> 16;
+        root->underline_position  = (FT_Short) (dict->underline_position >> 16);
+        root->underline_thickness = (FT_Short) (dict->underline_thickness >> 16);
 
         /* retrieve font family & style name */
         root->family_name  = cff_index_get_name( &cff->name_index, face_index );
diff --git a/src/cid/cidobjs.c b/src/cid/cidobjs.c
index 313d315..7945758 100644
--- a/src/cid/cidobjs.c
+++ b/src/cid/cidobjs.c
@@ -199,12 +199,12 @@
       if ( face->subrs )
       {
         FT_Int  n;
-        
+
 
         for ( n = 0; n < cid->num_dicts; n++ )
         {
           CID_Subrs  subr = face->subrs + n;
-          
+
 
           if ( subr->code )
           {
@@ -423,8 +423,8 @@
       root->height    = (FT_Short)(
         ( ( root->ascender - root->descender ) * 12 ) / 10 );
 
-      root->underline_position  = info->underline_position >> 16;
-      root->underline_thickness = info->underline_thickness >> 16;
+      root->underline_position  = (FT_Short) (info->underline_position >> 16);
+      root->underline_thickness = (FT_Short) (info->underline_thickness >> 16);
 
       root->internal->max_points   = 0;
       root->internal->max_contours = 0;
diff --git a/src/pfr/pfrsbit.c b/src/pfr/pfrsbit.c
index 84aeb7a..949e3de 100644
--- a/src/pfr/pfrsbit.c
+++ b/src/pfr/pfrsbit.c
@@ -654,7 +654,7 @@
             error = pfr_load_bitmap_bits( p,
                                           stream->limit,
                                           format,
-                                          face->header.color_flags & 2,
+                                          FT_BOOL(face->header.color_flags & 2),
                                           &glyph->root.bitmap );
           }
         }
diff --git a/src/psaux/psobjs.c b/src/psaux/psobjs.c
index fca38ba..992800f 100644
--- a/src/psaux/psobjs.c
+++ b/src/psaux/psobjs.c
@@ -589,14 +589,14 @@
       /* All white-space charcters are ignored. */
       skip_spaces( &cur, limit );
 
-      b = T1Radix( 16, &cur, cur + 1 );
+      b = (FT_Byte) T1Radix( 16, &cur, cur + 1 );
 
       if ( cur == cur2 )
         break;
 
       /* <f> == <f0> != <0f> */
-      bytes[n / 2] = ( n % 2 ) ? bytes[n / 2] + b
-                               : b * 16;
+      bytes[n / 2] = (FT_Byte)( ( n % 2 ) ? bytes[n / 2] + b
+                                          : b * 16 );
     }
 
     skip_spaces( &cur, limit );
diff --git a/src/sfnt/sfdriver.c b/src/sfnt/sfdriver.c
index 8080b81..cc186a6 100644
--- a/src/sfnt/sfdriver.c
+++ b/src/sfnt/sfdriver.c
@@ -89,7 +89,7 @@
   *  GLYPH DICT SERVICE
   *
   */
-  
+
   static FT_Error
   sfnt_get_glyph_name( TT_Face     face,
                        FT_UInt     glyph_index,
@@ -130,7 +130,7 @@
   *  POSTSCRIPT NAME SERVICE
   *
   */
-  
+
   static const char*
   sfnt_get_ps_name( TT_Face  face )
   {
@@ -243,7 +243,7 @@
 
   static const FT_Service_PsNameRec   sfnt_service_ps_name =
   {
-    (FT_PsName_GetFunc) & sfnt_get_ps_name
+    (FT_PsName_GetFunc) sfnt_get_ps_name
   };
 
 
@@ -258,10 +258,10 @@
     { FT_SERVICE_ID_POSTSCRIPT_NAME, & sfnt_service_ps_name },
 #ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
     { FT_SERVICE_ID_GLYPH_DICT,      & sfnt_service_glyph_dict },
-#endif    
+#endif
 
     { NULL, NULL }
-  };  
+  };
 
 
   FT_CALLBACK_DEF( FT_Module_Interface )
diff --git a/src/sfnt/sfobjs.c b/src/sfnt/sfobjs.c
index 33a71ae..64d8afb 100644
--- a/src/sfnt/sfobjs.c
+++ b/src/sfnt/sfobjs.c
@@ -643,14 +643,14 @@
           FT_Bitmap_Size*  bsize  = root->available_sizes + n;
           TT_SBit_Strike   strike = face->sbit_strikes + n;
           FT_UShort        fupem  = face->header.Units_Per_EM;
-          FT_Short         height = face->horizontal.Ascender -
-                                      face->horizontal.Descender +
-                                      face->horizontal.Line_Gap;
+          FT_Short         height = (FT_Short)( face->horizontal.Ascender -
+                                                face->horizontal.Descender +
+                                                face->horizontal.Line_Gap );
           FT_Short         avg    = face->os2.xAvgCharWidth;
 
 
           /* assume 72dpi */
-          bsize->height = 
+          bsize->height =
             (FT_Short)( ( height * strike->y_ppem + fupem/2 ) / fupem );
           bsize->width  =
             (FT_Short)( ( avg * strike->y_ppem + fupem/2 ) / fupem );
diff --git a/src/truetype/ttobjs.c b/src/truetype/ttobjs.c
index e1e69cd..3768dd6 100644
--- a/src/truetype/ttobjs.c
+++ b/src/truetype/ttobjs.c
@@ -228,7 +228,7 @@
 #ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING
 
     /* Determine whether unpatented hinting is to be used for this face. */
-    face->unpatented_hinting =
+    face->unpatented_hinting = FT_BOOL
        ( library->debug_hooks[ FT_DEBUG_HOOK_UNPATENTED_HINTING ] != NULL );
 
     {
diff --git a/src/type1/t1driver.c b/src/type1/t1driver.c
index e920f43..35cde03 100644
--- a/src/type1/t1driver.c
+++ b/src/type1/t1driver.c
@@ -116,7 +116,7 @@
 
   static const FT_Service_PsNameRec  t1_service_ps_name =
   {
-    (FT_PsName_GetFunc)  &t1_get_ps_name
+    (FT_PsName_GetFunc)  t1_get_ps_name
   };
 
 
@@ -145,10 +145,10 @@
     { FT_SERVICE_ID_POSTSCRIPT_NAME, &t1_service_ps_name },
     { FT_SERVICE_ID_GLYPH_DICT, &t1_service_glyph_dict },
     { FT_SERVICE_ID_XF86_NAME, FT_XF86_FORMAT_TYPE_1 },
-    
-#ifndef T1_CONFIG_OPTION_NO_MM_SUPPORT    
+
+#ifndef T1_CONFIG_OPTION_NO_MM_SUPPORT
     { FT_SERVICE_ID_MULTI_MASTERS, &t1_service_multi_masters },
-#endif      
+#endif
     { NULL, NULL }
   };
 
diff --git a/src/type1/t1objs.c b/src/type1/t1objs.c
index c62e72b..2207aef 100644
--- a/src/type1/t1objs.c
+++ b/src/type1/t1objs.c
@@ -434,8 +434,8 @@
 
       root->max_advance_height = root->height;
 
-      root->underline_position  = info->underline_position >> 16;
-      root->underline_thickness = info->underline_thickness >> 16;
+      root->underline_position  = (FT_Short)( info->underline_position >> 16 );
+      root->underline_thickness = (FT_Short)( info->underline_thickness >> 16 );
 
       root->internal->max_points   = 0;
       root->internal->max_contours = 0;
diff --git a/src/type42/t42objs.c b/src/type42/t42objs.c
index bb41205..37a4553 100644
--- a/src/type42/t42objs.c
+++ b/src/type42/t42objs.c
@@ -278,8 +278,8 @@
     root->max_advance_width  = face->ttf_face->max_advance_width;
     root->max_advance_height = face->ttf_face->max_advance_height;
 
-    root->underline_position  = info->underline_position >> 16;
-    root->underline_thickness = info->underline_thickness >> 16;
+    root->underline_position  = (FT_Short)( info->underline_position >> 16 );
+    root->underline_thickness = (FT_Short)( info->underline_thickness >> 16 );
 
     root->internal->max_points   = 0;
     root->internal->max_contours = 0;
diff --git a/src/winfonts/winfnt.c b/src/winfonts/winfnt.c
index b2e315f..ebbabe8 100644
--- a/src/winfonts/winfnt.c
+++ b/src/winfonts/winfnt.c
@@ -453,10 +453,10 @@
 
 
         bsize->width  = font->header.avg_width;
-        bsize->height =
-          font->header.pixel_height + font->header.external_leading;
+        bsize->height = (FT_Short)(
+          font->header.pixel_height + font->header.external_leading );
         bsize->size   = font->header.nominal_point_size << 6;
-        bsize->x_ppem = 
+        bsize->x_ppem =
           (FT_Pos)( ( font->header.horizontal_resolution * bsize->size + 36 )
                     / 72 );
         bsize->y_ppem =