diff options
author | Behdad Esfahbod <behdad@gnome.org> | 2006-02-03 02:46:17 +0000 |
---|---|---|
committer | Behdad Esfahbod <behdad@src.gnome.org> | 2006-02-03 02:46:17 +0000 |
commit | 6c9e853b93be4c01027e625427787e38be9b99f3 (patch) | |
tree | 9b1f07249ff96f43ce9f8af61613e067e0e1ea74 /pango/pango-layout.c | |
parent | b1e264aa208e43a3d98aa2f985a0eaafdb328bb8 (diff) | |
download | pango-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/pango-layout.c')
-rw-r--r-- | pango/pango-layout.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/pango/pango-layout.c b/pango/pango-layout.c index dd92b944..8e006284 100644 --- a/pango/pango-layout.c +++ b/pango/pango-layout.c @@ -2339,7 +2339,7 @@ imposed_shape (const char *text, for (i=0, p = text; i < n_chars; i++, p = g_utf8_next_char (p)) { - glyphs->glyphs[i].glyph = 0; + glyphs->glyphs[i].glyph = PANGO_GLYPH_EMPTY; glyphs->glyphs[i].geometry.x_offset = 0; glyphs->glyphs[i].geometry.y_offset = 0; glyphs->glyphs[i].geometry.width = shape_logical->width; @@ -2612,7 +2612,7 @@ shape_tab (PangoLayoutLine *line, pango_glyph_string_set_size (glyphs, 1); - glyphs->glyphs[0].glyph = 0; + glyphs->glyphs[0].glyph = PANGO_GLYPH_EMPTY; glyphs->glyphs[0].geometry.x_offset = 0; glyphs->glyphs[0].geometry.y_offset = 0; glyphs->glyphs[0].attr.is_cluster_start = 1; @@ -3844,11 +3844,19 @@ pango_layout_line_get_empty_extents (PangoLayoutLine *line, metrics = pango_font_get_metrics (font, pango_context_get_language (layout->context)); - logical_rect->y = - pango_font_metrics_get_ascent (metrics); - logical_rect->height = - logical_rect->y + pango_font_metrics_get_descent (metrics); + if (metrics) + { + logical_rect->y = - pango_font_metrics_get_ascent (metrics); + logical_rect->height = - logical_rect->y + pango_font_metrics_get_descent (metrics); + pango_font_metrics_unref (metrics); + } + else + { + logical_rect->y = 0; + logical_rect->height = 0; + } g_object_unref (font); - pango_font_metrics_unref (metrics); } else { |