Loading ...
Sorry, an error occurred while loading the content.

159[vim-multibyte] Tearoff Menu use font given from System.

Expand Messages
  • Yasuhiro Matsumoto
    Jan 23, 2000
      If vim user want to use multibyte tearoff menu
      then they must change source "gui_w32.c".

      Example....

      From:
      #define DLG_FONT_NAME "MS Sans Serif"
      To:
      #define DLG_FONT_NAME .... (possible font)

      see screenshot

      Original tearoff menu (japanesed)
      http://www.cis-net.co.jp/matsu/vim/work/original.jpg
      Patched tearoff menu (japanesed)
      http://www.cis-net.co.jp/matsu/vim/work/patched.jpg

      So I made patch.
      I think that this patch support multilingual.
      And if you change the system property of menu
      then vim change too.
      (but you must tear off the menu.)

      ----------------------------------------
      Problem: Tearoff menu possible use font that everyone doesn't have.
      Solution: Tearoff menu use font given from system.
      Files: src/gui_w32.c src/proto/gui_w32.pro

      *** src/gui_w32.c.orig Mon Jan 17 01:42:02 2000
      --- src/gui_w32.c Mon Jan 24 12:53:04 2000
      ***************
      *** 162,167 ****
      --- 162,169 ----
      static LOGFONT norm_logfont;
      #endif
      #endif
      + /* Use System Menu Font */
      + #define USE_SYSMENU_FONT

      /* Local variables: */
      static int s_button_pending = -1;
      ***************
      *** 2641,2647 ****
      if (font_name == NULL)
      font_name = lf.lfFaceName;
      #ifdef MULTI_BYTE_IME
      ! get_logfont(&norm_logfont, font_name);
      #endif
      gui_mch_free_font(gui.norm_font);
      gui.norm_font = font;
      --- 2643,2650 ----
      if (font_name == NULL)
      font_name = lf.lfFaceName;
      #ifdef MULTI_BYTE_IME
      ! //get_logfont(&norm_logfont, font_name);
      ! mch_memmove(&norm_logfont, &lf, sizeof(LOGFONT));
      #endif
      gui_mch_free_font(gui.norm_font);
      gui.norm_font = font;
      ***************
      *** 4613,4618 ****
      --- 4616,4635 ----
      "IDR_VIM_QUESTION"
      };

      + #ifdef USE_SYSMENU_FONT
      + /*
      + * Get Menu Font
      + */
      + LOGFONT*
      + gui_w32_get_menu_font()
      + {
      + static NONCLIENTMETRICS nm;
      + nm.cbSize = sizeof (NONCLIENTMETRICS);
      + SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(
      NONCLIENTMETRICS ), &nm, 0);
      + return &(nm.lfMenuFont);
      + }
      + #endif
      +
      int
      gui_mch_dialog(
      int type,
      ***************
      *** 4643,4648 ****
      --- 4660,4668 ----
      int vertical;
      int dlgPaddingX;
      int dlgPaddingY;
      + #ifdef USE_SYSMENU_FONT
      + LOGFONT *sysmenu_logfont = NULL;
      + #endif

      #ifndef NO_CONSOLE
      /* Don't output anything in silent mode ("ex -s") */
      ***************
      *** 4700,4707 ****
      --- 4720,4732 ----
      */
      hwnd = GetDesktopWindow();
      hdc = GetWindowDC(hwnd);
      + #ifndef USE_SYSMENU_FONT
      font = CreateFont(-DLG_FONT_POINT_SIZE, 0, 0, 0, 0, 0, 0, 0, 0, 0,
      0, 0,
      VARIABLE_PITCH , DLG_FONT_NAME);
      + #else
      + sysmenu_logfont = gui_w32_get_menu_font();
      + font = CreateFontIndirect(sysmenu_logfont);
      + #endif
      if (s_usenewlook)
      {
      oldFont = SelectFont(hdc, font);
      ***************
      *** 4837,4845 ****
      --- 4862,4877 ----
      if (s_usenewlook)
      {
      /* do the font, since DS_3DLOOK doesn't work properly */
      + #ifndef USE_SYSMENU_FONT
      *p++ = DLG_FONT_POINT_SIZE; //point size
      nchar = nCopyAnsiToWideChar (p, TEXT(DLG_FONT_NAME));
      p += nchar;
      + #else
      + /* point size */
      + *p++ = -MulDiv(sysmenu_logfont->lfHeight, 72, GetDeviceCaps(hdc,
      LOGPIXELSY));
      + nchar = nCopyAnsiToWideChar (p, TEXT(sysmenu_logfont->lfFaceName));
      + p += nchar;
      + #endif
      }

      pstart = tbuffer;
      ***************
      *** 5182,5187 ****
      --- 5214,5222 ----
      char_u *label, *text, *end, *acEnd;
      int padding0, padding1, padding2;
      int sepPadding=0;
      + #ifdef USE_SYSMENU_FONT
      + LOGFONT *sysmenu_logfont = NULL;
      + #endif

      /*
      * If this menu is already torn off, then don't
      ***************
      *** 5215,5222 ****
      --- 5250,5262 ----

      hwnd = GetDesktopWindow();
      hdc = GetWindowDC(hwnd);
      + #ifndef USE_SYSMENU_FONT
      font = CreateFont(-DLG_FONT_POINT_SIZE, 0, 0, 0, 0, 0, 0, 0, 0, 0,
      0, 0,
      VARIABLE_PITCH , DLG_FONT_NAME);
      + #else
      + sysmenu_logfont = gui_w32_get_menu_font();
      + font = CreateFontIndirect(sysmenu_logfont);
      + #endif
      if (s_usenewlook)
      oldFont = SelectFont(hdc, font);
      else
      ***************
      *** 5315,5323 ****
      --- 5355,5370 ----
      if (s_usenewlook)
      {
      /* do the font, since DS_3DLOOK doesn't work properly */
      + #ifndef USE_SYSMENU_FONT
      *p++ = DLG_FONT_POINT_SIZE; //point size
      nchar = nCopyAnsiToWideChar (p, TEXT(DLG_FONT_NAME));
      p += nchar;
      + #else
      + /* point size */
      + *p++ = -MulDiv(sysmenu_logfont->lfHeight, 72, GetDeviceCaps(hdc,
      LOGPIXELSY));
      + nchar = nCopyAnsiToWideChar (p, TEXT(sysmenu_logfont->lfFaceName));
      + p += nchar;
      + #endif
      }

      /* Don't include tearbar in tearoff menu */
      ***************
      *** 5447,5452 ****
      --- 5494,5502 ----
      HFONT hfontTools = 0;
      DWORD dlgFontSize;
      SIZE size;
      + #ifdef USE_SYSMENU_FONT
      + LOGFONT *sysmenu_logfont = NULL;
      + #endif

      s_usenewlook = FALSE;

      ***************
      *** 5456,5463 ****
      --- 5506,5518 ----
      */
      if (!is_winnt_3())
      {
      + #ifndef USE_SYSMENU_FONT
      hfontTools = CreateFont(-DLG_FONT_POINT_SIZE, 0, 0, 0, 0, 0, 0, 0,
      0, 0, 0, 0, VARIABLE_PITCH , DLG_FONT_NAME);
      + #else
      + sysmenu_logfont = gui_w32_get_menu_font();
      + hfontTools = CreateFontIndirect(sysmenu_logfont);
      + #endif

      if (hfontTools)
      {
      *** src/proto/gui_w32.pro.orig Mon Jan 24 12:59:07 2000
      --- src/proto/gui_w32.pro Mon Jan 24 12:59:53 2000
      ***************
      *** 67,69 ****
      --- 67,70 ----
      void gui_mch_find_dialog __ARGS((char_u *arg));
      void gui_mch_replace_dialog __ARGS((char_u *arg));
      void gui_mch_mousehide __ARGS((int hide));
      + LOGFONT* gui_get_sysmenu_logfont __ARGS((void));
    • Show all 4 messages in this topic