- Implement GetCharWidthA/W()
[reactos.git] / reactos / lib / gdi32 / misc / stubsa.c
1 /* $Id: stubsa.c,v 1.29 2004/03/23 07:59:47 gvg Exp $
2 *
3 * reactos/lib/gdi32/misc/stubs.c
4 *
5 * GDI32.DLL Stubs for ANSI functions
6 *
7 * When you implement one of these functions,
8 * remove its stub from this file.
9 *
10 */
11 #ifdef UNICODE
12 #undef UNICODE
13 #endif
14
15 #undef WIN32_LEAN_AND_MEAN
16 #include <windows.h>
17 #include <ddk/ntddk.h>
18 #include <win32k/text.h>
19 #include <win32k/dc.h>
20 #include <rosrtl/devmode.h>
21 #include <rosrtl/logfont.h>
22 #include <internal/heap.h>
23
24 /*
25 * @implemented
26 */
27 int
28 STDCALL
29 AddFontResourceExA ( LPCSTR lpszFilename, DWORD fl, PVOID pvReserved )
30 {
31 NTSTATUS Status;
32 PWSTR FilenameW;
33 int rc = 0;
34
35 Status = HEAP_strdupA2W ( &FilenameW, lpszFilename );
36 if ( !NT_SUCCESS (Status) )
37 SetLastError (RtlNtStatusToDosError(Status));
38 else
39 {
40 rc = AddFontResourceExW ( FilenameW, fl, pvReserved );
41
42 HEAP_free ( &FilenameW );
43 }
44 return rc;
45 }
46
47 /*
48 * @implemented
49 */
50 int
51 STDCALL
52 AddFontResourceA ( LPCSTR lpszFilename )
53 {
54 return AddFontResourceExA ( lpszFilename, 0, 0 );
55 }
56
57
58 /*
59 * @implemented
60 */
61 HDC
62 STDCALL
63 CreateICA(
64 LPCSTR lpszDriver,
65 LPCSTR lpszDevice,
66 LPCSTR lpszOutput,
67 CONST DEVMODEA * lpdvmInit
68 )
69 {
70 NTSTATUS Status;
71 LPWSTR lpszDriverW, lpszDeviceW, lpszOutputW;
72 UNICODE_STRING Driver, Device, Output;
73 DEVMODEW dvmInitW;
74 HDC rc = 0;
75
76 Status = HEAP_strdupA2W ( &lpszDriverW, lpszDriver );
77 if (!NT_SUCCESS (Status))
78 SetLastError (RtlNtStatusToDosError(Status));
79 else
80 {
81 Status = HEAP_strdupA2W ( &lpszDeviceW, lpszDevice );
82 if (!NT_SUCCESS (Status))
83 SetLastError (RtlNtStatusToDosError(Status));
84 else
85 {
86 Status = HEAP_strdupA2W ( &lpszOutputW, lpszOutput );
87 if (!NT_SUCCESS (Status))
88 SetLastError (RtlNtStatusToDosError(Status));
89 else
90 {
91 if ( lpdvmInit )
92 RosRtlDevModeA2W ( &dvmInitW, (const LPDEVMODEA)lpdvmInit );
93
94 RtlInitUnicodeString(&Driver, lpszDriverW);
95 RtlInitUnicodeString(&Device, lpszDeviceW);
96 RtlInitUnicodeString(&Output, lpszOutputW);
97 rc = NtGdiCreateIC ( &Driver,
98 &Device,
99 &Output,
100 lpdvmInit ? &dvmInitW : NULL );
101
102 HEAP_free ( lpszOutputW );
103 }
104 HEAP_free ( lpszDeviceW );
105 }
106 HEAP_free ( lpszDriverW );
107 }
108 return rc;
109 }
110
111
112 /*
113 * @implemented
114 */
115 BOOL
116 STDCALL
117 CreateScalableFontResourceA(
118 DWORD fdwHidden,
119 LPCSTR lpszFontRes,
120 LPCSTR lpszFontFile,
121 LPCSTR lpszCurrentPath
122 )
123 {
124 NTSTATUS Status;
125 LPWSTR lpszFontResW, lpszFontFileW, lpszCurrentPathW;
126 BOOL rc = FALSE;
127
128 Status = HEAP_strdupA2W ( &lpszFontResW, lpszFontRes );
129 if (!NT_SUCCESS (Status))
130 SetLastError (RtlNtStatusToDosError(Status));
131 else
132 {
133 Status = HEAP_strdupA2W ( &lpszFontFileW, lpszFontFile );
134 if (!NT_SUCCESS (Status))
135 SetLastError (RtlNtStatusToDosError(Status));
136 else
137 {
138 Status = HEAP_strdupA2W ( &lpszCurrentPathW, lpszCurrentPath );
139 if (!NT_SUCCESS (Status))
140 SetLastError (RtlNtStatusToDosError(Status));
141 else
142 {
143 rc = NtGdiCreateScalableFontResource ( fdwHidden,
144 lpszFontResW,
145 lpszFontFileW,
146 lpszCurrentPathW );
147
148 HEAP_free ( lpszCurrentPathW );
149 }
150
151 HEAP_free ( lpszFontFileW );
152 }
153
154 HEAP_free ( lpszFontResW );
155 }
156 return rc;
157 }
158
159
160 /*
161 * @unimplemented
162 */
163 int
164 STDCALL
165 DeviceCapabilitiesExA(
166 LPCSTR pDevice,
167 LPCSTR pPort,
168 WORD fwCapability,
169 LPSTR pOutput,
170 CONST DEVMODEA *pDevMode
171 )
172 {
173 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
174 return 0;
175 }
176
177
178 /*
179 * @implemented
180 */
181 int
182 STDCALL
183 EnumFontsA (
184 HDC hDC,
185 LPCSTR lpFaceName,
186 FONTENUMPROCA FontFunc,
187 LPARAM lParam
188 )
189 {
190 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
191 return 0;
192 #if 0
193 NTSTATUS Status;
194 LPWSTR lpFaceNameW;
195 int rc = 0;
196
197 Status = HEAP_strdupA2W ( &lpFaceNameW, lpFaceName );
198 if (!NT_SUCCESS (Status))
199 SetLastError (RtlNtStatusToDosError(Status));
200 else
201 {
202 rc = NtGdiEnumFonts ( hDC, lpFaceNameW, FontFunc, lParam );
203
204 HEAP_free ( lpFaceNameW );
205 }
206 return rc;
207 #endif
208 }
209
210
211 /*
212 * @unimplemented
213 */
214 BOOL
215 APIENTRY
216 GetCharWidthFloatA(
217 HDC hdc,
218 UINT iFirstChar,
219 UINT iLastChar,
220 PFLOAT pxBuffer
221 )
222 {
223 /* FIXME what to do with iFirstChar and iLastChar ??? */
224 return NtGdiGetCharWidthFloat ( hdc, iFirstChar, iLastChar, pxBuffer );
225 }
226
227
228 /*
229 * @unimplemented
230 */
231 BOOL
232 APIENTRY
233 GetCharABCWidthsA(
234 HDC hdc,
235 UINT uFirstChar,
236 UINT uLastChar,
237 LPABC lpabc
238 )
239 {
240 /* FIXME what to do with uFirstChar and uLastChar ??? */
241 return NtGdiGetCharABCWidths ( hdc, uFirstChar, uLastChar, lpabc );
242 }
243
244
245 /*
246 * @unimplemented
247 */
248 BOOL
249 APIENTRY
250 GetCharABCWidthsFloatA(
251 HDC hdc,
252 UINT iFirstChar,
253 UINT iLastChar,
254 LPABCFLOAT lpABCF
255 )
256 {
257 /* FIXME what to do with iFirstChar and iLastChar ??? */
258 return NtGdiGetCharABCWidthsFloat ( hdc, iFirstChar, iLastChar, lpABCF );
259 }
260
261
262 /*
263 * @implemented
264 */
265 DWORD
266 STDCALL
267 GetGlyphOutlineA(
268 HDC hdc,
269 UINT uChar,
270 UINT uFormat,
271 LPGLYPHMETRICS lpgm,
272 DWORD cbBuffer,
273 LPVOID lpvBuffer,
274 CONST MAT2 *lpmat2
275 )
276 {
277 return NtGdiGetGlyphOutline ( hdc, uChar, uFormat, lpgm, cbBuffer, lpvBuffer, (CONST LPMAT2)lpmat2 );
278 }
279
280
281 /*
282 * @unimplemented
283 */
284 UINT
285 APIENTRY
286 GetOutlineTextMetricsA(
287 HDC hdc,
288 UINT cbData,
289 LPOUTLINETEXTMETRICA lpOTM
290 )
291 {
292 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
293 return 0;
294 }
295
296
297 /*
298 * @implemented
299 */
300 BOOL
301 APIENTRY
302 GetTextExtentExPointA(
303 HDC hdc,
304 LPCSTR lpszStr,
305 int cchString,
306 int nMaxExtent,
307 LPINT lpnFit,
308 LPINT alpDx,
309 LPSIZE lpSize
310 )
311 {
312 NTSTATUS Status;
313 LPWSTR lpszStrW;
314 BOOL rc = 0;
315
316 Status = HEAP_strdupA2W ( &lpszStrW, lpszStr );
317 if (!NT_SUCCESS (Status))
318 SetLastError (RtlNtStatusToDosError(Status));
319 else
320 {
321 rc = NtGdiGetTextExtentExPoint (
322 hdc, lpszStrW, cchString, nMaxExtent, lpnFit, alpDx, lpSize );
323
324 HEAP_free ( lpszStrW );
325 }
326
327 return rc;
328 }
329
330
331 /*
332 * @unimplemented
333 */
334 DWORD
335 STDCALL
336 GetCharacterPlacementA(
337 HDC hDc,
338 LPCSTR a1,
339 int a2,
340 int a3,
341 LPGCP_RESULTSA a4,
342 DWORD a5
343 )
344 {
345 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
346 return 0;
347 }
348
349
350 /*
351 * @implemented
352 */
353 HDC
354 STDCALL
355 ResetDCA(
356 HDC hdc,
357 CONST DEVMODEA *lpInitData
358 )
359 {
360 DEVMODEW InitDataW;
361
362 RosRtlDevModeA2W ( &InitDataW, (CONST LPDEVMODEA)lpInitData );
363
364 return NtGdiResetDC ( hdc, &InitDataW );
365 }
366
367
368 /*
369 * @implemented
370 */
371 BOOL
372 STDCALL
373 RemoveFontResourceA(
374 LPCSTR lpFileName
375 )
376 {
377 NTSTATUS Status;
378 LPWSTR lpFileNameW;
379 BOOL rc = 0;
380
381 Status = HEAP_strdupA2W ( &lpFileNameW, lpFileName );
382 if (!NT_SUCCESS (Status))
383 SetLastError (RtlNtStatusToDosError(Status));
384 else
385 {
386 rc = NtGdiRemoveFontResource ( lpFileNameW );
387
388 HEAP_free ( lpFileNameW );
389 }
390
391 return rc;
392 }
393
394
395 /*
396 * @unimplemented
397 */
398 int
399 STDCALL
400 StartDocA(
401 HDC hdc,
402 CONST DOCINFOA *a1
403 )
404 {
405 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
406 return 0;
407 }
408
409
410 /*
411 * @unimplemented
412 */
413 int
414 STDCALL
415 GetObjectA(
416 HGDIOBJ a0,
417 int a1,
418 LPVOID a2
419 )
420 {
421 return NtGdiGetObject ( a0, a1, a2 );
422 }
423
424
425 /*
426 * @unimplemented
427 */
428 BOOL
429 STDCALL
430 PolyTextOutA(
431 HDC hdc,
432 CONST POLYTEXTA *a1,
433 int a2
434 )
435 {
436 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
437 return FALSE;
438 }
439
440
441 /*
442 * @unimplemented
443 */
444 int
445 STDCALL
446 GetTextFaceA(
447 HDC a0,
448 int a1,
449 LPSTR a2
450 )
451 {
452 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
453 return FALSE;
454 }
455
456
457 /*
458 * @unimplemented
459 */
460 DWORD
461 STDCALL
462 GetKerningPairsA(
463 HDC a0,
464 DWORD a1,
465 LPKERNINGPAIR a2
466 )
467 {
468 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
469 return 0;
470 }
471
472
473 /*
474 * @unimplemented
475 */
476 BOOL
477 STDCALL
478 GetLogColorSpaceA(
479 HCOLORSPACE a0,
480 LPLOGCOLORSPACEA a1,
481 DWORD a2
482 )
483 {
484 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
485 return FALSE;
486 }
487
488
489 /*
490 * @unimplemented
491 */
492 HCOLORSPACE
493 STDCALL
494 CreateColorSpaceA(
495 LPLOGCOLORSPACEA a0
496 )
497 {
498 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
499 return 0;
500 }
501
502
503 /*
504 * @unimplemented
505 */
506 BOOL
507 STDCALL
508 GetICMProfileA(
509 HDC a0,
510 DWORD a1, /* MS says LPDWORD! */
511 LPSTR a2
512 )
513 {
514 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
515 return FALSE;
516 }
517
518
519 /*
520 * @unimplemented
521 */
522 BOOL
523 STDCALL
524 SetICMProfileA(
525 HDC a0,
526 LPSTR a1
527 )
528 {
529 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
530 return FALSE;
531 }
532
533
534 /*
535 * @unimplemented
536 */
537 int
538 STDCALL
539 EnumICMProfilesA(
540 HDC a0,
541 ICMENUMPROCA a1,
542 LPARAM a2
543 )
544 {
545 /*
546 * FIXME - call NtGdiEnumICMProfiles with NULL for lpstrBuffer
547 * to find out how big a buffer we need. Then allocate that buffer
548 * and call NtGdiEnumICMProfiles again to have the buffer filled.
549 *
550 * Finally, step through the buffer ( MULTI-SZ recommended for format ),
551 * and convert each string to ANSI, calling the user's callback function
552 * until we run out of strings or the user returns FALSE
553 */
554
555 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
556 return 0;
557 }
558
559
560 /*
561 * @unimplemented
562 */
563 BOOL
564 STDCALL
565 wglUseFontBitmapsA(
566 HDC a0,
567 DWORD a1,
568 DWORD a2,
569 DWORD a3
570 )
571 {
572 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
573 return FALSE;
574 }
575
576
577 /*
578 * @unimplemented
579 */
580 BOOL
581 STDCALL
582 wglUseFontOutlinesA(
583 HDC a0,
584 DWORD a1,
585 DWORD a2,
586 DWORD a3,
587 FLOAT a4,
588 FLOAT a5,
589 int a6,
590 LPGLYPHMETRICSFLOAT a7
591 )
592 {
593 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
594 return FALSE;
595 }
596
597
598 /*
599 * @unimplemented
600 */
601 BOOL
602 STDCALL
603 UpdateICMRegKeyA(
604 DWORD a0,
605 DWORD a1,
606 LPSTR a2,
607 UINT a3
608 )
609 {
610 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
611 return FALSE;
612 }
613
614
615 /* EOF */