Patch 8.1.1294
Problem:    MS-Windows: Some fonts return wrong average char width.
Solution:   Compute the average ourselves. (Ken Takata, closes #4356)
Files:      src/gui_w32.c


*** ../vim-8.1.1293/src/gui_w32.c       2019-04-29 21:46:22.849288641 +0200
--- src/gui_w32.c       2019-05-07 22:50:35.029418835 +0200
***************
*** 1455,1464 ****
      HWND    hwnd = GetDesktopWindow();
      HDC           hdc = GetWindowDC(hwnd);
      HFONT   hfntOld = SelectFont(hdc, (HFONT)font);
      TEXTMETRIC tm;
  
      GetTextMetrics(hdc, &tm);
!     gui.char_width = tm.tmAveCharWidth + tm.tmOverhang;
  
      gui.char_height = tm.tmHeight + p_linespace;
  
--- 1455,1470 ----
      HWND    hwnd = GetDesktopWindow();
      HDC           hdc = GetWindowDC(hwnd);
      HFONT   hfntOld = SelectFont(hdc, (HFONT)font);
+     SIZE    size;
      TEXTMETRIC tm;
  
      GetTextMetrics(hdc, &tm);
!     // GetTextMetrics() may not return the right value in tmAveCharWidth
!     // for some fonts.  Do our own average computation.
!     GetTextExtentPoint(hdc,
!           "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
!           52, &size);
!     gui.char_width = (size.cx / 26 + 1) / 2 + tm.tmOverhang;
  
      gui.char_height = tm.tmHeight + p_linespace;
  
*** ../vim-8.1.1293/src/version.c       2019-05-07 22:25:23.486167275 +0200
--- src/version.c       2019-05-07 22:52:16.076724322 +0200
***************
*** 769,770 ****
--- 769,772 ----
  {   /* Add new patch number below this line */
+ /**/
+     1294,
  /**/

-- 
No man may purchase alcohol without written consent from his wife.
                [real standing law in Pennsylvania, United States of America]

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/201905072053.x47Kr5sF021706%40masaka.moolenaar.net.
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui