summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2002-12-17 02:07:37 +0000
committerOwen Taylor <otaylor@src.gnome.org>2002-12-17 02:07:37 +0000
commit29243ced945eb68460f3e3b57ca390c1c2a93129 (patch)
treeb1247bbc71481c2904fb2a4117c45f159947169b /modules
parent20b813ab225789782c942515e99bf50955975bec (diff)
downloadpango-29243ced945eb68460f3e3b57ca390c1c2a93129.tar.gz
When we get an isolated tone in isolation, do something reasonable rather
Mon Dec 16 19:28:18 2002 Owen Taylor <otaylor@redhat.com> * modules/hangul/hangul-xft.c (render_isolated_tone): When we get an isolated tone in isolation, do something reasonable rather than just return no glyphs and causing an assertion failure. (#100625) * pango/pangofc-fontmap.cI (_pango_fc_font_map_get_coverage): Add a hack to force Hangul marks to be be rendered in the same font as base Hangul glyphs.
Diffstat (limited to 'modules')
-rw-r--r--modules/hangul/hangul-fc.c35
-rw-r--r--modules/hangul/hangul-xft.c35
2 files changed, 66 insertions, 4 deletions
diff --git a/modules/hangul/hangul-fc.c b/modules/hangul/hangul-fc.c
index 49cbf9f9..be796693 100644
--- a/modules/hangul/hangul-fc.c
+++ b/modules/hangul/hangul-fc.c
@@ -147,11 +147,38 @@ render_tone (PangoFont *font, gunichar tone, PangoGlyphString *glyphs,
}
else
set_glyph (font, glyphs, *n_glyphs, cluster_offset,
- pango_xft_font_get_unknown_glyph (font, index));
+ pango_xft_font_get_unknown_glyph (font, tone));
}
(*n_glyphs)++;
}
+/* This is a fallback for when we get a tone mark not preceded
+ * by a syllable.
+ */
+static void
+render_isolated_tone (PangoFont *font, gunichar tone, PangoGlyphString *glyphs,
+ int *n_glyphs, int cluster_offset)
+{
+ /* Find a base character to render the mark on
+ */
+ int index = find_char (font, 0x25cc); /* DOTTED CIRCLE */
+ if (!index)
+ index = find_char (font, 0x25cb); /* WHITE CIRCLE, in KSC-5601 */
+ if (!index)
+ index = find_char (font, ' '); /* Space */
+ if (!index) /* Unknown glyph box with 0000 in it */
+ index = find_char (font, pango_xft_font_get_unknown_glyph (font, 0));
+
+ /* Add the base character
+ */
+ pango_glyph_string_set_size (glyphs, *n_glyphs + 1);
+ set_glyph (font, glyphs, *n_glyphs, cluster_offset, index);
+ (*n_glyphs)++;
+
+ /* And the tone mrak
+ */
+ render_tone(font, tone, glyphs, n_glyphs, cluster_offset);
+}
static void
render_syllable (PangoFont *font, gunichar *text, int length,
@@ -307,7 +334,11 @@ hangul_engine_shape (PangoFont *font,
jamos[n_jamos++] = T_FROM_S (wc);
}
else if (IS_M (wc) && !n_jamos)
- ; /* ignore M's which do not follow syllables */
+ {
+ /* Tone mark not following syllable */
+ render_isolated_tone (font, wc, glyphs, &n_glyphs, start - text);
+ start = g_utf8_next_char (p);
+ }
else
jamos[n_jamos++] = wc;
p = g_utf8_next_char (p);
diff --git a/modules/hangul/hangul-xft.c b/modules/hangul/hangul-xft.c
index 49cbf9f9..be796693 100644
--- a/modules/hangul/hangul-xft.c
+++ b/modules/hangul/hangul-xft.c
@@ -147,11 +147,38 @@ render_tone (PangoFont *font, gunichar tone, PangoGlyphString *glyphs,
}
else
set_glyph (font, glyphs, *n_glyphs, cluster_offset,
- pango_xft_font_get_unknown_glyph (font, index));
+ pango_xft_font_get_unknown_glyph (font, tone));
}
(*n_glyphs)++;
}
+/* This is a fallback for when we get a tone mark not preceded
+ * by a syllable.
+ */
+static void
+render_isolated_tone (PangoFont *font, gunichar tone, PangoGlyphString *glyphs,
+ int *n_glyphs, int cluster_offset)
+{
+ /* Find a base character to render the mark on
+ */
+ int index = find_char (font, 0x25cc); /* DOTTED CIRCLE */
+ if (!index)
+ index = find_char (font, 0x25cb); /* WHITE CIRCLE, in KSC-5601 */
+ if (!index)
+ index = find_char (font, ' '); /* Space */
+ if (!index) /* Unknown glyph box with 0000 in it */
+ index = find_char (font, pango_xft_font_get_unknown_glyph (font, 0));
+
+ /* Add the base character
+ */
+ pango_glyph_string_set_size (glyphs, *n_glyphs + 1);
+ set_glyph (font, glyphs, *n_glyphs, cluster_offset, index);
+ (*n_glyphs)++;
+
+ /* And the tone mrak
+ */
+ render_tone(font, tone, glyphs, n_glyphs, cluster_offset);
+}
static void
render_syllable (PangoFont *font, gunichar *text, int length,
@@ -307,7 +334,11 @@ hangul_engine_shape (PangoFont *font,
jamos[n_jamos++] = T_FROM_S (wc);
}
else if (IS_M (wc) && !n_jamos)
- ; /* ignore M's which do not follow syllables */
+ {
+ /* Tone mark not following syllable */
+ render_isolated_tone (font, wc, glyphs, &n_glyphs, start - text);
+ start = g_utf8_next_char (p);
+ }
else
jamos[n_jamos++] = wc;
p = g_utf8_next_char (p);