freetype-devel
[Top][All Lists]
Advanced

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

[Devel] PCF driver improvement


From: Detlef Würkner
Subject: [Devel] PCF driver improvement
Date: Tue, 11 Dec 2001 19:47:45 +0100

Hello!

Often the PCF driver sets the width and height of the bitmap font to
12 since it cant find out the correct values. I investigated this and
found that the .pcf files dont contain a "PIXEL_SIZE" property in this
case, but a "POINT_SIZE" property was there. Also it seems that the
"PIXEL_SIZE" property must NOT be corrected by the resolution, but
instead the "POINT_SIZE" property must be corrected, so I suggest
this changes to src/pcf/pcfread.c:

Old version, starting from line 981:
----8<----
      prop = find_property( face, "PIXEL_SIZE" );
      if ( prop != NULL )
      {
        PCF_Property  xres = 0, yres = 0;


        xres = find_property( face, "RESOLUTION_X" );
        yres = find_property( face, "RESOLUTION_Y" );
        if ( ( xres != NULL ) && ( yres != NULL ) )
        {
          root->available_sizes->width =
            (FT_Short)( prop->value.integer * 75 / xres->value.integer );
          root->available_sizes->height =
            (FT_Short)( prop->value.integer * 75 / yres->value.integer );
        }
      }
      else
      { /* XXX */
#if 0
        printf( "PCF Warning: Pixel Size undefined, assuming 12\n");
#endif
        root->available_sizes->width = 12;
        root->available_sizes->height = 12;
      }
----8<----

New version:
----8<----
      {
        PCF_Property  xres, yres;


        prop = find_property( face, "PIXEL_SIZE" );
        if ( prop != NULL )
        {
          root->available_sizes->width  = (FT_Short)prop->value.integer;
          root->available_sizes->height = (FT_Short)prop->value.integer;
        }
        else if ( ( ( prop = find_property( face, "POINT_SIZE"   ) ) != NULL ) 
&&
                  ( ( xres = find_property( face, "RESOLUTION_X" ) ) != NULL ) 
&&
                  ( ( yres = find_property( face, "RESOLUTION_Y" ) ) != NULL ) )
        {
          root->available_sizes->width =
            (FT_Short)( prop->value.integer * 75 / ( xres->value.integer * 10 ) 
);
          root->available_sizes->height =
            (FT_Short)( prop->value.integer * 75 / ( yres->value.integer * 10 ) 
);
        }
        else
        { /* XXX */
#if 0
          printf( "PCF Warning: Pixel Size undefined, assuming 12\n");
#endif
          root->available_sizes->width = 12;
          root->available_sizes->height = 12;
        }
      }
----8<----
Since there seems to be no bdftopcf for AmigaOS, my repertoire of .pcf files
is rather limited, so please check if its right that POINT_SIZE must be
corrected by resolution and PIXEL_SIZE not to get the width and height
in pixels (by trying fonts for a resolution different from 75 dpi).

Ciao, Detlef
-- 
_ // address@hidden
\X/  Detlef Wuerkner, Langgoens/Germany



reply via email to

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