Commit 36e0a0aa authored by Behdad Esfahbod's avatar Behdad Esfahbod Committed by Behdad Esfahbod

Cache the full ASCII range if Latin uses the default language.

2008-12-02  Behdad Esfahbod  <behdad@gnome.org>

        * src/vtedraw.h:
        * src/vtepangocairo.c (font_info_cache_ascii):
        Cache the full ASCII range if Latin uses the default language.


svn path=/trunk/; revision=2312
parent 4a3768af
2008-12-02 Behdad Esfahbod <behdad@gnome.org>
* src/vtedraw.h:
* src/vtepangocairo.c (font_info_cache_ascii):
Cache the full ASCII range if Latin uses the default language.
2008-12-02 Behdad Esfahbod <behdad@gnome.org>
* src/vtepangocairo.c (context_hash), (context_equal),
......
......@@ -29,9 +29,15 @@
G_BEGIN_DECLS
#define VTE_DRAW_SINGLE_WIDE_CHARACTERS "ABCDEFGHIJKLMNOPQRSTUVWXYZ" \
#define VTE_DRAW_SINGLE_WIDE_CHARACTERS \
" !\"#$%&'()*+,-./" \
"0123456789" \
":;<=>?@" \
"ABCDEFGHIJKLMNOPQRSTUVWXYZ" \
"[\\]^_`" \
"abcdefghijklmnopqrstuvwxyz" \
"0123456789./+@&"
"{|}~" \
""
#define VTE_DRAW_DOUBLE_WIDE_CHARACTERS 0x4e00, 0x4e8c, 0x4e09, 0x56db, 0x4e94,\
0xac00, 0xac01, 0xac04, 0xac08, 0xac10
/* For Pango, we have to use CJK Ideographs alone. Otherwise, 'width'
......
......@@ -270,6 +270,8 @@ font_info_cache_ascii (struct font_info *info)
cairo_scaled_font_t *scaled_font;
const char *text;
gboolean more;
PangoLanguage *language;
gboolean latin_uses_default_language;
/* We have info->layout holding most ASCII characters. We want to
* cache as much info as we can about the ASCII letters so we don't
......@@ -279,6 +281,11 @@ font_info_cache_ascii (struct font_info *info)
if (pango_layout_get_unknown_glyphs_count (info->layout) != 0)
return;
language = pango_context_get_language (pango_layout_get_context (info->layout));
if (language == NULL)
language = pango_language_get_default ();
latin_uses_default_language = pango_language_includes_script (language, PANGO_SCRIPT_LATIN);
text = pango_layout_get_text (info->layout);
line = pango_layout_get_line_readonly (info->layout, 0);
......@@ -316,9 +323,11 @@ font_info_cache_ascii (struct font_info *info)
glyph = glyph_string->glyphs[iter.start_glyph].glyph;
geometry = &glyph_string->glyphs[iter.start_glyph].geometry;
/* Only cache non-common characters as common characters get
* their font from their neighbors */
if (pango_script_for_unichar (c) <= PANGO_SCRIPT_INHERITED)
/* If not using the default locale language, only cache non-common
* characters as common characters get their font from their neighbors
* and we don't want to force Latin on them. */
if (!latin_uses_default_language &&
pango_script_for_unichar (c) <= PANGO_SCRIPT_INHERITED)
continue;
/* Only cache simple glyphs */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment