From: handa Date: Tue, 15 Jan 2008 00:33:09 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: REL-0-9-2 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=122bb5b03d69451e86471a9ba639e54078385948;p=m17n%2Fm17n-pango.git *** empty log message *** --- diff --git a/m17n-fc.c b/m17n-fc.c index 6efdd71..cc2b961 100644 --- a/m17n-fc.c +++ b/m17n-fc.c @@ -181,8 +181,15 @@ m17n_fc_get_family (PangoFont *pango_font) static MSymbol m17n_fc_get_language (PangoLanguage *pango_language) { + static PangoLanguage *cached_pango_language; + static MSymbol cached_language; MSymbol language; + if (cached_pango_language == pango_language) + { + return cached_language; + } + if (pango_language) { const char *lang = pango_language_to_string (pango_language); @@ -206,6 +213,8 @@ m17n_fc_get_language (PangoLanguage *pango_language) } else language = Mnil; + cached_pango_language = pango_language; + cached_language = language; return language; } @@ -217,7 +226,16 @@ m17n_fc_get_language (PangoLanguage *pango_language) MPlist * m17n_fc_lookup_fontset (MSymbol script, MSymbol language) { - MPlist *plist = mfontset_lookup (fontset, script, language, Mnil); + static MSymbol cached_script, cached_language; + static MPlist *cached_plist; + MPlist *plist; + + if (cached_script == script && cached_language == language) + { + m17n_object_ref (cached_plist); + return cached_plist; + } + plist = mfontset_lookup (fontset, script, language, Mnil); if (mplist_key (plist) == Mnil) { @@ -256,6 +274,10 @@ m17n_fc_lookup_fontset (MSymbol script, MSymbol language) } } } + cached_language = language; + cached_script = script; + cached_plist = plist; + m17n_object_ref (plist); return plist; } @@ -329,30 +351,22 @@ m17n_fc_engine_shape (PangoEngineShape *engine, g_return_if_fail (length >= 0); g_return_if_fail (analysis != NULL); - if (debug_level > 0) - { - char *msg = alloca (length + 1); - - if (msg) - { - memcpy (msg, text, length); - msg[length] = '\0'; - } - else - msg = "..."; - g_debug ("shape \"%s\"", msg); - } - if (! MZs) { MZs = msymbol ("Zs"); MCf = msymbol ("Cf"); + memset (&control, 0, sizeof control); } language = m17n_fc_get_language (analysis->language); mt = mtext_from_data (text, length, MTEXT_FORMAT_UTF_8); nchars = mtext_len (mt); + if (debug_level > 0) + { + g_debug ("shape \"U+%04X\"", mtext_ref_char (mt, 0)); + } + offsets = alloca (sizeof (int) * nchars); g_return_if_fail (offsets != NULL); for (i = 0, p = text; i < nchars; i++, p = g_utf8_next_char (p)) @@ -362,8 +376,10 @@ m17n_fc_engine_shape (PangoEngineShape *engine, g_return_if_fail (font != NULL); mtext_put_prop (mt, 0, nchars, Mfont, font); +#if 0 if (language != Mnil) mtext_put_prop (mt, 0, nchars, Mlanguage, language); +#endif control.enable_bidi = 1; m_glyphs = alloca (sizeof (MDrawGlyph) * nchars * 2); @@ -448,6 +464,9 @@ m17n_fc_engine_covers (PangoEngineShape *engine, Minherited = msymbol ("inherited"); } +#if 1 + return PANGO_COVERAGE_EXACT; +#else if (debug_level > 0 && wc != last_wc) { g_debug ("covers for U+%04X", wc); @@ -494,6 +513,7 @@ m17n_fc_engine_covers (PangoEngineShape *engine, result == PANGO_COVERAGE_EXACT ? "exact" : "none"); return result; +#endif } static void