ReactOS  0.4.15-dev-3193-g74513a7
text.c File Reference
#include <precomp.h>
#include <debug.h>
Include dependency graph for text.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

BOOL WINAPI TextOutA (_In_ HDC hdc, _In_ INT nXStart, _In_ INT nYStart, _In_reads_(cchString) LPCSTR lpString, _In_ INT cchString)
 
BOOL WINAPI TextOutW (_In_ HDC hdc, _In_ INT nXStart, _In_ INT nYStart, _In_reads_(cchString) LPCWSTR lpString, _In_ INT cchString)
 
BOOL WINAPI PolyTextOutA (_In_ HDC hdc, _In_reads_(cStrings) const POLYTEXTA *pptxt, _In_ INT cStrings)
 
BOOL WINAPI PolyTextOutW (_In_ HDC hdc, _In_reads_(cStrings) const POLYTEXTW *pptxt, _In_ INT cStrings)
 
DWORD WINAPI GdiGetCodePage (_In_ HDC hdc)
 
INT WINAPI GetTextCharacterExtra (_In_ HDC hdc)
 
INT WINAPI GetTextCharset (_In_ HDC hdc)
 
BOOL WINAPI GetTextMetricsA (_In_ HDC hdc, _Out_ LPTEXTMETRICA lptm)
 
BOOL WINAPI GetTextMetricsW (_In_ HDC hdc, _Out_ LPTEXTMETRICW lptm)
 
BOOL APIENTRY GetTextExtentPointA (_In_ HDC hdc, _In_reads_(cchString) LPCSTR lpString, _In_ INT cchString, _Out_ LPSIZE lpsz)
 
BOOL APIENTRY GetTextExtentPointW (_In_ HDC hdc, _In_reads_(cchString) LPCWSTR lpString, _In_ INT cchString, _Out_ LPSIZE lpsz)
 
BOOL WINAPI GetTextExtentExPointW (_In_ HDC hdc, _In_reads_(cchString) LPCWSTR lpszString, _In_ INT cchString, _In_ INT nMaxExtent, _Out_opt_ LPINT lpnFit, _Out_writes_to_opt_(cchString, *lpnFit) LPINT lpnDx, _Out_ LPSIZE lpSize)
 
BOOL WINAPI GetTextExtentExPointWPri (_In_ HDC hdc, _In_reads_(cwc) LPCWSTR lpwsz, _In_ INT cwc, _In_ INT dxMax, _Out_opt_ LPINT pcCh, _Out_writes_to_opt_(cwc, *pcCh) LPINT pdxOut, _In_ LPSIZE psize)
 
BOOL WINAPI GetTextExtentExPointA (_In_ HDC hdc, _In_reads_(cchString) LPCSTR lpszStr, _In_ INT cchString, _In_ INT nMaxExtent, _Out_opt_ LPINT lpnFit, _Out_writes_to_opt_(cchString, *lpnFit) LPINT lpnDx, _Out_ LPSIZE lpSize)
 
BOOL WINAPI GetTextExtentPoint32A (_In_ HDC hdc, _In_reads_(cchString) LPCSTR lpString, _In_ INT cchString, _Out_ LPSIZE lpSize)
 
BOOL WINAPI GetTextExtentPoint32W (_In_ HDC hdc, _In_reads_(cchString) LPCWSTR lpString, _In_ int cchString, _Out_ LPSIZE lpSize)
 
BOOL WINAPI GetTextExtentExPointI (_In_ HDC hdc, _In_reads_(cgi) LPWORD pgiIn, _In_ INT cgi, _In_ INT nMaxExtent, _Out_opt_ LPINT lpnFit, _Out_writes_to_opt_(cwchString, *lpnFit) LPINT lpnDx, _Out_ LPSIZE lpSize)
 
BOOL WINAPI GetTextExtentPointI (_In_ HDC hdc, _In_reads_(cgi) LPWORD pgiIn, _In_ int cgi, _Out_ LPSIZE lpSize)
 
BOOL WINAPI ExtTextOutA (_In_ HDC hdc, _In_ INT x, _In_ INT y, _In_ UINT fuOptions, _In_opt_ const RECT *lprc, _In_reads_opt_(cch) LPCSTR lpString, _In_ UINT cch, _In_reads_opt_(cch) const INT *lpDx)
 
BOOL WINAPI ExtTextOutW (_In_ HDC hdc, _In_ INT x, _In_ INT y, _In_ UINT fuOptions, _In_opt_ const RECT *lprc, _In_reads_opt_(cwc) LPCWSTR lpString, _In_ UINT cwc, _In_reads_opt_(cwc) const INT *lpDx)
 
INT WINAPI GetTextFaceW (_In_ HDC hdc, _In_ INT cwcMax, _Out_writes_to_opt_(cwcMax, return) LPWSTR pFaceName)
 
INT WINAPI GetTextFaceA (_In_ HDC hdc, _In_ INT cchMax, _Out_writes_to_opt_(cchMax, return) LPSTR lpName)
 
INT WINAPI GetTextFaceAliasW (_In_ HDC hdc, _In_ INT cwcMax, _Out_writes_to_opt_(cwcMax, return) LPWSTR pszOut)
 
BOOL WINAPI GetFontResourceInfoW (_In_z_ LPCWSTR lpFileName, _Inout_ DWORD *pdwBufSize, _Out_writes_to_opt_(*pdwBufSize, 1) PVOID lpBuffer, _In_ DWORD dwType)
 
INT WINAPI SetTextCharacterExtra (_In_ HDC hdc, _In_ INT nCharExtra)
 
UINT WINAPI GetTextAlign (_In_ HDC hdc)
 
COLORREF WINAPI GetTextColor (_In_ HDC hdc)
 
UINT WINAPI SetTextAlign (_In_ HDC hdc, _In_ UINT fMode)
 
COLORREF WINAPI SetTextColor (_In_ HDC hdc, _In_ COLORREF crColor)
 
BOOL WINAPI SetTextJustification (_In_ HDC hdc, _In_ INT nBreakExtra, _In_ INT nBreakCount)
 
UINT WINAPI GetStringBitmapA (_In_ HDC hdc, _In_ LPSTR psz, _In_ BOOL bDoCall, _In_ UINT cj, _Out_writes_(cj) BYTE *lpSB)
 
UINT WINAPI GetStringBitmapW (_In_ HDC hdc, _In_ LPWSTR pwsz, _In_ BOOL bDoCall, _In_ UINT cj, _Out_writes_(cj) BYTE *lpSB)
 
BOOL WINAPI GetETM (_In_ HDC hdc, _Out_ EXTTEXTMETRIC *petm)
 

Variables

static BOOL bBypassETOWMF = FALSE
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 11 of file text.c.

Function Documentation

◆ ExtTextOutA()

BOOL WINAPI ExtTextOutA ( _In_ HDC  hdc,
_In_ INT  x,
_In_ INT  y,
_In_ UINT  fuOptions,
_In_opt_ const RECT lprc,
_In_reads_opt_(cch) LPCSTR  lpString,
_In_ UINT  cch,
_In_reads_opt_(cch) const INT lpDx 
)

Definition at line 454 of file text.c.

463 {
464  ANSI_STRING StringA;
465  UNICODE_STRING StringU;
466  BOOL ret;
467 
468  RtlInitAnsiString(&StringA, (LPSTR)lpString);
469  RtlAnsiStringToUnicodeString(&StringU, &StringA, TRUE);
470 
471  ret = ExtTextOutW(hdc, x, y, fuOptions, lprc, StringU.Buffer, cch, lpDx);
472 
473  RtlFreeUnicodeString(&StringU);
474 
475  return ret;
476 }
_In_ int _Inout_ LPRECT lprc
Definition: winuser.h:4441
#define TRUE
Definition: types.h:120
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
char * LPSTR
Definition: xmlstorage.h:182
NTSYSAPI VOID NTAPI RtlInitAnsiString(PANSI_STRING DestinationString, PCSZ SourceString)
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL WINAPI ExtTextOutW(_In_ HDC hdc, _In_ INT x, _In_ INT y, _In_ UINT fuOptions, _In_opt_ const RECT *lprc, _In_reads_opt_(cwc) LPCWSTR lpString, _In_ UINT cwc, _In_reads_opt_(cwc) const INT *lpDx)
Definition: text.c:485
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
int ret
HDC hdc
Definition: main.c:9
NTSYSAPI NTSTATUS NTAPI RtlAnsiStringToUnicodeString(PUNICODE_STRING DestinationString, PANSI_STRING SourceString, BOOLEAN AllocateDestinationString)
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
IN PCTCH IN DWORD cch
Definition: pager.h:36

Referenced by PolyTextOutA().

◆ ExtTextOutW()

BOOL WINAPI ExtTextOutW ( _In_ HDC  hdc,
_In_ INT  x,
_In_ INT  y,
_In_ UINT  fuOptions,
_In_opt_ const RECT lprc,
_In_reads_opt_(cwc) LPCWSTR  lpString,
_In_ UINT  cwc,
_In_reads_opt_(cwc) const INT lpDx 
)

Definition at line 485 of file text.c.

494 {
495  PDC_ATTR pdcattr;
496 
497  if ( !bBypassETOWMF )
498  {
500  ExtTextOut,
501  FALSE,
502  hdc,
503  x,
504  y,
505  fuOptions,
506  lprc,
507  lpString,
508  cwc,
509  lpDx);
510  }
511 
512  if ( GdiConvertAndCheckDC(hdc) == NULL ) return FALSE;
513 
514  if (!(fuOptions & (ETO_GLYPH_INDEX | ETO_IGNORELANGUAGE)))
515  {
517 
518  if (LoadLPK(LPK_ETO))
519  return LpkExtTextOut(hdc, x, y, fuOptions, lprc, lpString, cwc , lpDx, 0);
520  }
521  else
522  {
524  }
525 
526  /* Get the DC attribute */
527  pdcattr = GdiGetDcAttr(hdc);
528  if ( pdcattr &&
529  !(pdcattr->ulDirty_ & DC_DIBSECTION) &&
530  !(pdcattr->lTextAlign & TA_UPDATECP))
531  {
532  if ( lprc && !cwc )
533  {
534  if ( fuOptions & ETO_OPAQUE )
535  {
536  PGDIBSEXTTEXTOUT pgO;
537 
539  if (pgO)
540  {
541  pdcattr->ulDirty_ |= DC_MODE_DIRTY;
542  pgO->Count = cwc;
543  pgO->Rect = *lprc;
544  pgO->Options = fuOptions;
545  /* Snapshot attribute */
546  pgO->ulBackgroundClr = pdcattr->ulBackgroundClr;
547  pgO->ptlViewportOrg = pdcattr->ptlViewportOrg;
548  return TRUE;
549  }
550  }
551  else // Do nothing, old explorer pops this off.
552  {
553  DPRINT1("GdiBCExtTextOut nothing\n");
554  return TRUE;
555  }
556  } // Max 580 wchars, if offset 0
557  else if ( cwc <= ((GDIBATCHBUFSIZE - sizeof(GDIBSTEXTOUT)) / sizeof(WCHAR)) )
558  {
559  PGDIBSTEXTOUT pgO;
560  PTEB pTeb = NtCurrentTeb();
561 
563  if (pgO)
564  {
565  USHORT cjSize = 0;
566  ULONG DxSize = 0;
567 
568  if (cwc > 2) cjSize = (cwc * sizeof(WCHAR)) - sizeof(pgO->String);
569 
570  /* Calculate buffer size for string and Dx values */
571  if (lpDx)
572  {
573  /* If ETO_PDY is specified, we have pairs of INTs */
574  DxSize = (cwc * sizeof(INT)) * (fuOptions & ETO_PDY ? 2 : 1);
575  cjSize += DxSize;
576  // The structure buffer holds 4 bytes. Store Dx data then string.
577  // Result one wchar -> Buf[ Dx ]Str[wC], [4][2][X] one extra unused wchar
578  // to assure alignment of 4.
579  }
580 
581  if ((pTeb->GdiTebBatch.Offset + cjSize ) <= GDIBATCHBUFSIZE)
582  {
584  pgO->cbCount = cwc;
585  pgO->x = x;
586  pgO->y = y;
587  pgO->Options = fuOptions;
588  pgO->iCS_CP = 0;
589 
590  if (lprc) pgO->Rect = *lprc;
591  else
592  {
593  pgO->Options |= GDIBS_NORECT; // Tell the other side lprc is nill.
594  }
595 
596  /* Snapshot attributes */
597  pgO->crForegroundClr = pdcattr->crForegroundClr;
598  pgO->crBackgroundClr = pdcattr->crBackgroundClr;
599  pgO->ulForegroundClr = pdcattr->ulForegroundClr;
600  pgO->ulBackgroundClr = pdcattr->ulBackgroundClr;
601  pgO->lBkMode = pdcattr->lBkMode == OPAQUE ? OPAQUE : TRANSPARENT;
602  pgO->hlfntNew = pdcattr->hlfntNew;
603  pgO->flTextAlign = pdcattr->flTextAlign;
604  pgO->ptlViewportOrg = pdcattr->ptlViewportOrg;
605 
606  pgO->Size = DxSize; // of lpDx then string after.
607  /* Put the Dx before the String to assure alignment of 4 */
608  if (lpDx) RtlCopyMemory( &pgO->Buffer, lpDx, DxSize);
609 
610  if (cwc) RtlCopyMemory( &pgO->String[DxSize/sizeof(WCHAR)], lpString, cwc * sizeof(WCHAR));
611 
612  // Recompute offset and return size
613  pTeb->GdiTebBatch.Offset += cjSize;
614  ((PGDIBATCHHDR)pgO)->Size += cjSize;
615  return TRUE;
616  }
617  // Reset offset and count then fall through
618  pTeb->GdiTebBatch.Offset -= sizeof(GDIBSTEXTOUT);
619  pTeb->GdiBatchCount--;
620  }
621  }
622  }
623  return NtGdiExtTextOutW(hdc,
624  x,
625  y,
626  fuOptions,
627  (LPRECT)lprc,
628  (LPWSTR)lpString,
629  cwc,
630  (LPINT)lpDx,
631  0);
632 }
ULONG Buffer[1]
Definition: ntgdityp.h:529
HDC WINAPI GdiConvertAndCheckDC(HDC hdc)
Definition: dc.c:416
POINTL ptlViewportOrg
Definition: ntgdihdl.h:347
ULONG ulBackgroundClr
Definition: ntgdityp.h:540
_In_ int _Inout_ LPRECT lprc
Definition: winuser.h:4441
#define TRUE
Definition: types.h:120
__kernel_entry W32KAPI BOOL APIENTRY NtGdiExtTextOutW(_In_ HDC hdc, _In_ INT x, _In_ INT y, _In_ UINT flOpts, _In_opt_ LPRECT prcl, _In_reads_opt_(cwc) LPWSTR pwsz, _In_range_(0, 0xffff) INT cwc, _In_reads_opt_(_Inexpressible_(cwc)) LPINT pdx, _In_ DWORD dwCodePage)
FORCEINLINE PDC_ATTR GdiGetDcAttr(HDC hdc)
Definition: gdi32p.h:451
#define INT
Definition: polytest.cpp:20
#define DC_DIBSECTION
Definition: ntgdihdl.h:159
struct _GDIBATCHHDR * PGDIBATCHHDR
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
static BOOL bBypassETOWMF
Definition: text.c:478
#define HANDLE_METADC(_RetType, _Func, dwError, hdc,...)
Definition: gdi32p.h:616
LONG lBkMode
Definition: ntgdityp.h:514
ULONG ulBackgroundClr
Definition: ntgdihdl.h:302
FLONG flTextAlign
Definition: ntgdityp.h:525
BOOL WINAPI LoadLPK(INT LpkFunctionID)
Definition: utils.c:423
#define FALSE
Definition: types.h:117
#define ETO_OPAQUE
Definition: wingdi.h:646
unsigned int BOOL
Definition: ntddk_ex.h:94
HANDLE hlfntNew
Definition: ntgdihdl.h:334
#define TRANSPARENT
Definition: wingdi.h:949
#define GDIBATCHBUFSIZE
Definition: ntgdityp.h:200
COLORREF crBackgroundClr
Definition: ntgdityp.h:513
UINT Options
Definition: ntgdityp.h:519
#define TA_UPDATECP
Definition: wingdi.h:935
ULONG ulDirty_
Definition: ntgdihdl.h:298
ULONG ulBackgroundClr
Definition: ntgdityp.h:516
COLORREF crBackgroundClr
Definition: ntgdihdl.h:301
__wchar_t WCHAR
Definition: xmlstorage.h:180
COLORREF crForegroundClr
Definition: ntgdityp.h:512
struct _GDIBSTEXTOUT GDIBSTEXTOUT
#define GDIBS_NORECT
Definition: ntgdityp.h:507
POINTL ptlViewportOrg
Definition: ntgdityp.h:539
#define ExtTextOut
Definition: wingdi.h:4453
GDI_TEB_BATCH GdiTebBatch
Definition: compat.h:716
ULONG GdiBatchCount
Definition: compat.h:746
#define OPAQUE
Definition: wingdi.h:948
HDC hdc
Definition: main.c:9
HANDLE hlfntNew
Definition: ntgdityp.h:524
#define DC_MODE_DIRTY
Definition: ntgdihdl.h:166
#define DC_FONTTEXT_DIRTY
Definition: ntgdihdl.h:167
WCHAR String[2]
Definition: ntgdityp.h:528
POINTL ptlViewportOrg
Definition: ntgdityp.h:526
DWORD iCS_CP
Definition: ntgdityp.h:521
#define LPK_ETO
Definition: gdi32p.h:82
Definition: compat.h:694
ULONG Offset
Definition: compat.h:690
FORCEINLINE struct _TEB * NtCurrentTeb(VOID)
Definition: psfuncs.h:420
unsigned short USHORT
Definition: pedump.c:61
ULONG ulForegroundClr
Definition: ntgdihdl.h:304
#define NULL
Definition: types.h:112
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
#define ETO_PDY
Definition: wingdi.h:656
FLONG flTextAlign
Definition: ntgdihdl.h:328
#define DPRINT1
Definition: precomp.h:8
LONG lBkMode
Definition: ntgdihdl.h:317
COLORREF crForegroundClr
Definition: ntgdihdl.h:303
unsigned int ULONG
Definition: retypes.h:1
_In_ ULONG cjSize
Definition: winddi.h:3634
UINT cbCount
Definition: ntgdityp.h:522
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
ULONG ulForegroundClr
Definition: ntgdityp.h:515
FORCEINLINE PVOID GdiAllocBatchCommand(HDC hdc, USHORT Cmd)
Definition: gdi32p.h:381
WCHAR * LPWSTR
Definition: xmlstorage.h:184
LPKETO LpkExtTextOut
Definition: utils.c:5
LONG lTextAlign
Definition: ntgdihdl.h:329
int * LPINT
Definition: windef.h:178

Referenced by DrawTextExWorker(), ExtTextOutA(), PolyTextOutW(), and TextOutW().

◆ GdiGetCodePage()

DWORD WINAPI GdiGetCodePage ( _In_ HDC  hdc)

Definition at line 140 of file text.c.

142 {
143  PDC_ATTR pdcattr;
144 
145  /* Get the DC attribute */
146  pdcattr = GdiGetDcAttr(hdc);
147  if (pdcattr == NULL)
148  {
150  return 0;
151  }
152 
153  if (pdcattr->ulDirty_ & DIRTY_CHARSET)
154  return LOWORD(NtGdiGetCharSet(hdc));
155 
156  return LOWORD(pdcattr->iCS_CP);
157 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define DIRTY_CHARSET
Definition: ntgdihdl.h:149
FORCEINLINE PDC_ATTR GdiGetDcAttr(HDC hdc)
Definition: gdi32p.h:451
ULONG ulDirty_
Definition: ntgdihdl.h:298
DWORD iCS_CP
Definition: ntgdihdl.h:309
#define SetLastError(x)
Definition: compat.h:611
HDC hdc
Definition: main.c:9
#define NULL
Definition: types.h:112
DWORD APIENTRY NtGdiGetCharSet(HDC hDC)
Definition: text.c:206
#define LOWORD(l)
Definition: pedump.c:82

◆ GetETM()

BOOL WINAPI GetETM ( _In_ HDC  hdc,
_Out_ EXTTEXTMETRIC petm 
)

Definition at line 1029 of file text.c.

1032 {
1033  BOOL bResult;
1034 
1035  bResult = NtGdiGetETM(hdc, petm);
1036 
1037  if (bResult && petm)
1038  {
1039  petm->emKernPairs = (WORD)GetKerningPairsA(hdc, 0, 0);
1040  }
1041 
1042  return bResult;
1043 }
DWORD WINAPI GetKerningPairsA(_In_ HDC hdc, _In_ DWORD nPairs, _Out_writes_to_opt_(nPairs, return) LPKERNINGPAIR lpKernPair)
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned short WORD
Definition: ntddk_ex.h:93
HDC hdc
Definition: main.c:9
__kernel_entry W32KAPI BOOL APIENTRY NtGdiGetETM(_In_ HDC hdc, _Out_opt_ EXTTEXTMETRIC *petm)

◆ GetFontResourceInfoW()

BOOL WINAPI GetFontResourceInfoW ( _In_z_ LPCWSTR  lpFileName,
_Inout_ DWORD pdwBufSize,
_Out_writes_to_opt_ *, 1pdwBufSize PVOID  lpBuffer,
_In_ DWORD  dwType 
)

Definition at line 726 of file text.c.

731 {
732  BOOL bRet;
733  UNICODE_STRING NtFileName;
734 
735  DPRINT("GetFontResourceInfoW: dwType = %lu\n", dwType);
736 
737  if (!lpFileName || !pdwBufSize)
738  {
740  return FALSE;
741  }
742 
744  &NtFileName,
745  NULL,
746  NULL))
747  {
749  return FALSE;
750  }
751 
753  NtFileName.Buffer,
754  (NtFileName.Length / sizeof(WCHAR)) + 1,
755  1,
756  *pdwBufSize,
757  pdwBufSize,
758  lpBuffer,
759  dwType);
760 
761  RtlFreeHeap(RtlGetProcessHeap(), 0, NtFileName.Buffer);
762 
763  return bRet;
764 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:606
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
static TAGREF LPCWSTR LPDWORD LPVOID lpBuffer
Definition: db.cpp:175
__kernel_entry W32KAPI BOOL APIENTRY NtGdiGetFontResourceInfoInternalW(_In_reads_z_(cwc) LPWSTR pwszFiles, _In_ ULONG cwc, _In_ ULONG cFiles, _In_ UINT cjBuf, _Out_ LPDWORD pdwBytes, _Out_writes_bytes_(cjBuf) LPVOID pvBuf, _In_ DWORD iType)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define SetLastError(x)
Definition: compat.h:611
#define NULL
Definition: types.h:112
#define ERROR_PATH_NOT_FOUND
Definition: winerror.h:106
#define DPRINT
Definition: sndvol32.h:71
NTSYSAPI BOOLEAN NTAPI RtlDosPathNameToNtPathName_U(_In_opt_z_ PCWSTR DosPathName, _Out_ PUNICODE_STRING NtPathName, _Out_opt_ PCWSTR *NtFileNamePart, _Out_opt_ PRTL_RELATIVE_NAME_U DirectoryInfo)
_In_ LPCSTR lpFileName
Definition: winbase.h:3050

◆ GetStringBitmapA()

UINT WINAPI GetStringBitmapA ( _In_ HDC  hdc,
_In_ LPSTR  psz,
_In_ BOOL  bDoCall,
_In_ UINT  cj,
_Out_writes_(cj) BYTE lpSB 
)

Definition at line 971 of file text.c.

977 {
978 
980  PWSTR pwsz;
981  UINT uResult = 0;
982 
983  if (!bDoCall)
984  {
985  return 0;
986  }
987 
988  Status = HEAP_strdupA2W(&pwsz, psz);
989  if (!NT_SUCCESS(Status))
990  {
992  }
993  else
994  {
995  uResult = NtGdiGetStringBitmapW(hdc, pwsz, 1, lpSB, cj);
996  HEAP_free(pwsz);
997  }
998 
999  return uResult;
1000 
1001 }
VOID HEAP_free(LPVOID memory)
Definition: heap.c:63
_In_ ULONG cj
Definition: winddi.h:3540
uint16_t * PWSTR
Definition: typedefs.h:56
LONG NTSTATUS
Definition: precomp.h:26
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
NTSTATUS HEAP_strdupA2W(LPWSTR *ppszW, LPCSTR lpszA)
Definition: heap.c:43
Status
Definition: gdiplustypes.h:24
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define SetLastError(x)
Definition: compat.h:611
HDC hdc
Definition: main.c:9
unsigned int UINT
Definition: ndis.h:50
__kernel_entry W32KAPI UINT APIENTRY NtGdiGetStringBitmapW(_In_ HDC hdc, _In_ LPWSTR pwsz, _In_ UINT cwc, _Out_writes_bytes_(cj) BYTE *lpSB, _In_ UINT cj)

◆ GetStringBitmapW()

UINT WINAPI GetStringBitmapW ( _In_ HDC  hdc,
_In_ LPWSTR  pwsz,
_In_ BOOL  bDoCall,
_In_ UINT  cj,
_Out_writes_(cj) BYTE lpSB 
)

Definition at line 1008 of file text.c.

1014 {
1015  if (!bDoCall)
1016  {
1017  return 0;
1018  }
1019 
1020  return NtGdiGetStringBitmapW(hdc, pwsz, 1, lpSB, cj);
1021 
1022 }
_In_ ULONG cj
Definition: winddi.h:3540
HDC hdc
Definition: main.c:9
__kernel_entry W32KAPI UINT APIENTRY NtGdiGetStringBitmapW(_In_ HDC hdc, _In_ LPWSTR pwsz, _In_ UINT cwc, _Out_writes_bytes_(cj) BYTE *lpSB, _In_ UINT cj)

