summaryrefslogtreecommitdiff
path: root/pango/pango-context.c
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@behdad.org>2012-09-26 15:37:20 -0400
committerBehdad Esfahbod <behdad@behdad.org>2012-09-26 15:37:20 -0400
commitbbec7e8697907a922f80c00b94f54b9b8634d264 (patch)
tree18c737c4c838199b9e6ca72383afdcd09e874af5 /pango/pango-context.c
parent1c151fef87c61e2d329d84d3db59559bffa767fe (diff)
downloadpango-bbec7e8697907a922f80c00b94f54b9b8634d264.tar.gz
Add pango_shape_full()
Variant of pango_shape() that takes the full paragraph text as input. This is then passed in entirety to HarfBuzz, which would allow certain cross-run interactions (in Arabic for example). When combined with upcoming HarfBuzz 0.9.5+, this fixes: Red Hat Bug 858736 - [Spanish] Stray dotted circle rendered https://bugzilla.redhat.com/show_bug.cgi?id=858736 and partially: Bug 313181 - color changes break arabic shaping https://bugzilla.gnome.org/show_bug.cgi?id=313181
Diffstat (limited to 'pango/pango-context.c')
-rw-r--r--pango/pango-context.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/pango/pango-context.c b/pango/pango-context.c
index 2a1e44f3..341f92a6 100644
--- a/pango/pango-context.c
+++ b/pango/pango-context.c
@@ -1646,6 +1646,7 @@ static void
update_metrics_from_items (PangoFontMetrics *metrics,
PangoLanguage *language,
const char *text,
+ unsigned int text_len,
GList *items)
{
@@ -1671,7 +1672,9 @@ update_metrics_from_items (PangoFontMetrics *metrics,
pango_font_metrics_unref (raw_metrics);
}
- pango_shape (text + item->offset, item->length, &item->analysis, glyphs);
+ pango_shape_full (text + item->offset, item->length,
+ text, text_len,
+ &item->analysis, glyphs);
metrics->approximate_char_width += pango_glyph_string_get_width (glyphs);
}
@@ -1716,6 +1719,7 @@ pango_context_get_metrics (PangoContext *context,
PangoFontset *current_fonts = NULL;
PangoFontMetrics *metrics;
const char *sample_str;
+ unsigned int text_len;
GList *items;
g_return_val_if_fail (PANGO_IS_CONTEXT (context), NULL);
@@ -1730,9 +1734,10 @@ pango_context_get_metrics (PangoContext *context,
metrics = get_base_metrics (current_fonts);
sample_str = pango_language_get_sample_string (language);
- items = itemize_with_font (context, sample_str, 0, strlen (sample_str), desc);
+ text_len = strlen (sample_str);
+ items = itemize_with_font (context, sample_str, 0, text_len, desc);
- update_metrics_from_items (metrics, language, sample_str, items);
+ update_metrics_from_items (metrics, language, sample_str, text_len, items);
g_list_foreach (items, (GFunc)pango_item_free, NULL);
g_list_free (items);