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

[vim-multibyte] Please use font given from SystemParameterInfo

Expand Messages
  • Yasuhiro Matsumoto
    I think good of... The GVim must not use static font name on GUI tear off menu. It is possible that everyone don t have font MS Sans Serif . Problem: Font of
    Message 1 of 1 , Jan 16, 2000
    • 0 Attachment
      I think good of...
      The GVim must not use static font name on GUI tear off menu.
      It is possible that everyone don't have font "MS Sans Serif".

      Problem: Font of Tearoff Menu use static font name.
      Solution: Use SystemParametersInfo function
      Files: src/gui_w32.c

      *** src/gui_w32.c.orig
      --- src/gui_w32.c
      **************
      *** 162,167
      static LOGFONT norm_logfont;
      #endif
      #endif

      /* Local variables: */
      static int s_button_pending = -1;
      --- 162,169 -----
      static LOGFONT norm_logfont;
      #endif
      #endif
      + /* Use System Menu Font */
      + #define USE_SYSMENU_FONT

      /* Local variables: */
      static int s_button_pending = -1;
      **************
      *** 4613,4618
      "IDR_VIM_QUESTION"
      };

      int
      gui_mch_dialog(
      int type,
      --- 4615,4634 -----
      "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
      int vertical;
      int dlgPaddingX;
      int dlgPaddingY;

      #ifndef NO_CONSOLE
      /* Don't output anything in silent mode ("ex -s") */
      --- 4659,4667 -----
      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,4705
      */
      hwnd = GetDesktopWindow();
      hdc = GetWindowDC(hwnd);
      font = CreateFont(-DLG_FONT_POINT_SIZE, 0, 0, 0, 0, 0, 0, 0, 0, 0,
      0, 0,
      VARIABLE_PITCH , DLG_FONT_NAME);
      if (s_usenewlook)
      --- 4719,4725 -----
      */
      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
      **************
      *** 4702,4707
      hdc = GetWindowDC(hwnd);
      font = CreateFont(-DLG_FONT_POINT_SIZE, 0, 0, 0, 0, 0, 0, 0, 0, 0,
      0, 0,
      VARIABLE_PITCH , DLG_FONT_NAME);
      if (s_usenewlook)
      {
      oldFont = SelectFont(hdc, font);
      --- 4722,4731 -----
      #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,4842
      if (s_usenewlook)
      {
      /* do the font, since DS_3DLOOK doesn't work properly */
      *p++ = DLG_FONT_POINT_SIZE; //point size
      nchar = nCopyAnsiToWideChar (p, TEXT(DLG_FONT_NAME));
      p += nchar;
      --- 4861,4867 -----
      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;
      **************
      *** 4840,4845
      *p++ = DLG_FONT_POINT_SIZE; //point size
      nchar = nCopyAnsiToWideChar (p, TEXT(DLG_FONT_NAME));
      p += nchar;
      }

      pstart = tbuffer;
      --- 4865,4876 -----
      *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
      char_u *label, *text, *end, *acEnd;
      int padding0, padding1, padding2;
      int sepPadding=0;

      /*
      * If this menu is already torn off, then don't
      --- 5213,5221 -----
      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,5220

      hwnd = GetDesktopWindow();
      hdc = GetWindowDC(hwnd);
      font = CreateFont(-DLG_FONT_POINT_SIZE, 0, 0, 0, 0, 0, 0, 0, 0, 0,
      0, 0,
      VARIABLE_PITCH , DLG_FONT_NAME);
      if (s_usenewlook)
      --- 5249,5255 -----

      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
      **************
      *** 5217,5222
      hdc = GetWindowDC(hwnd);
      font = CreateFont(-DLG_FONT_POINT_SIZE, 0, 0, 0, 0, 0, 0, 0, 0, 0,
      0, 0,
      VARIABLE_PITCH , DLG_FONT_NAME);
      if (s_usenewlook)
      oldFont = SelectFont(hdc, font);
      else
      --- 5252,5261 -----
      #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,5320
      if (s_usenewlook)
      {
      /* do the font, since DS_3DLOOK doesn't work properly */
      *p++ = DLG_FONT_POINT_SIZE; //point size
      nchar = nCopyAnsiToWideChar (p, TEXT(DLG_FONT_NAME));
      p += nchar;
      --- 5354,5360 -----
      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;
      **************
      *** 5318,5323
      *p++ = DLG_FONT_POINT_SIZE; //point size
      nchar = nCopyAnsiToWideChar (p, TEXT(DLG_FONT_NAME));
      p += nchar;
      }

      /* Don't include tearbar in tearoff menu */
      --- 5358,5369 -----
      *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
      HFONT hfontTools = 0;
      DWORD dlgFontSize;
      SIZE size;

      s_usenewlook = FALSE;

      --- 5493,5501 -----
      HFONT hfontTools = 0;
      DWORD dlgFontSize;
      SIZE size;
      + #ifdef USE_SYSMENU_FONT
      + LOGFONT *sysmenu_logfont = NULL;
      + #endif

      s_usenewlook = FALSE;

      **************
      *** 5456,5461
      */
      if (!is_winnt_3())
      {
      hfontTools = CreateFont(-DLG_FONT_POINT_SIZE, 0, 0, 0, 0, 0, 0, 0,
      0, 0, 0, 0, VARIABLE_PITCH , DLG_FONT_NAME);

      --- 5505,5511 -----
      */
      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
      **************
      *** 5458,5463
      {
      hfontTools = CreateFont(-DLG_FONT_POINT_SIZE, 0, 0, 0, 0, 0, 0, 0,
      0, 0, 0, 0, VARIABLE_PITCH , DLG_FONT_NAME);

      if (hfontTools)
      {
      --- 5508,5517 -----
      #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)
      {
    Your message has been successfully submitted and would be delivered to recipients shortly.