◆ GetTextAlign()

UINT WINAPI GetTextAlign ( _In_ HDC  hdc)

Definition at line 818 of file text.c.

820 {
821  PDC_ATTR pdcattr;
822 
823  /* Get the DC attribute */
824  pdcattr = GdiGetDcAttr(hdc);
825  if (pdcattr == NULL)
826  {
827  /* Do not set LastError here! */
828  return GDI_ERROR;
829  }
830 
831  return pdcattr->lTextAlign;
832 }
FORCEINLINE PDC_ATTR GdiGetDcAttr(HDC hdc)
Definition: gdi32p.h:451
HDC hdc
Definition: main.c:9
#define NULL
Definition: types.h:112
#define GDI_ERROR
Definition: wingdi.h:1308
LONG lTextAlign
Definition: ntgdihdl.h:329

Referenced by EMFDRV_ExtTextOut(), eto_emf_enum_proc(), LPK_DrawUnderscore(), LpkExtTextOut(), MainWndProc(), and test_ExtTextOut().

◆ GetTextCharacterExtra()

INT WINAPI GetTextCharacterExtra ( _In_ HDC  hdc)

Definition at line 165 of file text.c.

167 {
168  PDC_ATTR pdcattr;
169 
170  /* Get the DC attribute */
171  pdcattr = GdiGetDcAttr(hdc);
172  if (pdcattr == NULL)
173  {
174  /* Do not set LastError here! */
175  return 0x8000000;
176  }
177 
178  return pdcattr->lTextExtra;
179 }
FORCEINLINE PDC_ATTR GdiGetDcAttr(HDC hdc)
Definition: gdi32p.h:451
LONG lTextExtra
Definition: ntgdihdl.h:330
HDC hdc
Definition: main.c:9
#define NULL
Definition: types.h:112

Referenced by test_dc_values().

◆ GetTextCharset()

INT WINAPI GetTextCharset ( _In_ HDC  hdc)

Definition at line 187 of file text.c.

189 {
190  /* MSDN docs say this is equivalent */
191  return NtGdiGetTextCharsetInfo(hdc,NULL,0);
192 }
HDC hdc
Definition: main.c:9
#define NULL
Definition: types.h:112
INT APIENTRY NtGdiGetTextCharsetInfo(IN HDC hdc, OUT OPTIONAL LPFONTSIGNATURE lpSig, IN DWORD dwFlags)
Definition: text.c:267

Referenced by GetKerningPairsA(), map_font(), MFDRV_ExtTextOut(), test_bitmap_font_metrics(), test_GdiGetCodePage(), test_logfont(), test_nonexistent_font(), and test_oemcharset().

◆ GetTextColor()

COLORREF WINAPI GetTextColor ( _In_ HDC  hdc)

Definition at line 841 of file text.c.

843 {
844  PDC_ATTR pdcattr;
845 
846  /* Get the DC attribute */
847  pdcattr = GdiGetDcAttr(hdc);
848  if (pdcattr == NULL)
849  {
850  /* Do not set LastError here! */
851  return CLR_INVALID;
852  }
853 
854  return pdcattr->ulForegroundClr;
855 }
FORCEINLINE PDC_ATTR GdiGetDcAttr(HDC hdc)
Definition: gdi32p.h:451
#define CLR_INVALID
Definition: wingdi.h:882
HDC hdc
Definition: main.c:9
ULONG ulForegroundClr
Definition: ntgdihdl.h:304
#define NULL
Definition: types.h:112

Referenced by draw_graphics(), draw_text_2(), DrawThemeText(), EDIT_PaintText(), eto_emf_enum_proc(), ImageList_DrawIndirect(), LISTVIEW_Refresh(), LPK_DrawUnderscore(), MainWndProc(), MyDrawFrameCaption(), MyDrawFrameScroll(), parent_wnd_proc(), SS_ItemOut(), test_dc_values(), test_ExtTextOut(), Test_SrcMono1(), TEXT_DrawUnderscore(), UITOOLS95_DFC_ButtonCheckRadio(), UITOOLS95_DrawFrameCaption(), UITOOLS95_DrawFrameScroll(), and UserLpkPSMTextOut().

◆ GetTextExtentExPointA()

BOOL WINAPI GetTextExtentExPointA ( _In_ HDC  hdc,
_In_reads_(cchString) LPCSTR  lpszStr,
_In_ INT  cchString,
_In_ INT  nMaxExtent,
_Out_opt_ LPINT  lpnFit,
_Out_writes_to_opt_(cchString, *lpnFit) LPINT  lpnDx,
_Out_ LPSIZE  lpSize 
)

Definition at line 329 of file text.c.

