freetype-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ft-devel] BDF and FT_Set_Pixel_Sizes


From: Chia-I Wu
Subject: Re: [ft-devel] BDF and FT_Set_Pixel_Sizes
Date: Fri, 9 Dec 2005 09:30:27 +0800
User-agent: Mutt/1.5.11

Hi,

I guess I better describe the problem more thoroughly.  Let's begin with
a review of the current status of FT_Set_Pixel_Sizes.

FT_Set_{Char,Pixel}_Sizes, at the first place, is used to set the size
of the em square (nominal size).  It works well with all scalable fonts.
And in theory, it should work well with all bitmap fonts supported
because they all come with nominal size information.

But the world is not perfect and WinFNT fonts often have incorrect
nominal size information.  Without better solution, WinFNT driver is
forced to use the real height (ascent + descent) as fonts' nominal size.
As a result, WinFNT fonts look smaller than others at the same nominal
size.

To remedy this, the definition of FT_Set_Pixel_Sizes is changed to set
the real height, not the nominal height.  BDF/PCF drivers are also
updated to reflect this change.

As you can see, the problem is that other drivers are not updated.  The
scaling I mentioned in my another mail should be used for scalable font
drivers.  Sbit needs update too.

Actually, I personally don't like this change.  Because

- When use FT_Set_Char_Sizes, WinFNT fonts still look smaller.

- We made or will have to make all the changes only because WinFNT fonts
  give incorrect nominal size information.

I think a better solution is undo all the changes and add a special note
for WinFNT fonts.  Or even better, I propose following INTERNAL changes:

--- ftdriver.h  2005-12-06 17:38:43.000000000 +0800
+++ ftdriver.new.h      2005-12-09 08:19:48.000000000 +0800
@@ -51,18 +51,29 @@
   typedef void
   (*FT_Slot_DoneFunc)( FT_GlyphSlot  slot );
 
+  enum
+  {
+    SIZE_REQUEST_NOMINAL,
+    SIZE_REQUEST_REAL_DIM,
+    SIZE_REQUEST_BOUNDING_BOX
+  }
+
+  typedef struct  FT_Size_RequestRec_
+  {
+    FT_F26Dot6  width;
+    FT_F26Dot6  height;
+    FT_UInt     horiResolution;
+    FT_UInt     vertResolution;
+    FT_Int      type;
+  } FT_Size_RequestRec, *FT_Size_Request;
 
   typedef FT_Error
-  (*FT_Size_ResetPointsFunc)( FT_Size     size,
-                              FT_F26Dot6  char_width,
-                              FT_F26Dot6  char_height,
-                              FT_UInt     horz_resolution,
-                              FT_UInt     vert_resolution );
+  (*FT_Size_RequestFunc)( FT_Size          size,
+                          FT_Size_Request  req );
 
   typedef FT_Error
-  (*FT_Size_ResetPixelsFunc)( FT_Size  size,
-                              FT_UInt  pixel_width,
-                              FT_UInt  pixel_height );
+  (*FT_Face_SelectSizeFunc)( FT_Face  face,
+                             FT_Int   index );
 
   typedef FT_Error
   (*FT_Slot_LoadFunc)( FT_GlyphSlot  slot,
@@ -129,13 +140,15 @@
   /*                                                                       */
   /*    done_slot        :: The format-specific slot destructor.           */
   /*                                                                       */
-  /*    set_char_sizes   :: A handle to a function used to set the new     */
-  /*                        character size in points + resolution.  Can be */
-  /*                        set to 0 to indicate default behaviour.        */
-  /*                                                                       */
-  /*    set_pixel_sizes  :: A handle to a function used to set the new     */
-  /*                        character size in pixels.  Can be set to 0 to  */
-  /*                        indicate default behaviour.                    */
+  /*    request_size     :: A handle to a function used to set the new     */
+  /*                        character size.  It is used only when          */
+  /*                        @FT_FACE_FLAG_SCALABLE is set.  Can be set to  */
+  /*                        0 to indicate default behaviour.               */
+  /*                                                                       */
+  /*    select_size      :: A handle to a function used to select a new    */
+  /*                        character size.  It is used only when          */
+  /*                        @FT_FACE_FLAG_FIXED_SIZES is set.  Can be set  */
+  /*                        to 0 indicate default behaviour.               */
   /*                                                                       */
   /*    load_glyph       :: A function handle to load a given glyph image  */
   /*                        in a slot.  This field is mandatory!           */
@@ -186,8 +199,8 @@
     FT_Slot_InitFunc          init_slot;
     FT_Slot_DoneFunc          done_slot;
 
-    FT_Size_ResetPointsFunc   set_char_sizes;
-    FT_Size_ResetPixelsFunc   set_pixel_sizes;
+    FT_Size_RequestFunc       request_size;
+    FT_Face_SelectSizeFunc    select_size;
 
     FT_Slot_LoadFunc          load_glyph;
 
-- 
Regards,
olv




reply via email to

[Prev in Thread] Current Thread [Next in Thread]