diff options
author | Behdad Esfahbod <behdad@gnome.org> | 2006-05-11 08:22:20 +0000 |
---|---|---|
committer | Behdad Esfahbod <behdad@src.gnome.org> | 2006-05-11 08:22:20 +0000 |
commit | f0f38b3ab2fd9e9a8debe35db71156afc01b5d8c (patch) | |
tree | 77fc322e6198986ffc06378a21019eccb3e4c7ce | |
parent | 0a7f8d6fb481d2bd502b5f376a0dcef6f82ee0ff (diff) | |
download | pango-f0f38b3ab2fd9e9a8debe35db71156afc01b5d8c.tar.gz |
Update docs to note a size value of zero may have been set explicitly.
2006-05-11 Behdad Esfahbod <behdad@gnome.org>
* pango/fonts.c (pango_font_description_set_size): Update docs to note
a size value of zero may have been set explicitly.
* pango/pango-context.c (pango_context_load_font): Don't warn if font
size if zero.
* pango/pangoatsui-fontmap.c (pango_atsui_font_map_load_font):
* pango/pangox-fontmap.c (pango_x_font_map_load_font): Don't return if
size is zero (probably will fail with no fonts found.)
* pango/pangoxft-fontmap.c (pango_xft_font_map_default_substitute):
* Xft
chokes on size zero. Reassing PIXEL_SIZE to 1.0 if it's zero.
-rw-r--r-- | ChangeLog | 15 | ||||
-rw-r--r-- | pango/fonts.c | 3 | ||||
-rw-r--r-- | pango/pango-context.c | 1 | ||||
-rw-r--r-- | pango/pangoatsui-fontmap.c | 2 | ||||
-rw-r--r-- | pango/pangox-fontmap.c | 2 | ||||
-rw-r--r-- | pango/pangoxft-font.c | 4 | ||||
-rw-r--r-- | pango/pangoxft-fontmap.c | 8 | ||||
-rw-r--r-- | pango/pangoxft-render.c | 9 |
8 files changed, 34 insertions, 10 deletions
@@ -1,3 +1,18 @@ +2006-05-11 Behdad Esfahbod <behdad@gnome.org> + + * pango/fonts.c (pango_font_description_set_size): Update docs to note + a size value of zero may have been set explicitly. + + * pango/pango-context.c (pango_context_load_font): Don't warn if font + size if zero. + + * pango/pangoatsui-fontmap.c (pango_atsui_font_map_load_font): + * pango/pangox-fontmap.c (pango_x_font_map_load_font): Don't return if + size is zero (probably will fail with no fonts found.) + + * pango/pangoxft-fontmap.c (pango_xft_font_map_default_substitute): Xft + chokes on size zero. Reassing PIXEL_SIZE to 1.0 if it's zero. + 2006-05-01 Behdad Esfahbod <behdad@gnome.org> Bug 340229 – pango_font_description_from_string does not do bound diff --git a/pango/fonts.c b/pango/fonts.c index 83cc05d9..df7b0c94 100644 --- a/pango/fonts.c +++ b/pango/fonts.c @@ -365,7 +365,8 @@ pango_font_description_set_size (PangoFontDescription *desc, * Return value: the size field for the font description in points or device units. * You must call pango_font_description_get_size_is_absolute() * to find out which is the case. Returns 0 if the size field has not - * previously been set. pango_font_description_get_set_fields() to + * previously been set or it has been set to 0 explicitly. + * Use pango_font_description_get_set_fields() to * find out if the field was explicitely set or not. **/ gint diff --git a/pango/pango-context.c b/pango/pango-context.c index 937583d3..2e0c2bb4 100644 --- a/pango/pango-context.c +++ b/pango/pango-context.c @@ -268,7 +268,6 @@ pango_context_load_font (PangoContext *context, { g_return_val_if_fail (context != NULL, NULL); g_return_val_if_fail (pango_font_description_get_family (desc) != NULL, NULL); - g_return_val_if_fail (pango_font_description_get_size (desc) != 0, NULL); return pango_font_map_load_font (context->font_map, context, desc); } diff --git a/pango/pangoatsui-fontmap.c b/pango/pangoatsui-fontmap.c index c69fe005..52662978 100644 --- a/pango/pangoatsui-fontmap.c +++ b/pango/pangoatsui-fontmap.c @@ -545,7 +545,7 @@ pango_atsui_font_map_load_font (PangoFontMap *fontmap, size = pango_font_description_get_size (description); - if (size <= 0) + if (size < 0) return NULL; name = g_utf8_casefold (pango_font_description_get_family (description), -1); diff --git a/pango/pangox-fontmap.c b/pango/pangox-fontmap.c index 01c0de54..c6f14fb8 100644 --- a/pango/pangox-fontmap.c +++ b/pango/pangox-fontmap.c @@ -459,7 +459,7 @@ pango_x_font_map_load_font (PangoFontMap *fontmap, name = g_ascii_strdown (pango_font_description_get_family (description), -1); size = pango_font_description_get_size (description); - if (size <= 0) + if (size < 0) return NULL; font_family = g_hash_table_lookup (xfontmap->families, name); diff --git a/pango/pangoxft-font.c b/pango/pangoxft-font.c index fe3844fb..51fa7fcf 100644 --- a/pango/pangoxft-font.c +++ b/pango/pangoxft-font.c @@ -172,7 +172,7 @@ _pango_xft_font_get_mini_font (PangoXftFont *xfont) xfont->mini_width = PANGO_SCALE * width; xfont->mini_height = PANGO_SCALE * height; - xfont->mini_pad = PANGO_SCALE * MAX ((int)(2.2 * height + 27) / 28, 1); + xfont->mini_pad = PANGO_SCALE * MIN (height / 2, MAX ((int)(2.2 * height + 27) / 28, 1)); } return xfont->mini_font; @@ -387,7 +387,7 @@ xft_font_get_font (PangoFont *font) xfont = (PangoXftFont *)font; fcfont = (PangoFcFont *)font; - if (xfont->xft_font == NULL) + if (G_UNLIKELY (xfont->xft_font == NULL)) { FcPattern *pattern = FcPatternDuplicate (fcfont->font_pattern); FcPatternDel (pattern, FC_SPACING); diff --git a/pango/pangoxft-fontmap.c b/pango/pangoxft-fontmap.c index 7a15e49b..a033268c 100644 --- a/pango/pangoxft-fontmap.c +++ b/pango/pangoxft-fontmap.c @@ -354,11 +354,19 @@ pango_xft_font_map_default_substitute (PangoFcFontMap *fcfontmap, FcPattern *pattern) { PangoXftFontMap *xftfontmap = PANGO_XFT_FONT_MAP (fcfontmap); + double d; FcConfigSubstitute (NULL, pattern, FcMatchPattern); if (xftfontmap->substitute_func) xftfontmap->substitute_func (pattern, xftfontmap->substitute_data); XftDefaultSubstitute (xftfontmap->display, xftfontmap->screen, pattern); + if (FcPatternGetDouble (pattern, FC_PIXEL_SIZE, 0, &d) == FcResultMatch && d == 0.0) + { + FcValue v; + v.type = FcTypeDouble; + v.u.d = 1.0; + FcPatternAdd (pattern, FC_PIXEL_SIZE, v, FcFalse); + } } static PangoFcFont * diff --git a/pango/pangoxft-render.c b/pango/pangoxft-render.c index 3c5e5bed..7651cb61 100644 --- a/pango/pangoxft-render.c +++ b/pango/pangoxft-render.c @@ -372,10 +372,11 @@ _pango_xft_renderer_draw_unknown_glyph (PangoRenderer *renderer, xfont->mini_width * cols + xfont->mini_pad * (2 * cols + 1), xfont->mini_height * 2 + xfont->mini_pad * 5)) { - draw_box (renderer, xfont->mini_pad, - xs[0], ys[0], - xfont->mini_width * cols + xfont->mini_pad * (2 * cols + 1), - xfont->mini_height * 2 + xfont->mini_pad * 5); + if (xfont->mini_pad) + draw_box (renderer, xfont->mini_pad, + xs[0], ys[0], + xfont->mini_width * cols + xfont->mini_pad * (2 * cols + 1), + xfont->mini_height * 2 + xfont->mini_pad * 5); for (row = 0; row < 2; row++) for (col = 0; col < cols; col++) |