337 {
339  LPWSTR lpszStrW;
340  BOOL bResult = FALSE;
341 
342  if (nMaxExtent < -1)
343  {
345  return FALSE;
346  }
347 
348  Status = HEAP_strdupA2W(&lpszStrW, lpszStr);
349  if (!NT_SUCCESS (Status))
350  {
352  return FALSE;
353  }
354 
355  bResult = NtGdiGetTextExtentExW(hdc,
356  lpszStrW,
357  cchString,
358  nMaxExtent,
359  (PULONG)lpnFit,
360  (PULONG)lpnDx,
361  lpSize,
362  0);
363 
364  HEAP_free(lpszStrW);
365 
366  return bResult;
367 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
VOID HEAP_free(LPVOID memory)
Definition: heap.c:63
LONG NTSTATUS
Definition: precomp.h:26
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
NTSTATUS HEAP_strdupA2W(LPWSTR *ppszW, LPCSTR lpszA)
Definition: heap.c:43
Status
Definition: gdiplustypes.h:24
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define SetLastError(x)
Definition: compat.h:611
HDC hdc
Definition: main.c:9
unsigned int * PULONG
Definition: retypes.h:1
W32KAPI BOOL APIENTRY NtGdiGetTextExtentExW(IN HDC hDC, IN OPTIONAL LPWSTR UnsafeString, IN ULONG Count, IN ULONG MaxExtent, OUT OPTIONAL PULONG UnsafeFit, OUT OPTIONAL PULONG UnsafeDx, OUT LPSIZE UnsafeSize, IN FLONG fl)
Definition: text.c:326
WCHAR * LPWSTR
Definition: xmlstorage.h:184

◆ GetTextExtentExPointI()

BOOL WINAPI GetTextExtentExPointI ( _In_ HDC  hdc,
_In_reads_(cgi) LPWORD  pgiIn,
_In_ INT  cgi,
_In_ INT  nMaxExtent,
_Out_opt_ LPINT  lpnFit,
_Out_writes_to_opt_(cwchString, *lpnFit) LPINT  lpnDx,
_Out_ LPSIZE  lpSize 
)

Definition at line 416 of file text.c.

424 {
425  return NtGdiGetTextExtentExW(hdc,
426  pgiIn,
427  cgi,
428  nMaxExtent,
429  (PULONG)lpnFit,
430  (PULONG)lpnDx,
431  lpSize,
432  GTEF_INDICES);
433 }
HDC hdc
Definition: main.c:9
unsigned int * PULONG
Definition: retypes.h:1
W32KAPI BOOL APIENTRY NtGdiGetTextExtentExW(IN HDC hDC, IN OPTIONAL LPWSTR UnsafeString, IN ULONG Count, IN ULONG MaxExtent, OUT OPTIONAL PULONG UnsafeFit, OUT OPTIONAL PULONG UnsafeDx, OUT LPSIZE UnsafeSize, IN FLONG fl)
Definition: text.c:326
#define GTEF_INDICES
Definition: ntgdityp.h:213

◆ GetTextExtentExPointW()

BOOL WINAPI GetTextExtentExPointW ( _In_ HDC  hdc,
_In_reads_(cchString) LPCWSTR  lpszString,
_In_ INT  cchString,
_In_ INT  nMaxExtent,
_Out_opt_ LPINT  lpnFit,
_Out_writes_to_opt_(cchString, *lpnFit) LPINT  lpnDx,
_Out_ LPSIZE  lpSize 
)

Definition at line 283 of file text.c.

291 {
292 
293  /* Windows doesn't check nMaxExtent validity in unicode version */
294  if (nMaxExtent < -1)
295  {
296  DPRINT("nMaxExtent is invalid: %d\n", nMaxExtent);
297  }
298 
299  if (LoadLPK(LPK_GTEP))
300  return LpkGetTextExtentExPoint(hdc, lpszString, cchString, nMaxExtent, lpnFit, lpnDx, lpSize, 0, 0);
301 
302  return NtGdiGetTextExtentExW (
303  hdc, (LPWSTR)lpszString, cchString, nMaxExtent, (PULONG)lpnFit, (PULONG)lpnDx, lpSize, 0 );
304 }
BOOL WINAPI LoadLPK(INT LpkFunctionID)
Definition: utils.c:423
#define LPK_GTEP
Definition: gdi32p.h:84
HDC hdc
Definition: main.c:9
unsigned int * PULONG
Definition: retypes.h:1
W32KAPI BOOL APIENTRY NtGdiGetTextExtentExW(IN HDC hDC, IN OPTIONAL LPWSTR UnsafeString, IN ULONG Count, IN ULONG MaxExtent, OUT OPTIONAL PULONG UnsafeFit, OUT OPTIONAL PULONG UnsafeDx, OUT LPSIZE UnsafeSize, IN FLONG fl)
Definition: text.c:326
#define DPRINT
Definition: sndvol32.h:71
WCHAR * LPWSTR
Definition: xmlstorage.h:184
LPKGTEP LpkGetTextExtentExPoint
Definition: utils.c:7

Referenced by TEXT_Ellipsify(), TEXT_NextLineW(), TEXT_PathEllipsify(), and TEXT_WordBreak().

◆ GetTextExtentExPointWPri()

BOOL WINAPI GetTextExtentExPointWPri ( _In_ HDC  hdc,
_In_reads_(cwc) LPCWSTR  lpwsz,
_In_ INT  cwc,
_In_ INT  dxMax,
_Out_opt_ LPINT  pcCh,
_Out_writes_to_opt_(cwc, *pcCh) LPINT  pdxOut,
_In_ LPSIZE  psize 
)

Definition at line 312 of file text.c.

320 {
321  return NtGdiGetTextExtentExW(hdc, (LPWSTR)lpwsz, cwc, dxMax, (PULONG)pcCh, (PULONG)pdxOut, psize, 0);
322 }
_Must_inspect_result_ _Out_ LPSIZE psize
Definition: ntgdi.h:1569
HDC hdc
Definition: main.c:9
unsigned int * PULONG
Definition: retypes.h:1
W32KAPI BOOL APIENTRY NtGdiGetTextExtentExW(IN HDC hDC, IN OPTIONAL LPWSTR UnsafeString, IN ULONG Count, IN ULONG MaxExtent, OUT OPTIONAL PULONG UnsafeFit, OUT OPTIONAL PULONG UnsafeDx, OUT LPSIZE UnsafeSize, IN FLONG fl)
Definition: text.c:326
WCHAR * LPWSTR
Definition: xmlstorage.h:184

◆ GetTextExtentPoint32A()

BOOL WINAPI GetTextExtentPoint32A ( _In_ HDC  hdc,
_In_reads_(cchString) LPCSTR  lpString,
_In_ INT  cchString,
_Out_ LPSIZE  lpSize 
)

Definition at line 375 of file text.c.

380 {
381  ANSI_STRING StringA;
382  UNICODE_STRING StringU;
383  BOOL ret;
384 
385  StringA.Buffer = (LPSTR)lpString;
386  StringA.Length = cchString;
387  RtlAnsiStringToUnicodeString(&StringU, &StringA, TRUE);
388 
389  ret = GetTextExtentPoint32W(hdc, StringU.Buffer, cchString, lpSize);
390 
391  RtlFreeUnicodeString(&StringU);
392 
393  return ret;
394 }
#define TRUE
Definition: types.h:120
char * LPSTR
Definition: xmlstorage.h:182
unsigned int BOOL
Definition: ntddk_ex.h:94
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
int ret
HDC hdc
Definition: main.c:9
BOOL WINAPI GetTextExtentPoint32W(_In_ HDC hdc, _In_reads_(cchString) LPCWSTR lpString, _In_ int cchString, _Out_ LPSIZE lpSize)
Definition: text.c:402
NTSYSAPI NTSTATUS NTAPI RtlAnsiStringToUnicodeString(PUNICODE_STRING DestinationString, PANSI_STRING SourceString, BOOLEAN AllocateDestinationString)

◆ GetTextExtentPoint32W()

BOOL WINAPI GetTextExtentPoint32W ( _In_ HDC  hdc,
_In_reads_(cchString) LPCWSTR  lpString,
_In_ int  cchString,
_Out_ LPSIZE  lpSize 
)

Definition at line 402 of file text.c.

407 {
408  return NtGdiGetTextExtent(hdc, (LPWSTR)lpString, cchString, lpSize, 0);
409 }
HDC hdc
Definition: main.c:9
BOOL APIENTRY NtGdiGetTextExtent(HDC hdc, LPWSTR lpwsz, INT cwc, LPSIZE psize, UINT flOpts)
Definition: text.c:492
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by GetTextExtentPoint32A().

◆ GetTextExtentPointA()

BOOL APIENTRY GetTextExtentPointA ( _In_ HDC  hdc,
_In_reads_(cchString) LPCSTR  lpString,
_In_ INT  cchString,
_Out_ LPSIZE  lpsz 
)

Definition at line 242 of file text.c.

247 {
248  ANSI_STRING StringA;
249  UNICODE_STRING StringU;
250  BOOL ret;
251 
252  RtlInitAnsiString(&StringA, (LPSTR)lpString);
253  RtlAnsiStringToUnicodeString(&StringU, &StringA, TRUE);
254 
255  ret = GetTextExtentPointW(hdc, StringU.Buffer, cchString, lpsz);
256 
257  RtlFreeUnicodeString(&StringU);
258 
259  return ret;
260 }
#define TRUE
Definition: types.h:120
char * LPSTR
Definition: xmlstorage.h:182
NTSYSAPI VOID NTAPI RtlInitAnsiString(PANSI_STRING DestinationString, PCSZ SourceString)
unsigned int BOOL
Definition: ntddk_ex.h:94
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
int ret
HDC hdc
Definition: main.c:9
BOOL APIENTRY GetTextExtentPointW(_In_ HDC hdc, _In_reads_(cchString) LPCWSTR lpString, _In_ INT cchString, _Out_ LPSIZE lpsz)
Definition: text.c:268
NTSYSAPI NTSTATUS NTAPI RtlAnsiStringToUnicodeString(PUNICODE_STRING DestinationString, PANSI_STRING SourceString, BOOLEAN AllocateDestinationString)

◆ GetTextExtentPointI()

BOOL WINAPI GetTextExtentPointI ( _In_ HDC  hdc,
_In_reads_(cgi) LPWORD  pgiIn,
_In_ int  cgi,
_Out_ LPSIZE  lpSize 
)

Definition at line 440 of file text.c.

445 {
446  return NtGdiGetTextExtent(hdc, pgiIn, cgi, lpSize, GTEF_INDICES);
447 }
HDC hdc
Definition: main.c:9
BOOL APIENTRY NtGdiGetTextExtent(HDC hdc, LPWSTR lpwsz, INT cwc, LPSIZE psize, UINT flOpts)
Definition: text.c:492
#define GTEF_INDICES
Definition: ntgdityp.h:213

Referenced by Test_bug3481().

◆ GetTextExtentPointW()

BOOL APIENTRY GetTextExtentPointW ( _In_ HDC  hdc,
_In_reads_(cchString) LPCWSTR  lpString,
_In_ INT  cchString,
_Out_ LPSIZE  lpsz 
)

Definition at line 268 of file text.c.

273 {
274  return NtGdiGetTextExtent(hdc, (LPWSTR)lpString, cchString, lpsz, 0);
275 }
HDC hdc
Definition: main.c:9
BOOL APIENTRY NtGdiGetTextExtent(HDC hdc, LPWSTR lpwsz, INT cwc, LPSIZE psize, UINT flOpts)
Definition: text.c:492
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by DrawTextExWorker(), GetTextExtentPointA(), and TEXT_DrawUnderscore().

◆ GetTextFaceA()

INT WINAPI GetTextFaceA ( _In_ HDC  hdc,
_In_ INT  cchMax,
_Out_writes_to_opt_(cchMax, return) LPSTR  lpName 
)

Definition at line 663 of file text.c.

667 {
668  INT res;
669  LPWSTR nameW;
670 
671  /* Validate parameters */
672  if (lpName && cchMax <= 0)
673  {
674  /* Set last error and return failure */
676  return 0;
677  }
678 
679  res = GetTextFaceW(hdc, 0, NULL);
680  nameW = HeapAlloc( GetProcessHeap(), 0, res * 2 );
681  if (nameW == NULL)
682  {
683  return 0;
684  }
685 
686  GetTextFaceW( hdc, res, nameW );
687 
688  if (lpName)
689  {
691  lpName[cchMax-1] = 0;
692  res = strlen(lpName);
693  }
694  else
695  {
696  res = WideCharToMultiByte( CP_ACP, 0, nameW, -1, NULL, 0, NULL, NULL);
697  }
698 
699  HeapFree( GetProcessHeap(), 0, nameW );
700  return res;
701 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define WideCharToMultiByte
Definition: compat.h:111
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define CP_ACP
Definition: compat.h:109
_In_ LPCSTR lpName
Definition: winbase.h:2768
int32_t INT
Definition: typedefs.h:58
static const WCHAR nameW[]
Definition: main.c:46
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
INT WINAPI GetTextFaceW(_In_ HDC hdc, _In_ INT cwcMax, _Out_writes_to_opt_(cwcMax, return) LPWSTR pFaceName)
Definition: text.c:640
UINT cchMax
HDC hdc
Definition: main.c:9
VOID WINAPI GdiSetLastError(DWORD dwErrCode)
Definition: misc.c:873
#define NULL
Definition: types.h:112
GLuint res
Definition: glext.h:9613
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:594

◆ GetTextFaceAliasW()

INT WINAPI GetTextFaceAliasW ( _In_ HDC  hdc,
_In_ INT  cwcMax,
_Out_writes_to_opt_(cwcMax, return) LPWSTR  pszOut 
)

Definition at line 709 of file text.c.

713 {
714  if (pszOut && !cwcMax)
715  {
717  return 0;
718  }
719 
720  return NtGdiGetTextFaceW(hdc, cwcMax, pszOut, TRUE);
721 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define TRUE
Definition: types.h:120
HDC hdc
Definition: main.c:9
VOID WINAPI GdiSetLastError(DWORD dwErrCode)
Definition: misc.c:873
W32KAPI INT APIENTRY NtGdiGetTextFaceW(IN HDC hDC, IN INT Count, OUT OPTIONAL LPWSTR FaceName, IN BOOL bAliasName)
Definition: text.c:530

◆ GetTextFaceW()

INT WINAPI GetTextFaceW ( _In_ HDC  hdc,
_In_ INT  cwcMax,
_Out_writes_to_opt_(cwcMax, return) LPWSTR  pFaceName 
)

Definition at line 640 of file text.c.

644 {
645  /* Validate parameters */
646  if (pFaceName && cwcMax <= 0)
647  {
648  /* Set last error and return failure */
650  return 0;
651  }
652 
653  /* Forward to kernel */
654  return NtGdiGetTextFaceW(hdc, cwcMax, pFaceName, FALSE);
655 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define FALSE
Definition: types.h:117
HDC hdc
Definition: main.c:9
VOID WINAPI GdiSetLastError(DWORD dwErrCode)
Definition: misc.c:873
W32KAPI INT APIENTRY NtGdiGetTextFaceW(IN HDC hDC, IN INT Count, OUT OPTIONAL LPWSTR FaceName, IN BOOL bAliasName)
Definition: text.c:530

Referenced by GetTextFaceA().

◆ GetTextMetricsA()

BOOL WINAPI GetTextMetricsA ( _In_ HDC  hdc,
_Out_ LPTEXTMETRICA  lptm 
)

Definition at line 200 of file text.c.

203 {
204  TMW_INTERNAL tmwi;
205 
206  if (!NtGdiGetTextMetricsW(hdc, &tmwi, sizeof(TMW_INTERNAL)))
207  {
208  return FALSE;
209  }
210 
212  return TRUE;
213 }
TEXTMETRICW TextMetric
Definition: ntgdityp.h:370
#define TRUE
Definition: types.h:120
VOID FASTCALL FONT_TextMetricWToA(const TEXTMETRICW *ptmW, LPTEXTMETRICA ptmA)
Definition: font.c:79
#define FALSE
Definition: types.h:117
W32KAPI BOOL APIENTRY NtGdiGetTextMetricsW(IN HDC hDC, OUT TMW_INTERNAL *pUnsafeTmwi, IN ULONG cj)
Definition: text.c:590
HDC hdc
Definition: main.c:9
static LPTEXTMETRICW lptm
Definition: font.c:42

Referenced by _GdiGetCharDimensions(), check_height_font_enumproc(), check_item_height(), DECLARE_INTERFACE_(), draw_text_2(), DrawTextExA(), font_height(), get_current_font_height(), get_font_dpi(), get_text_metr_size(), get_tmheight(), ID3DXFontImpl_GetTextMetricsA(), init(), init_system_font_height(), menu_ownerdraw_wnd_proc(), system_font_height(), test_bcm_get_ideal_size(), test_bitmap_font(), test_bitmap_font_glyph_index(), test_bitmap_font_metrics(), test_dtm_get_ideal_size(), test_fake_bold_font(), test_font_caps(), test_font_metrics(), Test_FontSelectionEntry(), test_GetGlyphIndices(), test_GetGlyphOutline(), test_GetGlyphOutline_metric_clipping(), test_GetTextMetrics2(), test_height(), test_ID3DXFont(), test_item_count(), test_item_height(), test_max_height(), test_ScriptGetFontProperties(), test_ScriptGetGlyphABCWidth(), test_TabbedText(), test_text_extents(), test_text_metrics(), test_text_position_style(), and testJustification().

◆ GetTextMetricsW()

BOOL WINAPI GetTextMetricsW ( _In_ HDC  hdc,
_Out_ LPTEXTMETRICW  lptm 
)

Definition at line 221 of file text.c.

224 {
225  TMW_INTERNAL tmwi;
226 
227  if (!NtGdiGetTextMetricsW(hdc, &tmwi, sizeof(TMW_INTERNAL)))
228  {
229  return FALSE;
230  }
231 
232  *lptm = tmwi.TextMetric;
233  return TRUE;
234 }
TEXTMETRICW TextMetric
Definition: ntgdityp.h:370
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
W32KAPI BOOL APIENTRY NtGdiGetTextMetricsW(IN HDC hDC, OUT TMW_INTERNAL *pUnsafeTmwi, IN ULONG cj)
Definition: text.c:590
HDC hdc
Definition: main.c:9
static LPTEXTMETRICW lptm
Definition: font.c:42

Referenced by CBGetTextAreaHeight(), CFn_WMMeasureItem(), COMCTL32_GetFontMetrics(), D3DXCreateFontIndirectW(), DECLARE_INTERFACE_(), DrawTextExWorker(), EDIT_WM_SetFont(), EditTypeDlg_OnMeasureItem(), EMFDRV_ExtTextOut(), FILEDLG95_LOOKIN_DrawItem(), FILEDLG95_LOOKIN_Init(), GB_Paint(), GdiGetCharDimensions(), GdipAddPathString(), GdipDrawString(), GdipMeasureDriverString(), get_font_hfont(), get_tmheightW(), GetFontCellSize(), GetThemeTextMetrics(), HEADER_Create(), HEADER_SetFont(), HOTKEY_SetFont(), ID3DXFontImpl_GetTextMetricsW(), init_script_cache(), LabelWndProc(), LISTVIEW_Command(), LISTVIEW_EditLabelT(), LISTVIEW_SaveTextMetrics(), LpkGetTextExtentExPoint(), LpkPSMTextOut(), MainWndProc(), MONTHCAL_UpdateSize(), msi_dialog_get_sans_serif_height(), OLEFontImpl_QueryTextMetrics(), realize_font(), select_style(), CACListView::SetFont(), SetFontStylesToCombo2(), SYSLINK_GetIdealHeight(), SYSLINK_Render(), SYSLINK_SetFont(), TAB_Create(), TAB_SetItemBounds(), test_GetGlyphOutline_metric_clipping(), test_ScriptCacheGetHeight(), test_ScriptPlace(), test_ScriptString_pSize(), test_text_metrics(), TEXT_TabbedTextOut(), TOOLBAR_CalcStrings(), TREEVIEW_Command(), TREEVIEW_EditLabel(), TREEVIEW_EnsureVisible(), TREEVIEW_NaturalHeight(), UserLpkPSMTextOut(), and WINHELP_HistoryWndProc().

◆ PolyTextOutA()

BOOL WINAPI PolyTextOutA ( _In_ HDC  hdc,
_In_reads_(cStrings) const POLYTEXTA pptxt,
_In_ INT  cStrings 
)

Definition at line 82 of file text.c.

86 {
87  for (; cStrings>0; cStrings--, pptxt++)
88  {
89  if (!ExtTextOutA(hdc,
90  pptxt->x,
91  pptxt->y,
92  pptxt->uiFlags,
93  &pptxt->rcl,
94  pptxt->lpstr,
95  pptxt->n,
96  pptxt->pdx))
97  {
98  return FALSE;
99  }
100  }
101 
102  return TRUE;
103 }
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
HDC hdc
Definition: main.c:9
BOOL WINAPI ExtTextOutA(_In_ HDC hdc, _In_ INT x, _In_ INT y, _In_ UINT fuOptions, _In_opt_ const RECT *lprc, _In_reads_opt_(cch) LPCSTR lpString, _In_ UINT cch, _In_reads_opt_(cch) const INT *lpDx)
Definition: text.c:454

◆ PolyTextOutW()

BOOL WINAPI PolyTextOutW ( _In_ HDC  hdc,
_In_reads_(cStrings) const POLYTEXTW pptxt,
_In_ INT  cStrings 
)

Definition at line 111 of file text.c.

115 {
116  for (; cStrings>0; cStrings--, pptxt++)
117  {
118  if (!ExtTextOutW(hdc,
119  pptxt->x,
120  pptxt->y,
121  pptxt->uiFlags,
122  &pptxt->rcl,
123  pptxt->lpstr,
124  pptxt->n,
125  pptxt->pdx))
126  {
127  return FALSE;
128  }
129  }
130 
131  return TRUE;
132 }
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
BOOL WINAPI ExtTextOutW(_In_ HDC hdc, _In_ INT x, _In_ INT y, _In_ UINT fuOptions, _In_opt_ const RECT *lprc, _In_reads_opt_(cwc) LPCWSTR lpString, _In_ UINT cwc, _In_reads_opt_(cwc) const INT *lpDx)
Definition: text.c:485
HDC hdc
Definition: main.c:9

◆ SetTextAlign()

UINT WINAPI SetTextAlign ( _In_ HDC  hdc,
_In_ UINT  fMode 
)

Definition at line 863 of file text.c.

866 {
867  PDC_ATTR pdcattr;
868  UINT fOldMode;
869 
871 
872  /* Get the DC attribute */
873  pdcattr = GdiGetDcAttr(hdc);
874  if (pdcattr == NULL)
875  {
877  return GDI_ERROR;
878  }
879 
880 
881  fOldMode = pdcattr->lTextAlign;
882  pdcattr->lTextAlign = fMode; // Raw
883  if (pdcattr->dwLayout & LAYOUT_RTL)
884  {
885  if ((fMode & TA_CENTER) != TA_CENTER) fMode ^= TA_RIGHT;
886  }
887 
888  pdcattr->flTextAlign = fMode & TA_MASK;
889  return fOldMode;
890 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define LAYOUT_RTL
Definition: wingdi.h:1370
FORCEINLINE PDC_ATTR GdiGetDcAttr(HDC hdc)
Definition: gdi32p.h:451
#define HANDLE_METADC(_RetType, _Func, dwError, hdc,...)
Definition: gdi32p.h:616
unsigned int BOOL
Definition: ntddk_ex.h:94
#define TA_RIGHT
Definition: wingdi.h:932
#define SetLastError(x)
Definition: compat.h:611
HDC hdc
Definition: main.c:9
#define TA_MASK
Definition: wingdi.h:936
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
FLONG flTextAlign
Definition: ntgdihdl.h:328
DWORD dwLayout
Definition: ntgdihdl.h:343
#define TA_CENTER
Definition: wingdi.h:930
#define GDI_ERROR
Definition: wingdi.h:1308
LONG lTextAlign
Definition: ntgdihdl.h:329
UINT WINAPI SetTextAlign(_In_ HDC hdc, _In_ UINT fMode)
Definition: text.c:863

Referenced by add_ruler_units(), DoTestEntry(), draw_text_2(), EnumEnhMetaFile(), GDI32_GdipDrawDriverString(), GraphCtrl_InvalidateCtrl(), MainWndProc(), ME_DebugWrite(), ME_DrawParagraph(), PlayEnhMetaFileRecord(), PlayMetaFileRecord(), test_ExtTextOut(), TreeListDraw(), and TREEVIEW_DrawItem().

◆ SetTextCharacterExtra()

INT WINAPI SetTextCharacterExtra ( _In_ HDC  hdc,
_In_ INT  nCharExtra 
)

Definition at line 772 of file text.c.

775 {
776  PDC_ATTR pdcattr;
777  INT nOldCharExtra;
778 
779  if (nCharExtra == 0x80000000)
780  {
782  return 0x80000000;
783  }
784 
786  {
787  HANDLE_METADC(INT, SetTextCharacterExtra, 0x80000000, hdc, nCharExtra);
788  }
789 
790  /* Get the DC attribute */
791  pdcattr = GdiGetDcAttr(hdc);
792  if (pdcattr == NULL)
793  {
795  return 0x8000000;
796  }
797 
798  if (NtCurrentTeb()->GdiTebBatch.HDC == hdc)
799  {
800  if (pdcattr->ulDirty_ & DC_FONTTEXT_DIRTY)
801  {
802  NtGdiFlush(); // Sync up pdcattr from Kernel space.
804  }
805  }
806 
807  nOldCharExtra = pdcattr->lTextExtra;
808  pdcattr->lTextExtra = nCharExtra;
809  return nOldCharExtra;
810 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
INT WINAPI SetTextCharacterExtra(_In_ HDC hdc, _In_ INT nCharExtra)
Definition: text.c:772
FORCEINLINE PDC_ATTR GdiGetDcAttr(HDC hdc)
Definition: gdi32p.h:451
LONG lTextExtra
Definition: ntgdihdl.h:330
int32_t INT
Definition: typedefs.h:58
#define HANDLE_METADC(_RetType, _Func, dwError, hdc,...)
Definition: gdi32p.h:616
ULONG ulDirty_
Definition: ntgdihdl.h:298
#define GDI_HANDLE_GET_TYPE(h)
Definition: gdi.h:31
__kernel_entry W32KAPI NTSTATUS APIENTRY NtGdiFlush(VOID)
Definition: gdibatch.c:471
#define SetLastError(x)
Definition: compat.h:611
HDC hdc
Definition: main.c:9
#define DC_MODE_DIRTY
Definition: ntgdihdl.h:166
#define DC_FONTTEXT_DIRTY
Definition: ntgdihdl.h:167
FORCEINLINE struct _TEB * NtCurrentTeb(VOID)
Definition: psfuncs.h:420
#define NULL
Definition: types.h:112

◆ SetTextColor()

COLORREF WINAPI SetTextColor ( _In_ HDC  hdc,
_In_ COLORREF  crColor 
)

Definition at line 898 of file text.c.

901 {
902  PDC_ATTR pdcattr;
903  COLORREF crOldColor;
904 
906 
907  pdcattr = GdiGetDcAttr(hdc);
908  if (pdcattr == NULL)
909  {
911  return CLR_INVALID;
912  }
913 
914  crOldColor = (COLORREF) pdcattr->ulForegroundClr;
915  pdcattr->ulForegroundClr = (ULONG)crColor;
916 
917  if (pdcattr->crForegroundClr != crColor)
918  {
920  pdcattr->crForegroundClr = crColor;
921  }
922 
923  return crOldColor;
924 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
FORCEINLINE PDC_ATTR GdiGetDcAttr(HDC hdc)
Definition: gdi32p.h:451
#define CLR_INVALID
Definition: wingdi.h:882
#define HANDLE_METADC(_RetType, _Func, dwError, hdc,...)
Definition: gdi32p.h:616
ULONG ulDirty_
Definition: ntgdihdl.h:298
DWORD COLORREF
Definition: windef.h:300
#define SetLastError(x)
Definition: compat.h:611
#define DIRTY_TEXT
Definition: ntgdihdl.h:147
#define DIRTY_FILL
Definition: ntgdihdl.h:145
HDC hdc
Definition: main.c:9
ULONG ulForegroundClr
Definition: ntgdihdl.h:304
#define NULL
Definition: types.h:112
COLORREF crForegroundClr
Definition: ntgdihdl.h:303
unsigned int ULONG
Definition: retypes.h:1
#define DIRTY_LINE
Definition: ntgdihdl.h:146
COLORREF WINAPI SetTextColor(_In_ HDC hdc, _In_ COLORREF crColor)
Definition: text.c:898

Referenced by AboutProc(), ANIMATE_TransparentBlt(), CBPaintText(), CFn_WMDrawItem(), CFn_WMPaint(), COMBO_PrepareColors(), COMBOEX_DrawItem(), ConfigDlgProc(), CreateDragImage(), CreateLayoutIcon(), CreateTrayIcon(), DATETIME_Refresh(), DefWndControlColor(), RdpClientUI::Display_PatBlt(), RdpClientUI::Display_Polygon(), DlgProc(), CardButton::Draw(), draw_graphics(), Pane::draw_item(), draw_item(), draw_para_number(), draw_space(), draw_text(), draw_text_2(), DrawCheckedRect(), DrawGrayText(), DrawShadowText(), DrawThemeText(), EDIT_PaintText(), EDIT_WM_Paint(), EditTypeDlg_OnDrawItem(), EnumEnhMetaFile(), FD31_FileOpenDlgProc(), FD31_WMDrawItem(), FILEDLG95_LOOKIN_DrawItem(), FileMenu_DrawItem(), GDI32_GdipDrawDriverString(), Graph_DrawCpuUsageGraph(), Graph_DrawMemUsageGraph(), GraphCtrl_InvalidateCtrl(), GuiPaintTextModeBuffer(), HEADER_DrawItem(), HEXEDIT_PaintLines(), HLPFILE_RtfAddTransparentBitmap(), HOTKEY_DrawHotKey(), ICONTITLE_Paint(), ImageList_DrawIndirect(), ImageView_DrawImage(), IntDrawState(), IntGrayString(), IPADDRESS_Draw(), LISTBOX_DrawFocusRect(), LISTBOX_Paint(), LISTBOX_PaintItem(), LISTBOX_RepaintItem(), LISTVIEW_Refresh(), LogOffDialogProc(), MainWnd_OnDrawItem(), MainWndProc(), ME_DebugWrite(), MonSelPaint(), MonSelPaintMonitor(), MONTHCAL_DrawDay(), MONTHCAL_PaintCalendar(), MONTHCAL_PaintLeadTrailMonths(), MONTHCAL_PaintTitle(), MONTHCAL_PaintTodayTitle(), MONTHCAL_PaintWeeknumbers(), MONTHCAL_Refresh(), MonthCalPaint(), MouseOnCtrlColorStatic(), MSIText_WndProc(), MyDrawCaptionTemp(), MyDrawFrameCaption(), MyDrawFrameScroll(), MyDrawMenuBarTemp(), NT5_DrawLogoffCaptionText(), CMenuToolbarBase::OnCustomDraw(), CAutoComplete::OnDrawItem(), OnDrawItem(), CTrayClockWnd::OnPaint(), OnPaint(), PaintControl(), PaintText(), parent_wnd_proc(), PB_Paint(), PlayEnhMetaFileRecord(), PlayMetaFileRecord(), PlotCharacter(), prepaint_setup(), PROPSHEET_Paint(), REBAR_DrawBand(), render_masked_bitmap(), RosImageProc(), SetupControls(), ShutdownDialogProc(), SS_ItemOut(), START_TEST(), STATIC_PaintTextfn(), SubclassButtonProc(), SYSLINK_Draw(), TAB_DrawItemInterior(), TAB_EraseTabInterior(), TabDlgProc(), test_bitmap_colors(), test_dc_values(), test_ExtTextOut(), Test_GetPixel_1bpp(), test_mono_bitmap(), Test_SrcMono1(), test_StretchBlt(), Text(), ThemeDrawCaptionText(), TOOLBAR_CustomizeDialogProc(), TOOLBAR_DrawPattern(), TOOLBAR_DrawString(), ToolTipProc(), TOOLTIPS_Refresh(), TRACKBAR_DrawThumb(), TreeListDraw(), TREEVIEW_DrawItem(), UITOOLS95_DFC_ButtonCheckRadio(), UITOOLS95_DrawFrameCaption(), UITOOLS95_DrawFrameMenu(), UITOOLS95_DrawFrameScroll(), ColorStatic::WndProc(), and HyperlinkCtrl::WndProc().

◆ SetTextJustification()

BOOL WINAPI SetTextJustification ( _In_ HDC  hdc,
_In_ INT  nBreakExtra,
_In_ INT  nBreakCount 
)

Definition at line 931 of file text.c.

935 {
936  PDC_ATTR pdcattr;
937 
939  {
940  HANDLE_METADC(BOOL, SetTextJustification, FALSE, hdc, nBreakExtra, nBreakCount);
941  }
942 
943  /* Get the DC attribute */
944  pdcattr = GdiGetDcAttr(hdc);
945  if (pdcattr == NULL)
946  {
947  /* Do not set LastError here! */
948  return GDI_ERROR;
949  }
950 
951 
952  if (NtCurrentTeb()->GdiTebBatch.HDC == hdc)
953  {
954  if (pdcattr->ulDirty_ & DC_FONTTEXT_DIRTY)
955  {
956  NtGdiFlush(); // Sync up pdcattr from Kernel space.
958  }
959  }
960 
961  pdcattr->cBreak = nBreakCount;
962  pdcattr->lBreakExtra = nBreakExtra;
963  return TRUE;
964 }
#define TRUE
Definition: types.h:120
LONG lBreakExtra
Definition: ntgdihdl.h:332
FORCEINLINE PDC_ATTR GdiGetDcAttr(HDC hdc)
Definition: gdi32p.h:451
#define HANDLE_METADC(_RetType, _Func, dwError, hdc,...)
Definition: gdi32p.h:616
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
ULONG ulDirty_
Definition: ntgdihdl.h:298
#define GDI_HANDLE_GET_TYPE(h)
Definition: gdi.h:31
__kernel_entry W32KAPI NTSTATUS APIENTRY NtGdiFlush(VOID)
Definition: gdibatch.c:471
BOOL WINAPI SetTextJustification(_In_ HDC hdc, _In_ INT nBreakExtra, _In_ INT nBreakCount)
Definition: text.c:931
LONG cBreak
Definition: ntgdihdl.h:333
HDC hdc
Definition: main.c:9
#define DC_MODE_DIRTY
Definition: ntgdihdl.h:166
#define DC_FONTTEXT_DIRTY
Definition: ntgdihdl.h:167
FORCEINLINE struct _TEB * NtCurrentTeb(VOID)
Definition: psfuncs.h:420
#define NULL
Definition: types.h:112
#define GDI_ERROR
Definition: wingdi.h:1308

◆ TextOutA()

BOOL WINAPI TextOutA ( _In_ HDC  hdc,
_In_ INT  nXStart,
_In_ INT  nYStart,
_In_reads_(cchString) LPCSTR  lpString,
_In_ INT  cchString 
)

Definition at line 19 of file text.c.

25 {
26  ANSI_STRING StringA;
27  UNICODE_STRING StringU;
28  BOOL bResult;
30 
31  if (lpString != NULL && cchString > 0)
32  {
33  if (cchString > MAXUSHORT)
34  cchString = MAXUSHORT;
35 
36  StringA.Length = (USHORT)cchString;
37  StringA.MaximumLength = (USHORT)cchString;
38  StringA.Buffer = (PCHAR)lpString;
39 
40  Status = RtlAnsiStringToUnicodeString(&StringU, &StringA, TRUE);
41  if (!NT_SUCCESS(Status))
42  {
43  StringU.Buffer = NULL;
44  StringU.Length = 0;
45  }
46  }
47  else
48  {
49  StringU.Buffer = NULL;
50  StringU.Length = 0;
51  }
52 
53  bResult = TextOutW(hdc, nXStart, nYStart,
54  StringU.Buffer, StringU.Length / sizeof(WCHAR));
55 
56  RtlFreeUnicodeString(&StringU);
57  return bResult;
58 }
BOOL WINAPI TextOutW(_In_ HDC hdc, _In_ INT nXStart, _In_ INT nYStart, _In_reads_(cchString) LPCWSTR lpString, _In_ INT cchString)
Definition: text.c:66
#define TRUE
Definition: types.h:120
LONG NTSTATUS
Definition: precomp.h:26
unsigned int BOOL
Definition: ntddk_ex.h:94
#define PCHAR
Definition: match.c:90
Status
Definition: gdiplustypes.h:24
USHORT MaximumLength
Definition: env_spec_w32.h:377
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
HDC hdc
Definition: main.c:9
unsigned short USHORT
Definition: pedump.c:61
NTSYSAPI NTSTATUS NTAPI RtlAnsiStringToUnicodeString(PUNICODE_STRING DestinationString, PANSI_STRING SourceString, BOOLEAN AllocateDestinationString)
#define NULL
Definition: types.h:112
#define MAXUSHORT
Definition: typedefs.h:83

◆ TextOutW()

BOOL WINAPI TextOutW ( _In_ HDC  hdc,
_In_ INT  nXStart,
_In_ INT  nYStart,
_In_reads_(cchString) LPCWSTR  lpString,
_In_ INT  cchString 
)

Definition at line 66 of file text.c.

72 {
73  return ExtTextOutW(hdc, nXStart, nYStart, 0, NULL, (LPWSTR)lpString, cchString, NULL);
74 }
BOOL WINAPI ExtTextOutW(_In_ HDC hdc, _In_ INT x, _In_ INT y, _In_ UINT fuOptions, _In_opt_ const RECT *lprc, _In_reads_opt_(cwc) LPCWSTR lpString, _In_ UINT cwc, _In_reads_opt_(cwc) const INT *lpDx)
Definition: text.c:485
HDC hdc
Definition: main.c:9
#define NULL
Definition: types.h:112
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by GuiPaintTextModeBuffer(), and TextOutA().

Variable Documentation

◆ bBypassETOWMF

BOOL bBypassETOWMF = FALSE
static

Definition at line 478 of file text.c.

Referenced by ExtTextOutW().