[pango] [xft,ft2] Fix empty-glyph logical extents
- From: Behdad Esfahbod <behdad src gnome org>
- To: svn-commits-list gnome org
- Subject: [pango] [xft,ft2] Fix empty-glyph logical extents
- Date: Tue, 7 Apr 2009 14:34:27 -0400 (EDT)
commit 1e990af007255d1137ec76bd86658198d73994c6
Author: Behdad Esfahbod <behdad behdad org>
Date: Mon Apr 6 19:43:17 2009 -0400
[xft,ft2] Fix empty-glyph logical extents
Previously we were returning zero. We now return the height of the
glyph for space.
---
pango/pangoft2.c | 17 ++++++++++++-----
pango/pangoxft-font.c | 23 ++++++++++++++++++-----
2 files changed, 30 insertions(+), 10 deletions(-)
diff --git a/pango/pangoft2.c b/pango/pangoft2.c
index 224f6a0..dd268b9 100644
--- a/pango/pangoft2.c
+++ b/pango/pangoft2.c
@@ -318,14 +318,12 @@ pango_ft2_font_get_glyph_extents (PangoFont *font,
PangoRectangle *logical_rect)
{
PangoFT2GlyphInfo *info;
+ gboolean empty = FALSE;
if (glyph == PANGO_GLYPH_EMPTY)
{
- if (ink_rect)
- ink_rect->x = ink_rect->y = ink_rect->height = ink_rect->width = 0;
- if (logical_rect)
- logical_rect->x = logical_rect->y = logical_rect->height = logical_rect->width = 0;
- return;
+ glyph = pango_fc_font_get_glyph (font, ' ');
+ empty = TRUE;
}
if (glyph & PANGO_GLYPH_UNKNOWN_FLAG)
@@ -367,6 +365,15 @@ pango_ft2_font_get_glyph_extents (PangoFont *font,
*ink_rect = info->ink_rect;
if (logical_rect)
*logical_rect = info->logical_rect;
+
+ if (empty)
+ {
+ if (ink_rect)
+ ink_rect->x = ink_rect->y = ink_rect->height = ink_rect->width = 0;
+ if (logical_rect)
+ logical_rect->x = logical_rect->width = 0;
+ return;
+ }
}
/**
diff --git a/pango/pangoxft-font.c b/pango/pangoxft-font.c
index 6865490..4834f1f 100644
--- a/pango/pangoxft-font.c
+++ b/pango/pangoxft-font.c
@@ -326,19 +326,23 @@ pango_xft_font_get_glyph_extents (PangoFont *font,
{
PangoXftFont *xfont = (PangoXftFont *)font;
PangoFcFont *fcfont = PANGO_FC_FONT (font);
+ gboolean empty = FALSE;
- if (!fcfont->fontmap) /* Display closed */
- goto fallback;
-
- if (glyph == PANGO_GLYPH_EMPTY)
+ if (G_UNLIKELY (!fcfont->fontmap)) /* Display closed */
{
- fallback:
if (ink_rect)
ink_rect->x = ink_rect->width = ink_rect->y = ink_rect->height = 0;
if (logical_rect)
logical_rect->x = logical_rect->width = logical_rect->y = logical_rect->height = 0;
return;
}
+
+ if (glyph == PANGO_GLYPH_EMPTY)
+ {
+ glyph = pango_fc_font_get_glyph (font, ' ');
+ empty = TRUE;
+ }
+
if (glyph & PANGO_GLYPH_UNKNOWN_FLAG)
{
get_glyph_extents_missing (xfont, glyph, ink_rect, logical_rect);
@@ -350,6 +354,15 @@ pango_xft_font_get_glyph_extents (PangoFont *font,
else
get_glyph_extents_raw (xfont, glyph, ink_rect, logical_rect);
}
+
+ if (empty)
+ {
+ if (ink_rect)
+ ink_rect->x = ink_rect->y = ink_rect->height = ink_rect->width = 0;
+ if (logical_rect)
+ logical_rect->x = logical_rect->width = 0;
+ return;
+ }
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]