shithub: freetype+ttf2subf

Download patch

ref: 79786fba337b16cb5411fd2e4361c246f4d66921
parent: f9b44e30b5feedfb29b9ab85a9128f962203eff3
author: Werner Lemberg <[email protected]>
date: Tue Jun 15 10:13:10 EDT 2004

* 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.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2004-06-14  Huw D M Davies  <[email protected]>
+
+	* 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  <[email protected]>
 
 	* 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  <[email protected]>
@@ -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
--- a/include/freetype/freetype.h
+++ b/include/freetype/freetype.h
@@ -271,10 +271,10 @@
   /*    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    */
--- 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;