From 29243ced945eb68460f3e3b57ca390c1c2a93129 Mon Sep 17 00:00:00 2001 From: Owen Taylor Date: Tue, 17 Dec 2002 02:07:37 +0000 Subject: When we get an isolated tone in isolation, do something reasonable rather Mon Dec 16 19:28:18 2002 Owen Taylor * 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. --- ChangeLog | 11 +++++++++++ ChangeLog.pre-1-10 | 11 +++++++++++ ChangeLog.pre-1-2 | 11 +++++++++++ ChangeLog.pre-1-4 | 11 +++++++++++ ChangeLog.pre-1-6 | 11 +++++++++++ ChangeLog.pre-1-8 | 11 +++++++++++ modules/hangul/hangul-fc.c | 35 +++++++++++++++++++++++++++++++++-- modules/hangul/hangul-xft.c | 35 +++++++++++++++++++++++++++++++++-- pango/pangofc-fontmap.c | 12 ++++++++++++ pango/pangofc-fontmap.cI | 12 ++++++++++++ 10 files changed, 156 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index fffecb2f..239defdf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +Mon Dec 16 19:28:18 2002 Owen Taylor + + * 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. + Mon Dec 16 18:10:46 2002 Owen Taylor * modules/basic/basic-xft.c: Add some extra ranges diff --git a/ChangeLog.pre-1-10 b/ChangeLog.pre-1-10 index fffecb2f..239defdf 100644 --- a/ChangeLog.pre-1-10 +++ b/ChangeLog.pre-1-10 @@ -1,3 +1,14 @@ +Mon Dec 16 19:28:18 2002 Owen Taylor + + * 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. + Mon Dec 16 18:10:46 2002 Owen Taylor * modules/basic/basic-xft.c: Add some extra ranges diff --git a/ChangeLog.pre-1-2 b/ChangeLog.pre-1-2 index fffecb2f..239defdf 100644 --- a/ChangeLog.pre-1-2 +++ b/ChangeLog.pre-1-2 @@ -1,3 +1,14 @@ +Mon Dec 16 19:28:18 2002 Owen Taylor + + * 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. + Mon Dec 16 18:10:46 2002 Owen Taylor * modules/basic/basic-xft.c: Add some extra ranges diff --git a/ChangeLog.pre-1-4 b/ChangeLog.pre-1-4 index fffecb2f..239defdf 100644 --- a/ChangeLog.pre-1-4 +++ b/ChangeLog.pre-1-4 @@ -1,3 +1,14 @@ +Mon Dec 16 19:28:18 2002 Owen Taylor + + * 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. + Mon Dec 16 18:10:46 2002 Owen Taylor * modules/basic/basic-xft.c: Add some extra ranges diff --git a/ChangeLog.pre-1-6 b/ChangeLog.pre-1-6 index fffecb2f..239defdf 100644 --- a/ChangeLog.pre-1-6 +++ b/ChangeLog.pre-1-6 @@ -1,3 +1,14 @@ +Mon Dec 16 19:28:18 2002 Owen Taylor + + * 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. + Mon Dec 16 18:10:46 2002 Owen Taylor * modules/basic/basic-xft.c: Add some extra ranges diff --git a/ChangeLog.pre-1-8 b/ChangeLog.pre-1-8 index fffecb2f..239defdf 100644 --- a/ChangeLog.pre-1-8 +++ b/ChangeLog.pre-1-8 @@ -1,3 +1,14 @@ +Mon Dec 16 19:28:18 2002 Owen Taylor + + * 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. + Mon Dec 16 18:10:46 2002 Owen Taylor * modules/basic/basic-xft.c: Add some extra ranges 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); diff --git a/pango/pangofc-fontmap.c b/pango/pangofc-fontmap.c index b5d9b722..f277e80e 100644 --- a/pango/pangofc-fontmap.c +++ b/pango/pangofc-fontmap.c @@ -806,6 +806,18 @@ _pango_fc_font_map_get_coverage (PangoFontMap *fontmap, } } } + + /* Awful hack so Hangul Tone marks get rendered with the same + * font and in the same run as other Hangul characters. If a font + * covers the first composed Hangul glyph, then it is declared to cover + * the Hangul tone marks. This hack probably needs to be formalized + * by choosing fonts for scripts rather than individual code points. + */ + if (pango_coverage_get (coverage, 0xac00) == PANGO_COVERAGE_EXACT) + { + pango_coverage_set (coverage, 0x302e, PANGO_COVERAGE_EXACT); + pango_coverage_set (coverage, 0x302f, PANGO_COVERAGE_EXACT); + } pango_fc_font_map_set_coverage (fcfontmap, &key, coverage); diff --git a/pango/pangofc-fontmap.cI b/pango/pangofc-fontmap.cI index b5d9b722..f277e80e 100644 --- a/pango/pangofc-fontmap.cI +++ b/pango/pangofc-fontmap.cI @@ -806,6 +806,18 @@ _pango_fc_font_map_get_coverage (PangoFontMap *fontmap, } } } + + /* Awful hack so Hangul Tone marks get rendered with the same + * font and in the same run as other Hangul characters. If a font + * covers the first composed Hangul glyph, then it is declared to cover + * the Hangul tone marks. This hack probably needs to be formalized + * by choosing fonts for scripts rather than individual code points. + */ + if (pango_coverage_get (coverage, 0xac00) == PANGO_COVERAGE_EXACT) + { + pango_coverage_set (coverage, 0x302e, PANGO_COVERAGE_EXACT); + pango_coverage_set (coverage, 0x302f, PANGO_COVERAGE_EXACT); + } pango_fc_font_map_set_coverage (fcfontmap, &key, coverage); -- cgit v1.2.1