• R/O
  • SSH

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#objective-cqt誰得cocoapythonrubywindowsphpgameguibathyscaphec翻訳omegatframework計画中(planning stage)twitterdombtronvb.nettestarduinodirectxpreviewerゲームエンジン

K.Takata's patch queue for Vim


Commit MetaInfo

Revisionef90a5349fb709a6c697f4e43e6ba4c9136a4d36 (tree)
Zeit2022-01-21 16:28:43
AutorK.Takata <kentkt@csc....>
CommiterK.Takata

Log Message

Update ambiwidth patch

Ändern Zusammenfassung

Diff

diff -r fe2e4ccfbbf9 -r ef90a5349fb7 win32-directwrite-ambiwidth-auto.patch
--- a/win32-directwrite-ambiwidth-auto.patch Fri Jan 21 16:11:13 2022 +0900
+++ b/win32-directwrite-ambiwidth-auto.patch Fri Jan 21 16:28:43 2022 +0900
@@ -58,7 +58,7 @@
5858 + //_RPT2(_CRT_WARN, "len %d, count %d", len, count);
5959 + for (UINT32 i = 0; i < count; i++)
6060 + {
61-+ _RPT2(_CRT_WARN, "%x (%C), [%d]: width %f", c, c, i, metrics[i].width);
61++ //_RPT2(_CRT_WARN, "%x (%C), [%d]: width %f", c, c, i, metrics[i].width);
6262 + }
6363 +#endif
6464 + if (count >= 1)
@@ -103,16 +103,19 @@
103103 diff --git a/src/gui_w32.c b/src/gui_w32.c
104104 --- a/src/gui_w32.c
105105 +++ b/src/gui_w32.c
106-@@ -5182,21 +5182,21 @@ error:
106+@@ -5181,30 +5181,41 @@ error:
107+ #endif
107108
108109 #ifdef USE_AMBIWIDTH_AUTO
109- # define CHARWIDE_CACHESIZE 0x20000
110+-# define CHARWIDE_CACHESIZE 0x20000
110111 -static GuiFont last_font = NOFONT;
112++# define CHARWIDE_CACHESIZE 0x40000
111113
112114 int
113115 gui_mch_get_charwidth(int c)
114116 {
115- static int cache[CHARWIDE_CACHESIZE];
117+- static int cache[CHARWIDE_CACHESIZE];
118++ static char cache[CHARWIDE_CACHESIZE];
116119 + static GuiFont last_font = NOFONT;
117120 GuiFont usingfont = gui.wide_font ? gui.wide_font : gui.norm_font;
118121
@@ -127,8 +130,10 @@
127130 + TRACE("Charwidth cache will be updated (base=%d)\n", gui.char_width);
128131 last_font = usingfont;
129132 for (i = 0; i < CHARWIDE_CACHESIZE; ++i)
130- cache[i] = -1;
131-@@ -5205,6 +5205,17 @@ gui_mch_get_charwidth(int c)
133+- cache[i] = -1;
134++ cache[i] = (char)-1;
135+ }
136+ if (usingfont && 0 <= c && c < CHARWIDE_CACHESIZE)
132137 {
133138 if (cache[c] >= 0)
134139 return cache[c]; /* Use cached value */
@@ -139,7 +144,7 @@
139144 +
140145 + DWriteContext_SetFont(s_dwc, (HFONT)usingfont);
141146 + len = DWriteContext_GetCharWidth(s_dwc, c);
142-+ cache[c] = (len + (gui.char_width >> 1)) / gui.char_width;
147++ cache[c] = (char)((len + (gui.char_width >> 1)) / gui.char_width);
143148 + return cache[c];
144149 + }
145150 +# endif
@@ -151,7 +156,7 @@
151156 }
152157 else
153158 - cache[c] = ((len + (gui.char_width >> 1)) / gui.char_width);
154-+ cache[c] = (len + (gui.char_width >> 1)) / gui.char_width;
159++ cache[c] = (char)((len + (gui.char_width >> 1)) / gui.char_width);
155160 SelectFont(s_hdc, hfntOld);
156161
157162 return cache[c];