home *** CD-ROM | disk | FTP | other *** search
/ vim.ftp.fu-berlin.de / 2015-02-03.vim.ftp.fu-berlin.de.tar / vim.ftp.fu-berlin.de / patches / 6.1.303 < prev    next >
Encoding:
Internet Message Format  |  2003-01-27  |  3.5 KB

  1. To: vim-dev@vim.org
  2. Subject: Patch 6.1.303 (extra)
  3. Fcc: outbox
  4. From: Bram Moolenaar <Bram@moolenaar.net>
  5. Mime-Version: 1.0
  6. Content-Type: text/plain; charset=ISO-8859-1
  7. Content-Transfer-Encoding: 8bit
  8. ------------
  9.  
  10. Patch 6.1.303 (extra)
  11. Problem:    The Top/Bottom/All text does not always fit in the ruler when
  12.         translated to Japanese.  Problem with a character being wider when
  13.         in a bold font.
  14. Solution:   Use ETO_PDY to specify the width of each character. (Yasuhiro
  15.         Matsumoto)
  16. Files:        src/gui_w32.c
  17.  
  18.  
  19. *** ../vim61.302/src/gui_w32.c    Sun Jan 19 21:22:53 2003
  20. --- src/gui_w32.c    Thu Jan 23 14:55:54 2003
  21. ***************
  22. *** 268,273 ****
  23. --- 268,276 ----
  24.   #ifndef ETO_IGNORELANGUAGE
  25.   # define ETO_IGNORELANGUAGE  0x1000
  26.   #endif
  27. + #ifndef ETO_PDY
  28. + # define ETO_PDY             0x2000
  29. + #endif
  30.   
  31.   /*
  32.    * Return TRUE when running under Windows NT 3.x or Win32s, both of which have
  33. ***************
  34. *** 1601,1606 ****
  35. --- 1604,1610 ----
  36.       UINT    foptions = 0;
  37.   #ifdef FEAT_MBYTE
  38.       static WCHAR *unicodebuf = NULL;
  39. +     static int   *unicodepdy = NULL;
  40.       int        unibuflen = 0;
  41.       int        n;
  42.   #endif
  43. ***************
  44. *** 1736,1741 ****
  45. --- 1740,1754 ----
  46.       {
  47.       vim_free(unicodebuf);
  48.       unicodebuf = (WCHAR *)alloc(len * sizeof(WCHAR));
  49. +     vim_free(unicodepdy);
  50. +     unicodepdy = (int *)alloc(len * sizeof(int) * 2);
  51. +     if (unicodepdy == NULL)
  52. +     {
  53. +         vim_free(unicodebuf);
  54. +         unicodebuf = NULL;
  55. +     }
  56.       unibuflen = len;
  57.       }
  58.   
  59. ***************
  60. *** 1746,1762 ****
  61.       int        i = 0;
  62.       int        clen;    /* string length up to composing char */
  63.       int        cells;    /* cell width of string up to composing char */
  64.   
  65.       cells = 0;
  66.       for (clen = 0; i < len; )
  67.       {
  68.           unicodebuf[clen] = utf_ptr2char(text + i);
  69. !         cells += utf_char2cells(unicodebuf[clen]);
  70.           i += utfc_ptr2len_check_len(text + i, len - i);
  71.           ++clen;
  72.       }
  73.       ExtTextOutW(s_hdc, TEXT_X(col), TEXT_Y(row),
  74. !                  foptions, pcliprect, unicodebuf, clen, NULL);
  75.       len = cells;    /* used for underlining */
  76.       }
  77.       else if (is_funky_dbcs)
  78. --- 1759,1782 ----
  79.       int        i = 0;
  80.       int        clen;    /* string length up to composing char */
  81.       int        cells;    /* cell width of string up to composing char */
  82. +     int        cw;    /* width of current cell */
  83.   
  84.       cells = 0;
  85. +     /* Add ETO_PDY to make characters fit as we expect, even when the font
  86. +      * uses different widths (e.g., bold character is wider). */
  87. +     foptions |= ETO_PDY;
  88.       for (clen = 0; i < len; )
  89.       {
  90.           unicodebuf[clen] = utf_ptr2char(text + i);
  91. !         cw = utf_char2cells(unicodebuf[clen]);
  92. !         unicodepdy[clen * 2] = cw * gui.char_width;
  93. !         unicodepdy[clen * 2 + 1] = 0;
  94. !         cells += cw;
  95.           i += utfc_ptr2len_check_len(text + i, len - i);
  96.           ++clen;
  97.       }
  98.       ExtTextOutW(s_hdc, TEXT_X(col), TEXT_Y(row),
  99. !                  foptions, pcliprect, unicodebuf, clen, unicodepdy);
  100.       len = cells;    /* used for underlining */
  101.       }
  102.       else if (is_funky_dbcs)
  103. *** ../vim61.302/src/version.c    Sun Jan 26 22:42:25 2003
  104. --- src/version.c    Tue Jan 28 21:20:02 2003
  105. ***************
  106. *** 608,609 ****
  107. --- 608,611 ----
  108.   {   /* Add new patch number below this line */
  109. + /**/
  110. +     303,
  111.   /**/
  112.  
  113. -- 
  114. hundred-and-one symptoms of being an internet addict:
  115. 63. You start using smileys in your snail mail.
  116.  
  117.  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
  118. ///          Creator of Vim - Vi IMproved -- http://www.Vim.org          \\\
  119. \\\              Project leader for A-A-P -- http://www.A-A-P.org        ///
  120.  \\\     Help AIDS victims, buy at Amazon -- http://ICCF.nl/click1.html ///
  121.