15 _In_reads_(cchString
) LPCSTR lpString
,
19 UNICODE_STRING StringU
;
24 RtlInitAnsiString(&StringA
, (LPSTR
)lpString
);
25 RtlAnsiStringToUnicodeString(&StringU
, &StringA
, TRUE
);
29 StringU
.Buffer
= NULL
;
32 bResult
= TextOutW(hdc
, nXStart
, nYStart
, StringU
.Buffer
, cchString
);
34 RtlFreeUnicodeString(&StringU
);
48 _In_reads_(cchString
) LPCWSTR lpString
,
51 return NtGdiExtTextOutW(hdc
,
69 _In_reads_(cStrings
) const POLYTEXTA
*pptxt
,
72 for (; cStrings
>0; cStrings
--, pptxt
++)
98 _In_reads_(cStrings
) const POLYTEXTW
*pptxt
,
101 for (; cStrings
>0; cStrings
--, pptxt
++)
103 if (!ExtTextOutW(hdc
,
130 /* Get the DC attribute */
131 pdcattr
= GdiGetDcAttr(hdc
);
134 SetLastError(ERROR_INVALID_PARAMETER
);
138 if (pdcattr
->ulDirty_
& DIRTY_CHARSET
)
139 return LOWORD(NtGdiGetCharSet(hdc
));
141 return LOWORD(pdcattr
->iCS_CP
);
150 GetTextCharacterExtra(
155 /* Get the DC attribute */
156 pdcattr
= GdiGetDcAttr(hdc
);
159 /* Do not set LastError here! */
163 return pdcattr
->lTextExtra
;
175 /* MSDN docs say this is equivalent */
176 return NtGdiGetTextCharsetInfo(hdc
,NULL
,0);
187 _Out_ LPTEXTMETRICA lptm
)
191 if (!NtGdiGetTextMetricsW(hdc
, &tmwi
, sizeof(TMW_INTERNAL
)))
196 FONT_TextMetricWToA(&tmwi
.TextMetric
, lptm
);
208 _Out_ LPTEXTMETRICW lptm
)
212 if (!NtGdiGetTextMetricsW(hdc
, &tmwi
, sizeof(TMW_INTERNAL
)))
217 *lptm
= tmwi
.TextMetric
;
229 _In_reads_(cchString
) LPCSTR lpString
,
234 UNICODE_STRING StringU
;
237 RtlInitAnsiString(&StringA
, (LPSTR
)lpString
);
238 RtlAnsiStringToUnicodeString(&StringU
, &StringA
, TRUE
);
240 ret
= GetTextExtentPointW(hdc
, StringU
.Buffer
, cchString
, lpsz
);
242 RtlFreeUnicodeString(&StringU
);
255 _In_reads_(cchString
) LPCWSTR lpString
,
259 return NtGdiGetTextExtent(hdc
, (LPWSTR
)lpString
, cchString
, lpsz
, 0);
268 GetTextExtentExPointW(
270 _In_reads_(cchString
) LPCWSTR lpszString
,
273 _Out_opt_ LPINT lpnFit
,
274 _Out_writes_to_opt_(cchString
, *lpnFit
) LPINT lpnDx
,
278 /* Windows doesn't check nMaxExtent validity in unicode version */
281 DPRINT("nMaxExtent is invalid: %d\n", nMaxExtent
);
284 return NtGdiGetTextExtentExW (
285 hdc
, (LPWSTR
)lpszString
, cchString
, nMaxExtent
, (PULONG
)lpnFit
, (PULONG
)lpnDx
, lpSize
, 0 );
294 GetTextExtentExPointWPri(
296 _In_reads_(cwc
) LPWSTR lpwsz
,
299 _Out_opt_ ULONG
*pcCh
,
300 _Out_writes_to_opt_(cwc
, *pcCh
) PULONG pdxOut
,
303 return NtGdiGetTextExtentExW(hdc
, lpwsz
, cwc
, dxMax
, pcCh
, pdxOut
, psize
, 0);
311 GetTextExtentExPointA(
313 _In_reads_(cchString
) LPCSTR lpszStr
,
316 _Out_opt_ LPINT lpnFit
,
317 _Out_writes_to_opt_ (cchString
, *lpnFit
) LPINT lpnDx
,
322 BOOL bResult
= FALSE
;
326 SetLastError(ERROR_INVALID_PARAMETER
);
330 Status
= HEAP_strdupA2W(&lpszStrW
, lpszStr
);
331 if (!NT_SUCCESS (Status
))
333 SetLastError(RtlNtStatusToDosError(Status
));
337 bResult
= NtGdiGetTextExtentExW(hdc
,
357 GetTextExtentPoint32A(
359 _In_reads_(cchString
) LPCSTR lpString
,
364 UNICODE_STRING StringU
;
367 StringA
.Buffer
= (LPSTR
)lpString
;
368 StringA
.Length
= cchString
;
369 RtlAnsiStringToUnicodeString(&StringU
, &StringA
, TRUE
);
371 ret
= GetTextExtentPoint32W(hdc
, StringU
.Buffer
, cchString
, lpSize
);
373 RtlFreeUnicodeString(&StringU
);
384 GetTextExtentPoint32W(
386 _In_reads_(cchString
) LPCWSTR lpString
,
390 return NtGdiGetTextExtent(hdc
, (LPWSTR
)lpString
, cchString
, lpSize
, 0);
398 GetTextExtentExPointI(
400 _In_reads_(cgi
) LPWORD pgiIn
,
403 _Out_opt_ LPINT lpnFit
,
404 _Out_writes_to_opt_(cwchString
, *lpnFit
) LPINT lpnDx
,
407 return NtGdiGetTextExtentExW(hdc
,
424 _In_reads_(cgi
) LPWORD pgiIn
,
428 return NtGdiGetTextExtent(hdc
, pgiIn
, cgi
, lpSize
, GTEF_INDICES
);
441 _In_opt_
const RECT
*lprc
,
442 _In_reads_opt_(cch
) LPCSTR lpString
,
444 _In_reads_opt_(cch
) const INT
*lpDx
)
447 UNICODE_STRING StringU
;
450 RtlInitAnsiString(&StringA
, (LPSTR
)lpString
);
451 RtlAnsiStringToUnicodeString(&StringU
, &StringA
, TRUE
);
453 ret
= ExtTextOutW(hdc
, x
, y
, fuOptions
, lprc
, StringU
.Buffer
, cch
, lpDx
);
455 RtlFreeUnicodeString(&StringU
);
471 _In_opt_
const RECT
*lprc
,
472 _In_reads_opt_(cwc
) LPCWSTR lpString
,
474 _In_reads_opt_(cwc
) const INT
*lpDx
)
476 return NtGdiExtTextOutW(hdc
,
496 _Out_writes_to_opt_(cwcMax
, return) LPWSTR pFaceName
)
498 /* Validate parameters */
499 if (pFaceName
&& cwcMax
<= 0)
501 /* Set last error and return failure */
502 GdiSetLastError(ERROR_INVALID_PARAMETER
);
506 /* Forward to kernel */
507 return NtGdiGetTextFaceW(hdc
, cwcMax
, pFaceName
, FALSE
);
519 _Out_writes_to_opt_(cchMax
, return) LPSTR lpName
)
524 /* Validate parameters */
525 if (lpName
&& cchMax
<= 0)
527 /* Set last error and return failure */
528 GdiSetLastError(ERROR_INVALID_PARAMETER
);
532 res
= GetTextFaceW(hdc
, 0, NULL
);
533 nameW
= HeapAlloc( GetProcessHeap(), 0, res
* 2 );
539 GetTextFaceW( hdc
, res
, nameW
);
543 if (cchMax
&& !WideCharToMultiByte( CP_ACP
, 0, nameW
, -1, lpName
, cchMax
, NULL
, NULL
))
544 lpName
[cchMax
-1] = 0;
545 res
= strlen(lpName
);
549 res
= WideCharToMultiByte( CP_ACP
, 0, nameW
, -1, NULL
, 0, NULL
, NULL
);
552 HeapFree( GetProcessHeap(), 0, nameW
);
565 _Out_writes_to_opt_(cwcMax
, return) LPWSTR pszOut
)
567 if (pszOut
&& !cwcMax
)
569 GdiSetLastError(ERROR_INVALID_PARAMETER
);
573 return NtGdiGetTextFaceW(hdc
, cwcMax
, pszOut
, TRUE
);
579 GetFontResourceInfoW(
580 _In_z_ LPCWSTR lpFileName
,
581 _Inout_ DWORD
*pdwBufSize
,
582 _Out_writes_to_(*pdwBufSize
, *pdwBufSize
) PVOID lpBuffer
,
586 UNICODE_STRING NtFileName
;
588 if (!lpFileName
|| !pdwBufSize
|| !lpBuffer
)
590 SetLastError(ERROR_INVALID_PARAMETER
);
594 if (!RtlDosPathNameToNtPathName_U(lpFileName
,
599 SetLastError(ERROR_PATH_NOT_FOUND
);
603 bRet
= NtGdiGetFontResourceInfoInternalW(
605 (NtFileName
.Length
/ sizeof(WCHAR
)) + 1,
612 RtlFreeHeap(RtlGetProcessHeap(), 0, NtFileName
.Buffer
);
623 SetTextCharacterExtra(
630 if (nCharExtra
== 0x80000000)
632 SetLastError(ERROR_INVALID_PARAMETER
);
637 if (GDI_HANDLE_GET_TYPE(hdc
) == GDI_OBJECT_TYPE_METADC
)
639 return MFDRV_SetTextCharacterExtra( hdc
, nCharExtra
); // Wine port.
643 /* Get the DC attribute */
644 pdcattr
= GdiGetDcAttr(hdc
);
647 SetLastError(ERROR_INVALID_PARAMETER
);
651 if (NtCurrentTeb()->GdiTebBatch
.HDC
== hdc
)
653 if (pdcattr
->ulDirty_
& DC_FONTTEXT_DIRTY
)
655 NtGdiFlush(); // Sync up pdcattr from Kernel space.
656 pdcattr
->ulDirty_
&= ~(DC_MODE_DIRTY
|DC_FONTTEXT_DIRTY
);
660 nOldCharExtra
= pdcattr
->lTextExtra
;
661 pdcattr
->lTextExtra
= nCharExtra
;
662 return nOldCharExtra
;
676 /* Get the DC attribute */
677 pdcattr
= GdiGetDcAttr(hdc
);
680 /* Do not set LastError here! */
684 return pdcattr
->lTextAlign
;
699 /* Get the DC attribute */
700 pdcattr
= GdiGetDcAttr(hdc
);
703 /* Do not set LastError here! */
707 return pdcattr
->ulForegroundClr
;
723 /* Get the DC attribute */
724 pdcattr
= GdiGetDcAttr(hdc
);
727 SetLastError(ERROR_INVALID_PARAMETER
);
732 if (GDI_HANDLE_GET_TYPE(hDC
) != GDI_OBJECT_TYPE_DC
)
734 if (GDI_HANDLE_GET_TYPE(hDC
) == GDI_OBJECT_TYPE_METADC
)
735 return MFDRV_SetTextAlign( hdc
, fMode
)
738 PLDC pLDC
= pdcattr
->pvLDC
;
741 SetLastError(ERROR_INVALID_HANDLE
);
744 if (pLDC
->iType
== LDC_EMFLDC
)
746 if return EMFDRV_SetTextAlign( hdc
, fMode
)
752 fOldMode
= pdcattr
->lTextAlign
;
753 pdcattr
->lTextAlign
= fMode
; // Raw
754 if (pdcattr
->dwLayout
& LAYOUT_RTL
)
756 if ((fMode
& TA_CENTER
) != TA_CENTER
) fMode
^= TA_RIGHT
;
759 pdcattr
->flTextAlign
= fMode
& TA_MASK
;
771 _In_ COLORREF crColor
)
774 COLORREF crOldColor
= CLR_INVALID
;
776 /* Get the DC attribute */
777 pdcattr
= GdiGetDcAttr(hdc
);
780 SetLastError(ERROR_INVALID_PARAMETER
);
785 if (GDI_HANDLE_GET_TYPE(hDC
) != GDI_OBJECT_TYPE_DC
)
787 if (GDI_HANDLE_GET_TYPE(hDC
) == GDI_OBJECT_TYPE_METADC
)
788 return MFDRV_SetTextColor( hDC
, crColor
);
791 PLDC pLDC
= pdcattr
->pvLDC
;
794 SetLastError(ERROR_INVALID_HANDLE
);
797 if (pLDC
->iType
== LDC_EMFLDC
)
799 if return EMFDRV_SetTextColor( hDC
, crColor
);
805 crOldColor
= (COLORREF
) pdcattr
->ulForegroundClr
;
806 pdcattr
->ulForegroundClr
= (ULONG
)crColor
;
808 if (pdcattr
->crForegroundClr
!= crColor
)
810 pdcattr
->ulDirty_
|= (DIRTY_TEXT
|DIRTY_LINE
|DIRTY_FILL
);
811 pdcattr
->crForegroundClr
= crColor
;
822 SetTextJustification(
824 _In_ INT nBreakExtra
,
825 _In_ INT nBreakCount
)
829 /* Get the DC attribute */
830 pdcattr
= GdiGetDcAttr(hdc
);
833 /* Do not set LastError here! */
838 if (GDI_HANDLE_GET_TYPE(hDC
) != GDI_OBJECT_TYPE_DC
)
840 if (GDI_HANDLE_GET_TYPE(hDC
) == GDI_OBJECT_TYPE_METADC
)
841 return MFDRV_SetTextJustification( hdc
, nBreakExtra
, nBreakCount
)
844 SetLastError(ERROR_INVALID_HANDLE
);
849 if (NtCurrentTeb()->GdiTebBatch
.HDC
== hdc
)
851 if (pdcattr
->ulDirty_
& DC_FONTTEXT_DIRTY
)
853 NtGdiFlush(); // Sync up pdcattr from Kernel space.
854 pdcattr
->ulDirty_
&= ~(DC_MODE_DIRTY
|DC_FONTTEXT_DIRTY
);
858 pdcattr
->cBreak
= nBreakCount
;
859 pdcattr
->lBreakExtra
= nBreakExtra
;
873 _Out_writes_(cj
) BYTE
*lpSB
)
885 Status
= HEAP_strdupA2W(&pwsz
, psz
);
886 if (!NT_SUCCESS(Status
))
888 SetLastError (RtlNtStatusToDosError(Status
));
892 uResult
= NtGdiGetStringBitmapW(hdc
, pwsz
, 1, lpSB
, cj
);
910 _Out_writes_(cj
) BYTE
*lpSB
)
917 return NtGdiGetStringBitmapW(hdc
, pwsz
, 1, lpSB
, cj
);
928 _Out_ EXTTEXTMETRIC
*petm
)
932 bResult
= NtGdiGetETM(hdc
, petm
);
936 petm
->emKernPairs
= (WORD
)GetKerningPairsA(hdc
, 0, 0);