@shitiandmw/node-pty 1.1.0-agent.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (288) hide show
  1. package/LICENSE +69 -0
  2. package/README.md +170 -0
  3. package/binding.gyp +111 -0
  4. package/deps/.editorconfig +2 -0
  5. package/deps/winpty/.drone.yml +17 -0
  6. package/deps/winpty/.gitattributes +19 -0
  7. package/deps/winpty/LICENSE +21 -0
  8. package/deps/winpty/Makefile +166 -0
  9. package/deps/winpty/README.md +151 -0
  10. package/deps/winpty/RELEASES.md +280 -0
  11. package/deps/winpty/VERSION.txt +1 -0
  12. package/deps/winpty/configure +167 -0
  13. package/deps/winpty/misc/BufferResizeTests.cc +90 -0
  14. package/deps/winpty/misc/ChangeScreenBuffer.cc +53 -0
  15. package/deps/winpty/misc/ClearConsole.cc +72 -0
  16. package/deps/winpty/misc/ConinMode.cc +117 -0
  17. package/deps/winpty/misc/ConinMode.ps1 +116 -0
  18. package/deps/winpty/misc/ConoutMode.cc +113 -0
  19. package/deps/winpty/misc/DebugClient.py +42 -0
  20. package/deps/winpty/misc/DebugServer.py +63 -0
  21. package/deps/winpty/misc/DumpLines.py +5 -0
  22. package/deps/winpty/misc/EnableExtendedFlags.txt +46 -0
  23. package/deps/winpty/misc/Font-Report-June2016/CP437-Consolas.txt +528 -0
  24. package/deps/winpty/misc/Font-Report-June2016/CP437-Lucida.txt +633 -0
  25. package/deps/winpty/misc/Font-Report-June2016/CP932.txt +630 -0
  26. package/deps/winpty/misc/Font-Report-June2016/CP936.txt +630 -0
  27. package/deps/winpty/misc/Font-Report-June2016/CP949.txt +630 -0
  28. package/deps/winpty/misc/Font-Report-June2016/CP950.txt +630 -0
  29. package/deps/winpty/misc/Font-Report-June2016/MinimumWindowWidths.txt +16 -0
  30. package/deps/winpty/misc/Font-Report-June2016/Results.txt +4 -0
  31. package/deps/winpty/misc/Font-Report-June2016/Windows10SetFontBugginess.txt +144 -0
  32. package/deps/winpty/misc/FontSurvey.cc +100 -0
  33. package/deps/winpty/misc/FormatChar.h +21 -0
  34. package/deps/winpty/misc/FreezePerfTest.cc +62 -0
  35. package/deps/winpty/misc/GetCh.cc +20 -0
  36. package/deps/winpty/misc/GetConsolePos.cc +41 -0
  37. package/deps/winpty/misc/GetFont.cc +261 -0
  38. package/deps/winpty/misc/IdentifyConsoleWindow.ps1 +51 -0
  39. package/deps/winpty/misc/IsNewConsole.cc +87 -0
  40. package/deps/winpty/misc/MouseInputNotes.txt +90 -0
  41. package/deps/winpty/misc/MoveConsoleWindow.cc +34 -0
  42. package/deps/winpty/misc/Notes.txt +219 -0
  43. package/deps/winpty/misc/OSVersion.cc +27 -0
  44. package/deps/winpty/misc/ScreenBufferFreezeInactive.cc +101 -0
  45. package/deps/winpty/misc/ScreenBufferTest.cc +671 -0
  46. package/deps/winpty/misc/ScreenBufferTest2.cc +151 -0
  47. package/deps/winpty/misc/SelectAllTest.cc +45 -0
  48. package/deps/winpty/misc/SetBufferSize.cc +32 -0
  49. package/deps/winpty/misc/SetCursorPos.cc +10 -0
  50. package/deps/winpty/misc/SetFont.cc +145 -0
  51. package/deps/winpty/misc/SetWindowRect.cc +36 -0
  52. package/deps/winpty/misc/ShowArgv.cc +12 -0
  53. package/deps/winpty/misc/ShowConsoleInput.cc +40 -0
  54. package/deps/winpty/misc/Spew.py +5 -0
  55. package/deps/winpty/misc/TestUtil.cc +172 -0
  56. package/deps/winpty/misc/UnicodeDoubleWidthTest.cc +102 -0
  57. package/deps/winpty/misc/UnicodeWideTest1.cc +246 -0
  58. package/deps/winpty/misc/UnicodeWideTest2.cc +130 -0
  59. package/deps/winpty/misc/UnixEcho.cc +89 -0
  60. package/deps/winpty/misc/Utf16Echo.cc +46 -0
  61. package/deps/winpty/misc/VeryLargeRead.cc +122 -0
  62. package/deps/winpty/misc/VkEscapeTest.cc +56 -0
  63. package/deps/winpty/misc/Win10ResizeWhileFrozen.cc +52 -0
  64. package/deps/winpty/misc/Win10WrapTest1.cc +57 -0
  65. package/deps/winpty/misc/Win10WrapTest2.cc +30 -0
  66. package/deps/winpty/misc/Win32Echo1.cc +26 -0
  67. package/deps/winpty/misc/Win32Echo2.cc +19 -0
  68. package/deps/winpty/misc/Win32Test1.cc +46 -0
  69. package/deps/winpty/misc/Win32Test2.cc +70 -0
  70. package/deps/winpty/misc/Win32Test3.cc +78 -0
  71. package/deps/winpty/misc/Win32Write1.cc +44 -0
  72. package/deps/winpty/misc/WindowsBugCrashReader.cc +27 -0
  73. package/deps/winpty/misc/WriteConsole.cc +106 -0
  74. package/deps/winpty/misc/build32.sh +9 -0
  75. package/deps/winpty/misc/build64.sh +9 -0
  76. package/deps/winpty/misc/color-test.sh +212 -0
  77. package/deps/winpty/misc/font-notes.txt +300 -0
  78. package/deps/winpty/misc/winbug-15048.cc +201 -0
  79. package/deps/winpty/ship/build-pty4j-libpty.bat +36 -0
  80. package/deps/winpty/ship/common_ship.py +53 -0
  81. package/deps/winpty/ship/make_msvc_package.py +165 -0
  82. package/deps/winpty/ship/ship.py +108 -0
  83. package/deps/winpty/src/agent/Agent.cc +613 -0
  84. package/deps/winpty/src/agent/Agent.h +103 -0
  85. package/deps/winpty/src/agent/AgentCreateDesktop.cc +84 -0
  86. package/deps/winpty/src/agent/AgentCreateDesktop.h +28 -0
  87. package/deps/winpty/src/agent/ConsoleFont.cc +632 -0
  88. package/deps/winpty/src/agent/ConsoleFont.h +28 -0
  89. package/deps/winpty/src/agent/ConsoleInput.cc +852 -0
  90. package/deps/winpty/src/agent/ConsoleInput.h +109 -0
  91. package/deps/winpty/src/agent/ConsoleInputReencoding.cc +121 -0
  92. package/deps/winpty/src/agent/ConsoleInputReencoding.h +36 -0
  93. package/deps/winpty/src/agent/ConsoleLine.cc +152 -0
  94. package/deps/winpty/src/agent/ConsoleLine.h +41 -0
  95. package/deps/winpty/src/agent/Coord.h +87 -0
  96. package/deps/winpty/src/agent/DebugShowInput.cc +239 -0
  97. package/deps/winpty/src/agent/DebugShowInput.h +32 -0
  98. package/deps/winpty/src/agent/DefaultInputMap.cc +422 -0
  99. package/deps/winpty/src/agent/DefaultInputMap.h +28 -0
  100. package/deps/winpty/src/agent/DsrSender.h +30 -0
  101. package/deps/winpty/src/agent/EventLoop.cc +99 -0
  102. package/deps/winpty/src/agent/EventLoop.h +47 -0
  103. package/deps/winpty/src/agent/InputMap.cc +246 -0
  104. package/deps/winpty/src/agent/InputMap.h +114 -0
  105. package/deps/winpty/src/agent/LargeConsoleRead.cc +71 -0
  106. package/deps/winpty/src/agent/LargeConsoleRead.h +68 -0
  107. package/deps/winpty/src/agent/NamedPipe.cc +378 -0
  108. package/deps/winpty/src/agent/NamedPipe.h +125 -0
  109. package/deps/winpty/src/agent/Scraper.cc +699 -0
  110. package/deps/winpty/src/agent/Scraper.h +103 -0
  111. package/deps/winpty/src/agent/SimplePool.h +75 -0
  112. package/deps/winpty/src/agent/SmallRect.h +143 -0
  113. package/deps/winpty/src/agent/Terminal.cc +535 -0
  114. package/deps/winpty/src/agent/Terminal.h +69 -0
  115. package/deps/winpty/src/agent/UnicodeEncoding.h +157 -0
  116. package/deps/winpty/src/agent/UnicodeEncodingTest.cc +189 -0
  117. package/deps/winpty/src/agent/Win32Console.cc +107 -0
  118. package/deps/winpty/src/agent/Win32Console.h +67 -0
  119. package/deps/winpty/src/agent/Win32ConsoleBuffer.cc +193 -0
  120. package/deps/winpty/src/agent/Win32ConsoleBuffer.h +99 -0
  121. package/deps/winpty/src/agent/main.cc +114 -0
  122. package/deps/winpty/src/agent/subdir.mk +61 -0
  123. package/deps/winpty/src/configurations.gypi +60 -0
  124. package/deps/winpty/src/debugserver/DebugServer.cc +117 -0
  125. package/deps/winpty/src/debugserver/subdir.mk +41 -0
  126. package/deps/winpty/src/include/winpty.h +242 -0
  127. package/deps/winpty/src/include/winpty_constants.h +131 -0
  128. package/deps/winpty/src/libwinpty/AgentLocation.cc +75 -0
  129. package/deps/winpty/src/libwinpty/AgentLocation.h +28 -0
  130. package/deps/winpty/src/libwinpty/LibWinptyException.h +54 -0
  131. package/deps/winpty/src/libwinpty/WinptyInternal.h +72 -0
  132. package/deps/winpty/src/libwinpty/subdir.mk +46 -0
  133. package/deps/winpty/src/libwinpty/winpty.cc +970 -0
  134. package/deps/winpty/src/shared/AgentMsg.h +38 -0
  135. package/deps/winpty/src/shared/BackgroundDesktop.cc +122 -0
  136. package/deps/winpty/src/shared/BackgroundDesktop.h +73 -0
  137. package/deps/winpty/src/shared/Buffer.cc +103 -0
  138. package/deps/winpty/src/shared/Buffer.h +102 -0
  139. package/deps/winpty/src/shared/DebugClient.cc +187 -0
  140. package/deps/winpty/src/shared/DebugClient.h +38 -0
  141. package/deps/winpty/src/shared/GenRandom.cc +138 -0
  142. package/deps/winpty/src/shared/GenRandom.h +55 -0
  143. package/deps/winpty/src/shared/GetCommitHash.bat +13 -0
  144. package/deps/winpty/src/shared/Mutex.h +54 -0
  145. package/deps/winpty/src/shared/OsModule.h +63 -0
  146. package/deps/winpty/src/shared/OwnedHandle.cc +36 -0
  147. package/deps/winpty/src/shared/OwnedHandle.h +45 -0
  148. package/deps/winpty/src/shared/PrecompiledHeader.h +43 -0
  149. package/deps/winpty/src/shared/StringBuilder.h +227 -0
  150. package/deps/winpty/src/shared/StringBuilderTest.cc +114 -0
  151. package/deps/winpty/src/shared/StringUtil.cc +55 -0
  152. package/deps/winpty/src/shared/StringUtil.h +80 -0
  153. package/deps/winpty/src/shared/TimeMeasurement.h +63 -0
  154. package/deps/winpty/src/shared/UnixCtrlChars.h +45 -0
  155. package/deps/winpty/src/shared/UpdateGenVersion.bat +20 -0
  156. package/deps/winpty/src/shared/WindowsSecurity.cc +460 -0
  157. package/deps/winpty/src/shared/WindowsSecurity.h +104 -0
  158. package/deps/winpty/src/shared/WindowsVersion.cc +252 -0
  159. package/deps/winpty/src/shared/WindowsVersion.h +29 -0
  160. package/deps/winpty/src/shared/WinptyAssert.cc +55 -0
  161. package/deps/winpty/src/shared/WinptyAssert.h +64 -0
  162. package/deps/winpty/src/shared/WinptyException.cc +57 -0
  163. package/deps/winpty/src/shared/WinptyException.h +43 -0
  164. package/deps/winpty/src/shared/WinptyVersion.cc +42 -0
  165. package/deps/winpty/src/shared/WinptyVersion.h +27 -0
  166. package/deps/winpty/src/shared/winpty_snprintf.h +99 -0
  167. package/deps/winpty/src/subdir.mk +5 -0
  168. package/deps/winpty/src/tests/subdir.mk +28 -0
  169. package/deps/winpty/src/tests/trivial_test.cc +158 -0
  170. package/deps/winpty/src/unix-adapter/InputHandler.cc +114 -0
  171. package/deps/winpty/src/unix-adapter/InputHandler.h +56 -0
  172. package/deps/winpty/src/unix-adapter/OutputHandler.cc +80 -0
  173. package/deps/winpty/src/unix-adapter/OutputHandler.h +53 -0
  174. package/deps/winpty/src/unix-adapter/Util.cc +86 -0
  175. package/deps/winpty/src/unix-adapter/Util.h +31 -0
  176. package/deps/winpty/src/unix-adapter/WakeupFd.cc +70 -0
  177. package/deps/winpty/src/unix-adapter/WakeupFd.h +42 -0
  178. package/deps/winpty/src/unix-adapter/main.cc +729 -0
  179. package/deps/winpty/src/unix-adapter/subdir.mk +41 -0
  180. package/deps/winpty/src/winpty.gyp +234 -0
  181. package/deps/winpty/vcbuild.bat +83 -0
  182. package/lib/conpty_console_list_agent.js +16 -0
  183. package/lib/conpty_console_list_agent.js.map +1 -0
  184. package/lib/eventEmitter2.js +47 -0
  185. package/lib/eventEmitter2.js.map +1 -0
  186. package/lib/eventEmitter2.test.js +30 -0
  187. package/lib/eventEmitter2.test.js.map +1 -0
  188. package/lib/index.js +52 -0
  189. package/lib/index.js.map +1 -0
  190. package/lib/interfaces.js +7 -0
  191. package/lib/interfaces.js.map +1 -0
  192. package/lib/shared/conout.js +11 -0
  193. package/lib/shared/conout.js.map +1 -0
  194. package/lib/terminal.js +190 -0
  195. package/lib/terminal.js.map +1 -0
  196. package/lib/terminal.test.js +139 -0
  197. package/lib/terminal.test.js.map +1 -0
  198. package/lib/testUtils.test.js +28 -0
  199. package/lib/testUtils.test.js.map +1 -0
  200. package/lib/types.js +7 -0
  201. package/lib/types.js.map +1 -0
  202. package/lib/unixTerminal.js +346 -0
  203. package/lib/unixTerminal.js.map +1 -0
  204. package/lib/unixTerminal.test.js +351 -0
  205. package/lib/unixTerminal.test.js.map +1 -0
  206. package/lib/utils.js +39 -0
  207. package/lib/utils.js.map +1 -0
  208. package/lib/windowsConoutConnection.js +125 -0
  209. package/lib/windowsConoutConnection.js.map +1 -0
  210. package/lib/windowsPtyAgent.js +320 -0
  211. package/lib/windowsPtyAgent.js.map +1 -0
  212. package/lib/windowsPtyAgent.test.js +90 -0
  213. package/lib/windowsPtyAgent.test.js.map +1 -0
  214. package/lib/windowsTerminal.js +199 -0
  215. package/lib/windowsTerminal.js.map +1 -0
  216. package/lib/windowsTerminal.test.js +219 -0
  217. package/lib/windowsTerminal.test.js.map +1 -0
  218. package/lib/worker/conoutSocketWorker.js +22 -0
  219. package/lib/worker/conoutSocketWorker.js.map +1 -0
  220. package/package.json +68 -0
  221. package/prebuilds/darwin-arm64/pty.node +0 -0
  222. package/prebuilds/darwin-arm64/spawn-helper +0 -0
  223. package/prebuilds/darwin-x64/pty.node +0 -0
  224. package/prebuilds/darwin-x64/spawn-helper +0 -0
  225. package/prebuilds/win32-arm64/conpty/OpenConsole.exe +0 -0
  226. package/prebuilds/win32-arm64/conpty/conpty.dll +0 -0
  227. package/prebuilds/win32-arm64/conpty.node +0 -0
  228. package/prebuilds/win32-arm64/conpty.pdb +0 -0
  229. package/prebuilds/win32-arm64/conpty_console_list.node +0 -0
  230. package/prebuilds/win32-arm64/conpty_console_list.pdb +0 -0
  231. package/prebuilds/win32-arm64/pty.node +0 -0
  232. package/prebuilds/win32-arm64/pty.pdb +0 -0
  233. package/prebuilds/win32-arm64/winpty-agent.exe +0 -0
  234. package/prebuilds/win32-arm64/winpty-agent.pdb +0 -0
  235. package/prebuilds/win32-arm64/winpty.dll +0 -0
  236. package/prebuilds/win32-arm64/winpty.pdb +0 -0
  237. package/prebuilds/win32-x64/conpty/OpenConsole.exe +0 -0
  238. package/prebuilds/win32-x64/conpty/conpty.dll +0 -0
  239. package/prebuilds/win32-x64/conpty.node +0 -0
  240. package/prebuilds/win32-x64/conpty.pdb +0 -0
  241. package/prebuilds/win32-x64/conpty_console_list.node +0 -0
  242. package/prebuilds/win32-x64/conpty_console_list.pdb +0 -0
  243. package/prebuilds/win32-x64/pty.node +0 -0
  244. package/prebuilds/win32-x64/pty.pdb +0 -0
  245. package/prebuilds/win32-x64/winpty-agent.exe +0 -0
  246. package/prebuilds/win32-x64/winpty-agent.pdb +0 -0
  247. package/prebuilds/win32-x64/winpty.dll +0 -0
  248. package/prebuilds/win32-x64/winpty.pdb +0 -0
  249. package/scripts/gen-compile-commands.js +8 -0
  250. package/scripts/increment-version.js +54 -0
  251. package/scripts/post-install.js +99 -0
  252. package/scripts/prebuild.js +39 -0
  253. package/scripts/sync-prebuild.js +31 -0
  254. package/scripts/verify-darwin-fd-leak.js +63 -0
  255. package/src/conpty_console_list_agent.ts +15 -0
  256. package/src/eventEmitter2.test.ts +30 -0
  257. package/src/eventEmitter2.ts +48 -0
  258. package/src/index.ts +52 -0
  259. package/src/interfaces.ts +130 -0
  260. package/src/native.d.ts +54 -0
  261. package/src/shared/conout.ts +15 -0
  262. package/src/terminal.test.ts +119 -0
  263. package/src/terminal.ts +211 -0
  264. package/src/testUtils.test.ts +23 -0
  265. package/src/tsconfig.json +22 -0
  266. package/src/types.ts +15 -0
  267. package/src/unix/pty.cc +808 -0
  268. package/src/unix/spawn-helper.cc +23 -0
  269. package/src/unixTerminal.test.ts +367 -0
  270. package/src/unixTerminal.ts +388 -0
  271. package/src/utils.ts +29 -0
  272. package/src/win/conpty.cc +583 -0
  273. package/src/win/conpty.h +41 -0
  274. package/src/win/conpty_console_list.cc +44 -0
  275. package/src/win/path_util.cc +95 -0
  276. package/src/win/path_util.h +26 -0
  277. package/src/win/winpty.cc +333 -0
  278. package/src/windowsConoutConnection.ts +82 -0
  279. package/src/windowsPtyAgent.test.ts +94 -0
  280. package/src/windowsPtyAgent.ts +321 -0
  281. package/src/windowsTerminal.test.ts +229 -0
  282. package/src/windowsTerminal.ts +203 -0
  283. package/src/worker/conoutSocketWorker.ts +22 -0
  284. package/third_party/conpty/1.23.251008001/win10-arm64/OpenConsole.exe +0 -0
  285. package/third_party/conpty/1.23.251008001/win10-arm64/conpty.dll +0 -0
  286. package/third_party/conpty/1.23.251008001/win10-x64/OpenConsole.exe +0 -0
  287. package/third_party/conpty/1.23.251008001/win10-x64/conpty.dll +0 -0
  288. package/typings/node-pty.d.ts +211 -0
