19 UNICODE_STRING StringU
;
24 RtlInitAnsiString(&StringA
, (LPSTR
)lpString
);
25 RtlAnsiStringToUnicodeString(&StringU
, &StringA
, TRUE
);
28 StringU
.Buffer
= NULL
;
30 ret
= TextOutW(hdc
, nXStart
, nYStart
, StringU
.Buffer
, cchString
);
31 RtlFreeUnicodeString(&StringU
);
48 return NtGdiExtTextOutW(hdc
, nXStart
, nYStart
, 0, NULL
, (LPWSTR
)lpString
, cchString
, NULL
, 0);
57 GdiGetCodePage(HDC hdc
)
60 if (!GdiGetHandleUserData((HGDIOBJ
) hdc
, GDI_OBJECT_TYPE_DC
, (PVOID
) &Dc_Attr
)) return 0;
61 if (Dc_Attr
->ulDirty_
& DIRTY_CHARSET
) return LOWORD(NtGdiGetCharSet(hdc
));
62 return LOWORD(Dc_Attr
->iCS_CP
);
71 GetTextCharacterExtra(
77 if (!GdiGetHandleUserData((HGDIOBJ
) hDc
, GDI_OBJECT_TYPE_DC
, (PVOID
) &Dc_Attr
)) return 0;
78 return Dc_Attr
->lTextExtra
;
79 // return GetDCDWord( hDc, GdiGetTextCharExtra, 0);
88 GetTextCharset(HDC hdc
)
90 /* MSDN docs say this is equivalent */
91 return NtGdiGetTextCharsetInfo(hdc
,NULL
,0);
108 if (! NtGdiGetTextMetricsW(hdc
, &tmwi
, sizeof(TMW_INTERNAL
)))
113 FONT_TextMetricWToA(&tmwi
.TextMetric
, lptm
);
130 if (! NtGdiGetTextMetricsW(hdc
, &tmwi
, sizeof(TMW_INTERNAL
)))
135 *lptm
= tmwi
.TextMetric
;
153 UNICODE_STRING StringU
;
156 RtlInitAnsiString(&StringA
, (LPSTR
)lpString
);
157 RtlAnsiStringToUnicodeString(&StringU
, &StringA
, TRUE
);
159 ret
= GetTextExtentPointW(hdc
, StringU
.Buffer
, cchString
, lpSize
);
161 RtlFreeUnicodeString(&StringU
);
179 return NtGdiGetTextExtent(hdc
, (LPWSTR
)lpString
, cchString
, lpSize
, 0);
188 GetTextExtentExPointW(
199 /* Windows doesn't check nMaxExtent validity in unicode version */
201 DPRINT("nMaxExtent is invalid: %d\n", nMaxExtent
);
203 return NtGdiGetTextExtentExW (
204 hdc
, (LPWSTR
)lpszStr
, cchString
, nMaxExtent
, (PULONG
)lpnFit
, (PULONG
)alpDx
, lpSize
, 0 );
213 GetTextExtentExPointA(
229 SetLastError(ERROR_INVALID_PARAMETER
);
233 Status
= HEAP_strdupA2W ( &lpszStrW
, lpszStr
);
234 if (!NT_SUCCESS (Status
))
235 SetLastError (RtlNtStatusToDosError(Status
));
238 rc
= NtGdiGetTextExtentExW (
239 hdc
, lpszStrW
, cchString
, nMaxExtent
, (PULONG
)lpnFit
, (PULONG
)alpDx
, lpSize
, 0 );
241 HEAP_free ( lpszStrW
);
253 GetTextExtentPoint32A(
261 UNICODE_STRING StringU
;
264 StringA
.Buffer
= (LPSTR
)lpString
;
265 StringA
.Length
= cchString
;
266 RtlAnsiStringToUnicodeString(&StringU
, &StringA
, TRUE
);
268 ret
= GetTextExtentPoint32W(hdc
, StringU
.Buffer
, cchString
, lpSize
);
270 RtlFreeUnicodeString(&StringU
);
281 GetTextExtentPoint32W(
288 return NtGdiGetTextExtent(hdc
, (LPWSTR
)lpString
, cchString
, lpSize
, 0);
296 GetTextExtentExPointI(HDC hdc
,
304 return NtGdiGetTextExtentExW(hdc
,pgiIn
,cgi
,nMaxExtent
,(ULONG
*)lpnFit
, (PULONG
) alpDx
,lpSize
,GTEF_INDICES
);
312 GetTextExtentPointI(HDC hdc
,
317 return NtGdiGetTextExtent(hdc
,pgiIn
,cgi
,lpSize
,GTEF_INDICES
);
337 UNICODE_STRING StringU
;
340 RtlInitAnsiString(&StringA
, (LPSTR
)lpString
);
341 RtlAnsiStringToUnicodeString(&StringU
, &StringA
, TRUE
);
343 ret
= ExtTextOutW(hdc
, X
, Y
, fuOptions
, lprc
, StringU
.Buffer
, cchString
, lpDx
);
345 RtlFreeUnicodeString(&StringU
);
367 return NtGdiExtTextOutW(hdc
, X
, Y
, fuOptions
, (LPRECT
)lprc
, (LPWSTR
)lpString
, cchString
, (LPINT
)lpDx
, 0);
376 GetTextFaceW(HDC hDC
,
380 /* Validate parameters */
381 if (pFaceName
&& nCount
<= 0)
383 /* Set last error and return failure */
384 GdiSetLastError(ERROR_INVALID_PARAMETER
);
388 /* Forward to kernel */
389 return NtGdiGetTextFaceW(hDC
, nCount
, pFaceName
, FALSE
);
398 GetTextFaceA( HDC hdc
, INT count
, LPSTR name
)
403 /* Validate parameters */
404 if (name
&& count
<= 0)
406 /* Set last error and return failure */
407 GdiSetLastError(ERROR_INVALID_PARAMETER
);
411 res
= GetTextFaceW(hdc
, 0, NULL
);
412 nameW
= HeapAlloc( GetProcessHeap(), 0, res
* 2 );
417 GetTextFaceW( hdc
, res
, nameW
);
421 if (count
&& !WideCharToMultiByte( CP_ACP
, 0, nameW
, -1, name
, count
, NULL
, NULL
))
426 res
= WideCharToMultiByte( CP_ACP
, 0, nameW
, -1, NULL
, 0, NULL
, NULL
);
427 HeapFree( GetProcessHeap(), 0, nameW
);
437 GetTextFaceAliasW(HDC hdc
,
441 if ( pszOut
&& !cChar
)
443 GdiSetLastError(ERROR_INVALID_PARAMETER
);
446 return NtGdiGetTextFaceW(hdc
,cChar
,pszOut
,TRUE
);
452 GetFontResourceInfoW(
460 UNICODE_STRING NtFileName
;
462 if (!lpFileName
|| !pdwBufSize
|| !lpBuffer
)
464 SetLastError(ERROR_INVALID_PARAMETER
);
468 if (!RtlDosPathNameToNtPathName_U(lpFileName
,
473 SetLastError(ERROR_PATH_NOT_FOUND
);
477 bRet
= NtGdiGetFontResourceInfoInternalW(
479 (NtFileName
.Length
/ sizeof(WCHAR
)) + 1,
486 RtlFreeHeap(RtlGetProcessHeap(), 0, NtFileName
.Buffer
);
502 SetTextCharacterExtra(
507 INT cExtra
= 0x80000000;
510 if (CharExtra
== cExtra
)
512 SetLastError(ERROR_INVALID_PARAMETER
);
516 if (GDI_HANDLE_GET_TYPE(hDC
) == GDI_OBJECT_TYPE_METADC
)
518 return MFDRV_SetTextCharacterExtra( hDC
, CharExtra
); // Wine port.
521 if (!GdiGetHandleUserData((HGDIOBJ
) hDC
, GDI_OBJECT_TYPE_DC
, (PVOID
) &Dc_Attr
)) return cExtra
;
523 if (NtCurrentTeb()->GdiTebBatch
.HDC
== hDC
)
525 if (Dc_Attr
->ulDirty_
& DC_FONTTEXT_DIRTY
)
527 NtGdiFlush(); // Sync up Dc_Attr from Kernel space.
528 Dc_Attr
->ulDirty_
&= ~(DC_MODE_DIRTY
|DC_FONTTEXT_DIRTY
);
531 cExtra
= Dc_Attr
->lTextExtra
;
532 Dc_Attr
->lTextExtra
= CharExtra
;
534 // return GetAndSetDCDWord( hDC, GdiGetSetTextCharExtra, CharExtra, 0, 0, 0 );
543 GetTextAlign(HDC hdc
)
546 if (!GdiGetHandleUserData((HGDIOBJ
) hdc
, GDI_OBJECT_TYPE_DC
, (PVOID
) &Dc_Attr
)) return 0;
547 return Dc_Attr
->lTextAlign
;
557 GetTextColor(HDC hdc
)
560 if (!GdiGetHandleUserData((HGDIOBJ
) hdc
, GDI_OBJECT_TYPE_DC
, (PVOID
) &Dc_Attr
)) return 0;
561 return Dc_Attr
->ulForegroundClr
;
571 SetTextAlign(HDC hdc
,
577 if (GDI_HANDLE_GET_TYPE(hDC
) != GDI_OBJECT_TYPE_DC
)
579 if (GDI_HANDLE_GET_TYPE(hDC
) == GDI_OBJECT_TYPE_METADC
)
580 return MFDRV_SetTextAlign( hdc
, fMode
)
583 PLDC pLDC
= Dc_Attr
->pvLDC
;
586 SetLastError(ERROR_INVALID_HANDLE
);
589 if (pLDC
->iType
== LDC_EMFLDC
)
591 if return EMFDRV_SetTextAlign( hdc
, fMode
)
596 if (!GdiGetHandleUserData((HGDIOBJ
) hdc
, GDI_OBJECT_TYPE_DC
, (PVOID
) &Dc_Attr
)) return GDI_ERROR
;
598 OldMode
= Dc_Attr
->lTextAlign
;
599 Dc_Attr
->lTextAlign
= fMode
; // Raw
600 if (Dc_Attr
->dwLayout
& LAYOUT_RTL
)
602 if ((fMode
& TA_CENTER
) != TA_CENTER
) fMode
^= TA_RIGHT
;
604 Dc_Attr
->flTextAlign
= fMode
& TA_MASK
;
620 COLORREF OldColor
= CLR_INVALID
;
622 if (GDI_HANDLE_GET_TYPE(hDC
) != GDI_OBJECT_TYPE_DC
)
624 if (GDI_HANDLE_GET_TYPE(hDC
) == GDI_OBJECT_TYPE_METADC
)
625 return MFDRV_SetTextColor( hDC
, crColor
);
628 PLDC pLDC
= Dc_Attr
->pvLDC
;
631 SetLastError(ERROR_INVALID_HANDLE
);
634 if (pLDC
->iType
== LDC_EMFLDC
)
636 if return EMFDRV_SetTextColor( hDC
, crColor
);
641 if (!GdiGetHandleUserData((HGDIOBJ
) hdc
, GDI_OBJECT_TYPE_DC
, (PVOID
) &Dc_Attr
)) return OldColor
;
643 OldColor
= (COLORREF
) Dc_Attr
->ulForegroundClr
;
644 Dc_Attr
->ulForegroundClr
= (ULONG
) crColor
;
646 if ( Dc_Attr
->crForegroundClr
!= crColor
)
648 Dc_Attr
->ulDirty_
|= (DIRTY_TEXT
|DIRTY_LINE
|DIRTY_FILL
);
649 Dc_Attr
->crForegroundClr
= crColor
;
659 SetTextJustification(
667 if (GDI_HANDLE_GET_TYPE(hDC
) != GDI_OBJECT_TYPE_DC
)
669 if (GDI_HANDLE_GET_TYPE(hDC
) == GDI_OBJECT_TYPE_METADC
)
670 return MFDRV_SetTextJustification( hdc
, extra
, breaks
)
673 SetLastError(ERROR_INVALID_HANDLE
);
677 if (!GdiGetHandleUserData((HGDIOBJ
) hdc
, GDI_OBJECT_TYPE_DC
, (PVOID
) &Dc_Attr
)) return FALSE
;
679 if (NtCurrentTeb()->GdiTebBatch
.HDC
== hdc
)
681 if (Dc_Attr
->ulDirty_
& DC_FONTTEXT_DIRTY
)
683 NtGdiFlush(); // Sync up Dc_Attr from Kernel space.
684 Dc_Attr
->ulDirty_
&= ~(DC_MODE_DIRTY
|DC_FONTTEXT_DIRTY
);
687 Dc_Attr
->cBreak
= breaks
;
688 Dc_Attr
->lBreakExtra
= extra
;