To: vim-dev@vim.org Subject: Patch 6.2.237 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.2.237 Problem: GTK 2: Thai text is drawn wrong. It changes when moving the cursor over it. Solution: Disable the shaping engine, it moves combining characters to a wrong position and combines characters, while drawing the cursor doesn't combine characters. Files: src/gui_gtk_x11.c *** ../vim-6.2.236/src/gui_gtk_x11.c Sun Jan 25 20:45:55 2004 --- src/gui_gtk_x11.c Thu Feb 5 15:04:01 2004 *************** *** 4296,4301 **** --- 4296,4303 ---- #endif /* !HAVE_GTK2 */ #ifdef HAVE_GTK2 + static PangoEngineShape *default_shape_engine = NULL; + /* * Create a map from ASCII characters in the range [32,126] to glyphs * of the current font. This is used by gui_gtk2_draw_string() to skip *************** *** 4336,4341 **** --- 4338,4346 ---- item = (PangoItem *)item_list->data; width = gui.char_width * PANGO_SCALE; + /* Remember the shape engine used for ASCII. */ + default_shape_engine = item->analysis.shape_engine; + gui.ascii_font = item->analysis.font; g_object_ref(gui.ascii_font); *************** *** 5146,5151 **** --- 5151,5160 ---- */ item->analysis.level = (item->analysis.level + 1) & (~1U); + /* HACK: Overrule the shape engine, we don't want shaping to be + * done, because drawing the cursor would change the display. */ + item->analysis.shape_engine = default_shape_engine; + pango_shape((const char *)s + item->offset, item->length, &item->analysis, glyphs); /* *************** *** 5194,5200 **** item_cells += cellcount; cells = cellcount; } ! else if (i > 0) /* i == 0 "cannot happen" */ { int width; --- 5203,5209 ---- item_cells += cellcount; cells = cellcount; } ! else if (i > 0) { int width; *************** *** 5208,5214 **** MAX(0, width - cluster_width) / 2; glyph->geometry.width = width; } ! else { glyph->geometry.width = 0; } --- 5217,5223 ---- MAX(0, width - cluster_width) / 2; glyph->geometry.width = width; } ! else /* i == 0 "cannot happen" */ { glyph->geometry.width = 0; } *** ../vim-6.2.236/src/version.c Thu Feb 5 12:09:25 2004 --- src/version.c Thu Feb 5 15:28:02 2004 *************** *** 639,640 **** --- 639,642 ---- { /* Add new patch number below this line */ + /**/ + 237, /**/ -- The future isn't what it used to be. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ Project leader for A-A-P -- http://www.A-A-P.org /// \\\ Help AIDS victims, buy here: http://ICCF-Holland.org/click1.html ///