From 54dee9a070383e0e36db7f96b53620507d10e3a4 Mon Sep 17 00:00:00 2001 From: Owen Taylor Date: Wed, 2 May 2001 03:50:40 +0000 Subject: Fix numeric format in warning. Tue May 1 23:30:53 2001 Owen Taylor * modules/hangul/hangul-x.c (hangul_engine_shape): Fix numeric format in warning. * pango/pangox.c (get_font_metrics_from_string): Fix assorted brokenness. --- ChangeLog | 8 ++++++++ ChangeLog.pre-1-0 | 8 ++++++++ ChangeLog.pre-1-10 | 8 ++++++++ ChangeLog.pre-1-2 | 8 ++++++++ ChangeLog.pre-1-4 | 8 ++++++++ ChangeLog.pre-1-6 | 8 ++++++++ ChangeLog.pre-1-8 | 8 ++++++++ modules/hangul/hangul-x.c | 2 +- pango/pangox.c | 33 +++++++++++++++++++++++++-------- 9 files changed, 82 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index b38270e1..4724a4f3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Tue May 1 23:30:53 2001 Owen Taylor + + * modules/hangul/hangul-x.c (hangul_engine_shape): Fix numeric + format in warning. + + * pango/pangox.c (get_font_metrics_from_string): Fix assorted + brokenness. + Tue May 1 19:27:00 2001 Owen Taylor * pango/pangox.c (pango_x_render): Rewrite the newline diff --git a/ChangeLog.pre-1-0 b/ChangeLog.pre-1-0 index b38270e1..4724a4f3 100644 --- a/ChangeLog.pre-1-0 +++ b/ChangeLog.pre-1-0 @@ -1,3 +1,11 @@ +Tue May 1 23:30:53 2001 Owen Taylor + + * modules/hangul/hangul-x.c (hangul_engine_shape): Fix numeric + format in warning. + + * pango/pangox.c (get_font_metrics_from_string): Fix assorted + brokenness. + Tue May 1 19:27:00 2001 Owen Taylor * pango/pangox.c (pango_x_render): Rewrite the newline diff --git a/ChangeLog.pre-1-10 b/ChangeLog.pre-1-10 index b38270e1..4724a4f3 100644 --- a/ChangeLog.pre-1-10 +++ b/ChangeLog.pre-1-10 @@ -1,3 +1,11 @@ +Tue May 1 23:30:53 2001 Owen Taylor + + * modules/hangul/hangul-x.c (hangul_engine_shape): Fix numeric + format in warning. + + * pango/pangox.c (get_font_metrics_from_string): Fix assorted + brokenness. + Tue May 1 19:27:00 2001 Owen Taylor * pango/pangox.c (pango_x_render): Rewrite the newline diff --git a/ChangeLog.pre-1-2 b/ChangeLog.pre-1-2 index b38270e1..4724a4f3 100644 --- a/ChangeLog.pre-1-2 +++ b/ChangeLog.pre-1-2 @@ -1,3 +1,11 @@ +Tue May 1 23:30:53 2001 Owen Taylor + + * modules/hangul/hangul-x.c (hangul_engine_shape): Fix numeric + format in warning. + + * pango/pangox.c (get_font_metrics_from_string): Fix assorted + brokenness. + Tue May 1 19:27:00 2001 Owen Taylor * pango/pangox.c (pango_x_render): Rewrite the newline diff --git a/ChangeLog.pre-1-4 b/ChangeLog.pre-1-4 index b38270e1..4724a4f3 100644 --- a/ChangeLog.pre-1-4 +++ b/ChangeLog.pre-1-4 @@ -1,3 +1,11 @@ +Tue May 1 23:30:53 2001 Owen Taylor + + * modules/hangul/hangul-x.c (hangul_engine_shape): Fix numeric + format in warning. + + * pango/pangox.c (get_font_metrics_from_string): Fix assorted + brokenness. + Tue May 1 19:27:00 2001 Owen Taylor * pango/pangox.c (pango_x_render): Rewrite the newline diff --git a/ChangeLog.pre-1-6 b/ChangeLog.pre-1-6 index b38270e1..4724a4f3 100644 --- a/ChangeLog.pre-1-6 +++ b/ChangeLog.pre-1-6 @@ -1,3 +1,11 @@ +Tue May 1 23:30:53 2001 Owen Taylor + + * modules/hangul/hangul-x.c (hangul_engine_shape): Fix numeric + format in warning. + + * pango/pangox.c (get_font_metrics_from_string): Fix assorted + brokenness. + Tue May 1 19:27:00 2001 Owen Taylor * pango/pangox.c (pango_x_render): Rewrite the newline diff --git a/ChangeLog.pre-1-8 b/ChangeLog.pre-1-8 index b38270e1..4724a4f3 100644 --- a/ChangeLog.pre-1-8 +++ b/ChangeLog.pre-1-8 @@ -1,3 +1,11 @@ +Tue May 1 23:30:53 2001 Owen Taylor + + * modules/hangul/hangul-x.c (hangul_engine_shape): Fix numeric + format in warning. + + * pango/pangox.c (get_font_metrics_from_string): Fix assorted + brokenness. + Tue May 1 19:27:00 2001 Owen Taylor * pango/pangox.c (pango_x_render): Rewrite the newline diff --git a/modules/hangul/hangul-x.c b/modules/hangul/hangul-x.c index 5dd43569..0cc03e05 100644 --- a/modules/hangul/hangul-x.c +++ b/modules/hangul/hangul-x.c @@ -642,7 +642,7 @@ hangul_engine_shape (PangoFont *font, } else { - g_warning ("Character not handled by Hangul shaper: 0x04%x", wc4); + g_warning ("Character not handled by Hangul shaper: %#04x", wc4); continue; } diff --git a/pango/pangox.c b/pango/pangox.c index 43c04cd9..85df8759 100644 --- a/pango/pangox.c +++ b/pango/pangox.c @@ -750,7 +750,10 @@ get_font_metrics_from_subfonts (PangoFont *font, } /* This is pretty darn bogus. */ - metrics->approximate_char_width = total_avg_widths / n_avg_widths; + if (n_avg_widths) + metrics->approximate_char_width = total_avg_widths / n_avg_widths; + else + metrics->approximate_char_width = 10 * PANGO_SCALE; } /* Get composite font metrics for all subfonts resulting from shaping @@ -775,6 +778,7 @@ get_font_metrics_from_string (PangoFont *font, guint8 *embedding_levels; PangoDirection base_dir = PANGO_DIRECTION_LTR; GSList *subfonts = NULL; + gboolean finished = FALSE; text_ucs4 = g_utf8_to_ucs4_fast (str, -1, &n_chars); if (!text_ucs4) @@ -790,19 +794,29 @@ get_font_metrics_from_string (PangoFont *font, i = 0; p = start = str; - while (*p) + while (*p || !finished) { - gunichar wc = g_utf8_get_char (p); - p = g_utf8_next_char (p); + gunichar wc; + + if (*p) + { + wc = g_utf8_get_char (p); + shaper = pango_font_find_shaper (font, lang, wc); + } + else + { + finished = TRUE; + shaper = NULL; + } - shaper = pango_font_find_shaper (font, lang, wc); - if (p > start && - (shaper != last_shaper || last_level != embedding_levels[i])) + if (p > start && + (finished || + (shaper != last_shaper || last_level != embedding_levels[i]))) { PangoAnalysis analysis; int j; - analysis.shape_engine = shaper; + analysis.shape_engine = last_shaper; analysis.lang_engine = NULL; analysis.font = font; analysis.level = last_level; @@ -819,6 +833,9 @@ get_font_metrics_from_string (PangoFont *font, start = p; } + if (!finished) + p = g_utf8_next_char (p); + last_shaper = shaper; last_level = embedding_levels[i]; i++; -- cgit v1.2.1