18 UNICODE_STRING StringU
;
23 RtlInitAnsiString(&StringA
, (LPSTR
)lpString
);
24 RtlAnsiStringToUnicodeString(&StringU
, &StringA
, TRUE
);
26 StringU
.Buffer
= NULL
;
28 ret
= TextOutW(hdc
, nXStart
, nYStart
, StringU
.Buffer
, cbString
);
29 RtlFreeUnicodeString(&StringU
);
46 return NtGdiExtTextOutW(hdc
, nXStart
, nYStart
, 0, NULL
, (LPWSTR
)lpString
, cbString
, NULL
, 0);
55 GdiGetCodePage(HDC hdc
)
58 if (!GdiGetHandleUserData((HGDIOBJ
) hdc
, GDI_OBJECT_TYPE_DC
, (PVOID
) &Dc_Attr
)) return 0;
59 if (Dc_Attr
->ulDirty_
& DIRTY_CHARSET
) return LOWORD(NtGdiGetCharSet(hdc
));
60 return LOWORD(Dc_Attr
->iCS_CP
);
69 GetTextCharacterExtra(
75 if (!GdiGetHandleUserData((HGDIOBJ
) hDc
, GDI_OBJECT_TYPE_DC
, (PVOID
) &Dc_Attr
)) return 0;
76 return Dc_Attr
->lTextExtra
;
77 // return GetDCDWord( hDc, GdiGetTextCharExtra, 0);
86 GetTextCharset(HDC hdc
)
88 /* MSDN docs say this is equivalent */
89 return NtGdiGetTextCharsetInfo(hdc
,NULL
,0);
107 if (! NtGdiGetTextMetricsW(hdc
, &tmwi
, sizeof(TMW_INTERNAL
)))
112 return TextMetricW2A(lptm
, &tmwi
.TextMetric
);
128 if (! NtGdiGetTextMetricsW(hdc
, &tmwi
, sizeof(TMW_INTERNAL
)))
133 *lptm
= tmwi
.TextMetric
;
151 UNICODE_STRING StringU
;
154 RtlInitAnsiString(&StringA
, (LPSTR
)lpString
);
155 RtlAnsiStringToUnicodeString(&StringU
, &StringA
, TRUE
);
157 ret
= GetTextExtentPointW(hdc
, StringU
.Buffer
, cbString
, lpSize
);
159 RtlFreeUnicodeString(&StringU
);
177 return NtGdiGetTextExtent(hdc
, (LPWSTR
)lpString
, cbString
, lpSize
, 0);
186 GetTextExtentExPointW(
196 return NtGdiGetTextExtentExW (
197 hdc
, (LPWSTR
)lpszStr
, cchString
, nMaxExtent
, (PULONG
)lpnFit
, (PULONG
)alpDx
, lpSize
, 0 );
206 GetTextExtentExPointA(
220 Status
= HEAP_strdupA2W ( &lpszStrW
, lpszStr
);
221 if (!NT_SUCCESS (Status
))
222 SetLastError (RtlNtStatusToDosError(Status
));
225 rc
= NtGdiGetTextExtentExW (
226 hdc
, lpszStrW
, cchString
, nMaxExtent
, (PULONG
)lpnFit
, (PULONG
)alpDx
, lpSize
, 0 );
228 HEAP_free ( lpszStrW
);
240 GetTextExtentPoint32A(
248 UNICODE_STRING StringU
;
251 RtlInitAnsiString(&StringA
, (LPSTR
)lpString
);
252 RtlAnsiStringToUnicodeString(&StringU
, &StringA
, TRUE
);
254 ret
= GetTextExtentPoint32W(hdc
, StringU
.Buffer
, cbString
, lpSize
);
256 RtlFreeUnicodeString(&StringU
);
267 GetTextExtentPoint32W(
274 return NtGdiGetTextExtent(hdc
, (LPWSTR
)lpString
, cbString
, lpSize
, 0);
282 GetTextExtentExPointI(HDC hdc
,
290 return NtGdiGetTextExtentExW(hdc
,pgiIn
,cgi
,nMaxExtent
,(ULONG
*)lpnFit
, (PULONG
) alpDx
,lpSize
,1);
298 GetTextExtentPointI(HDC hdc
,
303 return NtGdiGetTextExtent(hdc
,pgiIn
,cgi
,lpSize
,2);
323 UNICODE_STRING StringU
;
326 RtlInitAnsiString(&StringA
, (LPSTR
)lpString
);
327 RtlAnsiStringToUnicodeString(&StringU
, &StringA
, TRUE
);
329 ret
= ExtTextOutW(hdc
, X
, Y
, fuOptions
, lprc
, StringU
.Buffer
, cbCount
, lpDx
);
331 RtlFreeUnicodeString(&StringU
);
353 return NtGdiExtTextOutW(hdc
, X
, Y
, fuOptions
, (LPRECT
)lprc
, (LPWSTR
)lpString
, cbCount
, (LPINT
)lpDx
, 0);
362 GetTextFaceW(HDC hDC
,
367 if ((!lpFaceName
) || (nCount
))
369 retValue
= NtGdiGetTextFaceW(hDC
,nCount
,lpFaceName
,0);
373 SetLastError(ERROR_INVALID_PARAMETER
);
384 GetTextFaceA( HDC hdc
, INT count
, LPSTR name
)
386 INT res
= GetTextFaceW(hdc
, 0, NULL
);
387 LPWSTR nameW
= HeapAlloc( GetProcessHeap(), 0, res
* 2 );
388 GetTextFaceW( hdc
, res
, nameW
);
392 if (count
&& !WideCharToMultiByte( CP_ACP
, 0, nameW
, -1, name
, count
, NULL
, NULL
))
397 res
= WideCharToMultiByte( CP_ACP
, 0, nameW
, -1, NULL
, 0, NULL
, NULL
);
398 HeapFree( GetProcessHeap(), 0, nameW
);
404 GetFontResourceInfoW(
412 UNICODE_STRING NtFileName
;
414 if (!lpFileName
|| !pdwBufSize
|| !lpBuffer
)
416 SetLastError(ERROR_INVALID_PARAMETER
);
420 if (!RtlDosPathNameToNtPathName_U(lpFileName
,
425 SetLastError(ERROR_PATH_NOT_FOUND
);
429 bRet
= NtGdiGetFontResourceInfoInternalW(
438 RtlFreeHeap(RtlGetProcessHeap(), 0, NtFileName
.Buffer
);
454 SetTextCharacterExtra(
459 INT cExtra
= 0x80000000;
462 if (CharExtra
== cExtra
)
464 SetLastError(ERROR_INVALID_PARAMETER
);
468 if (GDI_HANDLE_GET_TYPE(hDC
) == GDI_OBJECT_TYPE_METADC
)
470 return MFDRV_SetTextCharacterExtra( hDC
, CharExtra
); // Wine port.
473 if (!GdiGetHandleUserData((HGDIOBJ
) hDC
, GDI_OBJECT_TYPE_DC
, (PVOID
) &Dc_Attr
)) return cExtra
;
475 if (NtCurrentTeb()->GdiTebBatch
.HDC
== (ULONG
)hDC
)
477 if (Dc_Attr
->ulDirty_
& DC_FONTTEXT_DIRTY
)
479 NtGdiFlush(); // Sync up Dc_Attr from Kernel space.
480 Dc_Attr
->ulDirty_
&= ~(DC_MODE_DIRTY
|DC_FONTTEXT_DIRTY
);
483 cExtra
= Dc_Attr
->lTextExtra
;
484 Dc_Attr
->lTextExtra
= CharExtra
;
486 // return GetAndSetDCDWord( hDC, GdiGetSetTextCharExtra, CharExtra, 0, 0, 0 );
495 GetTextAlign(HDC hdc
)
498 if (!GdiGetHandleUserData((HGDIOBJ
) hdc
, GDI_OBJECT_TYPE_DC
, (PVOID
) &Dc_Attr
)) return 0;
499 return Dc_Attr
->lTextAlign
;
509 GetTextColor(HDC hdc
)
512 if (!GdiGetHandleUserData((HGDIOBJ
) hdc
, GDI_OBJECT_TYPE_DC
, (PVOID
) &Dc_Attr
)) return 0;
513 return Dc_Attr
->ulForegroundClr
;
523 SetTextAlign(HDC hdc
,
529 if (GDI_HANDLE_GET_TYPE(hDC
) != GDI_OBJECT_TYPE_DC
)
531 if (GDI_HANDLE_GET_TYPE(hDC
) == GDI_OBJECT_TYPE_METADC
)
532 return MFDRV_SetTextAlign( hdc
, fMode
)
535 PLDC pLDC
= Dc_Attr
->pvLDC
;
538 SetLastError(ERROR_INVALID_HANDLE
);
541 if (pLDC
->iType
== LDC_EMFLDC
)
543 if return EMFDRV_SetTextAlign( hdc
, fMode
)
548 if (!GdiGetHandleUserData((HGDIOBJ
) hdc
, GDI_OBJECT_TYPE_DC
, (PVOID
) &Dc_Attr
)) return OldMode
;
550 OldMode
= Dc_Attr
->lTextAlign
;
551 Dc_Attr
->lTextAlign
= fMode
; // Raw
552 if (Dc_Attr
->dwLayout
& LAYOUT_RTL
)
554 if(!(fMode
& TA_CENTER
)) fMode
|= TA_RIGHT
;
556 Dc_Attr
->flTextAlign
= fMode
& (TA_BASELINE
|TA_UPDATECP
|TA_CENTER
);
573 COLORREF OldColor
= CLR_INVALID
;
575 if (GDI_HANDLE_GET_TYPE(hDC
) != GDI_OBJECT_TYPE_DC
)
577 if (GDI_HANDLE_GET_TYPE(hDC
) == GDI_OBJECT_TYPE_METADC
)
578 return MFDRV_SetTextColor( hDC
, crColor
);
581 PLDC pLDC
= Dc_Attr
->pvLDC
;
584 SetLastError(ERROR_INVALID_HANDLE
);
587 if (pLDC
->iType
== LDC_EMFLDC
)
589 if return EMFDRV_SetTextColor( hDC
, crColor
);
594 if (!GdiGetHandleUserData((HGDIOBJ
) hdc
, GDI_OBJECT_TYPE_DC
, (PVOID
) &Dc_Attr
)) return OldColor
;
596 OldColor
= (COLORREF
) Dc_Attr
->ulForegroundClr
;
597 Dc_Attr
->ulForegroundClr
= (ULONG
) crColor
;
599 if ( Dc_Attr
->crForegroundClr
!= crColor
)
601 Dc_Attr
->ulDirty_
|= DIRTY_TEXT
;
602 Dc_Attr
->crForegroundClr
= crColor
;
612 SetTextJustification(
620 if (GDI_HANDLE_GET_TYPE(hDC
) != GDI_OBJECT_TYPE_DC
)
622 if (GDI_HANDLE_GET_TYPE(hDC
) == GDI_OBJECT_TYPE_METADC
)
623 return MFDRV_SetTextJustification( hdc
, extra
, breaks
)
626 SetLastError(ERROR_INVALID_HANDLE
);
630 if (!GdiGetHandleUserData((HGDIOBJ
) hdc
, GDI_OBJECT_TYPE_DC
, (PVOID
) &Dc_Attr
)) return FALSE
;
632 if (NtCurrentTeb()->GdiTebBatch
.HDC
== (ULONG
)hdc
)
634 if (Dc_Attr
->ulDirty_
& DC_FONTTEXT_DIRTY
)
636 NtGdiFlush(); // Sync up Dc_Attr from Kernel space.
637 Dc_Attr
->ulDirty_
&= ~(DC_MODE_DIRTY
|DC_FONTTEXT_DIRTY
);
640 Dc_Attr
->cBreak
= breaks
;
641 Dc_Attr
->lBreakExtra
= extra
;