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