@@ -58,6 +58,27 @@ public static extern int ToUnicode(uint uVirtKey, uint uScanCode, byte[] lpKeySt
58
58
59
59
[ DllImport ( "user32.dll" , CharSet = CharSet . Unicode , SetLastError = true ) ]
60
60
public static extern short VkKeyScan ( char @char ) ;
61
+
62
+ [ DllImport ( "kernel32.dll" , SetLastError = false , CharSet = CharSet . Unicode ) ]
63
+ public static extern uint GetConsoleOutputCP ( ) ;
64
+
65
+ [ DllImport ( "User32.dll" , SetLastError = false , CharSet = CharSet . Unicode ) ]
66
+ public static extern int ReleaseDC ( IntPtr hwnd , IntPtr hdc ) ;
67
+
68
+ [ DllImport ( "kernel32.dll" , SetLastError = true , CharSet = CharSet . Unicode ) ]
69
+ public static extern IntPtr GetConsoleWindow ( ) ;
70
+
71
+ [ DllImport ( "User32.dll" , SetLastError = true , CharSet = CharSet . Unicode ) ]
72
+ public static extern IntPtr GetDC ( IntPtr hwnd ) ;
73
+
74
+ [ DllImport ( "GDI32.dll" , SetLastError = true , CharSet = CharSet . Unicode ) ]
75
+ public static extern bool TranslateCharsetInfo ( IntPtr src , out CHARSETINFO Cs , uint options ) ;
76
+
77
+ [ DllImport ( "GDI32.dll" , SetLastError = true , CharSet = CharSet . Unicode ) ]
78
+ public static extern bool GetTextMetrics ( IntPtr hdc , out TEXTMETRIC tm ) ;
79
+
80
+ [ DllImport ( "GDI32.dll" , SetLastError = true , CharSet = CharSet . Unicode ) ]
81
+ public static extern bool GetCharWidth32 ( IntPtr hdc , uint first , uint last , out int width ) ;
61
82
}
62
83
63
84
public delegate bool BreakHandler ( ConsoleBreakSignal ConsoleBreakSignal ) ;
@@ -119,6 +140,56 @@ public override string ToString()
119
140
}
120
141
}
121
142
143
+ [ StructLayout ( LayoutKind . Sequential ) ]
144
+ public struct FONTSIGNATURE
145
+ {
146
+ //From public\sdk\inc\wingdi.h
147
+
148
+ // fsUsb*: A 128-bit Unicode subset bitfield (USB) identifying up to 126 Unicode subranges
149
+ internal uint fsUsb0 ;
150
+ internal uint fsUsb1 ;
151
+ internal uint fsUsb2 ;
152
+ internal uint fsUsb3 ;
153
+ // fsCsb*: A 64-bit, code-page bitfield (CPB) that identifies a specific character set or code page.
154
+ internal uint fsCsb0 ;
155
+ internal uint fsCsb1 ;
156
+ }
157
+
158
+ [ StructLayout ( LayoutKind . Sequential ) ]
159
+ public struct CHARSETINFO
160
+ {
161
+ //From public\sdk\inc\wingdi.h
162
+ internal uint ciCharset ; // Character set value.
163
+ internal uint ciACP ; // ANSI code-page identifier.
164
+ internal FONTSIGNATURE fs ;
165
+ }
166
+
167
+ [ StructLayout ( LayoutKind . Sequential , CharSet = CharSet . Unicode ) ]
168
+ public struct TEXTMETRIC
169
+ {
170
+ //From public\sdk\inc\wingdi.h
171
+ public int tmHeight ;
172
+ public int tmAscent ;
173
+ public int tmDescent ;
174
+ public int tmInternalLeading ;
175
+ public int tmExternalLeading ;
176
+ public int tmAveCharWidth ;
177
+ public int tmMaxCharWidth ;
178
+ public int tmWeight ;
179
+ public int tmOverhang ;
180
+ public int tmDigitizedAspectX ;
181
+ public int tmDigitizedAspectY ;
182
+ public char tmFirstChar ;
183
+ public char tmLastChar ;
184
+ public char tmDefaultChar ;
185
+ public char tmBreakChar ;
186
+ public byte tmItalic ;
187
+ public byte tmUnderlined ;
188
+ public byte tmStruckOut ;
189
+ public byte tmPitchAndFamily ;
190
+ public byte tmCharSet ;
191
+ }
192
+
122
193
public struct CHAR_INFO
123
194
{
124
195
public ushort UnicodeChar ;
0 commit comments