summaryrefslogtreecommitdiff
path: root/pango/pangoxft-font.c
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@gnome.org>2006-02-03 02:46:17 +0000
committerBehdad Esfahbod <behdad@src.gnome.org>2006-02-03 02:46:17 +0000
commit6c9e853b93be4c01027e625427787e38be9b99f3 (patch)
tree9b1f07249ff96f43ce9f8af61613e067e0e1ea74 /pango/pangoxft-font.c
parentb1e264aa208e43a3d98aa2f985a0eaafdb328bb8 (diff)
downloadpango-6c9e853b93be4c01027e625427787e38be9b99f3.tar.gz
Finish the 'glyph 0' work of this morning: PANGO_GLYPH_NULL that I
2006-02-02 Behdad Esfahbod <behdad@gnome.org> Finish the 'glyph 0' work of this morning: PANGO_GLYPH_NULL that I introduced is renamed to PANGO_GLYPH_EMPTY. It means, no rendering should be performed. The backends however, still return 0 if a glyph is not found. The modules then are free to replace this 0 glyph with an unknown character. * modules/arabic/arabic-fc.c, modules/basic/basic-atsui.c, modules/basic/basic-fc.c, modules/basic/basic-win32.c, modules/basic/basic-x.c, modules/hangul/hangul-fc.c, modules/hebrew/hebrew-fc.c, modules/indic/indic-fc.c, modules/khmer/khmer-fc.c, modules/syriac/syriac-fc.c, modules/thai/thai-fc.c, modules/tibetan/tibetan-fc.c, pango/pangox.c, pango/pangowin32.c: Adapt to above change. Backends return 0 if glyph not found. * pango/fonts.c (pango_font_get_glyph_extents): If font is not usable (!PANGO_IS_FONT (font)), return the generic UNKNOWN_GLYPH metrics. This is used when your backends are misconfigured and you don't find *any* font at all. * pango/pango-engince.c: Add unknown glyphs in fallback shaper, instead of empty glyphs. * pango/shape.c: Call the fall-back shaper if shaper fails, instead of generating a dummy glyph string ourselves. * pango/pango-layout.c (imposed_shape, shape_tab): Use PANGO_GLYPH_EMPTY instead of glyph 0. * pango/pango-renderer.c (pango_renderer_draw_glyph): No-op on PANGO_GLYPH_EMPTY instead of glyph 0. * pango/pangocairo-atsuifont.c, pango/pangocairo-win32font.c, pango/pangocairo-fcfont.c, pango/pangocairo-font.c, pango/pangocairo-private.h: install_font returns a boolean now. * pango/pangocairo-render.c, pango/pangoxft-render.c: Handle font and hex-box failures more gracefully by drawing a generic unknown-box glyph. * pango/pangoft2.c, pango/pangoft2-render.c: Draw the generic unknown-box glyph here too. For unknown glyphs though, if the font is TTF (FT_IS_SFNT), use the zero-indexed glyph, otherwise, draw a box of proper size.
Diffstat (limited to 'pango/pangoxft-font.c')
-rw-r--r--pango/pangoxft-font.c29
1 files changed, 9 insertions, 20 deletions
diff --git a/pango/pangoxft-font.c b/pango/pangoxft-font.c
index f67d7b5b..2e96c1f4 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 (height / 10, 1);
+ xfont->mini_pad = PANGO_SCALE * MAX ((int)(2.2 * height + 27) / 28, 1);
}
return xfont->mini_font;
@@ -325,27 +325,16 @@ pango_xft_font_get_glyph_extents (PangoFont *font,
if (!fcfont->fontmap) /* Display closed */
goto fallback;
- if (glyph == PANGO_GLYPH_NULL)
+ if (glyph == PANGO_GLYPH_EMPTY)
{
fallback:
-
if (ink_rect)
- {
- ink_rect->x = 0;
- ink_rect->width = 0;
- ink_rect->y = 0;
- ink_rect->height = 0;
- }
+ ink_rect->x = ink_rect->width = ink_rect->y = ink_rect->height = 0;
if (logical_rect)
- {
- logical_rect->x = 0;
- logical_rect->width = 0;
- logical_rect->y = 0;
- logical_rect->height = 0;
- }
+ logical_rect->x = logical_rect->width = logical_rect->y = logical_rect->height = 0;
return;
}
- else if (glyph & PANGO_GLYPH_UNKNOWN_FLAG)
+ if (glyph & PANGO_GLYPH_UNKNOWN_FLAG)
{
get_glyph_extents_missing (xfont, glyph, ink_rect, logical_rect);
}
@@ -449,7 +438,7 @@ pango_xft_font_real_get_glyph (PangoFcFont *font,
gunichar wc)
{
XftFont *xft_font = xft_font_get_font ((PangoFont *)font);
-
+
return XftCharIndex (NULL, xft_font, wc);
}
@@ -484,7 +473,7 @@ pango_xft_font_get_font (PangoFont *font)
if (!_pango_xft_warning_history.get_font)
{
_pango_xft_warning_history.get_font = TRUE;
- g_critical ("pango_xft_font_get_font called with font == NULL, expect ugly output");
+ g_critical ("pango_xft_font_get_font called with bad font, expect ugly output");
}
return NULL;
}
@@ -587,7 +576,7 @@ pango_xft_font_unlock_face (PangoFont *font)
*
* Use pango_fc_font_get_glyph() instead.
*
- * Return value: the glyph index, or %PANGO_GLYPH_NULL, if the Unicode
+ * Return value: the glyph index, or 0, if the Unicode
* character does not exist in the font.
*
* Since: 1.2
@@ -596,7 +585,7 @@ guint
pango_xft_font_get_glyph (PangoFont *font,
gunichar wc)
{
- g_return_val_if_fail (PANGO_XFT_IS_FONT (font), PANGO_GLYPH_NULL);
+ g_return_val_if_fail (PANGO_XFT_IS_FONT (font), 0);
return pango_fc_font_get_glyph (PANGO_FC_FONT (font), wc);
}