Reverted latest changes.
[reactos.git] / reactos / lib / gdi32 / objects / text.c
1 #ifdef UNICODE
2 #undef UNICODE
3 #endif
4
5 #undef WIN32_LEAN_AND_MEAN
6 #include <windows.h>
7 #include <ddk/ntddk.h>
8 #include <win32k/kapi.h>
9
10 BOOL
11 STDCALL
12 TextOutA(
13 HDC hDC,
14 int XStart,
15 int YStart,
16 LPCSTR String,
17 int Count)
18 {
19 ANSI_STRING StringA;
20 UNICODE_STRING StringU;
21 BOOL ret;
22
23 if (NULL != String)
24 {
25 RtlInitAnsiString(&StringA, (LPSTR)String);
26 RtlAnsiStringToUnicodeString(&StringU, &StringA, TRUE);
27 } else
28 StringU.Buffer = NULL;
29
30 ret = TextOutW(hDC, XStart, YStart, StringU.Buffer, Count);
31 RtlFreeUnicodeString(&StringU);
32 return ret;
33 }
34
35 BOOL
36 STDCALL
37 TextOutW(
38 HDC hDC,
39 int XStart,
40 int YStart,
41 LPCWSTR String,
42 int Count)
43 {
44 return W32kTextOut(hDC, XStart, YStart, String, Count);
45 }
46
47 COLORREF
48 STDCALL
49 SetTextColor(
50 HDC hDC,
51 COLORREF color
52 )
53 {
54 return W32kSetTextColor(hDC, color);
55 }
56
57 BOOL
58 STDCALL
59 GetTextMetricsA(
60 HDC hdc,
61 LPTEXTMETRIC tm
62 )
63 {
64 return W32kGetTextMetrics(hdc, tm);
65 }
66
67 BOOL
68 STDCALL
69 GetTextMetricsW(
70 HDC hdc,
71 LPTEXTMETRIC tm
72 )
73 {
74 return W32kGetTextMetrics(hdc, tm);
75 }
76
77 BOOL
78 APIENTRY
79 GetTextExtentPointA(
80 HDC hDC,
81 LPCSTR String,
82 int Count,
83 LPSIZE Size
84 )
85 {
86 ANSI_STRING StringA;
87 UNICODE_STRING StringU;
88 BOOL ret;
89
90 RtlInitAnsiString(&StringA, (LPSTR)String);
91 RtlAnsiStringToUnicodeString(&StringU, &StringA, TRUE);
92
93 ret = GetTextExtentPointW(hDC, StringU.Buffer, Count, Size);
94
95 RtlFreeUnicodeString(&StringU);
96
97 return ret;
98 }
99
100 BOOL
101 APIENTRY
102 GetTextExtentPointW(
103 HDC hDC,
104 LPCWSTR String,
105 int Count,
106 LPSIZE Size
107 )
108 {
109 return W32kGetTextExtentPoint(hDC, String, Count, Size);
110 }
111
112 BOOL
113 STDCALL
114 ExtTextOutA(
115 HDC hDC,
116 int X,
117 int Y,
118 UINT Options,
119 CONST RECT *Rect,
120 LPCSTR String,
121 UINT Count,
122 CONST INT *Spacings
123 )
124 {
125 ANSI_STRING StringA;
126 UNICODE_STRING StringU;
127 BOOL ret;
128
129 RtlInitAnsiString(&StringA, (LPSTR)String);
130 RtlAnsiStringToUnicodeString(&StringU, &StringA, TRUE);
131
132 ret = ExtTextOutW(hDC, X, Y, Options, Rect, StringU.Buffer, Count, Spacings);
133
134 RtlFreeUnicodeString(&StringU);
135
136 return ret;
137 }
138
139 BOOL
140 STDCALL
141 ExtTextOutW(
142 HDC hDC,
143 int X,
144 int Y,
145 UINT Options,
146 CONST RECT *Rect,
147 LPCWSTR String,
148 UINT Count,
149 CONST INT *Spacings
150 )
151 {
152 return W32kTextOut(hDC, X, Y, String, Count);
153 }
154
155 HFONT
156 STDCALL
157 CreateFontIndirectA(
158 CONST LOGFONT *lf
159 )
160 {
161 ANSI_STRING StringA;
162 UNICODE_STRING StringU;
163 HFONT ret;
164 LOGFONT tlf;
165
166 RtlInitAnsiString(&StringA, (LPSTR)lf->lfFaceName);
167 RtlAnsiStringToUnicodeString(&StringU, &StringA, TRUE);
168 memcpy(&tlf, lf, sizeof(LOGFONT));
169 memcpy(&tlf.lfFaceName, &StringU.Buffer, StringU.Length);
170
171 ret = CreateFontIndirectW((CONST LOGFONT *)&lf);
172
173 RtlFreeUnicodeString(&StringU);
174
175 return ret;
176 }
177
178 HFONT
179 STDCALL
180 CreateFontIndirectW(
181 CONST LOGFONT *lf
182 )
183 {
184 return W32kCreateFontIndirect((CONST LPLOGFONT)lf);
185 }
186
187 HFONT
188 STDCALL
189 CreateFontA(
190 int Height,
191 int Width,
192 int Escapement,
193 int Orientation,
194 int Weight,
195 DWORD Italic,
196 DWORD Underline,
197 DWORD StrikeOut,
198 DWORD CharSet,
199 DWORD OutputPrecision,
200 DWORD ClipPrecision,
201 DWORD Quality,
202 DWORD PitchAndFamily,
203 LPCSTR Face
204 )
205 {
206 ANSI_STRING StringA;
207 UNICODE_STRING StringU;
208 HFONT ret;
209 LOGFONT tlf;
210
211 RtlInitAnsiString(&StringA, (LPSTR)Face);
212 RtlAnsiStringToUnicodeString(&StringU, &StringA, TRUE);
213
214 ret = CreateFontW(Height, Width, Escapement, Orientation, Weight, Italic, Underline, StrikeOut,
215 CharSet, OutputPrecision, ClipPrecision, Quality, PitchAndFamily, StringU.Buffer);
216
217 RtlFreeUnicodeString(&StringU);
218
219 return ret;
220 }
221
222 HFONT
223 STDCALL
224 CreateFontW(
225 int Height,
226 int Width,
227 int Escapement,
228 int Orientation,
229 int Weight,
230 DWORD Italic,
231 DWORD Underline,
232 DWORD StrikeOut,
233 DWORD CharSet,
234 DWORD OutputPrecision,
235 DWORD ClipPrecision,
236 DWORD Quality,
237 DWORD PitchAndFamily,
238 LPCWSTR Face
239 )
240 {
241 return W32kCreateFont(Height, Width, Escapement, Orientation, Weight, Italic, Underline, StrikeOut,
242 CharSet, OutputPrecision, ClipPrecision, Quality, PitchAndFamily, Face);
243 }