From 6f68171097f576fe1b050356fe8d62cf24b0e412 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 30 Mar 2004 17:17:20 +0000 Subject: [PATCH] Use code from HEAD in computing pixel sizes of fonts so that vageries in FreeType over y_ppem/height issues don't affect what pixel size values are used. --- ChangeLog | 7 +++++++ src/fcfreetype.c | 22 +++++++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index f71330f..9d50541 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2004-03-30 Keith Packard + + * src/fcfreetype.c: (FcGetPixelSize), (FcFreeTypeQuery): + Use code from HEAD in computing pixel sizes of fonts + so that vageries in FreeType over y_ppem/height issues + don't affect what pixel size values are used. + 2004-03-30 Keith Packard Bug #387 - usr352@wanadoo.es (Pedro Gimeno) diff --git a/src/fcfreetype.c b/src/fcfreetype.c index 1211dc6..d928224 100644 --- a/src/fcfreetype.c +++ b/src/fcfreetype.c @@ -256,6 +256,26 @@ FcVendorFoundry(const char *vendor) return 0; } +static double +FcGetPixelSize (FT_Face face, int i) +{ +#if HAVE_FT_GET_BDF_PROPERTY + if (face->num_fixed_sizes == 1) + { + BDF_PropertyRec prop; + int rc; + + rc = MY_Get_BDF_Property (face, "PIXEL_SIZE", &prop); + if (rc == 0 && prop.type == BDF_PROPERTY_TYPE_INTEGER) + return (double) prop.u.integer; + } +#endif +#if HAVE_FT_BITMAP_SIZE_Y_PPEM + return (double) face->available_sizes[i].y_ppem / 64.0; +#else + return (double) face->available_sizes[i].height; +#endif +} FcPattern * FcFreeTypeQuery (const FcChar8 *file, @@ -908,7 +928,7 @@ FcFreeTypeQuery (const FcChar8 *file, { for (i = 0; i < face->num_fixed_sizes; i++) if (!FcPatternAddDouble (pat, FC_PIXEL_SIZE, - (double) face->available_sizes[i].height)) + FcGetPixelSize (face, i))) goto bail1; if (!FcPatternAddBool (pat, FC_ANTIALIAS, FcFalse)) goto bail1; -- 2.39.5