diff options
author | Owen Taylor <otaylor@redhat.com> | 2001-11-26 23:18:53 +0000 |
---|---|---|
committer | Owen Taylor <otaylor@src.gnome.org> | 2001-11-26 23:18:53 +0000 |
commit | e3f92b5972401c611f26f028804c4b7056f0be00 (patch) | |
tree | 6564f810c7235e71ffff0dd844961dc1438433e6 /modules/hangul/hangul-x.c | |
parent | 1170903eb4010f837197c71d2817b9933b3f9ef4 (diff) | |
download | pango-e3f92b5972401c611f26f028804c4b7056f0be00.tar.gz |
Instead of including all-unicode.txt in the distribution, include a small
Mon Nov 26 18:17:00 2001 Owen Taylor <otaylor@redhat.com>
* tests/Makefile.am tests/gen-all-unicode.c: Instead
of including all-unicode.txt in the distribution, include
a small program to generate it.
* modules/hangul/hangul-x.c (render_syllable_with_ksc5601): When
falling back to uncomposed Jamos, if we can't render a Jamo
in any way, use the unknown glyph rather than nothing.
* modules/hangul/hangul-x.c (hangul_engine_shape): Prevent
overflows for invalid sequences which can be of arbitrary
length. (#50086)
* modules/arabic/arconv.c: New versions from Roozbeh Pournader.
- Replacing the tables with automatically-generated ones
- Using binary search instead of linear search for table lookup
- Updating all the names with Unicode names (eg Nun -> Noon)
- Fixed the Hamza mixup, using the Unicode rules
- Updating missed cases (eg Superscript Alef was missing from
arabic_isvowel)
- Removing too-intelligent cases which made the code non-compliant
(eg Alef with Hamza above+Kasra was changing to Alef with Hamza below)
- Removing 'connecttoleft' from 'charstruct' (replacing it with a macro)
- Indenting in the GNU style
Diffstat (limited to 'modules/hangul/hangul-x.c')
-rw-r--r-- | modules/hangul/hangul-x.c | 47 |
1 files changed, 46 insertions, 1 deletions
diff --git a/modules/hangul/hangul-x.c b/modules/hangul/hangul-x.c index 951819b1..d1308b6e 100644 --- a/modules/hangul/hangul-x.c +++ b/modules/hangul/hangul-x.c @@ -20,6 +20,7 @@ */ #include <glib.h> +#include <stdlib.h> #include <string.h> #include "pangox.h" @@ -71,6 +72,29 @@ set_glyph (PangoGlyphString *glyphs, glyphs->glyphs[i].geometry.width = logical_rect.width; } +static void +set_unknown_glyph (PangoGlyphString *glyphs, + int *n_glyphs, + PangoFont *font, + gunichar wc, + int cluster_offset) +{ + PangoRectangle logical_rect; + gint i = *n_glyphs; + + (*n_glyphs)++; + pango_glyph_string_set_size (glyphs, *n_glyphs); + + glyphs->glyphs[i].glyph = pango_x_get_unknown_glyph (font); + + glyphs->glyphs[i].geometry.x_offset = 0; + glyphs->glyphs[i].geometry.y_offset = 0; + + pango_font_get_glyph_extents (font, glyphs->glyphs[i].glyph, NULL, &logical_rect); + glyphs->glyphs[i].geometry.width = logical_rect.width; + + glyphs->log_clusters[i] = cluster_offset; +} /* * From 3.10 of the Unicode 2.0 Book; used for combining Jamos. @@ -264,6 +288,8 @@ JOHAB_COMMON else break; } + if (j == 0) + set_unknown_glyph (glyphs, n_glyphs, font, text[i], cluster_offset); } } @@ -297,6 +323,8 @@ JOHAB_COMMON (*n_glyphs)++; } } + if (j == 0) + set_unknown_glyph (glyphs, n_glyphs, font, wc, cluster_offset); } } @@ -458,6 +486,8 @@ render_syllable_with_ksc5601 (PangoFont *font, PangoXSubfont subfont, glyphs->log_clusters[*n_glyphs] = cluster_offset; (*n_glyphs)++; } + if (j == 0) + set_unknown_glyph (glyphs, n_glyphs, font, gindex, cluster_offset); } } @@ -555,7 +585,9 @@ hangul_engine_shape (PangoFont *font, const char *ptr; const char *next; int i, n_chars; - gunichar2 jamos[4]; + gunichar2 jamos_static[4]; + guint jamos_max = G_N_ELEMENTS (jamos_static); + gunichar2 *jamos = jamos_static; int n_jamos = 0; int n_glyphs = 0, cluster_offset = 0; @@ -637,6 +669,16 @@ hangul_engine_shape (PangoFont *font, /* Clear. */ n_jamos = 0; } + if (n_jamos == jamos_max) + { + gunichar2 *new_jamos; + + jamos_max++; + new_jamos = g_new (gunichar2, jamos_max); + memcpy (new_jamos, jamos, n_jamos * sizeof (gunichar2)); + + jamos = new_jamos; + } jamos[n_jamos++] = wc; } } @@ -657,6 +699,9 @@ hangul_engine_shape (PangoFont *font, cluster_offset = next - text; n_jamos = 0; } + + if (jamos != jamos_static) + g_free (jamos); } static PangoCoverage * |