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 PolyTextOutA( HDC hdc
, const POLYTEXTA
*pptxt
, INT cStrings
)
59 for (; cStrings
>0; cStrings
--, pptxt
++)
60 if (!ExtTextOutA( hdc
, pptxt
->x
, pptxt
->y
, pptxt
->uiFlags
, &pptxt
->rcl
, pptxt
->lpstr
, pptxt
->n
, pptxt
->pdx
))
71 PolyTextOutW( HDC hdc
, const POLYTEXTW
*pptxt
, INT cStrings
)
73 for (; cStrings
>0; cStrings
--, pptxt
++)
74 if (!ExtTextOutW( hdc
, pptxt
->x
, pptxt
->y
, pptxt
->uiFlags
, &pptxt
->rcl
, pptxt
->lpstr
, pptxt
->n
, pptxt
->pdx
))
85 GdiGetCodePage(HDC hdc
)
88 if (!GdiGetHandleUserData((HGDIOBJ
) hdc
, GDI_OBJECT_TYPE_DC
, (PVOID
) &Dc_Attr
)) return 0;
89 if (Dc_Attr
->ulDirty_
& DIRTY_CHARSET
) return LOWORD(NtGdiGetCharSet(hdc
));
90 return LOWORD(Dc_Attr
->iCS_CP
);
99 GetTextCharacterExtra(
105 if (!GdiGetHandleUserData((HGDIOBJ
) hDc
, GDI_OBJECT_TYPE_DC
, (PVOID
) &Dc_Attr
)) return 0;
106 return Dc_Attr
->lTextExtra
;
107 // return GetDCDWord( hDc, GdiGetTextCharExtra, 0);
116 GetTextCharset(HDC hdc
)
118 /* MSDN docs say this is equivalent */
119 return NtGdiGetTextCharsetInfo(hdc
,NULL
,0);
136 if (! NtGdiGetTextMetricsW(hdc
, &tmwi
, sizeof(TMW_INTERNAL
)))
141 FONT_TextMetricWToA(&tmwi
.TextMetric
, lptm
);
158 if (! NtGdiGetTextMetricsW(hdc
, &tmwi
, sizeof(TMW_INTERNAL
)))
163 *lptm
= tmwi
.TextMetric
;
181 UNICODE_STRING StringU
;
184 RtlInitAnsiString(&StringA
, (LPSTR
)lpString
);
185 RtlAnsiStringToUnicodeString(&StringU
, &StringA
, TRUE
);
187 ret
= GetTextExtentPointW(hdc
, StringU
.Buffer
, cchString
, lpSize
);
189 RtlFreeUnicodeString(&StringU
);
207 return NtGdiGetTextExtent(hdc
, (LPWSTR
)lpString
, cchString
, lpSize
, 0);
216 GetTextExtentExPointW(
227 /* Windows doesn't check nMaxExtent validity in unicode version */
229 DPRINT("nMaxExtent is invalid: %d\n", nMaxExtent
);
231 return NtGdiGetTextExtentExW (
232 hdc
, (LPWSTR
)lpszStr
, cchString
, nMaxExtent
, (PULONG
)lpnFit
, (PULONG
)alpDx
, lpSize
, 0 );
241 GetTextExtentExPointWPri(HDC hdc
,
249 return NtGdiGetTextExtentExW(hdc
,lpwsz
,cwc
,dxMax
,pcCh
,pdxOut
,psize
,0);
257 GetTextExtentExPointA(
273 SetLastError(ERROR_INVALID_PARAMETER
);
277 Status
= HEAP_strdupA2W ( &lpszStrW
, lpszStr
);
278 if (!NT_SUCCESS (Status
))
279 SetLastError (RtlNtStatusToDosError(Status
));
282 rc
= NtGdiGetTextExtentExW (
283 hdc
, lpszStrW
, cchString
, nMaxExtent
, (PULONG
)lpnFit
, (PULONG
)alpDx
, lpSize
, 0 );
285 HEAP_free ( lpszStrW
);
297 GetTextExtentPoint32A(
305 UNICODE_STRING StringU
;
308 StringA
.Buffer
= (LPSTR
)lpString
;
309 StringA
.Length
= cchString
;
310 RtlAnsiStringToUnicodeString(&StringU
, &StringA
, TRUE
);
312 ret
= GetTextExtentPoint32W(hdc
, StringU
.Buffer
, cchString
, lpSize
);
314 RtlFreeUnicodeString(&StringU
);
325 GetTextExtentPoint32W(
332 return NtGdiGetTextExtent(hdc
, (LPWSTR
)lpString
, cchString
, lpSize
, 0);
340 GetTextExtentExPointI(HDC hdc
,
348 return NtGdiGetTextExtentExW(hdc
,pgiIn
,cgi
,nMaxExtent
,(ULONG
*)lpnFit
, (PULONG
) alpDx
,lpSize
,GTEF_INDICES
);
356 GetTextExtentPointI(HDC hdc
,
361 return NtGdiGetTextExtent(hdc
,pgiIn
,cgi
,lpSize
,GTEF_INDICES
);
381 UNICODE_STRING StringU
;
384 RtlInitAnsiString(&StringA
, (LPSTR
)lpString
);
385 RtlAnsiStringToUnicodeString(&StringU
, &StringA
, TRUE
);
387 ret
= ExtTextOutW(hdc
, X
, Y
, fuOptions
, lprc
, StringU
.Buffer
, cchString
, lpDx
);
389 RtlFreeUnicodeString(&StringU
);
411 return NtGdiExtTextOutW(hdc
, X
, Y
, fuOptions
, (LPRECT
)lprc
, (LPWSTR
)lpString
, cchString
, (LPINT
)lpDx
, 0);
420 GetTextFaceW(HDC hDC
,
424 /* Validate parameters */
425 if (pFaceName
&& nCount
<= 0)
427 /* Set last error and return failure */
428 GdiSetLastError(ERROR_INVALID_PARAMETER
);
432 /* Forward to kernel */
433 return NtGdiGetTextFaceW(hDC
, nCount
, pFaceName
, FALSE
);
442 GetTextFaceA( HDC hdc
, INT count
, LPSTR name
)
447 /* Validate parameters */
448 if (name
&& count
<= 0)
450 /* Set last error and return failure */
451 GdiSetLastError(ERROR_INVALID_PARAMETER
);
455 res
= GetTextFaceW(hdc
, 0, NULL
);
456 nameW
= HeapAlloc( GetProcessHeap(), 0, res
* 2 );
461 GetTextFaceW( hdc
, res
, nameW
);
465 if (count
&& !WideCharToMultiByte( CP_ACP
, 0, nameW
, -1, name
, count
, NULL
, NULL
))
470 res
= WideCharToMultiByte( CP_ACP
, 0, nameW
, -1, NULL
, 0, NULL
, NULL
);
471 HeapFree( GetProcessHeap(), 0, nameW
);
481 GetTextFaceAliasW(HDC hdc
,
485 if ( pszOut
&& !cChar
)
487 GdiSetLastError(ERROR_INVALID_PARAMETER
);
490 return NtGdiGetTextFaceW(hdc
,cChar
,pszOut
,TRUE
);
496 GetFontResourceInfoW(
504 UNICODE_STRING NtFileName
;
506 if (!lpFileName
|| !pdwBufSize
|| !lpBuffer
)
508 SetLastError(ERROR_INVALID_PARAMETER
);
512 if (!RtlDosPathNameToNtPathName_U(lpFileName
,
517 SetLastError(ERROR_PATH_NOT_FOUND
);
521 bRet
= NtGdiGetFontResourceInfoInternalW(
523 (NtFileName
.Length
/ sizeof(WCHAR
)) + 1,
530 RtlFreeHeap(RtlGetProcessHeap(), 0, NtFileName
.Buffer
);
546 SetTextCharacterExtra(
551 INT cExtra
= 0x80000000;
554 if (CharExtra
== cExtra
)
556 SetLastError(ERROR_INVALID_PARAMETER
);
560 if (GDI_HANDLE_GET_TYPE(hDC
) == GDI_OBJECT_TYPE_METADC
)
562 return MFDRV_SetTextCharacterExtra( hDC
, CharExtra
); // Wine port.
565 if (!GdiGetHandleUserData((HGDIOBJ
) hDC
, GDI_OBJECT_TYPE_DC
, (PVOID
) &Dc_Attr
)) return cExtra
;
567 if (NtCurrentTeb()->GdiTebBatch
.HDC
== hDC
)
569 if (Dc_Attr
->ulDirty_
& DC_FONTTEXT_DIRTY
)
571 NtGdiFlush(); // Sync up Dc_Attr from Kernel space.
572 Dc_Attr
->ulDirty_
&= ~(DC_MODE_DIRTY
|DC_FONTTEXT_DIRTY
);
575 cExtra
= Dc_Attr
->lTextExtra
;
576 Dc_Attr
->lTextExtra
= CharExtra
;
578 // return GetAndSetDCDWord( hDC, GdiGetSetTextCharExtra, CharExtra, 0, 0, 0 );
587 GetTextAlign(HDC hdc
)
590 if (!GdiGetHandleUserData((HGDIOBJ
) hdc
, GDI_OBJECT_TYPE_DC
, (PVOID
) &Dc_Attr
)) return 0;
591 return Dc_Attr
->lTextAlign
;
601 GetTextColor(HDC hdc
)
604 if (!GdiGetHandleUserData((HGDIOBJ
) hdc
, GDI_OBJECT_TYPE_DC
, (PVOID
) &Dc_Attr
)) return 0;
605 return Dc_Attr
->ulForegroundClr
;
615 SetTextAlign(HDC hdc
,
621 if (GDI_HANDLE_GET_TYPE(hDC
) != GDI_OBJECT_TYPE_DC
)
623 if (GDI_HANDLE_GET_TYPE(hDC
) == GDI_OBJECT_TYPE_METADC
)
624 return MFDRV_SetTextAlign( hdc
, fMode
)
627 PLDC pLDC
= Dc_Attr
->pvLDC
;
630 SetLastError(ERROR_INVALID_HANDLE
);
633 if (pLDC
->iType
== LDC_EMFLDC
)
635 if return EMFDRV_SetTextAlign( hdc
, fMode
)
640 if (!GdiGetHandleUserData((HGDIOBJ
) hdc
, GDI_OBJECT_TYPE_DC
, (PVOID
) &Dc_Attr
)) return GDI_ERROR
;
642 OldMode
= Dc_Attr
->lTextAlign
;
643 Dc_Attr
->lTextAlign
= fMode
; // Raw
644 if (Dc_Attr
->dwLayout
& LAYOUT_RTL
)
646 if ((fMode
& TA_CENTER
) != TA_CENTER
) fMode
^= TA_RIGHT
;
648 Dc_Attr
->flTextAlign
= fMode
& TA_MASK
;
664 COLORREF OldColor
= CLR_INVALID
;
666 if (GDI_HANDLE_GET_TYPE(hDC
) != GDI_OBJECT_TYPE_DC
)
668 if (GDI_HANDLE_GET_TYPE(hDC
) == GDI_OBJECT_TYPE_METADC
)
669 return MFDRV_SetTextColor( hDC
, crColor
);
672 PLDC pLDC
= Dc_Attr
->pvLDC
;
675 SetLastError(ERROR_INVALID_HANDLE
);
678 if (pLDC
->iType
== LDC_EMFLDC
)
680 if return EMFDRV_SetTextColor( hDC
, crColor
);
685 if (!GdiGetHandleUserData((HGDIOBJ
) hdc
, GDI_OBJECT_TYPE_DC
, (PVOID
) &Dc_Attr
)) return OldColor
;
687 OldColor
= (COLORREF
) Dc_Attr
->ulForegroundClr
;
688 Dc_Attr
->ulForegroundClr
= (ULONG
) crColor
;
690 if ( Dc_Attr
->crForegroundClr
!= crColor
)
692 Dc_Attr
->ulDirty_
|= (DIRTY_TEXT
|DIRTY_LINE
|DIRTY_FILL
);
693 Dc_Attr
->crForegroundClr
= crColor
;
703 SetTextJustification(
711 if (GDI_HANDLE_GET_TYPE(hDC
) != GDI_OBJECT_TYPE_DC
)
713 if (GDI_HANDLE_GET_TYPE(hDC
) == GDI_OBJECT_TYPE_METADC
)
714 return MFDRV_SetTextJustification( hdc
, extra
, breaks
)
717 SetLastError(ERROR_INVALID_HANDLE
);
721 if (!GdiGetHandleUserData((HGDIOBJ
) hdc
, GDI_OBJECT_TYPE_DC
, (PVOID
) &Dc_Attr
)) return FALSE
;
723 if (NtCurrentTeb()->GdiTebBatch
.HDC
== hdc
)
725 if (Dc_Attr
->ulDirty_
& DC_FONTTEXT_DIRTY
)
727 NtGdiFlush(); // Sync up Dc_Attr from Kernel space.
728 Dc_Attr
->ulDirty_
&= ~(DC_MODE_DIRTY
|DC_FONTTEXT_DIRTY
);
731 Dc_Attr
->cBreak
= breaks
;
732 Dc_Attr
->lBreakExtra
= extra
;
741 GetStringBitmapA(HDC hdc
,
754 Status
= HEAP_strdupA2W ( &pwsz
, psz
);
755 if ( !NT_SUCCESS (Status
) )
757 SetLastError (RtlNtStatusToDosError(Status
));
761 retValue
= NtGdiGetStringBitmapW(hdc
, pwsz
, 1, lpSB
, cj
);
775 GetStringBitmapW(HDC hdc
,
785 retValue
= NtGdiGetStringBitmapW(hdc
, pwsz
, 1, lpSB
, cj
);
800 BOOL Ret
= NtGdiGetETM(hdc
, petm
);
803 petm
->emKernPairs
= (WORD
)GetKerningPairsA(hdc
, 0, 0);