2009-01-28 Behdad Esfahbod <behdad@gnome.org>
+ Bug 560792 – Make PangoLayoutLine with line->layout==NULL renderable
+
+ * pango/pango-renderer.c (pango_renderer_draw_layout_line),
+ (pango_renderer_draw_glyph_item), (pango_renderer_set_matrix):
+ Handle line->layout == NULL.
+
+2009-01-28 Behdad Esfahbod <behdad@gnome.org>
+
Bug 567392 – Abiword crashes in pango when opening document with
certain locales
* active.
*/
if (!renderer->active_count)
- {
- PangoContext *context = pango_layout_get_context (line->layout);
- pango_renderer_set_matrix (renderer,
- pango_context_get_matrix (context));
- }
+ pango_renderer_set_matrix (renderer,
+ G_LIKELY (line->layout) ?
+ pango_context_get_matrix
+ (pango_layout_get_context (line->layout)) :
+ NULL);
pango_renderer_activate (renderer);
state.underline = PANGO_UNDERLINE_NONE;
state.strikethrough = FALSE;
- text = pango_layout_get_text (line->layout);
+ text = G_LIKELY (line->layout) ? pango_layout_get_text (line->layout) : NULL;
for (l = line->runs; l; l = l->next)
{
/**
* pango_renderer_draw_glyph_item:
* @renderer: a #PangoRenderer
- * @text: the UTF-8 text that @glyph_item refers to
+ * @text: the UTF-8 text that @glyph_item refers to, or %NULL
* @glyph_item: a #PangoGlyphItem
* @x: X position of left edge of baseline, in user space coordinates
* in Pango units.
* Note that @text is the start of the text for layout, which is then
* indexed by <literal>@glyph_item->item->offset</literal>.
*
+ * If @text is %NULL, this simply calls pango_renderer_draw_glyphs().
+ *
* The default implementation of this method simply falls back to
* pango_renderer_draw_glyphs().
*
int x,
int y)
{
+ if (G_UNLIKELY (text))
+ {
+ pango_renderer_draw_glyphs (renderer,
+ glyph_item->item->analysis.font,
+ glyph_item->glyphs,
+ x, y);
+ return;
+ }
+
g_return_if_fail (PANGO_IS_RENDERER_FAST (renderer));
pango_renderer_activate (renderer);
{
g_return_if_fail (PANGO_IS_RENDERER_FAST (renderer));
- if (renderer->matrix)
- pango_matrix_free (renderer->matrix);
- if (matrix)
- renderer->matrix = pango_matrix_copy (matrix);
- else
- renderer->matrix = NULL;
-
+ pango_matrix_free (renderer->matrix);
+ renderer->matrix = pango_matrix_copy (matrix);
}
/**
* Since: 1.20
**/
PangoLayout *
-pango_renderer_get_layout (PangoRenderer *renderer)
+pango_renderer_get_layout (PangoRenderer *renderer)
{
if (G_UNLIKELY (renderer->priv->line == NULL))
return NULL;