To: vim-dev@vim.org Subject: patch 5.5.043 Fcc: outbox From: Bram Moolenaar ------------ Patch 5.5.043 Problem: GTK: Handling of fontset fonts was not right when 'guifontset' contains exactly 14 times '-'. Solution: Avoid setting fonts when working with a fontset. (Sung-Hyun Nam) Files: src/gui_gtk_x11.c *** ../vim-5.5.42/src/gui_gtk_x11.c Sun Oct 31 15:20:13 1999 --- src/gui_gtk_x11.c Fri Dec 3 15:44:48 1999 *************** *** 1519,1608 **** /* Set the fontname, which will be used for information purposes */ hl_set_font_name(font_name); ! /* There is only one excuse I can give for the following attempt ! * to manage font styles: ! * ! * I HATE THE BRAIN DEAD WAY X11 IS HANDLING FONTS (--mdcki) ! */ ! if ((sdup = g_strdup((const char *)font_name)) == NULL) ! return FAIL; ! ! /* slipt up the whole */ ! i = 0; ! for (tmp = sdup; *tmp != '\0'; ++tmp) { ! if (*tmp == '-') { ! *tmp = '\0'; ! chunk[i] = tmp + 1; ! ++i; ! } ! } ! g_free(sdup); ! ! if (i == 14) { ! char *bold_name = NULL; ! char *ital_name = NULL; ! char *italbold_name = NULL; ! ! /* font name was compleate */ ! len = strlen((const char *)font_name) + 32; ! bold_name = (char *)alloc(len); ! ital_name = (char *)alloc(len); ! italbold_name = (char *)alloc(len); ! if (bold_name == NULL || ital_name == NULL || italbold_name == NULL) { ! vim_free(bold_name); ! vim_free(ital_name); ! vim_free(italbold_name); return FAIL; - } ! *bold_name = '\0'; ! *ital_name = '\0'; ! *italbold_name = '\0'; ! ! for (i = 0; i < 14; ++i) { ! strcat(bold_name, "-"); ! strcat(ital_name, "-"); ! strcat(italbold_name, "-"); ! strcat(bold_name, (i != 2) ? chunk[i] : "bold"); ! strcat(ital_name, (i != 3) ? chunk[i] : "o"); ! ! if (i != 2 && i != 3) ! strcat(italbold_name, chunk[i]); ! else { ! if (i == 2) ! strcat(italbold_name, "bold"); ! else if (i == 3) ! strcat(italbold_name, "o"); } - } ! font = gui_mch_get_font((char_u *)bold_name, FALSE); ! if (font != NULL) ! gui.bold_font = font; ! else if (gui.bold_font) { ! gdk_font_unref(gui.bold_font); ! gui.bold_font = NULL; ! } ! font = gui_mch_get_font((char_u *)ital_name, FALSE); ! if (font != NULL) ! gui.ital_font = font; ! else if (gui.ital_font) { ! gdk_font_unref(gui.ital_font); ! gui.ital_font = NULL; ! } ! font = gui_mch_get_font((char_u *)italbold_name, FALSE); ! if (font != NULL) ! gui.boldital_font = font; ! else if (gui.boldital_font) { ! gdk_font_unref(gui.boldital_font); ! gui.boldital_font = NULL; ! } ! vim_free(bold_name); ! vim_free(ital_name); ! vim_free(italbold_name); } /* Synchronize the fonts used in user input dialogs, since otherwise --- 1519,1619 ---- /* Set the fontname, which will be used for information purposes */ hl_set_font_name(font_name); ! if (font->type != GDK_FONT_FONTSET) ! { ! /* There is only one excuse I can give for the following attempt ! * to manage font styles: ! * ! * I HATE THE BRAIN DEAD WAY X11 IS HANDLING FONTS (--mdcki) ! */ ! if ((sdup = g_strdup((const char *)font_name)) == NULL) return FAIL; ! /* slipt up the whole */ ! i = 0; ! for (tmp = sdup; *tmp != '\0'; ++tmp) ! if (*tmp == '-') ! { ! *tmp = '\0'; ! chunk[i] = tmp + 1; ! ++i; } ! g_free(sdup); ! if (i == 14) ! { ! char *bold_name = NULL; ! char *ital_name = NULL; ! char *italbold_name = NULL; ! ! /* font name was compleate */ ! len = strlen((const char *)font_name) + 32; ! bold_name = (char *)alloc(len); ! ital_name = (char *)alloc(len); ! italbold_name = (char *)alloc(len); ! if (bold_name == NULL || ital_name == NULL || italbold_name == NULL) ! { ! vim_free(bold_name); ! vim_free(ital_name); ! vim_free(italbold_name); ! return FAIL; ! } ! *bold_name = '\0'; ! *ital_name = '\0'; ! *italbold_name = '\0'; ! ! for (i = 0; i < 14; ++i) ! { ! strcat(bold_name, "-"); ! strcat(ital_name, "-"); ! strcat(italbold_name, "-"); ! strcat(bold_name, (i != 2) ? chunk[i] : "bold"); ! strcat(ital_name, (i != 3) ? chunk[i] : "o"); ! ! if (i != 2 && i != 3) ! strcat(italbold_name, chunk[i]); ! else ! { ! if (i == 2) ! strcat(italbold_name, "bold"); ! else if (i == 3) ! strcat(italbold_name, "o"); ! } ! } ! ! font = gui_mch_get_font((char_u *)bold_name, FALSE); ! if (font != NULL) ! gui.bold_font = font; ! else if (gui.bold_font) ! { ! gdk_font_unref(gui.bold_font); ! gui.bold_font = NULL; ! } ! font = gui_mch_get_font((char_u *)ital_name, FALSE); ! if (font != NULL) ! gui.ital_font = font; ! else if (gui.ital_font) ! { ! gdk_font_unref(gui.ital_font); ! gui.ital_font = NULL; ! } ! ! font = gui_mch_get_font((char_u *)italbold_name, FALSE); ! if (font != NULL) ! gui.boldital_font = font; ! else if (gui.boldital_font) ! { ! gdk_font_unref(gui.boldital_font); ! gui.boldital_font = NULL; ! } ! ! vim_free(bold_name); ! vim_free(ital_name); ! vim_free(italbold_name); ! } } /* Synchronize the fonts used in user input dialogs, since otherwise *** ../vim-5.5.42/src/version.c Fri Dec 3 15:48:38 1999 --- src/version.c Fri Dec 3 15:48:18 1999 *************** *** 420,420 **** --- 420,421 ---- { /* Add new patch number below this line */ + 43, -- hundred-and-one symptoms of being an internet addict: 216. Your pet rock leaves home. --/-/---- Bram Moolenaar ---- Bram@moolenaar.net ---- Bram@vim.org ---\-\-- \ \ www.vim.org/iccf www.moolenaar.net www.vim.org / /