Commit 79786fba337b16cb5411fd2e4361c246f4d66921

Werner Lemberg 2004-06-15T14:13:10

* src/winfonts/winfnt.c (FNT_Face_Init): Set x_ppem and y_ppem based on pixel_width and pixel_height. (FNT_Size_Set_Pixels): Updated.

diff --git a/ChangeLog b/ChangeLog
index 6931201..5dbb153 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2004-06-14  Huw D M Davies  <h.davies1@physics.ox.ac.uk>
+
+	* src/winfonts/winfnt.c (FNT_Face_Init): Set x_ppem and y_ppem
+	based on pixel_width and pixel_height.
+	(FNT_Size_Set_Pixels): Updated.
+
 2004-06-14  Werner Lemberg  <wl@gnu.org>
 
 	* src/lzw/zopen.c: Comment out inclusion of signal.h and unistd.h.
@@ -658,8 +664,8 @@
 	Handle broken FNT files which don't have a trailing NULL byte
 	in the face name string.
 
-	* src/winfnt/winfnt.h (FNT_FontRec): New member `family_name'.
-	* src/winfnt/winfnt.c (fnt_font_done): Free font->family_name.
+	* src/winfonts/winfnt.h (FNT_FontRec): New member `family_name'.
+	* src/winfonts/winfnt.c (fnt_font_done): Free font->family_name.
 	(FNT_Face_Init): Append a final zero byte to the font face name.
 
 2004-03-30  Werner Lemberg  <wl@gnu.org>
@@ -7449,7 +7455,7 @@
 	(tt_driver_class): Add it.
 	* src/type1/t1driver.c (Get_Next_Char): New function.
 	(t1_driver_class): Add it.
-	* src/winfnt/winfnt.c (FNT_Get_Next_Char): New function.
+	* src/winfonts/winfnt.c (FNT_Get_Next_Char): New function.
 	(winfnt_driver_class): Add it.
 
 	* src/pcf/pcfread.c (pcf_load_font): For now, report Unicode for
diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h
index a77e004..80a3b63 100644
--- a/include/freetype/freetype.h
+++ b/include/freetype/freetype.h
@@ -271,10 +271,10 @@ FT_BEGIN_HEADER
   /*    where `size' is in points.                                         */
   /*                                                                       */
   /*    Windows FNT:                                                       */
-  /*      The `size', `x_ppem', and `y_ppem' parameters are not reliable:  */
-  /*      There exist fonts (e.g. app850.fon) which have a wrong size for  */
-  /*      some subfonts; since FNT files don't contain ppem but dpi values */
-  /*      the computed x_ppem and y_ppem numbers are thus wrong also.      */
+  /*      The `size' parameter is not reliable: There exist fonts (e.g.,   */
+  /*      app850.fon) which have a wrong size for some subfonts; x_ppem    */
+  /*      and y_ppem are thus set equal to pixel width and height given in */
+  /*      in the Windows FNT header.                                       */
   /*                                                                       */
   /*    TrueType embedded bitmaps:                                         */
   /*      `size', `width', and `height' values are not contained in the    */
diff --git a/src/winfonts/winfnt.c b/src/winfonts/winfnt.c
index 66ceef7..92174ae 100644
--- a/src/winfonts/winfnt.c
+++ b/src/winfonts/winfnt.c
@@ -466,12 +466,8 @@
         bsize->height = (FT_Short)(
           font->header.pixel_height + font->header.external_leading );
         bsize->size   = font->header.nominal_point_size << 6;
-        bsize->x_ppem =
-          (FT_Pos)( ( font->header.horizontal_resolution * bsize->size + 36 )
-                    / 72 );
-        bsize->y_ppem =
-          (FT_Pos)( ( font->header.vertical_resolution* bsize->size + 36 )
-                    / 72 );
+        bsize->x_ppem = font->header.pixel_width << 6;
+        bsize->y_ppem = font->header.pixel_height << 6;
       }
 
       {
@@ -553,7 +549,7 @@
     FT_Face   root = FT_FACE( face );
 
 
-    if ( size->metrics.y_ppem == root->available_sizes->height )
+    if ( size->metrics.y_ppem == root->available_sizes->y_ppem >> 6 )
     {
       FNT_Font  font = face->font;