@@ -0,0 +1,106 @@
1
+ #include <windows.h>
2
+
3
+ #include <assert.h>
4
+ #include <stdint.h>
5
+ #include <stdlib.h>
6
+
7
+ #include <string>
8
+ #include <vector>
9
+
10
+ static std::wstring mbsToWcs(const std::string &s) {
11
+ const size_t len = mbstowcs(nullptr, s.c_str(), 0);
12
+ if (len == static_cast<size_t>(-1)) {
13
+ assert(false && "mbsToWcs: invalid string");
14
+ }
15
+ std::wstring ret;
16
+ ret.resize(len);
17
+ const size_t len2 = mbstowcs(&ret[0], s.c_str(), len);
18
+ assert(len == len2);
19
+ return ret;
20
+ }
21
+
22
+ uint32_t parseHex(wchar_t ch, bool &invalid) {
23
+ if (ch >= L'0' && ch <= L'9') {
24
+ return ch - L'0';
25
+ } else if (ch >= L'a' && ch <= L'f') {
26
+ return ch - L'a' + 10;
27
+ } else if (ch >= L'A' && ch <= L'F') {
28
+ return ch - L'A' + 10;
29
+ } else {
30
+ invalid = true;
31
+ return 0;
32
+ }
33
+ }
34
+
35
+ int main(int argc, char *argv[]) {
36
+ std::vector<std::wstring> args;
37
+ for (int i = 1; i < argc; ++i) {
38
+ args.push_back(mbsToWcs(argv[i]));
39
+ }
40
+
41
+ std::wstring out;
42
+ for (const auto &arg : args) {
43
+ if (!out.empty()) {
44
+ out.push_back(L' ');
45
+ }
46
+ for (size_t i = 0; i < arg.size(); ++i) {
47
+ wchar_t ch = arg[i];
48
+ wchar_t nch = i + 1 < arg.size() ? arg[i + 1] : L'\0';
49
+ if (ch == L'\\') {
50
+ switch (nch) {
51
+ case L'a': ch = L'\a'; ++i; break;
52
+ case L'b': ch = L'\b'; ++i; break;
53
+ case L'e': ch = L'\x1b'; ++i; break;
54
+ case L'f': ch = L'\f'; ++i; break;
55
+ case L'n': ch = L'\n'; ++i; break;
56
+ case L'r': ch = L'\r'; ++i; break;
57
+ case L't': ch = L'\t'; ++i; break;
58
+ case L'v': ch = L'\v'; ++i; break;
59
+ case L'\\': ch = L'\\'; ++i; break;
60
+ case L'\'': ch = L'\''; ++i; break;
61
+ case L'\"': ch = L'\"'; ++i; break;
62
+ case L'\?': ch = L'\?'; ++i; break;
63
+ case L'x':
64
+ if (i + 3 < arg.size()) {
65
+ bool invalid = false;
66
+ uint32_t d1 = parseHex(arg[i + 2], invalid);
67
+ uint32_t d2 = parseHex(arg[i + 3], invalid);
68
+ if (!invalid) {
69
+ i += 3;
70
+ ch = (d1 << 4) | d2;
71
+ }
72
+ }
73
+ break;
74
+ case L'u':
75
+ if (i + 5 < arg.size()) {
76
+ bool invalid = false;
77
+ uint32_t d1 = parseHex(arg[i + 2], invalid);
78
+ uint32_t d2 = parseHex(arg[i + 3], invalid);
79
+ uint32_t d3 = parseHex(arg[i + 4], invalid);
80
+ uint32_t d4 = parseHex(arg[i + 5], invalid);
81
+ if (!invalid) {
82
+ i += 5;
83
+ ch = (d1 << 24) | (d2 << 16) | (d3 << 8) | d4;
84
+ }
85
+ }
86
+ break;
87
+ default: break;
88
+ }
89
+ }
90
+ out.push_back(ch);
91
+ }
92
+ }
93
+
94
+ DWORD actual = 0;
95
+ if (!WriteConsoleW(
96
+ GetStdHandle(STD_OUTPUT_HANDLE),
97
+ out.c_str(),
98
+ out.size(),
99
+ &actual,
100
+ nullptr)) {
101
+ fprintf(stderr, "WriteConsole failed (is stdout a console?)\n");
102
+ exit(1);
103
+ }
104
+
105
+ return 0;
106
+ }
@@ -0,0 +1,9 @@
1
+ #!/bin/bash
2
+ set -e
3
+ name=$1
4
+ name=${name%.}
5
+ name=${name%.cc}
6
+ name=${name%.exe}
7
+ echo Compiling $name.cc to $name.exe
8
+ i686-w64-mingw32-g++.exe -static -std=c++11 $name.cc -o $name.exe
9
+ i686-w64-mingw32-strip $name.exe
@@ -0,0 +1,9 @@
1
+ #!/bin/bash
2
+ set -e
3
+ name=$1
4
+ name=${name%.}
5
+ name=${name%.cc}
6
+ name=${name%.exe}
7
+ echo Compiling $name.cc to $name.exe
8
+ x86_64-w64-mingw32-g++.exe -static -std=c++11 $name.cc -o $name.exe
9
+ x86_64-w64-mingw32-strip $name.exe
@@ -0,0 +1,212 @@
1
+ #!/bin/bash
2
+
3
+ FORE=$1
4
+ BACK=$2
5
+ FILL=$3
6
+
7
+ if [ "$FORE" = "" ]; then
8
+ FORE=DefaultFore
9
+ fi
10
+ if [ "$BACK" = "" ]; then
11
+ BACK=DefaultBack
12
+ fi
13
+
14
+ # To detect color changes, we want a character that fills the whole cell
15
+ # if possible. U+2588 is perfect, except that it becomes invisible in the
16
+ # original xterm, when bolded. For that terminal, use something else, like
17
+ # "#" or "@".
18
+ if [ "$FILL" = "" ]; then
19
+ FILL="█"
20
+ fi
21
+
22
+ # SGR (Select Graphic Rendition)
23
+ s() {
24
+ printf '\033[0m'
25
+ while [ "$1" != "" ]; do
26
+ printf '\033['"$1"'m'
27
+ shift
28
+ done
29
+ }
30
+
31
+ # Print
32
+ p() {
33
+ echo -n "$@"
34
+ }
35
+
36
+ # Print with newline
37
+ pn() {
38
+ echo "$@"
39
+ }
40
+
41
+ # For practical reasons, sandwich black and white in-between the other colors.
42
+ FORE_COLORS="31 30 37 32 33 34 35 36"
43
+ BACK_COLORS="41 40 47 42 43 44 45 46"
44
+
45
+
46
+
47
+ ### Test order of Invert(7) -- it does not matter what order it appears in.
48
+
49
+ # The Red color setting here (31) is shadowed by the green setting (32). The
50
+ # Reverse flag does not cause (32) to alter the background color immediately;
51
+ # instead, the Reverse flag is applied once to determine the final effective
52
+ # Fore/Back colors.
53
+ s 7 31 32; p " -- Should be: $BACK-on-green -- "; s; pn
54
+ s 31 7 32; p " -- Should be: $BACK-on-green -- "; s; pn
55
+ s 31 32 7; p " -- Should be: $BACK-on-green -- "; s; pn
56
+
57
+ # As above, but for the background color.
58
+ s 7 41 42; p " -- Should be: green-on-$FORE -- "; s; pn
59
+ s 41 7 42; p " -- Should be: green-on-$FORE -- "; s; pn
60
+ s 41 42 7; p " -- Should be: green-on-$FORE -- "; s; pn
61
+
62
+ # One last, related test
63
+ s 7; p "Invert text"; s 7 1; p " with some words bold"; s; pn;
64
+ s 0; p "Normal text"; s 0 1; p " with some words bold"; s; pn;
65
+
66
+ pn
67
+
68
+
69
+
70
+ ### Test effect of Bold(1) on color, with and without Invert(7).
71
+
72
+ # The Bold flag does not affect the background color when Reverse is missing.
73
+ # There should always be 8 colored boxes.
74
+ p " "
75
+ for x in $BACK_COLORS; do
76
+ s $x; p "-"; s $x 1; p "-"
77
+ done
78
+ s; pn " Bold should not affect background"
79
+
80
+ # On some terminals, Bold affects color, and on some it doesn't. If there
81
+ # are only 8 colored boxes, then the next two tests will also show 8 colored
82
+ # boxes. If there are 16 boxes, then exactly one of the next two tests will
83
+ # also have 16 boxes.
84
+ p " "
85
+ for x in $FORE_COLORS; do
86
+ s $x; p "$FILL"; s $x 1; p "$FILL"
87
+ done
88
+ s; pn " Does bold affect foreground color?"
89
+
90
+ # On some terminals, Bold+Invert highlights the final Background color.
91
+ p " "
92
+ for x in $FORE_COLORS; do
93
+ s $x 7; p "-"; s $x 7 1; p "-"
94
+ done
95
+ s; pn " Test if Bold+Invert affects background color"
96
+
97
+ # On some terminals, Bold+Invert highlights the final Foreground color.
98
+ p " "
99
+ for x in $BACK_COLORS; do
100
+ s $x 7; p "$FILL"; s $x 7 1; p "$FILL"
101
+ done
102
+ s; pn " Test if Bold+Invert affects foreground color"
103
+
104
+ pn
105
+
106
+
107
+
108
+ ### Test for support of ForeHi and BackHi properties.
109
+
110
+ # ForeHi
111
+ p " "
112
+ for x in $FORE_COLORS; do
113
+ hi=$(( $x + 60 ))
114
+ s $x; p "$FILL"; s $hi; p "$FILL"
115
+ done
116
+ s; pn " Test for support of ForeHi colors"
117
+ p " "
118
+ for x in $FORE_COLORS; do
119
+ hi=$(( $x + 60 ))
120
+ s $x; p "$FILL"; s $x $hi; p "$FILL"
121
+ done
122
+ s; pn " Test for support of ForeHi colors (w/compat)"
123
+
124
+ # BackHi
125
+ p " "
126
+ for x in $BACK_COLORS; do
127
+ hi=$(( $x + 60 ))
128
+ s $x; p "-"; s $hi; p "-"
129
+ done
130
+ s; pn " Test for support of BackHi colors"
131
+ p " "
132
+ for x in $BACK_COLORS; do
133
+ hi=$(( $x + 60 ))
134
+ s $x; p "-"; s $x $hi; p "-"
135
+ done
136
+ s; pn " Test for support of BackHi colors (w/compat)"
137
+
138
+ pn
139
+
140
+
141
+
142
+ ### Identify the default fore and back colors.
143
+
144
+ pn "Match default fore and back colors against 16-color palette"
145
+ pn " ==fore== ==back=="
146
+ for fore in $FORE_COLORS; do
147
+ forehi=$(( $fore + 60 ))
148
+ back=$(( $fore + 10 ))
149
+ backhi=$(( $back + 60 ))
150
+ p " "
151
+ s $fore; p "$FILL"; s; p "$FILL"; s $fore; p "$FILL"; s; p " "
152
+ s $forehi; p "$FILL"; s; p "$FILL"; s $forehi; p "$FILL"; s; p " "
153
+ s $back; p "-"; s; p "-"; s $back; p "-"; s; p " "
154
+ s $backhi; p "-"; s; p "-"; s $backhi; p "-"; s; p " "
155
+ pn " $fore $forehi $back $backhi"
156
+ done
157
+
158
+ pn
159
+
160
+
161
+
162
+ ### Test coloring of rest-of-line.
163
+
164
+ #
165
+ # When a new line is scrolled in, every cell in the line receives the
166
+ # current background color, which can be the default/transparent color.
167
+ #
168
+
169
+ p "Newline with red background: usually no red -->"; s 41; pn
170
+ s; pn "This text is plain, but rest is red if scrolled -->"
171
+ s; p " "; s 41; printf '\033[1K'; s; printf '\033[1C'; pn "<-- red Erase-in-Line to beginning"
172
+ s; p "red Erase-in-Line to end -->"; s 41; printf '\033[0K'; s; pn
173
+ pn
174
+
175
+
176
+
177
+ ### Moving the cursor around does not change colors of anything.
178
+
179
+ pn "Test modifying uncolored lines with a colored SGR:"
180
+ pn "aaaa"
181
+ pn
182
+ pn "____e"
183
+ s 31 42; printf '\033[4C\033[3A'; pn "bb"
184
+ pn "cccc"
185
+ pn "dddd"
186
+ s; pn
187
+
188
+ pn "Test modifying colored+inverted+bold line with plain text:"
189
+ s 42 31 7 1; printf 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\r';
190
+ s; pn "This text is plain and followed by green-on-red -->"
191
+ pn
192
+
193
+
194
+
195
+ ### Full-width character overwriting
196
+
197
+ pn 'Overwrite part of a full-width char with a half-width char'
198
+ p 'initial U+4000 ideographs -->'; s 31 42; p '䀀䀀'; s; pn
199
+ p 'write X to index #1 -->'; s 31 42; p '䀀䀀'; s 35 44; printf '\033[24G'; p X; s; pn
200
+ p 'write X to index #2 -->'; s 31 42; p '䀀䀀'; s 35 44; printf '\033[25G'; p X; s; pn
201
+ p 'write X to index #3 -->'; s 31 42; p '䀀䀀'; s 35 44; printf '\033[26G'; p X; s; pn
202
+ p 'write X to index #4 -->'; s 31 42; p '䀀䀀'; s 35 44; printf '\033[27G'; p X; s; pn
203
+ pn
204
+
205
+ pn 'Verify that Erase-in-Line can "fix" last char in line'
206
+ p 'original -->'; s 31 42; p '䀀䀀'; s; pn
207
+ p 'overwrite -->'; s 31 42; p '䀀䀀'; s 35 44; printf '\033[30G'; p 'XXX'; s; pn
208
+ p 'overwrite + Erase-in-Line -->'; s 31 42; p '䀀䀀'; s 35 44; printf '\033[30G'; p 'XXX'; s; printf '\033[0K'; pn
209
+ p 'original -->'; s 31 42; p 'X䀀䀀'; s; pn
210
+ p 'overwrite -->'; s 31 42; p 'X䀀䀀'; s 35 44; printf '\033[30G'; p 'ーー'; s; pn
211
+ p 'overwrite + Erase-in-Line -->'; s 31 42; p 'X䀀䀀'; s 35 44; printf '\033[30G'; p 'ーー'; s; printf '\033[0K'; pn
212
+ pn
@@ -0,0 +1,300 @@
1
+ ==================================================================
2
+ Notes regarding fonts, code pages, and East Asian character widths
3
+ ==================================================================
4
+
5
+
6
+ Registry settings
7
+ =================
8
+
9
+ * There are console registry settings in `HKCU\Console`. That key has many
10
+ default settings (e.g. the default font settings) and also per-app subkeys
11
+ for app-specific overrides.
12
+
13
+ * It is possible to override the code page with an app-specific setting.
14
+
15
+ * There are registry settings in
16
+ `HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Console`. In particular,
17
+ the `TrueTypeFont` subkey has a list of suitable font names associated with
18
+ various CJK code pages, as well as default font names.
19
+
20
+ * There are two values in `HKLM\SYSTEM\CurrentControlSet\Control\Nls\CodePage`
21
+ that specify the current code pages -- `OEMCP` and `ACP`. Setting the
22
+ system locale via the Control Panel's "Region" or "Language" dialogs seems
23
+ to change these code page values.
24
+
25
+
26
+ Console fonts
27
+ =============
28
+
29
+ * The `FontFamily` field of `CONSOLE_FONT_INFOEX` has two parts:
30
+ - The high four bits can be exactly one of the `FF_xxxx` font families:
31
+ FF_DONTCARE(0x00)
32
+ FF_ROMAN(0x10)
33
+ FF_SWISS(0x20)
34
+ FF_MODERN(0x30)
35
+ FF_SCRIPT(0x40)
36
+ FF_DECORATIVE(0x50)
37
+ - The low four bits are a bitmask:
38
+ TMPF_FIXED_PITCH(1) -- actually means variable pitch
39
+ TMPF_VECTOR(2)
40
+ TMPF_TRUETYPE(4)
41
+ TMPF_DEVICE(8)
42
+
43
+ * Each console has its own independent console font table. The current font
44
+ is identified with an index into this table. The size of the table is
45
+ returned by the undocumented `GetNumberOfConsoleFonts` API. It is apparently
46
+ possible to get the table size without this API, by instead calling
47
+ `GetConsoleFontSize` on each nonnegative index starting with 0 until the API
48
+ fails by returning (0, 0).
49
+
50
+ * The font table grows dynamically. Each time the console is configured with
51
+ a previously-unused (FaceName, Size) combination, two entries are added to
52
+ the font table -- one with normal weight and one with bold weight. Fonts
53
+ added this way are always TrueType fonts.
54
+
55
+ * Initially, the font table appears to contain only raster fonts. For
56
+ example, on an English Windows 8 installation, here is the initial font
57
+ table:
58
+ font 0: 4x6
59
+ font 1: 6x8
60
+ font 2: 8x8
61
+ font 3: 16x8
62
+ font 4: 5x12
63
+ font 5: 7x12
64
+ font 6: 8x12 -- the current font
65
+ font 7: 16x12
66
+ font 8: 12x16
67
+ font 9: 10x18
68
+ `GetNumberOfConsoleFonts` returns 10, and this table matches the raster font
69
+ sizes according to the console properties dialog.
70
+
71
+ * With a Japanese or Chinese locale, the initial font table appears to contain
72
+ the sizes applicable to both the East Asian raster font, as well as the
73
+ sizes for the CP437/CP1252 raster font.
74
+
75
+ * The index passed to `SetCurrentConsoleFontEx` apparently has no effect.
76
+ The undocumented `SetConsoleFont` API, however, accepts *only* a font index,
77
+ and on Windows 8 English, it switches between all 10 fonts, even font index
78
+ #0.
79
+
80
+ * If the index passed to `SetConsoleFont` identifies a Raster Font
81
+ incompatible with the current code page, then another Raster Font is
82
+ activated.
83
+
84
+ * Passing "Terminal" to `SetCurrentConsoleFontEx` seems to have no effect.
85
+ Perhaps relatedly, `SetCurrentConsoleFontEx` does not fail if it is given a
86
+ bogus `FaceName`. Some font is still chosen and activated. Passing a face
87
+ name and height seems to work reliably, modulo the CP936 issue described
88
+ below.
89
+
90
+
91
+ Console fonts and code pages
92
+ ============================
93
+
94
+ * On an English Windows installation, the default code page is 437, and it
95
+ cannot be set to 932 (Shift-JIS). (The API call fails.) Changing the
96
+ system locale to "Japanese (Japan)" using the Region/Language dialog
97
+ changes the default CP to 932 and permits changing the console CP between
98
+ 437 and 932.
99
+
100
+ * A console has both an input code page and an output code page
101
+ (`{Get,Set}ConsoleCP` and `{Get,Set}ConsoleOutputCP`). I'm not going to
102
+ distinguish between the two for this document; presumably only the output
103
+ CP matters. The code page can change while the console is open, e.g.
104
+ by running `mode con: cp select={932,437,1252}` or by calling
105
+ `SetConsoleOutputCP`.
106
+
107
+ * The current code page restricts which TrueType fonts and which Raster Font
108
+ sizes are available in the console properties dialog. This can change
109
+ while the console is open.
110
+
111
+ * Changing the code page almost(?) always changes the current console font.
112
+ So far, I don't know how the new font is chosen.
113
+
114
+ * With a CP of 932, the only TrueType font available in the console properties
115
+ dialog is "MS Gothic", displayed as "MS ゴシック". It is still possible to
116
+ use the English-default TrueType console fonts, Lucida Console and Consolas,
117
+ via `SetCurrentConsoleFontEx`.
118
+
119
+ * When using a Raster Font and CP437 or CP1252, writing a UTF-16 codepoint not
120
+ representable in the code page instead writes a question mark ('?') to the
121
+ console. This conversion does not apply with a TrueType font, nor with the
122
+ Raster Font for CP932 or CP936.
123
+
124
+
125
+ ReadConsoleOutput and double-width characters
126
+ ==============================================
127
+
128
+ * With a Raster Font active, when `ReadConsoleOutputW` reads two cells of a
129
+ double-width character, it fills only a single `CHAR_INFO` structure. The
130
+ unused trailing `CHAR_INFO` structures are zero-filled. With a TrueType
131
+ font active, `ReadConsoleOutputW` instead fills two `CHAR_INFO` structures,
132
+ the first marked with `COMMON_LVB_LEADING_BYTE` and the second marked with
133
+ `COMMON_LVB_TRAILING_BYTE`. The flag is a misnomer--there aren't two
134
+ *bytes*, but two cells, and they have equal `CHAR_INFO.Char.UnicodeChar`
135
+ values.
136
+
137
+ * `ReadConsoleOutputA`, on the other hand, reads two `CHAR_INFO` cells, and
138
+ if the UTF-16 value can be represented as two bytes in the ANSI/OEM CP, then
139
+ the two bytes are placed in the two `CHAR_INFO.Char.AsciiChar` values, and
140
+ the `COMMON_LVB_{LEADING,TRAILING}_BYTE` values are also used. If the
141
+ codepoint isn't representable, I don't remember what happens -- I think the
142
+ `AsciiChar` values take on an invalid marker.
143
+
144
+ * Reading only one cell of a double-width character reads a space (U+0020)
145
+ instead. Raster-vs-TrueType and wide-vs-ANSI do not matter.
146
+ - XXX: what about attributes? Can a double-width character have mismatched
147
+ color attributes?
148
+ - XXX: what happens when writing to just one cell of a double-width
149
+ character?
150
+
151
+
152
+ Default Windows fonts for East Asian languages
153
+ ==============================================
154
+ CP932 / Japanese: "MS ゴシック" (MS Gothic)
155
+ CP936 / Chinese Simplified: "新宋体" (SimSun)
156
+
157
+
158
+ Unreliable character width (half-width vs full-width)
159
+ =====================================================
160
+
161
+ The half-width vs full-width status of a codepoint depends on at least these variables:
162
+ * OS version (Win10 legacy and new modes are different versions)
163
+ * system locale (English vs Japanese vs Chinese Simplified vs Chinese Traditional, etc)
164
+ * code page (437 vs 932 vs 936, etc)
165
+ * raster vs TrueType (Terminal vs MS Gothic vs SimSun, etc)
166
+ * font size
167
+ * rendered-vs-model (rendered width can be larger or smaller than model width)
168
+
169
+ Example 1: U+2014 (EM DASH): East_Asian_Width: Ambiguous
170
+ --------------------------------------------------------
171
+ rendered modeled
172
+ CP932: Win7/8 Raster Fonts half half
173
+ CP932: Win7/8 Gothic 14/15px half full
174
+ CP932: Win7/8 Consolas 14/15px half full
175
+ CP932: Win7/8 Lucida Console 14px half full
176
+ CP932: Win7/8 Lucida Console 15px half half
177
+ CP932: Win10New Raster Fonts half half
178
+ CP932: Win10New Gothic 14/15px half half
179
+ CP932: Win10New Consolas 14/15px half half
180
+ CP932: Win10New Lucida Console 14/15px half half
181
+
182
+ CP936: Win7/8 Raster Fonts full full
183
+ CP936: Win7/8 SimSun 14px full full
184
+ CP936: Win7/8 SimSun 15px full half
185
+ CP936: Win7/8 Consolas 14/15px half full
186
+ CP936: Win10New Raster Fonts full full
187
+ CP936: Win10New SimSum 14/15px full full
188
+ CP936: Win10New Consolas 14/15px half half
189
+
190
+ Example 2: U+3044 (HIRAGANA LETTER I): East_Asian_Width: Wide
191
+ -------------------------------------------------------------
192
+ rendered modeled
193
+ CP932: Win7/8/10N Raster Fonts full full
194
+ CP932: Win7/8/10N Gothic 14/15px full full
195
+ CP932: Win7/8/10N Consolas 14/15px half(*2) full
196
+ CP932: Win7/8/10N Lucida Console 14/15px half(*3) full
197
+
198
+ CP936: Win7/8/10N Raster Fonts full full
199
+ CP936: Win7/8/10N SimSun 14/15px full full
200
+ CP936: Win7/8/10N Consolas 14/15px full full
201
+
202
+ Example 3: U+30FC (KATAKANA-HIRAGANA PROLONGED SOUND MARK): East_Asian_Width: Wide
203
+ ----------------------------------------------------------------------------------
204
+ rendered modeled
205
+ CP932: Win7 Raster Fonts full full
206
+ CP932: Win7 Gothic 14/15px full full
207
+ CP932: Win7 Consolas 14/15px half(*2) full
208
+ CP932: Win7 Lucida Console 14px half(*3) full
209
+ CP932: Win7 Lucida Console 15px half(*3) half
210
+ CP932: Win8 Raster Fonts full full
211
+ CP932: Win8 Gothic 14px full half
212
+ CP932: Win8 Gothic 15px full full
213
+ CP932: Win8 Consolas 14/15px half(*2) full
214
+ CP932: Win8 Lucida Console 14px half(*3) full
215
+ CP932: Win8 Lucida Console 15px half(*3) half
216
+ CP932: Win10New Raster Fonts full full
217
+ CP932: Win10New Gothic 14/15px full full
218
+ CP932: Win10New Consolas 14/15px half(*2) half
219
+ CP932: Win10New Lucida Console 14/15px half(*2) half
220
+
221
+ CP936: Win7/8 Raster Fonts full full
222
+ CP936: Win7/8 SimSun 14px full full
223
+ CP936: Win7/8 SimSun 15px full half
224
+ CP936: Win7/8 Consolas 14px full full
225
+ CP936: Win7/8 Consolas 15px full half
226
+ CP936: Win10New Raster Fonts full full
227
+ CP936: Win10New SimSum 14/15px full full
228
+ CP936: Win10New Consolas 14/15px full full
229
+
230
+ Example 4: U+4000 (CJK UNIFIED IDEOGRAPH-4000): East_Asian_Width: Wide
231
+ ----------------------------------------------------------------------
232
+ rendered modeled
233
+ CP932: Win7 Raster Fonts half(*1) half
234
+ CP932: Win7 Gothic 14/15px full full
235
+ CP932: Win7 Consolas 14/15px half(*2) full
236
+ CP932: Win7 Lucida Console 14px half(*3) full
237
+ CP932: Win7 Lucida Console 15px half(*3) half
238
+ CP932: Win8 Raster Fonts half(*1) half
239
+ CP932: Win8 Gothic 14px full half
240
+ CP932: Win8 Gothic 15px full full
241
+ CP932: Win8 Consolas 14/15px half(*2) full
242
+ CP932: Win8 Lucida Console 14px half(*3) full
243
+ CP932: Win8 Lucida Console 15px half(*3) half
244
+ CP932: Win10New Raster Fonts half(*1) half
245
+ CP932: Win10New Gothic 14/15px full full
246
+ CP932: Win10New Consolas 14/15px half(*2) half
247
+ CP932: Win10New Lucida Console 14/15px half(*2) half
248
+
249
+ CP936: Win7/8 Raster Fonts full full
250
+ CP936: Win7/8 SimSun 14px full full
251
+ CP936: Win7/8 SimSun 15px full half
252
+ CP936: Win7/8 Consolas 14px full full
253
+ CP936: Win7/8 Consolas 15px full half
254
+ CP936: Win10New Raster Fonts full full
255
+ CP936: Win10New SimSum 14/15px full full
256
+ CP936: Win10New Consolas 14/15px full full
257
+
258
+ (*1) Rendered as a half-width filled white box
259
+ (*2) Rendered as a half-width box with a question mark inside
260
+ (*3) Rendered as a half-width empty box
261
+ (!!) One of the only places in Win10New where rendered and modeled width disagree
262
+
263
+
264
+ Windows quirk: unreliable font heights with CP936 / Chinese Simplified
265
+ ======================================================================
266
+
267
+ When I set the font to 新宋体 17px, using either the properties dialog or
268
+ `SetCurrentConsoleFontEx`, the height reported by `GetCurrentConsoleFontEx` is
269
+ not 17, but is instead 19. The same problem does not affect Raster Fonts,
270
+ nor have I seen the problem in the English or Japanese locales. I observed
271
+ this with Windows 7 and Windows 10 new mode.
272
+
273
+ If I set the font using the facename, width, *and* height, then the
274
+ `SetCurrentConsoleFontEx` and `GetCurrentConsoleFontEx` values agree. If I
275
+ set the font using *only* the facename and height, then the two values
276
+ disagree.
277
+
278
+
279
+ Windows bug: GetCurrentConsoleFontEx is initially invalid
280
+ =========================================================
281
+
282
+ - Assume there is no configured console font name in the registry. In this
283
+ case, the console defaults to a raster font.
284
+ - Open a new console and call the `GetCurrentConsoleFontEx` API.
285
+ - The `FaceName` field of the returned `CONSOLE_FONT_INFOEX` data
286
+ structure is incorrect. On Windows 7, 8, and 10, I observed that the
287
+ field was blank. On Windows 8, occasionally, it instead contained:
288
+ U+AE72 U+75BE U+0001
289
+ The other fields of the structure all appeared correct:
290
+ nFont=6 dwFontSize=(8,12) FontFamily=0x30 FontWeight=400
291
+ - The `FaceName` field becomes initialized easily:
292
+ - Open the console properties dialog and click OK. (Cancel is not
293
+ sufficient.)
294
+ - Call the undocumented `SetConsoleFont` with the current font table
295
+ index, which is 6 in the example above.
296
+ - It seems that the console uncritically accepts whatever string is
297
+ stored in the registry, including a blank string, and passes it on the
298
+ the `GetCurrentConsoleFontEx` caller. It is possible to get the console
299
+ to *write* a blank setting into the registry -- simply open the console
300
+ (default or app-specific) properties and click OK.