diff options
author | Behdad Esfahbod <behdad@gnome.org> | 2005-11-15 07:45:37 +0000 |
---|---|---|
committer | Behdad Esfahbod <behdad@src.gnome.org> | 2005-11-15 07:45:37 +0000 |
commit | bd57d6cceae35873b241d262d3e02d3f65a97d77 (patch) | |
tree | da2c8e3134d896fec0680a41cb4a0eb2192e3317 | |
parent | 75c9641dab04f8ddc9480a2bf08264686b568beb (diff) | |
download | pango-bd57d6cceae35873b241d262d3e02d3f65a97d77.tar.gz |
Respect fontconfig reassignment of pixelsize. (#317121, Funda Wang)
2005-11-14 Behdad Esfahbod <behdad@gnome.org>
* pango/pangocairo-fcfont.c: Respect fontconfig reassignment of
pixelsize. (#317121, Funda Wang)
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | pango/pangocairo-fcfont.c | 27 |
2 files changed, 29 insertions, 3 deletions
@@ -1,5 +1,10 @@ 2005-11-14 Behdad Esfahbod <behdad@gnome.org> + * pango/pangocairo-fcfont.c: Respect fontconfig reassignment of + pixelsize. (#317121, Funda Wang) + +2005-11-14 Behdad Esfahbod <behdad@gnome.org> + * examples/Makefile.am: Add X_CFLAGS to INCLUDES. We normally are picking them up from XFT_CFLAGS, but we don't require Xft any more for X11. (#320576) diff --git a/pango/pangocairo-fcfont.c b/pango/pangocairo-fcfont.c index eb6825ef..99ee5b1c 100644 --- a/pango/pangocairo-fcfont.c +++ b/pango/pangocairo-fcfont.c @@ -369,9 +369,30 @@ pango_cairo_fc_font_init (PangoCairoFcFont *cffont) static double get_font_size (PangoCairoFcFontMap *cffontmap, PangoContext *context, - const PangoFontDescription *desc) + const PangoFontDescription *desc, + FcPattern *pattern) { - + double size; + + /* The reason why we read FC_PIXEL_SIZE here rather than just + * using the specified size is to support operations like clamping + * a font to a minimal readable size in fonts.conf. This is pretty weird, + * since it could mean that changing the Cairo CTM doesn't change the + * font size, but it's just a more radical version of the non-linear + * font scaling we already have due to hinting and due to bitmap + * fonts being only available at a few sizes. + * + * If honoring FC_PIXEL_SIZE gets in the way of more useful features + * it should be removed since it only matters in the unusual case + * of people doing exotic stuff in fonts.conf. + */ + + if (FcPatternGetDouble (pattern, FC_PIXEL_SIZE, 0, &size) == FcResultMatch) + return size * PANGO_SCALE; + + /* Just in case FC_PIXEL_SIZE got unset between pango_fc_make_pattern() + * and here. + */ if (pango_font_description_get_size_is_absolute (desc)) return pango_font_description_get_size (desc); else @@ -416,7 +437,7 @@ _pango_cairo_fc_font_new (PangoCairoFcFontMap *cffontmap, else cairo_matrix_init_identity (&cffont->font_matrix); - size = get_font_size (cffontmap, context, desc); + size = get_font_size (cffontmap, context, desc, pattern); cairo_matrix_scale (&cffont->font_matrix, size / PANGO_SCALE, size / PANGO_SCALE); |