summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2000-02-02 04:00:04 +0000
committerOwen Taylor <otaylor@src.gnome.org>2000-02-02 04:00:04 +0000
commite709de3de9fb63189624b35022f47dc2665677d2 (patch)
tree860abcf39f910706a6d88867d975084470dc52d0 /modules
parent82d8346691a72e4dd37a1e3999a939be269df32d (diff)
downloadpango-e709de3de9fb63189624b35022f47dc2665677d2.tar.gz
Add a call to get a glyph for unknown an unknown char.
Wed Feb 2 20:49:21 2000 Owen Taylor <otaylor@redhat.com> * libpango/pangox.c (pango_x_get_unknown_glyph): Add a call to get a glyph for unknown an unknown char. * modules/basic/basic.c: use pango_x_get_unknown_glyph. * libpango/utils.[ch] (_pango_guchar4_to_utf8): Added util function for coverting wide chars to utf8. * libpango/pangox.c (pango_x_font_get_coverage pango_x_font_get_shaper): Initial implementations.
Diffstat (limited to 'modules')
-rw-r--r--modules/basic/basic-x.c45
-rw-r--r--modules/basic/basic.c45
2 files changed, 6 insertions, 84 deletions
diff --git a/modules/basic/basic-x.c b/modules/basic/basic-x.c
index 7f62ebcb..acd4a947 100644
--- a/modules/basic/basic-x.c
+++ b/modules/basic/basic-x.c
@@ -417,7 +417,6 @@ basic_engine_shape (PangoFont *font,
const char *p;
const char *next;
- PangoXSubfont fallback_subfont = 0;
CharCache *cache;
g_return_if_fail (font != NULL);
@@ -460,30 +459,7 @@ basic_engine_shape (PangoFont *font,
}
}
else
- {
- if (!fallback_subfont)
- {
- static char *charset_names[] = { "iso8859-1" };
- PangoXSubfont *subfonts;
- int *subfont_charsets;
- int n_subfonts;
-
- n_subfonts = pango_x_list_subfonts (font, charset_names, 1, &subfonts, &subfont_charsets);
-
- if (n_subfonts == 0)
- {
- g_warning ("No fallback character found\n");
- continue;
- }
-
- fallback_subfont = subfonts[0];
-
- g_free (subfont_charsets);
- g_free (subfonts);
- }
-
- set_glyph (font, glyphs, i, PANGO_X_MAKE_GLYPH (fallback_subfont, ' '));
- }
+ set_glyph (font, glyphs, i, pango_x_get_unknown_glyph (font));
p = next;
}
@@ -519,28 +495,13 @@ basic_engine_get_coverage (PangoFont *font,
PangoCoverage *result = pango_coverage_new ();
GUChar4 wc;
- iconv_t utf8_conv = (iconv_t)-1;
-
- if (utf8_conv == (iconv_t)-1)
- {
- utf8_conv = iconv_open ("utf-8", "ucs-4");
- if (utf8_conv == (iconv_t)-1)
- g_error ("Could not open coverter from ucs-4 to utf-8!");
- }
-
for (wc = 0; wc < 65536; wc++)
{
- char buf[4];
- const char *inbuf = (const char *)&wc;
- size_t inbytes_left = 4;
- char *outbuf = buf;
- size_t outbytes_left = 4;
-
- iconv (utf8_conv, &inbuf, &inbytes_left, &outbuf, &outbytes_left);
+ char buf[6];
+ _pango_guchar4_to_utf8 (wc, buf);
if (find_char (cache, font, wc, buf))
pango_coverage_set (result, wc, PANGO_COVERAGE_EXACT);
-
}
return result;
diff --git a/modules/basic/basic.c b/modules/basic/basic.c
index 7f62ebcb..acd4a947 100644
--- a/modules/basic/basic.c
+++ b/modules/basic/basic.c
@@ -417,7 +417,6 @@ basic_engine_shape (PangoFont *font,
const char *p;
const char *next;
- PangoXSubfont fallback_subfont = 0;
CharCache *cache;
g_return_if_fail (font != NULL);
@@ -460,30 +459,7 @@ basic_engine_shape (PangoFont *font,
}
}
else
- {
- if (!fallback_subfont)
- {
- static char *charset_names[] = { "iso8859-1" };
- PangoXSubfont *subfonts;
- int *subfont_charsets;
- int n_subfonts;
-
- n_subfonts = pango_x_list_subfonts (font, charset_names, 1, &subfonts, &subfont_charsets);
-
- if (n_subfonts == 0)
- {
- g_warning ("No fallback character found\n");
- continue;
- }
-
- fallback_subfont = subfonts[0];
-
- g_free (subfont_charsets);
- g_free (subfonts);
- }
-
- set_glyph (font, glyphs, i, PANGO_X_MAKE_GLYPH (fallback_subfont, ' '));
- }
+ set_glyph (font, glyphs, i, pango_x_get_unknown_glyph (font));
p = next;
}
@@ -519,28 +495,13 @@ basic_engine_get_coverage (PangoFont *font,
PangoCoverage *result = pango_coverage_new ();
GUChar4 wc;
- iconv_t utf8_conv = (iconv_t)-1;
-
- if (utf8_conv == (iconv_t)-1)
- {
- utf8_conv = iconv_open ("utf-8", "ucs-4");
- if (utf8_conv == (iconv_t)-1)
- g_error ("Could not open coverter from ucs-4 to utf-8!");
- }
-
for (wc = 0; wc < 65536; wc++)
{
- char buf[4];
- const char *inbuf = (const char *)&wc;
- size_t inbytes_left = 4;
- char *outbuf = buf;
- size_t outbytes_left = 4;
-
- iconv (utf8_conv, &inbuf, &inbytes_left, &outbuf, &outbytes_left);
+ char buf[6];
+ _pango_guchar4_to_utf8 (wc, buf);
if (find_char (cache, font, wc, buf))
pango_coverage_set (result, wc, PANGO_COVERAGE_EXACT);
-
}
return result;