vte r2312 - in trunk: . src



Author: behdad
Date: Tue Dec  2 20:16:27 2008
New Revision: 2312
URL: http://svn.gnome.org/viewvc/vte?rev=2312&view=rev

Log:
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.



Modified:
   trunk/ChangeLog
   trunk/src/vtedraw.h
   trunk/src/vtepangocairo.c

Modified: trunk/src/vtedraw.h
==============================================================================
--- trunk/src/vtedraw.h	(original)
+++ trunk/src/vtedraw.h	Tue Dec  2 20:16:27 2008
@@ -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'

Modified: trunk/src/vtepangocairo.c
==============================================================================
--- trunk/src/vtepangocairo.c	(original)
+++ trunk/src/vtepangocairo.c	Tue Dec  2 20:16:27 2008
@@ -270,6 +270,8 @@
 	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 @@
 	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 @@
 		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 */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]