comparison src/gui_gtk_x11.c @ 9879:5cd29e15f2f7 v7.4.2214

commit https://github.com/vim/vim/commit/16350cb97914bc86320185a9910b23c2b297d273 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Aug 14 20:27:34 2016 +0200 patch 7.4.2214 Problem: A font that uses ligatures messes up the screen display. Solution: Put spaces between characters when building the glyph table. (based on a patch from Manuel Schiller)
author Christian Brabandt <cb@256bit.org>
date Sun, 14 Aug 2016 20:30:06 +0200
parents 664276833670
children ccb6461b82df
comparison
equal deleted inserted replaced
9878:1f21964a22f7 9879:5cd29e15f2f7
5237 * the itemize and shaping process for the most common case. 5237 * the itemize and shaping process for the most common case.
5238 */ 5238 */
5239 static void 5239 static void
5240 ascii_glyph_table_init(void) 5240 ascii_glyph_table_init(void)
5241 { 5241 {
5242 char_u ascii_chars[128]; 5242 char_u ascii_chars[2 * 128];
5243 PangoAttrList *attr_list; 5243 PangoAttrList *attr_list;
5244 GList *item_list; 5244 GList *item_list;
5245 int i; 5245 int i;
5246 5246
5247 if (gui.ascii_glyphs != NULL) 5247 if (gui.ascii_glyphs != NULL)
5250 g_object_unref(gui.ascii_font); 5250 g_object_unref(gui.ascii_font);
5251 5251
5252 gui.ascii_glyphs = NULL; 5252 gui.ascii_glyphs = NULL;
5253 gui.ascii_font = NULL; 5253 gui.ascii_font = NULL;
5254 5254
5255 /* For safety, fill in question marks for the control characters. */ 5255 /* For safety, fill in question marks for the control characters.
5256 for (i = 0; i < 32; ++i) 5256 * Put a space between characters to avoid shaping. */
5257 ascii_chars[i] = '?'; 5257 for (i = 0; i < 128; ++i)
5258 for (; i < 127; ++i) 5258 {
5259 ascii_chars[i] = i; 5259 if (i >= 32 && i < 127)
5260 ascii_chars[i] = '?'; 5260 ascii_chars[2 * i] = i;
5261 else
5262 ascii_chars[2 * i] = '?';
5263 ascii_chars[2 * i + 1] = ' ';
5264 }
5261 5265
5262 attr_list = pango_attr_list_new(); 5266 attr_list = pango_attr_list_new();
5263 item_list = pango_itemize(gui.text_context, (const char *)ascii_chars, 5267 item_list = pango_itemize(gui.text_context, (const char *)ascii_chars,
5264 0, sizeof(ascii_chars), attr_list, NULL); 5268 0, sizeof(ascii_chars), attr_list, NULL);
5265 5269
5944 5948
5945 pango_glyph_string_set_size(glyphs, len); 5949 pango_glyph_string_set_size(glyphs, len);
5946 5950
5947 for (i = 0; i < len; ++i) 5951 for (i = 0; i < len; ++i)
5948 { 5952 {
5949 glyphs->glyphs[i] = gui.ascii_glyphs->glyphs[s[i]]; 5953 glyphs->glyphs[i] = gui.ascii_glyphs->glyphs[2 * s[i]];
5950 glyphs->log_clusters[i] = i; 5954 glyphs->log_clusters[i] = i;
5951 } 5955 }
5952 5956
5953 #if GTK_CHECK_VERSION(3,0,0) 5957 #if GTK_CHECK_VERSION(3,0,0)
5954 draw_glyph_string(row, col, len, flags, gui.ascii_font, glyphs, cr); 5958 draw_glyph_string(row, col, len, flags, gui.ascii_font, glyphs, cr);