* src/pfc/pcfread.c (pcf_load_font): Handle property `POINT_SIZE' and fix incorrect computation of `available_sizes'.
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
diff --git a/ChangeLog b/ChangeLog
index 65b4be0..5cb9741 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2001-12-22 Francesco Zappa Nardelli <Francesco.Zappa.Nardelli@ens.fr>
+
+ * src/pfc/pcfread.c (pcf_load_font): Handle property `POINT_SIZE'
+ and fix incorrect computation of `available_sizes'.
+
2001-12-22 David Turner <david@freetype.org>
* src/autohint/ahhint.c (ah_hinter_load): Auto-hinted glyphs had an
diff --git a/src/pcf/pcfread.c b/src/pcf/pcfread.c
index 984df71..d769126 100644
--- a/src/pcf/pcfread.c
+++ b/src/pcf/pcfread.c
@@ -920,6 +920,7 @@ THE SOFTWARE.
{
FT_Face root = FT_FACE( face );
PCF_Property prop;
+ int size_set = 0;
root->num_faces = 1;
@@ -981,25 +982,42 @@ THE SOFTWARE.
prop = find_property( face, "PIXEL_SIZE" );
if ( prop != NULL )
{
- PCF_Property xres = 0, yres = 0;
+ root->available_sizes->width = (FT_Short)( prop->value.integer );
+ root->available_sizes->height = (FT_Short)( prop->value.integer );
+
+ size_set = 1;
+ }
+ else
+ {
+ prop = find_property( face, "POINT_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 );
+ 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 *
+ xres->value.integer / 720 );
+ root->available_sizes->height =
+ (FT_Short)( prop->value.integer *
+ yres->value.integer / 720 );
+
+ size_set = 1;
+ }
}
}
- else
- { /* XXX */
+
+ if (size_set == 0 )
+ {
#if 0
printf( "PCF Warning: Pixel Size undefined, assuming 12\n");
#endif
- root->available_sizes->width = 12;
+ root->available_sizes->width = 12;
root->available_sizes->height = 12;
}