[pango] [layout] When computing empty line extents, use both layout and context fontdesc
- From: Behdad Esfahbod <behdad src gnome org>
- To: svn-commits-list gnome org
- Subject: [pango] [layout] When computing empty line extents, use both layout and context fontdesc
- Date: Tue, 7 Apr 2009 14:34:42 -0400 (EDT)
commit b6b9a22500c3e760f7c05d6c1fd62ff1529dee1b
Author: Behdad Esfahbod <behdad behdad org>
Date: Mon Apr 6 19:47:40 2009 -0400
[layout] When computing empty line extents, use both layout and context fontdesc
By merging them. This is what happens for loading fonts in pango-context.
We should do the same or we'll get zero-size fonts if layout has a font desc
set with no size.
---
pango/pango-layout.c | 23 ++++++++++++++---------
1 files changed, 14 insertions(+), 9 deletions(-)
diff --git a/pango/pango-layout.c b/pango/pango-layout.c
index 364e453..b1b75a4 100644
--- a/pango/pango-layout.c
+++ b/pango/pango-layout.c
@@ -4343,6 +4343,15 @@ pango_layout_get_empty_extents_at_index (PangoLayout *layout,
PangoFontDescription *font_desc = NULL;
gboolean free_font_desc = FALSE;
+ font_desc = pango_context_get_font_description (layout->context);
+
+ if (layout->font_desc)
+ {
+ font_desc = pango_font_description_copy_static (font_desc);
+ pango_font_description_merge (font_desc, layout->font_desc, TRUE);
+ free_font_desc = TRUE;
+ }
+
/* Find the font description for this line
*/
if (layout->attrs)
@@ -4363,8 +4372,11 @@ pango_layout_get_empty_extents_at_index (PangoLayout *layout,
else
base_font_desc = pango_context_get_font_description (layout->context);
- font_desc = pango_font_description_copy_static (base_font_desc);
- free_font_desc = TRUE;
+ if (!free_font_desc)
+ {
+ font_desc = pango_font_description_copy_static (font_desc);
+ free_font_desc = TRUE;
+ }
pango_attr_iterator_get_font (iter,
font_desc,
@@ -4379,13 +4391,6 @@ pango_layout_get_empty_extents_at_index (PangoLayout *layout,
pango_attr_iterator_destroy (iter);
}
- else
- {
- if (layout->font_desc)
- font_desc = layout->font_desc;
- else
- font_desc = pango_context_get_font_description (layout->context);
- }
font = pango_context_load_font (layout->context, font_desc);
if (font)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]