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);
}
else
language = Mnil;
+ cached_pango_language = pango_language;
+ cached_language = language;
return 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)
{
}
}
}
+ cached_language = language;
+ cached_script = script;
+ cached_plist = plist;
+ m17n_object_ref (plist);
return plist;
}
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))
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);
Minherited = msymbol ("inherited");
}
+#if 1
+ return PANGO_COVERAGE_EXACT;
+#else
if (debug_level > 0 && wc != last_wc)
{
g_debug ("covers for U+%04X", wc);
result == PANGO_COVERAGE_EXACT ? "exact" : "none");
return result;
+#endif
}
static void