ReactOS 0.4.16-dev-2491-g3dc6630
font.c File Reference
#include <precomp.h>
#include <math.h>
#include <strsafe.h>
#include <debug.h>
Include dependency graph for font.c:

Go to the source code of this file.

Macros

#define NDEBUG
 
#define MAXTCIINDEX   32
 
#define INITIAL_FAMILY_COUNT   64
 
#define IFFCX_CHARSET   1
 
#define IFFCX_STYLE   2
 
#define IEFF_UNICODE   1
 
#define IEFF_EXTENDED   2
 
#define EfdFontFamilies   3
 

Functions

static __inline INT GDI_ROUND (FLOAT val)
 
VOID FASTCALL FONT_TextMetricWToA (const TEXTMETRICW *ptmW, LPTEXTMETRICA ptmA)
 
static LPWSTR FONT_mbtowc (HDC hdc, LPCSTR str, INT count, INT *plenW, UINT *pCP)
 
static LPSTR FONT_GetCharsByRangeA (HDC hdc, UINT firstChar, UINT lastChar, PINT pByteLen)
 
VOID FASTCALL NewTextMetricW2A (NEWTEXTMETRICA *tma, NEWTEXTMETRICW *tmw)
 
VOID FASTCALL NewTextMetricExW2A (NEWTEXTMETRICEXA *tma, NEWTEXTMETRICEXW *tmw)
 
FORCEINLINE int FASTCALL IntFontFamilyCompareEx (const FONTFAMILYINFO *ffi1, const FONTFAMILYINFO *ffi2, DWORD dwCompareFlags)
 
static int __cdecl IntFontFamilyCompare (const void *ffi1, const void *ffi2)
 
int FASTCALL IntFontFamilyListUnique (FONTFAMILYINFO *InfoList, INT nCount, const LOGFONTW *plf, DWORD dwFlags)
 
static int FASTCALL IntEnumFontFamilies (HDC Dc, const LOGFONTW *LogFont, PVOID EnumProc, LPARAM lParam, DWORD dwFlags)
 
int WINAPI EnumFontFamiliesExW (HDC hdc, LPLOGFONTW lpLogfont, FONTENUMPROCW lpEnumFontFamExProc, LPARAM lParam, DWORD dwFlags)
 
int WINAPI EnumFontFamiliesW (HDC hdc, LPCWSTR lpszFamily, FONTENUMPROCW lpEnumFontFamProc, LPARAM lParam)
 
int WINAPI EnumFontFamiliesExA (HDC hdc, LPLOGFONTA lpLogfont, FONTENUMPROCA lpEnumFontFamExProc, LPARAM lParam, DWORD dwFlags)
 
int WINAPI EnumFontFamiliesA (HDC hdc, LPCSTR lpszFamily, FONTENUMPROCA lpEnumFontFamProc, LPARAM lParam)
 
DWORD WINAPI GetCharacterPlacementA (HDC hdc, LPCSTR lpString, INT uCount, INT nMaxExtent, GCP_RESULTSA *lpResults, DWORD dwFlags)
 
DWORD WINAPI GetCharacterPlacementW (HDC hdc, LPCWSTR lpString, INT uCount, INT nMaxExtent, GCP_RESULTSW *lpResults, DWORD dwFlags)
 
DWORD WINAPI NewGetCharacterPlacementW (HDC hdc, LPCWSTR lpString, INT uCount, INT nMaxExtent, GCP_RESULTSW *lpResults, DWORD dwFlags)
 
BOOL WINAPI GetCharABCWidthsFloatW (HDC hdc, UINT FirstChar, UINT LastChar, LPABCFLOAT abcF)
 
BOOL WINAPI GetCharWidthFloatW (HDC hdc, UINT iFirstChar, UINT iLastChar, PFLOAT pxBuffer)
 
BOOL WINAPI GetCharWidthW (HDC hdc, UINT iFirstChar, UINT iLastChar, LPINT lpBuffer)
 
BOOL WINAPI GetCharWidth32W (HDC hdc, UINT iFirstChar, UINT iLastChar, LPINT lpBuffer)
 
BOOL WINAPI GetCharABCWidthsW (HDC hdc, UINT FirstChar, UINT LastChar, LPABC lpabc)
 
BOOL WINAPI GetCharWidthA (HDC hdc, UINT iFirstChar, UINT iLastChar, LPINT lpBuffer)
 
BOOL WINAPI GetCharWidth32A (HDC hdc, UINT iFirstChar, UINT iLastChar, LPINT lpBuffer)
 
BOOL APIENTRY GetCharWidthFloatA (HDC hdc, UINT iFirstChar, UINT iLastChar, PFLOAT pxBuffer)
 
BOOL APIENTRY GetCharABCWidthsA (HDC hdc, UINT iFirstChar, UINT iLastChar, LPABC lpabc)
 
BOOL APIENTRY GetCharABCWidthsFloatA (HDC hdc, UINT iFirstChar, UINT iLastChar, LPABCFLOAT lpABCF)
 
BOOL WINAPI GetCharABCWidthsI (HDC hdc, UINT giFirst, UINT cgi, LPWORD pgi, LPABC lpabc)
 
BOOL WINAPI GetCharWidthI (HDC hdc, UINT giFirst, UINT cgi, LPWORD pgi, LPINT lpBuffer)
 
DWORD WINAPI GetFontLanguageInfo (HDC hDc)
 
DWORD WINAPI GetGlyphIndicesA (HDC hdc, LPCSTR lpstr, INT count, LPWORD pgi, DWORD flags)
 
DWORD WINAPI GetGlyphOutlineA (HDC hdc, UINT uChar, UINT uFormat, LPGLYPHMETRICS lpgm, DWORD cbBuffer, LPVOID lpvBuffer, CONST MAT2 *lpmat2)
 
DWORD WINAPI GetGlyphOutlineW (HDC hdc, UINT uChar, UINT uFormat, LPGLYPHMETRICS lpgm, DWORD cbBuffer, LPVOID lpvBuffer, CONST MAT2 *lpmat2)
 
DWORD WINAPI GetGlyphOutlineWow (DWORD a0, DWORD a1, DWORD a2, DWORD a3, DWORD a4, DWORD a5, DWORD a6)
 
UINT APIENTRY GetOutlineTextMetricsA (HDC hdc, UINT cbData, LPOUTLINETEXTMETRICA lpOTM)
 
static INT INTERNAL_YDSTOWS (XFORM *xForm, INT height)
 
static INT width_to_LP (XFORM *xForm, INT width)
 
static INT height_to_LP (XFORM *xForm, INT height)
 
UINT APIENTRY GetOutlineTextMetricsW (HDC hdc, UINT cbData, LPOUTLINETEXTMETRICW lpOTM)
 
DWORD WINAPI GetKerningPairsW (HDC hdc, ULONG cPairs, LPKERNINGPAIR pkpDst)
 
DWORD WINAPI GetKerningPairsA (HDC hDC, DWORD cPairs, LPKERNINGPAIR kern_pairA)
 
HFONT WINAPI CreateFontIndirectExA (const ENUMLOGFONTEXDVA *elfexd)
 
HFONT WINAPI CreateFontIndirectExW (const ENUMLOGFONTEXDVW *elfexd)
 
HFONT WINAPI CreateFontIndirectA (CONST LOGFONTA *lplf)
 
HFONT WINAPI CreateFontIndirectW (CONST LOGFONTW *lplf)
 
HFONT WINAPI CreateFontA (int nHeight, int nWidth, int nEscapement, int nOrientation, int fnWeight, DWORD fdwItalic, DWORD fdwUnderline, DWORD fdwStrikeOut, DWORD fdwCharSet, DWORD fdwOutputPrecision, DWORD fdwClipPrecision, DWORD fdwQuality, DWORD fdwPitchAndFamily, LPCSTR lpszFace)
 
HFONT WINAPI CreateFontW (int nHeight, int nWidth, int nEscapement, int nOrientation, int nWeight, DWORD fnItalic, DWORD fdwUnderline, DWORD fdwStrikeOut, DWORD fdwCharSet, DWORD fdwOutputPrecision, DWORD fdwClipPrecision, DWORD fdwQuality, DWORD fdwPitchAndFamily, LPCWSTR lpszFace)
 
PWSTR FASTCALL IntConvertFontPaths (_In_ PCWSTR pszFiles, _Out_ PDWORD pcFiles, _Out_ PDWORD pcwc, _Inout_ PDWORD pfl, _In_ BOOL bFlag)
 
BOOL WINAPI CreateScalableFontResourceA (DWORD fdwHidden, LPCSTR lpszFontRes, LPCSTR lpszFontFile, LPCSTR lpszCurrentPath)
 
INT WINAPI AddFontResourceExW (_In_ LPCWSTR lpszFilename, _In_ DWORD fl, _In_opt_ PVOID pvReserved)
 
INT WINAPI AddFontResourceExA (_In_ LPCSTR lpszFilename, _In_ DWORD fl, _In_opt_ PVOID pvReserved)
 
INT WINAPI AddFontResourceA (_In_ LPCSTR lpszFilename)
 
INT WINAPI AddFontResourceW (_In_ LPCWSTR lpszFilename)
 
BOOL WINAPI RemoveFontResourceW (_In_ LPCWSTR lpFileName)
 
BOOL WINAPI RemoveFontResourceA (_In_ LPCSTR lpFileName)
 
BOOL WINAPI RemoveFontResourceExA (_In_ LPCSTR lpFileName, _In_ DWORD fl, _In_opt_ PVOID pdv)
 
BOOL WINAPI RemoveFontResourceExW (_In_ LPCWSTR lpFileName, _In_ DWORD fl, _In_opt_ PVOID pdv)
 
LONG WINAPI GdiGetCharDimensions (HDC hdc, LPTEXTMETRICW lptm, LONG *height)
 
BOOL WINAPI TranslateCharsetInfo (LPDWORD lpSrc, LPCHARSETINFO lpCs, DWORD flags)
 
DWORD WINAPI SetMapperFlags (HDC hDC, DWORD flags)
 
int WINAPI EnumFontsW (HDC hDC, LPCWSTR lpFaceName, FONTENUMPROCW FontFunc, LPARAM lParam)
 
int WINAPI EnumFontsA (HDC hDC, LPCSTR lpFaceName, FONTENUMPROCA FontFunc, LPARAM lParam)
 
INT WINAPI NewEnumFontFamiliesExW (HDC hDC, LPLOGFONTW lpLogfont, FONTENUMPROCW lpEnumFontFamExProcW, LPARAM lParam, DWORD dwFlags)
 
INT WINAPI GdiAddFontResourceW (LPCWSTR lpszFilename, FLONG fl, DESIGNVECTOR *pdv)
 
HANDLE WINAPI AddFontMemResourceEx (PVOID pbFont, DWORD cbFont, PVOID pdv, DWORD *pcFonts)
 
BOOL WINAPI RemoveFontMemResourceEx (HANDLE fh)
 
int WINAPI AddFontResourceTracking (LPCSTR lpString, int unknown)
 
int WINAPI RemoveFontResourceTracking (LPCSTR lpString, int unknown)
 
BOOL WINAPI CreateScalableFontResourceW (DWORD fdwHidden, LPCWSTR lpszFontRes, LPCWSTR lpszFontFile, LPCWSTR lpszCurrentPath)
 
BOOL WINAPI bInitSystemAndFontsDirectoriesW (LPWSTR *SystemDir, LPWSTR *FontsDir)
 
BOOL WINAPI EudcLoadLinkW (LPCWSTR pBaseFaceName, LPCWSTR pEudcFontPath, INT iPriority, INT iFontLinkType)
 
BOOL WINAPI EudcUnloadLinkW (LPCWSTR pBaseFaceName, LPCWSTR pEudcFontPath)
 
ULONG WINAPI GetEUDCTimeStamp (VOID)
 
DWORD WINAPI GetEUDCTimeStampExW (LPWSTR lpBaseFaceName)
 
ULONG WINAPI GetFontAssocStatus (HDC hdc)
 
DWORD WINAPI QueryFontAssocStatus (VOID)
 
VOID WINAPI UnloadNetworkFonts (DWORD unknown)
 
DWORD WINAPI GetFontData (HDC hdc, DWORD dwTable, DWORD dwOffset, LPVOID lpvBuffer, DWORD cbData)
 
DWORD WINAPI cGetTTFFromFOT (DWORD x1, DWORD x2, DWORD x3, DWORD x4, DWORD x5, DWORD x6, DWORD x7)
 

Variables

static const CHARSETINFO FONT_tci [MAXTCIINDEX]
 

Macro Definition Documentation

◆ EfdFontFamilies

#define EfdFontFamilies   3

Definition at line 2491 of file font.c.

◆ IEFF_EXTENDED

#define IEFF_EXTENDED   2

Definition at line 254 of file font.c.

◆ IEFF_UNICODE

#define IEFF_UNICODE   1

Definition at line 253 of file font.c.

◆ IFFCX_CHARSET

#define IFFCX_CHARSET   1

Definition at line 210 of file font.c.

◆ IFFCX_STYLE

#define IFFCX_STYLE   2

Definition at line 211 of file font.c.

◆ INITIAL_FAMILY_COUNT

#define INITIAL_FAMILY_COUNT   64

Definition at line 74 of file font.c.

◆ MAXTCIINDEX

#define MAXTCIINDEX   32

Definition at line 32 of file font.c.

◆ NDEBUG

#define NDEBUG

Definition at line 17 of file font.c.

Function Documentation

◆ AddFontMemResourceEx()

HANDLE WINAPI AddFontMemResourceEx ( PVOID  pbFont,
DWORD  cbFont,
PVOID  pdv,
DWORD pcFonts 
)

Definition at line 2602 of file font.c.

2608{
2609 if ( pbFont && cbFont && pcFonts)
2610 {
2611 return NtGdiAddFontMemResourceEx(pbFont, cbFont, NULL, 0, pcFonts);
2612 }
2614 return NULL;
2615}
#define NULL
Definition: types.h:112
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define SetLastError(x)
Definition: compat.h:752
__kernel_entry W32KAPI HANDLE APIENTRY NtGdiAddFontMemResourceEx(_In_reads_bytes_(cjBuffer) const VOID *pvBuffer, _In_ DWORD cjBuffer, _In_reads_bytes_opt_(cjDV) const DESIGNVECTOR *pdv, _In_ ULONG cjDV, _Out_ PDWORD pNumFonts)
Definition: font.c:584

◆ AddFontResourceA()

INT WINAPI AddFontResourceA ( _In_ LPCSTR  lpszFilename)

Definition at line 2180 of file font.c.

2181{
2182 return AddFontResourceExA(lpszFilename, 0, NULL);
2183}
INT WINAPI AddFontResourceExA(_In_ LPCSTR pszFilename, _In_ DWORD fl, _Reserved_ PVOID pvReserved)

Referenced by Test_AddFontResourceA().

◆ AddFontResourceExA()

INT WINAPI AddFontResourceExA ( _In_ LPCSTR  lpszFilename,
_In_ DWORD  fl,
_In_opt_ PVOID  pvReserved 
)

Definition at line 2139 of file font.c.

2143{
2144 if (fl & ~(FR_PRIVATE | FR_NOT_ENUM))
2145 {
2147 return 0;
2148 }
2149
2150 if (!lpszFilename)
2151 return 0;
2152
2153 PWSTR FilenameW;
2154 WCHAR szBuff[MAX_PATH];
2155
2156 _SEH2_TRY
2157 {
2158 FilenameW = HEAP_strdupA2W_buf(lpszFilename, szBuff, _countof(szBuff));
2159 }
2161 {
2162 _SEH2_YIELD(return 0);
2163 }
2164 _SEH2_END;
2165
2166 if (!FilenameW)
2167 {
2169 return 0;
2170 }
2171
2172 INT ret = GdiAddFontResourceW(FilenameW, fl, NULL);
2173 HEAP_strdupA2W_buf_free(FilenameW, szBuff);
2174 return ret;
2175}
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13
#define MAX_PATH
Definition: compat.h:34
return ret
Definition: mutex.c:146
PWSTR FASTCALL HEAP_strdupA2W_buf(_In_ PCSTR lpszA, _In_ PWSTR pszStaticBuff, _In_ SIZE_T cchStaticBuff)
Definition: heap.c:53
static VOID FASTCALL HEAP_strdupA2W_buf_free(_In_opt_ PWSTR pszDynamicBuff, _In_ PWSTR pszStaticBuff)
Definition: gdi32p.h:244
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:90
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:104
#define _SEH2_END
Definition: pseh2_64.h:194
#define _SEH2_TRY
Definition: pseh2_64.h:93
#define _SEH2_YIELD(__stmt)
Definition: pseh2_64.h:207
#define _countof(array)
Definition: sndvol32.h:70
uint16_t * PWSTR
Definition: typedefs.h:56
int32_t INT
Definition: typedefs.h:58
INT WINAPI GdiAddFontResourceW(LPCWSTR lpszFilename, FLONG fl, DESIGNVECTOR *pdv)
Definition: font.c:2571
_In_ FLONG fl
Definition: winddi.h:1279
__wchar_t WCHAR
Definition: xmlstorage.h:180

◆ AddFontResourceExW()

INT WINAPI AddFontResourceExW ( _In_ LPCWSTR  lpszFilename,
_In_ DWORD  fl,
_In_opt_ PVOID  pvReserved 
)

Definition at line 2122 of file font.c.

2126{
2127 if (fl & ~(FR_PRIVATE | FR_NOT_ENUM))
2128 {
2130 return 0;
2131 }
2132
2133 return GdiAddFontResourceW(lpszFilename, fl, NULL);
2134}

◆ AddFontResourceTracking()

int WINAPI AddFontResourceTracking ( LPCSTR  lpString,
int  unknown 
)

Definition at line 2638 of file font.c.

2642{
2645 return 0;
2646}
#define UNIMPLEMENTED
Definition: ntoskrnl.c:15
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:102

◆ AddFontResourceW()

INT WINAPI AddFontResourceW ( _In_ LPCWSTR  lpszFilename)

Definition at line 2188 of file font.c.

2189{
2190 return GdiAddFontResourceW(lpszFilename, 0, NULL);
2191}

Referenced by DoEntry(), DoInstallFontFile(), and wWinMain().

◆ bInitSystemAndFontsDirectoriesW()

BOOL WINAPI bInitSystemAndFontsDirectoriesW ( LPWSTR SystemDir,
LPWSTR FontsDir 
)

Definition at line 2693 of file font.c.

2694{
2697 return 0;
2698}

◆ cGetTTFFromFOT()

DWORD WINAPI cGetTTFFromFOT ( DWORD  x1,
DWORD  x2,
DWORD  x3,
DWORD  x4,
DWORD  x5,
DWORD  x6,
DWORD  x7 
)

Definition at line 2816 of file font.c.

2817{
2820 return 0;
2821}

◆ CreateFontA()

HFONT WINAPI CreateFontA ( int  nHeight,
int  nWidth,
int  nEscapement,
int  nOrientation,
int  fnWeight,
DWORD  fdwItalic,
DWORD  fdwUnderline,
DWORD  fdwStrikeOut,
DWORD  fdwCharSet,
DWORD  fdwOutputPrecision,
DWORD  fdwClipPrecision,
DWORD  fdwQuality,
DWORD  fdwPitchAndFamily,
LPCSTR  lpszFace 
)

Definition at line 1867 of file font.c.

1883{
1884 ANSI_STRING StringA;
1885 UNICODE_STRING StringU;
1886 HFONT ret;
1887
1888 RtlInitAnsiString(&StringA, lpszFace);
1889 RtlAnsiStringToUnicodeString(&StringU, &StringA, TRUE);
1890
1891 ret = CreateFontW(nHeight,
1892 nWidth,
1893 nEscapement,
1894 nOrientation,
1895 fnWeight,
1896 fdwItalic,
1897 fdwUnderline,
1898 fdwStrikeOut,
1899 fdwCharSet,
1900 fdwOutputPrecision,
1901 fdwClipPrecision,
1902 fdwQuality,
1903 fdwPitchAndFamily,
1904 StringU.Buffer);
1905
1906 RtlFreeUnicodeString(&StringU);
1907
1908 return ret;
1909}
#define TRUE
Definition: types.h:120
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
NTSYSAPI NTSTATUS NTAPI RtlAnsiStringToUnicodeString(PUNICODE_STRING DestinationString, PANSI_STRING SourceString, BOOLEAN AllocateDestinationString)
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
NTSYSAPI VOID NTAPI RtlInitAnsiString(PANSI_STRING DestinationString, PCSZ SourceString)
HFONT WINAPI CreateFontW(_In_ int, _In_ int, _In_ int, _In_ int, _In_ int, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_opt_ LPCWSTR)

◆ CreateFontIndirectA()

HFONT WINAPI CreateFontIndirectA ( CONST LOGFONTA lplf)

Definition at line 1722 of file font.c.

1725{
1726 if (lplf)
1727 {
1728 LOGFONTW tlf;
1729
1730 LogFontA2W(&tlf, lplf);
1731 return CreateFontIndirectW(&tlf);
1732 }
1733 else return NULL;
1734}
VOID NTAPI LogFontA2W(LPLOGFONTW pW, CONST LOGFONTA *pA)
Definition: utils.c:348
HFONT WINAPI CreateFontIndirectW(_In_ const LOGFONTW *)

◆ CreateFontIndirectExA()

HFONT WINAPI CreateFontIndirectExA ( const ENUMLOGFONTEXDVA elfexd)

Definition at line 1680 of file font.c.

1681{
1682 if (elfexd)
1683 {
1684 ENUMLOGFONTEXDVW Logfont;
1685
1687 &Logfont.elfEnumLogfontEx );
1688
1690 &elfexd->elfDesignVector,
1691 sizeof(DESIGNVECTOR));
1692
1693 return NtGdiHfontCreate( &Logfont, 0, 0, 0, NULL);
1694 }
1695 else return NULL;
1696}
VOID WINAPI EnumLogFontExW2A(LPENUMLOGFONTEXA fontA, CONST ENUMLOGFONTEXW *fontW)
Definition: utils.c:402
__kernel_entry W32KAPI HFONT APIENTRY NtGdiHfontCreate(_In_reads_bytes_(cjElfw) const ENUMLOGFONTEXDVW *pelfw, _In_ ULONG cjElfw, _In_ LFTYPE lft, _In_ FLONG fl, _In_opt_ PVOID pvCliData)
Definition: font.c:1277
DESIGNVECTOR elfDesignVector
Definition: wingdi.h:3221
DESIGNVECTOR elfDesignVector
Definition: wingdi.h:3226
ENUMLOGFONTEXW elfEnumLogfontEx
Definition: wingdi.h:3225
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263

Referenced by Test_CreateFontIndirectExA().

◆ CreateFontIndirectExW()

HFONT WINAPI CreateFontIndirectExW ( const ENUMLOGFONTEXDVW elfexd)

Definition at line 1704 of file font.c.

1705{
1706 /* Msdn: Note, this function ignores the elfDesignVector member in
1707 ENUMLOGFONTEXDV.
1708 */
1709 if ( elfexd )
1710 {
1711 return NtGdiHfontCreate((PENUMLOGFONTEXDVW) elfexd, 0, 0, 0, NULL );
1712 }
1713 else return NULL;
1714}

Referenced by CreateFontIndirectW(), and Test_CreateFontIndirectExW().

◆ CreateFontIndirectW()

HFONT WINAPI CreateFontIndirectW ( CONST LOGFONTW lplf)

Definition at line 1826 of file font.c.

1829{
1830#if 0
1831 static BOOL bDidTest = FALSE;
1832 if (!bDidTest)
1833 {
1834 bDidTest = TRUE;
1835 DoFontSystemUnittest();
1836 }
1837#endif
1838 if (lplf)
1839 {
1840 ENUMLOGFONTEXDVW Logfont;
1841
1842 RtlCopyMemory( &Logfont.elfEnumLogfontEx.elfLogFont, lplf, sizeof(LOGFONTW));
1843 // Need something other than just cleaning memory here.
1844 // Guess? Use caller data to determine the rest.
1846 sizeof(Logfont.elfEnumLogfontEx.elfFullName));
1848 sizeof(Logfont.elfEnumLogfontEx.elfStyle));
1850 sizeof(Logfont.elfEnumLogfontEx.elfScript));
1851
1852 Logfont.elfDesignVector.dvNumAxes = 0; // No more than MM_MAX_NUMAXES
1853
1854 RtlZeroMemory( &Logfont.elfDesignVector, sizeof(DESIGNVECTOR));
1855
1856 return CreateFontIndirectExW(&Logfont);
1857 }
1858 else return NULL;
1859}
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
DWORD dvNumAxes
Definition: wingdi.h:3215
WCHAR elfStyle[LF_FACESIZE]
Definition: wingdi.h:3150
LOGFONTW elfLogFont
Definition: wingdi.h:3148
WCHAR elfFullName[LF_FULLFACESIZE]
Definition: wingdi.h:3149
WCHAR elfScript[LF_FACESIZE]
Definition: wingdi.h:3151
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
HFONT WINAPI CreateFontIndirectExW(const ENUMLOGFONTEXDVW *elfexd)
Definition: font.c:1704

◆ CreateFontW()

HFONT WINAPI CreateFontW ( int  nHeight,
int  nWidth,
int  nEscapement,
int  nOrientation,
int  nWeight,
DWORD  fnItalic,
DWORD  fdwUnderline,
DWORD  fdwStrikeOut,
DWORD  fdwCharSet,
DWORD  fdwOutputPrecision,
DWORD  fdwClipPrecision,
DWORD  fdwQuality,
DWORD  fdwPitchAndFamily,
LPCWSTR  lpszFace 
)

Definition at line 1917 of file font.c.

1933{
1934 LOGFONTW logfont;
1935
1936 logfont.lfHeight = nHeight;
1937 logfont.lfWidth = nWidth;
1938 logfont.lfEscapement = nEscapement;
1939 logfont.lfOrientation = nOrientation;
1940 logfont.lfWeight = nWeight;
1941 logfont.lfItalic = (BYTE)fnItalic;
1942 logfont.lfUnderline = (BYTE)fdwUnderline;
1943 logfont.lfStrikeOut = (BYTE)fdwStrikeOut;
1944 logfont.lfCharSet = (BYTE)fdwCharSet;
1945 logfont.lfOutPrecision = (BYTE)fdwOutputPrecision;
1946 logfont.lfClipPrecision = (BYTE)fdwClipPrecision;
1947 logfont.lfQuality = (BYTE)fdwQuality;
1948 logfont.lfPitchAndFamily = (BYTE)fdwPitchAndFamily;
1949
1950 if (NULL != lpszFace)
1951 {
1952 int Size = sizeof(logfont.lfFaceName) / sizeof(WCHAR);
1953 wcsncpy((wchar_t *)logfont.lfFaceName, lpszFace, Size - 1);
1954 /* Be 101% sure to have '\0' at end of string */
1955 logfont.lfFaceName[Size - 1] = '\0';
1956 }
1957 else
1958 {
1959 logfont.lfFaceName[0] = L'\0';
1960 }
1961
1962 return CreateFontIndirectW(&logfont);
1963}
#define L(x)
Definition: resources.c:13
wcsncpy
BYTE lfOutPrecision
Definition: dimm.idl:68
BYTE lfStrikeOut
Definition: dimm.idl:66
BYTE lfItalic
Definition: dimm.idl:64
LONG lfHeight
Definition: dimm.idl:59
LONG lfWeight
Definition: dimm.idl:63
WCHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:72
LONG lfOrientation
Definition: dimm.idl:62
LONG lfWidth
Definition: dimm.idl:60
BYTE lfUnderline
Definition: dimm.idl:65
BYTE lfClipPrecision
Definition: dimm.idl:69
LONG lfEscapement
Definition: dimm.idl:61
BYTE lfCharSet
Definition: dimm.idl:67
BYTE lfQuality
Definition: dimm.idl:70
BYTE lfPitchAndFamily
Definition: dimm.idl:71
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4539
unsigned char BYTE
Definition: xxhash.c:193

◆ CreateScalableFontResourceA()

BOOL WINAPI CreateScalableFontResourceA ( DWORD  fdwHidden,
LPCSTR  lpszFontRes,
LPCSTR  lpszFontFile,
LPCSTR  lpszCurrentPath 
)

Definition at line 2109 of file font.c.

2115{
2116 return FALSE;
2117}

◆ CreateScalableFontResourceW()

BOOL WINAPI CreateScalableFontResourceW ( DWORD  fdwHidden,
LPCWSTR  lpszFontRes,
LPCWSTR  lpszFontFile,
LPCWSTR  lpszCurrentPath 
)

Definition at line 2662 of file font.c.

2668{
2669 HANDLE f;
2670
2672
2673 /* fHidden=1 - only visible for the calling app, read-only, not
2674 * enumerated with EnumFonts/EnumFontFamilies
2675 * lpszCurrentPath can be NULL
2676 */
2677
2678 /* If the output file already exists, return the ERROR_FILE_EXISTS error as specified in MSDN */
2679 if ((f = CreateFileW(lpszFontRes, 0, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0)) != INVALID_HANDLE_VALUE)
2680 {
2681 CloseHandle(f);
2683 return FALSE;
2684 }
2685 return FALSE; /* create failed */
2686}
#define CloseHandle
Definition: compat.h:739
#define OPEN_EXISTING
Definition: compat.h:775
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define CreateFileW
Definition: compat.h:741
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
GLfloat f
Definition: glext.h:7540
#define f
Definition: ke_i.h:83
#define ERROR_FILE_EXISTS
Definition: winerror.h:287

◆ EnumFontFamiliesA()

int WINAPI EnumFontFamiliesA ( HDC  hdc,
LPCSTR  lpszFamily,
FONTENUMPROCA  lpEnumFontFamProc,
LPARAM  lParam 
)

Definition at line 482 of file font.c.

484{
485 LOGFONTW LogFont;
486
487 DPRINT("EnumFontFamiliesA(%p, %s, %p, %p)\n",
488 hdc, lpszFamily, lpEnumFontFamProc, lParam);
489
490 ZeroMemory(&LogFont, sizeof(LOGFONTW));
491 LogFont.lfCharSet = DEFAULT_CHARSET;
492 if (NULL != lpszFamily)
493 {
494 if (!*lpszFamily) return 1;
495 MultiByteToWideChar(CP_THREAD_ACP, 0, lpszFamily, -1, LogFont.lfFaceName, LF_FACESIZE);
496 }
497
498 return IntEnumFontFamilies(hdc, &LogFont, lpEnumFontFamProc, lParam, 0);
499}
LPARAM lParam
Definition: combotst.c:139
#define LF_FACESIZE
Definition: dimm.idl:39
#define MultiByteToWideChar
Definition: compat.h:110
#define ZeroMemory
Definition: minwinbase.h:31
HDC hdc
Definition: main.c:9
#define DPRINT
Definition: sndvol32.h:73
static int FASTCALL IntEnumFontFamilies(HDC Dc, const LOGFONTW *LogFont, PVOID EnumProc, LPARAM lParam, DWORD dwFlags)
Definition: font.c:290
#define DEFAULT_CHARSET
Definition: wingdi.h:384
#define CP_THREAD_ACP
Definition: winnls.h:251

◆ EnumFontFamiliesExA()

int WINAPI EnumFontFamiliesExA ( HDC  hdc,
LPLOGFONTA  lpLogfont,
FONTENUMPROCA  lpEnumFontFamExProc,
LPARAM  lParam,
DWORD  dwFlags 
)

Definition at line 449 of file font.c.

451{
452 LOGFONTW LogFontW, *pLogFontW;
453
454 if (lpLogfont)
455 {
456 DPRINT("EnumFontFamiliesExA(%p, %p(%s, %u, %u), %p, %p, 0x%08lX)\n",
457 hdc, lpLogfont, lpLogfont->lfFaceName, lpLogfont->lfCharSet,
458 lpLogfont->lfPitchAndFamily, lpEnumFontFamExProc, lParam, dwFlags);
459 }
460 else
461 {
462 DPRINT("EnumFontFamiliesExA(%p, NULL, %p, %p, 0x%08lX)\n",
463 hdc, lpEnumFontFamExProc, lParam, dwFlags);
464 }
465
466 if (lpLogfont)
467 {
468 LogFontA2W(&LogFontW,lpLogfont);
469 pLogFontW = &LogFontW;
470 }
471 else pLogFontW = NULL;
472
473 /* no need to convert LogFontW back to lpLogFont b/c it's an [in] parameter only */
474 return IntEnumFontFamilies(hdc, pLogFontW, lpEnumFontFamExProc, lParam, IEFF_EXTENDED);
475}
_In_ LPWSTR _In_ DWORD _In_ DWORD _In_ DWORD dwFlags
Definition: netsh.h:141
BYTE lfCharSet
Definition: wingdi.h:2335
BYTE lfPitchAndFamily
Definition: wingdi.h:2339
CHAR lfFaceName[LF_FACESIZE]
Definition: wingdi.h:2340
#define IEFF_EXTENDED
Definition: font.c:254

◆ EnumFontFamiliesExW()

int WINAPI EnumFontFamiliesExW ( HDC  hdc,
LPLOGFONTW  lpLogfont,
FONTENUMPROCW  lpEnumFontFamExProc,
LPARAM  lParam,
DWORD  dwFlags 
)

Definition at line 402 of file font.c.

404{
405 if (lpLogfont)
406 {
407 DPRINT("EnumFontFamiliesExW(%p, %p(%S, %u, %u), %p, %p, 0x%08lX)\n",
408 hdc, lpLogfont, lpLogfont->lfFaceName, lpLogfont->lfCharSet,
409 lpLogfont->lfPitchAndFamily, lpEnumFontFamExProc, lParam, dwFlags);
410 }
411 else
412 {
413 DPRINT("EnumFontFamiliesExW(%p, NULL, %p, %p, 0x%08lX)\n",
414 hdc, lpEnumFontFamExProc, lParam, dwFlags);
415 }
416 return IntEnumFontFamilies(hdc, lpLogfont, lpEnumFontFamExProc, lParam,
418}
BYTE lfCharSet
Definition: wingdi.h:2351
WCHAR lfFaceName[LF_FACESIZE]
Definition: wingdi.h:2356
BYTE lfPitchAndFamily
Definition: wingdi.h:2355
#define IEFF_UNICODE
Definition: font.c:253

◆ EnumFontFamiliesW()

int WINAPI EnumFontFamiliesW ( HDC  hdc,
LPCWSTR  lpszFamily,
FONTENUMPROCW  lpEnumFontFamProc,
LPARAM  lParam 
)

Definition at line 425 of file font.c.

427{
428 LOGFONTW LogFont;
429
430 DPRINT("EnumFontFamiliesW(%p, %S, %p, %p)\n",
431 hdc, lpszFamily, lpEnumFontFamProc, lParam);
432
433 ZeroMemory(&LogFont, sizeof(LOGFONTW));
434 LogFont.lfCharSet = DEFAULT_CHARSET;
435 if (NULL != lpszFamily)
436 {
437 if (!*lpszFamily) return 1;
438 lstrcpynW(LogFont.lfFaceName, lpszFamily, LF_FACESIZE);
439 }
440
441 return IntEnumFontFamilies(hdc, &LogFont, lpEnumFontFamProc, lParam, IEFF_UNICODE);
442}
#define lstrcpynW
Definition: compat.h:738

◆ EnumFontsA()

int WINAPI EnumFontsA ( HDC  hDC,
LPCSTR  lpFaceName,
FONTENUMPROCA  FontFunc,
LPARAM  lParam 
)

Definition at line 2464 of file font.c.

2470{
2471#if 0
2473 LPWSTR lpFaceNameW;
2474 int rc = 0;
2475
2476 Status = HEAP_strdupA2W ( &lpFaceNameW, lpFaceName );
2477 if (!NT_SUCCESS (Status))
2479 else
2480 {
2481 rc = NtGdiEnumFonts ( hDC, lpFaceNameW, FontFunc, lParam );
2482
2483 HEAP_free ( lpFaceNameW );
2484 }
2485 return rc;
2486#else
2487 return EnumFontFamiliesA( hDC, lpFaceName, FontFunc, lParam );
2488#endif
2489}
static HDC hDC
Definition: 3dtext.c:33
LONG NTSTATUS
Definition: precomp.h:26
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
static VOID FASTCALL HEAP_free(_In_ __drv_freesMem(Mem) PVOID memory)
Definition: gdi32p.h:226
NTSTATUS FASTCALL HEAP_strdupA2W(_Outptr_ PWSTR *ppszW, _In_ PCSTR lpszA)
Definition: heap.c:34
Status
Definition: gdiplustypes.h:25
__kernel_entry W32KAPI BOOL APIENTRY NtGdiEnumFonts(_In_ HDC hdc, _In_ ULONG iEnumType, _In_ FLONG flWin31Compat, _In_ ULONG cchFaceName, _In_reads_opt_(cchFaceName) LPCWSTR pwszFaceName, _In_ ULONG lfCharSet, _Inout_ ULONG *pulCount, _Out_writes_bytes_opt_(*pulCount) PVOID pvUserModeBuffer)
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
int WINAPI EnumFontFamiliesA(_In_ HDC, _In_opt_ LPCSTR, _In_ FONTENUMPROCA, _In_ LPARAM)
WCHAR * LPWSTR
Definition: xmlstorage.h:184

◆ EnumFontsW()

int WINAPI EnumFontsW ( HDC  hDC,
LPCWSTR  lpFaceName,
FONTENUMPROCW  FontFunc,
LPARAM  lParam 
)

Definition at line 2445 of file font.c.

2451{
2452#if 0
2453 return NtGdiEnumFonts ( hDC, lpFaceName, FontFunc, lParam );
2454#else
2455 return EnumFontFamiliesW( hDC, lpFaceName, FontFunc, lParam );
2456#endif
2457}
int WINAPI EnumFontFamiliesW(_In_ HDC, _In_opt_ LPCWSTR, _In_ FONTENUMPROCW, _In_ LPARAM)

◆ EudcLoadLinkW()

BOOL WINAPI EudcLoadLinkW ( LPCWSTR  pBaseFaceName,
LPCWSTR  pEudcFontPath,
INT  iPriority,
INT  iFontLinkType 
)

Definition at line 2705 of file font.c.

2706{
2709 return 0;
2710}

◆ EudcUnloadLinkW()

BOOL WINAPI EudcUnloadLinkW ( LPCWSTR  pBaseFaceName,
LPCWSTR  pEudcFontPath 
)

Definition at line 2717 of file font.c.

2718{
2721 return 0;
2722}

◆ FONT_GetCharsByRangeA()

static LPSTR FONT_GetCharsByRangeA ( HDC  hdc,
UINT  firstChar,
UINT  lastChar,
PINT  pByteLen 
)
static

Definition at line 148 of file font.c.

149{
150 INT i, count = lastChar - firstChar + 1;
151 UINT c;
152 LPSTR str;
153
154 if (count <= 0)
155 return NULL;
156
157 switch (GdiGetCodePage(hdc))
158 {
159 case 932:
160 case 936:
161 case 949:
162 case 950:
163 case 1361:
164 if (lastChar > 0xffff)
165 return NULL;
166 if ((firstChar ^ lastChar) > 0xff)
167 return NULL;
168 break;
169 default:
170 if (lastChar > 0xff)
171 return NULL;
172 break;
173 }
174
175 str = HeapAlloc(GetProcessHeap(), 0, count * 2 + 1);
176 if (str == NULL)
177 return NULL;
178
179 for(i = 0, c = firstChar; c <= lastChar; i++, c++)
180 {
181 if (c > 0xff)
182 str[i++] = (BYTE)(c >> 8);
183 str[i] = (BYTE)c;
184 }
185 str[i] = '\0';
186
187 *pByteLen = i;
188
189 return str;
190}
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
GLuint GLuint GLsizei count
Definition: gl.h:1545
const GLubyte * c
Definition: glext.h:8905
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define c
Definition: ke_i.h:80
unsigned int UINT
Definition: ndis.h:50
const WCHAR * str
DWORD WINAPI GdiGetCodePage(HDC)
char * LPSTR
Definition: xmlstorage.h:182

Referenced by GetCharABCWidthsA(), GetCharABCWidthsFloatA(), GetCharWidth32A(), GetCharWidthA(), and GetCharWidthFloatA().

◆ FONT_mbtowc()

static LPWSTR FONT_mbtowc ( HDC  hdc,
LPCSTR  str,
INT  count,
INT plenW,
UINT pCP 
)
static

Definition at line 126 of file font.c.

127{
129 INT lenW;
130 LPWSTR strW;
131
132 if(count == -1) count = strlen(str);
133 lenW = MultiByteToWideChar(cp, 0, str, count, NULL, 0);
134 strW = HeapAlloc(GetProcessHeap(), 0, lenW*sizeof(WCHAR));
135 if (!strW)
136 return NULL;
137 if(!MultiByteToWideChar(cp, 0, str, count, strW, lenW))
138 {
140 return NULL;
141 }
142 DPRINT("mapped %s -> %S\n", str, strW);
143 if(plenW) *plenW = lenW;
144 if(pCP) *pCP = cp;
145 return strW;
146}
#define HeapFree(x, y, z)
Definition: compat.h:735
_ACRTIMP size_t __cdecl strlen(const char *)
Definition: string.c:1592
POINT cp
Definition: magnifier.c:59
WCHAR strW[12]
Definition: clipboard.c:2216

Referenced by GetCharABCWidthsA(), GetCharABCWidthsFloatA(), GetCharacterPlacementA(), GetCharWidth32A(), GetCharWidthA(), GetCharWidthFloatA(), GetGlyphIndicesA(), and GetGlyphOutlineA().

◆ FONT_TextMetricWToA()

VOID FASTCALL FONT_TextMetricWToA ( const TEXTMETRICW ptmW,
LPTEXTMETRICA  ptmA 
)

Definition at line 81 of file font.c.

82{
83 ptmA->tmHeight = ptmW->tmHeight;
84 ptmA->tmAscent = ptmW->tmAscent;
85 ptmA->tmDescent = ptmW->tmDescent;
88 ptmA->tmAveCharWidth = ptmW->tmAveCharWidth;
89 ptmA->tmMaxCharWidth = ptmW->tmMaxCharWidth;
90 ptmA->tmWeight = ptmW->tmWeight;
91 ptmA->tmOverhang = ptmW->tmOverhang;
94 ptmA->tmFirstChar = min(ptmW->tmFirstChar, 255);
95 if (ptmW->tmCharSet == SYMBOL_CHARSET)
96 {
97 ptmA->tmFirstChar = 0x1e;
98 ptmA->tmLastChar = 0xff; /* win9x behaviour - we need the OS2 table data to calculate correctly */
99 }
100 else
101 {
102 ptmA->tmFirstChar = ptmW->tmDefaultChar - 1;
103 ptmA->tmLastChar = min(ptmW->tmLastChar, 0xff);
104 }
105 ptmA->tmDefaultChar = (CHAR)ptmW->tmDefaultChar;
106 ptmA->tmBreakChar = (CHAR)ptmW->tmBreakChar;
107 ptmA->tmItalic = ptmW->tmItalic;
108 ptmA->tmUnderlined = ptmW->tmUnderlined;
109 ptmA->tmStruckOut = ptmW->tmStruckOut;
111 ptmA->tmCharSet = ptmW->tmCharSet;
112}
#define CHAR(Char)
#define min(a, b)
Definition: monoChain.cc:55
BYTE tmStruckOut
Definition: wingdi.h:2824
BYTE tmPitchAndFamily
Definition: wingdi.h:2825
BYTE tmCharSet
Definition: wingdi.h:2826
LONG tmDescent
Definition: wingdi.h:2809
LONG tmDigitizedAspectX
Definition: wingdi.h:2816
BYTE tmFirstChar
Definition: wingdi.h:2818
LONG tmExternalLeading
Definition: wingdi.h:2811
LONG tmWeight
Definition: wingdi.h:2814
BYTE tmBreakChar
Definition: wingdi.h:2821
LONG tmInternalLeading
Definition: wingdi.h:2810
BYTE tmLastChar
Definition: wingdi.h:2819
BYTE tmUnderlined
Definition: wingdi.h:2823
LONG tmMaxCharWidth
Definition: wingdi.h:2813
LONG tmAveCharWidth
Definition: wingdi.h:2812
BYTE tmDefaultChar
Definition: wingdi.h:2820
LONG tmAscent
Definition: wingdi.h:2808
LONG tmOverhang
Definition: wingdi.h:2815
LONG tmHeight
Definition: wingdi.h:2807
BYTE tmItalic
Definition: wingdi.h:2822
LONG tmDigitizedAspectY
Definition: wingdi.h:2817
WCHAR tmFirstChar
Definition: wingdi.h:2840
LONG tmDigitizedAspectX
Definition: wingdi.h:2838
LONG tmDigitizedAspectY
Definition: wingdi.h:2839
LONG tmOverhang
Definition: wingdi.h:2837
LONG tmAveCharWidth
Definition: wingdi.h:2834
LONG tmAscent
Definition: wingdi.h:2830
LONG tmMaxCharWidth
Definition: wingdi.h:2835
BYTE tmItalic
Definition: wingdi.h:2844
BYTE tmStruckOut
Definition: wingdi.h:2846
LONG tmInternalLeading
Definition: wingdi.h:2832
BYTE tmUnderlined
Definition: wingdi.h:2845
LONG tmExternalLeading
Definition: wingdi.h:2833
BYTE tmPitchAndFamily
Definition: wingdi.h:2847
LONG tmWeight
Definition: wingdi.h:2836
WCHAR tmBreakChar
Definition: wingdi.h:2843
WCHAR tmDefaultChar
Definition: wingdi.h:2842
BYTE tmCharSet
Definition: wingdi.h:2848
WCHAR tmLastChar
Definition: wingdi.h:2841
LONG tmHeight
Definition: wingdi.h:2829
LONG tmDescent
Definition: wingdi.h:2831
#define SYMBOL_CHARSET
Definition: wingdi.h:385
char CHAR
Definition: xmlstorage.h:175

Referenced by GetOutlineTextMetricsA(), GetTextMetricsA(), and NewTextMetricW2A().

◆ GDI_ROUND()

static __inline INT GDI_ROUND ( FLOAT  val)
static

Definition at line 24 of file font.c.

25{
26 return (int)floor(val + 0.5);
27}
_ACRTIMP double __cdecl floor(double)
Definition: floor.c:18
GLuint GLfloat * val
Definition: glext.h:7180

Referenced by height_to_LP(), INTERNAL_YDSTOWS(), and width_to_LP().

◆ GdiAddFontResourceW()

INT WINAPI GdiAddFontResourceW ( LPCWSTR  lpszFilename,
FLONG  fl,
DESIGNVECTOR pdv 
)

Definition at line 2571 of file font.c.

2575{
2576 ULONG cFiles, cwc;
2577 PWSTR pszConverted = IntConvertFontPaths(lpszFilename, &cFiles, &cwc, &fl, FALSE);
2578 if (!pszConverted)
2579 return 0;
2580
2581 INT ret = NtGdiAddFontResourceW(pszConverted, cwc, cFiles, fl, 0, pdv);
2582 HEAP_free(pszConverted);
2583 if (ret)
2584 return ret;
2585
2586 pszConverted = IntConvertFontPaths(lpszFilename, &cFiles, &cwc, &fl, TRUE);
2587 if (!pszConverted)
2588 return 0;
2589
2590 ret = NtGdiAddFontResourceW(pszConverted, cwc, cFiles, fl, 0, pdv);
2591 HEAP_free(pszConverted);
2592 if (!ret)
2594 return ret;
2595}
INT APIENTRY NtGdiAddFontResourceW(_In_reads_(cwc) WCHAR *pwszFiles, _In_ ULONG cwc, _In_ ULONG cFiles, _In_ FLONG f, _In_ DWORD dwPidTid, _In_opt_ DESIGNVECTOR *pdv)
uint32_t ULONG
Definition: typedefs.h:59
PWSTR FASTCALL IntConvertFontPaths(_In_ PCWSTR pszFiles, _Out_ PDWORD pcFiles, _Out_ PDWORD pcwc, _Inout_ PDWORD pfl, _In_ BOOL bFlag)
Definition: font.c:1968
_In_ ULONG_PTR _In_opt_ DESIGNVECTOR * pdv
Definition: winddi.h:3723

Referenced by AddFontResourceExA(), AddFontResourceExW(), and AddFontResourceW().

◆ GdiGetCharDimensions()

LONG WINAPI GdiGetCharDimensions ( HDC  hdc,
LPTEXTMETRICW  lptm,
LONG height 
)

Definition at line 2314 of file font.c.

2315{
2316 SIZE sz;
2318 static const WCHAR alphabet[] =
2319 {
2320 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q',
2321 'r','s','t','u','v','w','x','y','z','A','B','C','D','E','F','G','H',
2322 'I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',0
2323 };
2324
2325 if(!GetTextMetricsW(hdc, &tm)) return 0;
2326
2327 if(!GetTextExtentPointW(hdc, alphabet, 52, &sz)) return 0;
2328
2329 if (lptm) *lptm = tm;
2330 if (height) *height = tm.tmHeight;
2331
2332 return (sz.cx / 26 + 1) / 2;
2333}
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
static LPTEXTMETRICW lptm
Definition: font.c:42
LONG cx
Definition: kdterminal.h:27
BOOL WINAPI GetTextMetricsW(_In_ HDC, _Out_ LPTEXTMETRICW)
Definition: text.c:221
BOOL WINAPI GetTextExtentPointW(_In_ HDC hdc, _In_reads_(c) LPCWSTR lpString, _In_ int c, _Out_ LPSIZE lpsz)

Referenced by CalculateCharWidth(), DIALOG_CreateIndirect(), EDIT_EM_SetMargins(), EDIT_UpdateUniscribeData_linedef(), GetDialogBaseUnits(), LoadDialog(), OleCreatePropertyFrameIndirect(), SoftModalMessageBox(), taskdialog_init(), Test_GdiGetCharDimensions(), test_margins_default(), and test_margins_usefontinfo().

◆ GetCharABCWidthsA()

BOOL APIENTRY GetCharABCWidthsA ( HDC  hdc,
UINT  iFirstChar,
UINT  iLastChar,
LPABC  lpabc 
)

Definition at line 949 of file font.c.

955{
956 INT wlen, count = 0;
957 LPSTR str;
958 LPWSTR wstr;
959 BOOL ret = TRUE;
960
961 DPRINT("GetCharABCWidthsA\n");
962
963 str = FONT_GetCharsByRangeA(hdc, iFirstChar, iLastChar, &count);
964 if (!str)
965 return FALSE;
966
967 wstr = FONT_mbtowc(hdc, str, count+1, &wlen, NULL);
968 if (!wstr)
969 {
971 return FALSE;
972 }
973
975 wstr[0],
976 wlen - 1,
977 (PWCHAR)wstr,
979 (PVOID)lpabc);
980
982 HeapFree(GetProcessHeap(), 0, wstr);
983
984 return ret;
985}
__kernel_entry W32KAPI BOOL APIENTRY NtGdiGetCharABCWidthsW(_In_ HDC hdc, _In_ UINT wchFirst, _In_ UINT cwch, _In_reads_opt_(cwch) PCWCH pwch, _In_ FLONG fl, _Out_writes_bytes_(cwch *sizeof(ABC)) PVOID pvBuf)
#define GCABCW_NOFLOAT
Definition: ntgdityp.h:209
uint16_t * PWCHAR
Definition: typedefs.h:56
static LPSTR FONT_GetCharsByRangeA(HDC hdc, UINT firstChar, UINT lastChar, PINT pByteLen)
Definition: font.c:148
static LPWSTR FONT_mbtowc(HDC hdc, LPCSTR str, INT count, INT *plenW, UINT *pCP)
Definition: font.c:126

◆ GetCharABCWidthsFloatA()

BOOL APIENTRY GetCharABCWidthsFloatA ( HDC  hdc,
UINT  iFirstChar,
UINT  iLastChar,
LPABCFLOAT  lpABCF 
)

Definition at line 992 of file font.c.

998{
999 INT wlen, count = 0;
1000 LPSTR str;
1001 LPWSTR wstr;
1002 BOOL ret = TRUE;
1003
1004 DPRINT("GetCharABCWidthsFloatA\n");
1005
1006 str = FONT_GetCharsByRangeA(hdc, iFirstChar, iLastChar, &count);
1007 if (!str)
1008 return FALSE;
1009
1010 wstr = FONT_mbtowc( hdc, str, count+1, &wlen, NULL );
1011 if (!wstr)
1012 {
1013 HeapFree( GetProcessHeap(), 0, str );
1014 return FALSE;
1015 }
1016 ret = NtGdiGetCharABCWidthsW(hdc, wstr[0], count, wstr, 0, lpABCF);
1017
1018 HeapFree( GetProcessHeap(), 0, str );
1019 HeapFree( GetProcessHeap(), 0, wstr );
1020
1021 return ret;
1022}

◆ GetCharABCWidthsFloatW()

BOOL WINAPI GetCharABCWidthsFloatW ( HDC  hdc,
UINT  FirstChar,
UINT  LastChar,
LPABCFLOAT  abcF 
)

Definition at line 688 of file font.c.

692{
693 DPRINT("GetCharABCWidthsFloatW\n");
694 if ((!abcF) || (FirstChar > LastChar))
695 {
697 return FALSE;
698 }
700 FirstChar,
701 (ULONG)(LastChar - FirstChar + 1),
702 NULL,
703 0,
704 abcF);
705}

◆ GetCharABCWidthsI()

BOOL WINAPI GetCharABCWidthsI ( HDC  hdc,
UINT  giFirst,
UINT  cgi,
LPWORD  pgi,
LPABC  lpabc 
)

Definition at line 1029 of file font.c.

1034{
1035 DPRINT("GetCharABCWidthsI\n");
1037 giFirst,
1038 (ULONG) cgi,
1039 (PWCHAR) pgi,
1041 (PVOID)lpabc);
1042}
static LPCSTR INT LPWORD pgi
Definition: font.c:51
#define GCABCW_INDICES
Definition: ntgdityp.h:210

◆ GetCharABCWidthsW()

BOOL WINAPI GetCharABCWidthsW ( HDC  hdc,
UINT  FirstChar,
UINT  LastChar,
LPABC  lpabc 
)

Definition at line 787 of file font.c.

791{
792 DPRINT("GetCharABCWidthsW\n");
793 if ((!lpabc) || (FirstChar > LastChar))
794 {
796 return FALSE;
797 }
799 FirstChar,
800 (ULONG)(LastChar - FirstChar + 1),
801 NULL,
803 lpabc);
804}

◆ GetCharacterPlacementA()

DWORD WINAPI GetCharacterPlacementA ( HDC  hdc,
LPCSTR  lpString,
INT  uCount,
INT  nMaxExtent,
GCP_RESULTSA lpResults,
DWORD  dwFlags 
)

Definition at line 507 of file font.c.

514{
515 WCHAR *lpStringW;
516 INT uCountW;
517 GCP_RESULTSW resultsW;
518 DWORD ret;
519 UINT font_cp;
520
521 if ( !lpString || uCount <= 0 || !lpResults || (nMaxExtent < 0 && nMaxExtent != -1 ) )
522 {
524 return 0;
525 }
526 /* TRACE("%s, %d, %d, 0x%08x\n",
527 debugstr_an(lpString, uCount), uCount, nMaxExtent, dwFlags);
528 */
529 /* both structs are equal in size */
530 memcpy(&resultsW, lpResults, sizeof(resultsW));
531
532 lpStringW = FONT_mbtowc(hdc, lpString, uCount, &uCountW, &font_cp);
533 if (lpStringW == NULL)
534 {
535 return 0;
536 }
537 if(lpResults->lpOutString)
538 {
539 resultsW.lpOutString = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR)*uCountW);
540 if (resultsW.lpOutString == NULL)
541 {
542 HeapFree(GetProcessHeap(), 0, lpStringW);
543 return 0;
544 }
545 }
546
547 ret = GetCharacterPlacementW(hdc, lpStringW, uCountW, nMaxExtent, &resultsW, dwFlags);
548
549 lpResults->nGlyphs = resultsW.nGlyphs;
550 lpResults->nMaxFit = resultsW.nMaxFit;
551
552 if(lpResults->lpOutString)
553 {
554 WideCharToMultiByte(font_cp, 0, resultsW.lpOutString, uCountW,
555 lpResults->lpOutString, uCount, NULL, NULL );
556 }
557
558 HeapFree(GetProcessHeap(), 0, lpStringW);
559 HeapFree(GetProcessHeap(), 0, resultsW.lpOutString);
560
561 return ret;
562}
#define WideCharToMultiByte
Definition: compat.h:111
unsigned long DWORD
Definition: ntddk_ex.h:95
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
LPSTR lpOutString
Definition: wingdi.h:2867
LPWSTR lpOutString
Definition: wingdi.h:2878
DWORD WINAPI GetCharacterPlacementW(_In_ HDC hdc, _In_reads_(nCount) LPCWSTR lpString, _In_ int nCount, _In_ int nMexExtent, _Inout_ LPGCP_RESULTSW lpResults, _In_ DWORD dwFlags)

◆ GetCharacterPlacementW()

DWORD WINAPI GetCharacterPlacementW ( HDC  hdc,
LPCWSTR  lpString,
INT  uCount,
INT  nMaxExtent,
GCP_RESULTSW lpResults,
DWORD  dwFlags 
)

Definition at line 570 of file font.c.

578{
579 DWORD ret=0;
580 SIZE size;
581 UINT i, nSet;
582 DPRINT("GetCharacterPlacementW\n");
583
584 if (dwFlags&(~GCP_REORDER)) DPRINT("flags 0x%08lx ignored\n", dwFlags);
585 if (lpResults->lpClass) DPRINT("classes not implemented\n");
586
587 nSet = (UINT)uCount;
588 if (nSet > lpResults->nGlyphs)
589 nSet = lpResults->nGlyphs;
590
591 /* return number of initialized fields */
592 lpResults->nGlyphs = nSet;
593
594 if (dwFlags & GCP_REORDER)
595 {
596 if (LoadLPK(LPK_GCP))
597 return LpkGetCharacterPlacement(hdc, lpString, uCount, nMaxExtent, lpResults, dwFlags, 0);
598 }
599
600 /* Treat the case where no special handling was requested in a fastpath way */
601 /* copy will do if the GCP_REORDER flag is not set */
602 if (lpResults->lpOutString)
603 lstrcpynW( lpResults->lpOutString, lpString, nSet );
604
605 if (lpResults->lpOrder)
606 {
607 for (i = 0; i < nSet; i++)
608 lpResults->lpOrder[i] = i;
609 }
610
611 /* FIXME: Will use the placement chars */
612 if (lpResults->lpDx)
613 {
614 int c;
615 for (i = 0; i < nSet; i++)
616 {
617 if (GetCharWidth32W(hdc, lpString[i], lpString[i], &c))
618 lpResults->lpDx[i]= c;
619 }
620 }
621
622 if (lpResults->lpCaretPos && !(dwFlags & GCP_REORDER))
623 {
624 int pos = 0;
625
626 lpResults->lpCaretPos[0] = 0;
627 for (i = 1; i < nSet; i++)
628 if (GetTextExtentPoint32W(hdc, &(lpString[i - 1]), 1, &size))
629 lpResults->lpCaretPos[i] = (pos += size.cx);
630 }
631
632 if (lpResults->lpGlyphs)
633 NtGdiGetGlyphIndicesW(hdc, lpString, nSet, lpResults->lpGlyphs, 0);
634
635 if (GetTextExtentPoint32W(hdc, lpString, uCount, &size))
636 ret = MAKELONG(size.cx, size.cy);
637
638 return ret;
639}
LPKGCP LpkGetCharacterPlacement
Definition: utils.c:6
#define LPK_GCP
Definition: gdi32p.h:83
BOOL WINAPI LoadLPK(INT LpkFunctionID)
Definition: utils.c:423
GLsizeiptr size
Definition: glext.h:5919
__kernel_entry W32KAPI DWORD APIENTRY NtGdiGetGlyphIndicesW(_In_ HDC hdc, _In_reads_opt_(cwc) PCWCH pwc, _In_ INT cwc, _Out_writes_opt_(cwc) PWORD pgi, _In_ DWORD iMode)
Definition: font.c:1440
INT * lpCaretPos
Definition: wingdi.h:2881
LPWSTR lpClass
Definition: wingdi.h:2882
UINT * lpOrder
Definition: wingdi.h:2879
LPWSTR lpGlyphs
Definition: wingdi.h:2883
#define MAKELONG(a, b)
Definition: typedefs.h:249
BOOL WINAPI GetCharWidth32W(HDC hdc, UINT iFirstChar, UINT iLastChar, LPINT lpBuffer)
Definition: font.c:762
#define GCP_REORDER
Definition: wingdi.h:843
BOOL WINAPI GetTextExtentPoint32W(_In_ HDC hdc, _In_reads_(c) LPCWSTR lpString, _In_ int c, _Out_ LPSIZE psizl)

◆ GetCharWidth32A()

BOOL WINAPI GetCharWidth32A ( HDC  hdc,
UINT  iFirstChar,
UINT  iLastChar,
LPINT  lpBuffer 
)

Definition at line 859 of file font.c.

864{
865 INT wlen, count = 0;
866 LPSTR str;
867 LPWSTR wstr;
868 BOOL ret = TRUE;
869
870 DPRINT("GetCharWidths32A\n");
871
873 {
875 return FALSE;
876 }
877
878 str = FONT_GetCharsByRangeA(hdc, iFirstChar, iLastChar, &count);
879 if (!str)
880 return FALSE;
881
882 wstr = FONT_mbtowc(hdc, str, count+1, &wlen, NULL);
883 if (!wstr)
884 {
886 return FALSE;
887 }
888
890 wstr[0],
891 count,
892 wstr,
894 lpBuffer);
895
897 HeapFree(GetProcessHeap(), 0, wstr);
898
899 return ret;
900}
BOOL WINAPI GdiValidateHandle(HGDIOBJ)
Definition: misc.c:712
#define GDI_OBJECT_TYPE_DC
Definition: gdi.h:46
#define GDI_HANDLE_GET_TYPE(h)
Definition: gdi.h:31
_Out_ LPWSTR lpBuffer
Definition: netsh.h:68
__kernel_entry W32KAPI BOOL APIENTRY NtGdiGetCharWidthW(_In_ HDC hdc, _In_ UINT wcFirst, _In_ UINT cwc, _In_reads_opt_(cwc) PCWCH pwc, _In_ FLONG fl, _Out_writes_bytes_(cwc *sizeof(ULONG)) PVOID pvBuf)
#define GCW_WIN32
Definition: ntgdityp.h:204
#define GCW_NOFLOAT
Definition: ntgdityp.h:205

◆ GetCharWidth32W()

BOOL WINAPI GetCharWidth32W ( HDC  hdc,
UINT  iFirstChar,
UINT  iLastChar,
LPINT  lpBuffer 
)

Definition at line 762 of file font.c.

766{
767 DPRINT("GetCharWidths32W\n");
768 if ((!lpBuffer) || (iFirstChar > iLastChar) || HIWORD(iLastChar) ||
770 {
772 return FALSE;
773 }
774 return NtGdiGetCharWidthW( hdc,
775 iFirstChar,
776 (ULONG)(iLastChar - iFirstChar + 1),
777 NULL,
779 lpBuffer);
780}
#define HIWORD(l)
Definition: typedefs.h:247

Referenced by GetCharacterPlacementW().

◆ GetCharWidthA()

BOOL WINAPI GetCharWidthA ( HDC  hdc,
UINT  iFirstChar,
UINT  iLastChar,
LPINT  lpBuffer 
)

Definition at line 811 of file font.c.

816{
817 INT wlen, count = 0;
818 LPSTR str;
819 LPWSTR wstr;
820 BOOL ret = TRUE;
821
822 DPRINT("GetCharWidthsA\n");
823
825 {
827 return FALSE;
828 }
829
830 str = FONT_GetCharsByRangeA(hdc, iFirstChar, iLastChar, &count);
831 if (!str)
832 return FALSE;
833
834 wstr = FONT_mbtowc(hdc, str, count+1, &wlen, NULL);
835 if (!wstr)
836 {
838 return FALSE;
839 }
840
842 wstr[0],
843 count,
844 wstr,
846 lpBuffer);
847
849 HeapFree(GetProcessHeap(), 0, wstr);
850
851 return ret;
852}

◆ GetCharWidthFloatA()

BOOL APIENTRY GetCharWidthFloatA ( HDC  hdc,
UINT  iFirstChar,
UINT  iLastChar,
PFLOAT  pxBuffer 
)

Definition at line 907 of file font.c.

912{
913 INT wlen, count = 0;
914 LPSTR str;
915 LPWSTR wstr;
916 BOOL ret = TRUE;
917
918 DPRINT("GetCharWidthsFloatA\n");
919
921 {
923 return FALSE;
924 }
925
926 str = FONT_GetCharsByRangeA(hdc, iFirstChar, iLastChar, &count);
927 if (!str)
928 return FALSE;
929
930 wstr = FONT_mbtowc(hdc, str, count+1, &wlen, NULL);
931 if (!wstr)
932 {
934 return FALSE;
935 }
936 ret = NtGdiGetCharWidthW(hdc, wstr[0], count, wstr, 0, pxBuffer);
937
939 HeapFree(GetProcessHeap(), 0, wstr);
940
941 return ret;
942}

◆ GetCharWidthFloatW()

BOOL WINAPI GetCharWidthFloatW ( HDC  hdc,
UINT  iFirstChar,
UINT  iLastChar,
PFLOAT  pxBuffer 
)

Definition at line 712 of file font.c.

716{
717 DPRINT("GetCharWidthsFloatW\n");
718 if ((!pxBuffer) || (iFirstChar > iLastChar) || HIWORD(iLastChar) ||
720 {
722 return FALSE;
723 }
724 return NtGdiGetCharWidthW( hdc,
725 iFirstChar,
726 (ULONG)(iLastChar - iFirstChar + 1),
727 NULL,
728 0,
729 pxBuffer);
730}

◆ GetCharWidthI()

BOOL WINAPI GetCharWidthI ( HDC  hdc,
UINT  giFirst,
UINT  cgi,
LPWORD  pgi,
LPINT  lpBuffer 
)

Definition at line 1049 of file font.c.

1054{
1055 DPRINT("GetCharWidthsI\n");
1056
1057 if (!lpBuffer || (!pgi && HIWORD(giFirst)))
1058 {
1060 return FALSE;
1061 }
1062
1063 if (!cgi)
1064 return TRUE;
1065
1066 return NtGdiGetCharWidthW( hdc,
1067 giFirst,
1068 cgi,
1069 (PWCHAR) pgi,
1071 (PVOID) lpBuffer );
1072}
#define GCW_INDICES
Definition: ntgdityp.h:206

◆ GetCharWidthW()

BOOL WINAPI GetCharWidthW ( HDC  hdc,
UINT  iFirstChar,
UINT  iLastChar,
LPINT  lpBuffer 
)

Definition at line 737 of file font.c.

741{
742 DPRINT("GetCharWidthsW\n");
743 if ((!lpBuffer) || (iFirstChar > iLastChar) || HIWORD(iLastChar) ||
745 {
747 return FALSE;
748 }
749 return NtGdiGetCharWidthW( hdc,
750 iFirstChar,
751 (ULONG)(iLastChar - iFirstChar + 1),
752 NULL,
754 lpBuffer);
755}

◆ GetEUDCTimeStamp()

ULONG WINAPI GetEUDCTimeStamp ( VOID  )

Definition at line 2729 of file font.c.

2730{
2732}
__kernel_entry W32KAPI ULONG APIENTRY NtGdiGetEudcTimeStampEx(_In_reads_opt_(cwcBaseFaceName) LPWSTR lpBaseFaceName, _In_ ULONG cwcBaseFaceName, _In_ BOOL bSystemTimeStamp)

◆ GetEUDCTimeStampExW()

DWORD WINAPI GetEUDCTimeStampExW ( LPWSTR  lpBaseFaceName)

Definition at line 2739 of file font.c.

2740{
2741 DWORD retValue = 0;
2742
2743 if (!lpBaseFaceName)
2744 {
2745 retValue = NtGdiGetEudcTimeStampEx(NULL,0,FALSE);
2746 }
2747 else
2748 {
2749 retValue = NtGdiGetEudcTimeStampEx(lpBaseFaceName, wcslen(lpBaseFaceName), FALSE);
2750 }
2751
2752 return retValue;
2753}
_ACRTIMP size_t __cdecl wcslen(const wchar_t *)
Definition: wcs.c:2983

◆ GetFontAssocStatus()

ULONG WINAPI GetFontAssocStatus ( HDC  hdc)

Definition at line 2760 of file font.c.

2761{
2762 ULONG retValue = 0;
2763
2764 if (hdc)
2765 {
2766 retValue = NtGdiQueryFontAssocInfo(hdc);
2767 }
2768
2769 return retValue;
2770}
__kernel_entry W32KAPI ULONG APIENTRY NtGdiQueryFontAssocInfo(_In_ HDC hdc)

◆ GetFontData()

DWORD WINAPI GetFontData ( HDC  hdc,
DWORD  dwTable,
DWORD  dwOffset,
LPVOID  lpvBuffer,
DWORD  cbData 
)

Definition at line 2801 of file font.c.

2806{
2807 if (!lpvBuffer)
2808 {
2809 cbData = 0;
2810 }
2811 return NtGdiGetFontData(hdc, dwTable, dwOffset, lpvBuffer, cbData);
2812}
_In_ DWORD _In_ DWORD dwOffset
Definition: ntgdi.h:2033
_In_ DWORD dwTable
Definition: ntgdi.h:2032
_In_opt_ _In_opt_ _In_ _In_ DWORD cbData
Definition: shlwapi.h:761
DWORD APIENTRY NtGdiGetFontData(_In_ HDC hDC, _In_ DWORD Table, _In_ DWORD Offset, _Out_writes_bytes_(Size) PVOID Buffer, _In_ DWORD Size)
Definition: font.c:674

Referenced by check_vertical_metrics(), get_first_last_from_cmap(), get_font_metrics(), get_ttf_nametable_entry(), init_script_cache(), load_CMAP_format12_table(), load_gdef_table(), load_gpos_table(), load_gsub_table(), test_fullname2_helper(), and test_text_metrics().

◆ GetFontLanguageInfo()

DWORD WINAPI GetFontLanguageInfo ( HDC  hDc)

Definition at line 1079 of file font.c.

1082{
1083 DWORD Gcp = 0, Ret = 0;
1084 if (gbLpk)
1085 {
1086 Ret = NtGdiGetTextCharsetInfo(hDc, NULL, 0);
1087 if ((Ret == ARABIC_CHARSET) || (Ret == HEBREW_CHARSET))
1089 }
1091 if ( Gcp == GCP_ERROR)
1092 return Gcp;
1093 else
1094 Ret = Gcp | Ret;
1095 return Ret;
1096}
BOOL gbLpk
Definition: dllmain.c:12
DWORD WINAPI GetDCDWord(_In_ HDC hdc, _In_ UINT u, _In_ DWORD dwError)
Definition: dc.c:787
__kernel_entry W32KAPI INT APIENTRY NtGdiGetTextCharsetInfo(_In_ HDC hdc, _Out_opt_ LPFONTSIGNATURE lpSig, _In_ DWORD dwFlags)
Definition: text.c:265
@ GdiGetFontLanguageInfo
Definition: ntgdityp.h:54
#define GCP_GLYPHSHAPE
Definition: wingdi.h:833
#define GCP_DIACRITIC
Definition: wingdi.h:831
#define GCP_LIGATE
Definition: wingdi.h:837
#define ARABIC_CHARSET
Definition: wingdi.h:394
#define GCP_KASHIDA
Definition: wingdi.h:836
#define GCP_ERROR
Definition: wingdi.h:829
#define HEBREW_CHARSET
Definition: wingdi.h:393

◆ GetGlyphIndicesA()

DWORD WINAPI GetGlyphIndicesA ( HDC  hdc,
LPCSTR  lpstr,
INT  count,
LPWORD  pgi,
DWORD  flags 
)

Definition at line 1103 of file font.c.

1110{
1111 DWORD Ret;
1112 WCHAR *lpstrW;
1113 INT countW;
1114
1116 {
1118 return GDI_ERROR;
1119 }
1120
1121 lpstrW = FONT_mbtowc(hdc, lpstr, count, &countW, NULL);
1122 if (lpstrW == NULL)
1123 return GDI_ERROR;
1124
1125 Ret = NtGdiGetGlyphIndicesW(hdc, lpstrW, countW, pgi, flags);
1126 HeapFree(GetProcessHeap(), 0, lpstrW);
1127 return Ret;
1128}
GLbitfield flags
Definition: glext.h:7161
static LPCSTR lpstr
Definition: font.c:51
#define GDI_ERROR
Definition: wingdi.h:1309

◆ GetGlyphOutlineA()

DWORD WINAPI GetGlyphOutlineA ( HDC  hdc,
UINT  uChar,
UINT  uFormat,
LPGLYPHMETRICS  lpgm,
DWORD  cbBuffer,
LPVOID  lpvBuffer,
CONST MAT2 lpmat2 
)

Definition at line 1135 of file font.c.

1144{
1145
1146 LPWSTR p = NULL;
1147 DWORD ret;
1148 UINT c;
1149 DPRINT("GetGlyphOutlineA uChar %x\n", uChar);
1150 if (!lpgm || !lpmat2) return GDI_ERROR;
1151 if(!(uFormat & GGO_GLYPH_INDEX))
1152 {
1153 int len;
1154 char mbchs[2];
1155 if(uChar > 0xff) /* but, 2 bytes character only */
1156 {
1157 len = 2;
1158 mbchs[0] = (uChar & 0xff00) >> 8;
1159 mbchs[1] = (uChar & 0xff);
1160 }
1161 else
1162 {
1163 len = 1;
1164 mbchs[0] = (uChar & 0xff);
1165 }
1166 p = FONT_mbtowc(hdc, mbchs, len, NULL, NULL);
1167 if(!p)
1168 return GDI_ERROR;
1169 c = p[0];
1170 }
1171 else
1172 c = uChar;
1173 ret = NtGdiGetGlyphOutline(hdc, c, uFormat, lpgm, cbBuffer, lpvBuffer, (CONST LPMAT2)lpmat2, TRUE);
1174 HeapFree(GetProcessHeap(), 0, p);
1175 return ret;
1176}
GLfloat GLfloat p
Definition: glext.h:8902
GLenum GLsizei len
Definition: glext.h:6722
__kernel_entry W32KAPI ULONG APIENTRY NtGdiGetGlyphOutline(_In_ HDC hdc, _In_ WCHAR wch, _In_ UINT iFormat, _Out_ LPGLYPHMETRICS pgm, _In_ ULONG cjBuf, _Out_writes_bytes_opt_(cjBuf) PVOID pvBuf, _In_ const MAT2 *pmat2, _In_ BOOL bIgnoreRotation)
#define CONST
Definition: pedump.c:81
Definition: wingdi.h:2918
#define GGO_GLYPH_INDEX
Definition: wingdi.h:855

◆ GetGlyphOutlineW()

DWORD WINAPI GetGlyphOutlineW ( HDC  hdc,
UINT  uChar,
UINT  uFormat,
LPGLYPHMETRICS  lpgm,
DWORD  cbBuffer,
LPVOID  lpvBuffer,
CONST MAT2 lpmat2 
)

Definition at line 1184 of file font.c.

1193{
1194 DPRINT("GetGlyphOutlineW uChar %x\n", uChar);
1195 if (!lpgm || !lpmat2) return GDI_ERROR;
1196 if (!lpvBuffer) cbBuffer = 0;
1197 return NtGdiGetGlyphOutline ( hdc, uChar, uFormat, lpgm, cbBuffer, lpvBuffer, (CONST LPMAT2)lpmat2, TRUE);
1198}

◆ GetGlyphOutlineWow()

DWORD WINAPI GetGlyphOutlineWow ( DWORD  a0,
DWORD  a1,
DWORD  a2,
DWORD  a3,
DWORD  a4,
DWORD  a5,
DWORD  a6 
)

Definition at line 1205 of file font.c.

1214{
1217 return 0;
1218}

◆ GetKerningPairsA()

DWORD WINAPI GetKerningPairsA ( HDC  hDC,
DWORD  cPairs,
LPKERNINGPAIR  kern_pairA 
)

Definition at line 1598 of file font.c.

1601{
1602 INT charset;
1603 CHARSETINFO csi;
1604 CPINFO cpi;
1605 DWORD i, total_kern_pairs, kern_pairs_copied = 0;
1606 KERNINGPAIR *kern_pairW;
1607
1608 if (!cPairs && kern_pairA)
1609 {
1611 return 0;
1612 }
1613
1616 {
1617 DPRINT1("Can't find codepage for charset %d\n", charset);
1618 return 0;
1619 }
1620 /* GetCPInfo() will fail on CP_SYMBOL, and WideCharToMultiByte is supposed
1621 * to fail on an invalid character for CP_SYMBOL.
1622 */
1623 cpi.DefaultChar[0] = 0;
1624 if (csi.ciACP != CP_SYMBOL && !GetCPInfo(csi.ciACP, &cpi))
1625 {
1626 DPRINT1("Can't find codepage %u info\n", csi.ciACP);
1627 return 0;
1628 }
1629 DPRINT("charset %d => codepage %u\n", charset, csi.ciACP);
1630
1631 total_kern_pairs = NtGdiGetKerningPairs(hDC, 0, NULL);
1632 if (!total_kern_pairs) return 0;
1633
1634 if (!cPairs && !kern_pairA) return total_kern_pairs;
1635
1636 kern_pairW = HeapAlloc(GetProcessHeap(), 0, total_kern_pairs * sizeof(*kern_pairW));
1637 if (kern_pairW == NULL)
1638 {
1639 return 0;
1640 }
1641 GetKerningPairsW(hDC, total_kern_pairs, kern_pairW);
1642
1643 for (i = 0; i < total_kern_pairs; i++)
1644 {
1645 char first, second;
1646
1647 if (!WideCharToMultiByte(csi.ciACP, 0, &kern_pairW[i].wFirst, 1, &first, 1, NULL, NULL))
1648 continue;
1649
1650 if (!WideCharToMultiByte(csi.ciACP, 0, &kern_pairW[i].wSecond, 1, &second, 1, NULL, NULL))
1651 continue;
1652
1653 if (first == cpi.DefaultChar[0] || second == cpi.DefaultChar[0])
1654 continue;
1655
1656 if (kern_pairA)
1657 {
1658 if (kern_pairs_copied >= cPairs) break;
1659
1660 kern_pairA->wFirst = (BYTE)first;
1661 kern_pairA->wSecond = (BYTE)second;
1662 kern_pairA->iKernAmount = kern_pairW[i].iKernAmount;
1663 kern_pairA++;
1664 }
1665 kern_pairs_copied++;
1666 }
1667
1668 HeapFree(GetProcessHeap(), 0, kern_pairW);
1669
1670 return kern_pairs_copied;
1671}
#define DPRINT1
Definition: precomp.h:8
#define ULongToPtr(ul)
Definition: basetsd.h:86
CFF_Charset charset
Definition: cffcmap.c:137
BOOL WINAPI GetCPInfo(UINT codepage, LPCPINFO cpinfo)
Definition: locale.c:2146
const GLint * first
Definition: glext.h:5794
static UINT first
Definition: font.c:44
__kernel_entry W32KAPI ULONG APIENTRY NtGdiGetKerningPairs(_In_ HDC hdc, _In_ ULONG cPairs, _Out_writes_to_opt_(cPairs, return) KERNINGPAIR *pkpDst)
BYTE DefaultChar[MAX_DEFAULTCHAR]
Definition: winnls.h:651
WORD wSecond
Definition: wingdi.h:2911
int iKernAmount
Definition: wingdi.h:2912
int WINAPI GetTextCharset(_In_ HDC)
Definition: text.c:187
#define TCI_SRCCHARSET
Definition: wingdi.h:961
DWORD WINAPI GetKerningPairsW(_In_ HDC hdc, _In_ DWORD nPairs, _Out_writes_to_opt_(nPairs, return) LPKERNINGPAIR lpKernPair)
BOOL WINAPI TranslateCharsetInfo(_Inout_ PDWORD, _Out_ LPCHARSETINFO, _In_ DWORD)
#define CP_SYMBOL
Definition: winnls.h:252

◆ GetKerningPairsW()

DWORD WINAPI GetKerningPairsW ( HDC  hdc,
ULONG  cPairs,
LPKERNINGPAIR  pkpDst 
)

Definition at line 1578 of file font.c.

1581{
1582 if ((cPairs != 0) || (pkpDst == 0))
1583 {
1584 return NtGdiGetKerningPairs(hdc,cPairs,pkpDst);
1585 }
1586 else
1587 {
1589 return 0;
1590 }
1591}

◆ GetOutlineTextMetricsA()

UINT APIENTRY GetOutlineTextMetricsA ( HDC  hdc,
UINT  cbData,
LPOUTLINETEXTMETRICA  lpOTM 
)

Definition at line 1225 of file font.c.

1230{
1231 char buf[512], *ptr;
1232 UINT ret, needed;
1234 OUTLINETEXTMETRICA *output = lpOTM;
1235 INT left, len;
1236
1237 if((ret = GetOutlineTextMetricsW(hdc, 0, NULL)) == 0)
1238 return 0;
1239 if(ret > sizeof(buf))
1240 {
1241 lpOTMW = HeapAlloc(GetProcessHeap(), 0, ret);
1242 if (lpOTMW == NULL)
1243 {
1244 return 0;
1245 }
1246 }
1247 GetOutlineTextMetricsW(hdc, ret, lpOTMW);
1248
1249 needed = sizeof(OUTLINETEXTMETRICA);
1250 if(lpOTMW->otmpFamilyName)
1251 needed += WideCharToMultiByte(CP_ACP, 0,
1252 (WCHAR*)((char*)lpOTMW + (intptr_t)lpOTMW->otmpFamilyName), -1,
1253 NULL, 0, NULL, NULL);
1254 if(lpOTMW->otmpFaceName)
1255 needed += WideCharToMultiByte(CP_ACP, 0,
1256 (WCHAR*)((char*)lpOTMW + (intptr_t)lpOTMW->otmpFaceName), -1,
1257 NULL, 0, NULL, NULL);
1258 if(lpOTMW->otmpStyleName)
1259 needed += WideCharToMultiByte(CP_ACP, 0,
1260 (WCHAR*)((char*)lpOTMW + (intptr_t)lpOTMW->otmpStyleName), -1,
1261 NULL, 0, NULL, NULL);
1262 if(lpOTMW->otmpFullName)
1263 needed += WideCharToMultiByte(CP_ACP, 0,
1264 (WCHAR*)((char*)lpOTMW + (intptr_t)lpOTMW->otmpFullName), -1,
1265 NULL, 0, NULL, NULL);
1266
1267 if(!lpOTM)
1268 {
1269 ret = needed;
1270 goto end;
1271 }
1272
1273 DPRINT("needed = %u\n", needed);
1274 if(needed > cbData)
1275 {
1276 /* Since the supplied buffer isn't big enough, we'll alloc one
1277 that is and memcpy the first cbData bytes into the lpOTM at
1278 the end. */
1279 output = HeapAlloc(GetProcessHeap(), 0, needed);
1280 if (output == NULL)
1281 {
1282 goto end;
1283 }
1284 }
1285
1286 ret = output->otmSize = min(needed, cbData);
1288 output->otmFiller = 0;
1289 output->otmPanoseNumber = lpOTMW->otmPanoseNumber;
1290 output->otmfsSelection = lpOTMW->otmfsSelection;
1291 output->otmfsType = lpOTMW->otmfsType;
1292 output->otmsCharSlopeRise = lpOTMW->otmsCharSlopeRise;
1293 output->otmsCharSlopeRun = lpOTMW->otmsCharSlopeRun;
1294 output->otmItalicAngle = lpOTMW->otmItalicAngle;
1295 output->otmEMSquare = lpOTMW->otmEMSquare;
1296 output->otmAscent = lpOTMW->otmAscent;
1297 output->otmDescent = lpOTMW->otmDescent;
1298 output->otmLineGap = lpOTMW->otmLineGap;
1299 output->otmsCapEmHeight = lpOTMW->otmsCapEmHeight;
1300 output->otmsXHeight = lpOTMW->otmsXHeight;
1301 output->otmrcFontBox = lpOTMW->otmrcFontBox;
1302 output->otmMacAscent = lpOTMW->otmMacAscent;
1303 output->otmMacDescent = lpOTMW->otmMacDescent;
1304 output->otmMacLineGap = lpOTMW->otmMacLineGap;
1305 output->otmusMinimumPPEM = lpOTMW->otmusMinimumPPEM;
1306 output->otmptSubscriptSize = lpOTMW->otmptSubscriptSize;
1310 output->otmsStrikeoutSize = lpOTMW->otmsStrikeoutSize;
1312 output->otmsUnderscoreSize = lpOTMW->otmsUnderscoreSize;
1314
1315
1316 ptr = (char*)(output + 1);
1317 left = needed - sizeof(*output);
1318
1319 if(lpOTMW->otmpFamilyName)
1320 {
1321 output->otmpFamilyName = (LPSTR)(ptr - (char*)output);
1323 (WCHAR*)((char*)lpOTMW + (intptr_t)lpOTMW->otmpFamilyName), -1,
1324 ptr, left, NULL, NULL);
1325 left -= len;
1326 ptr += len;
1327 }
1328 else
1329 output->otmpFamilyName = 0;
1330
1331 if(lpOTMW->otmpFaceName)
1332 {
1333 output->otmpFaceName = (LPSTR)(ptr - (char*)output);
1335 (WCHAR*)((char*)lpOTMW + (intptr_t)lpOTMW->otmpFaceName), -1,
1336 ptr, left, NULL, NULL);
1337 left -= len;
1338 ptr += len;
1339 }
1340 else
1341 output->otmpFaceName = 0;
1342
1343 if(lpOTMW->otmpStyleName)
1344 {
1345 output->otmpStyleName = (LPSTR)(ptr - (char*)output);
1347 (WCHAR*)((char*)lpOTMW + (intptr_t)lpOTMW->otmpStyleName), -1,
1348 ptr, left, NULL, NULL);
1349 left -= len;
1350 ptr += len;
1351 }
1352 else
1353 output->otmpStyleName = 0;
1354
1355 if(lpOTMW->otmpFullName)
1356 {
1357 output->otmpFullName = (LPSTR)(ptr - (char*)output);
1359 (WCHAR*)((char*)lpOTMW + (intptr_t)lpOTMW->otmpFullName), -1,
1360 ptr, left, NULL, NULL);
1361 left -= len;
1362 }
1363 else
1364 output->otmpFullName = 0;
1365
1366 ASSERT(left == 0);
1367
1368 if(output != lpOTM)
1369 {
1370 memcpy(lpOTM, output, cbData);
1371 HeapFree(GetProcessHeap(), 0, output);
1372
1373 /* check if the string offsets really fit into the provided size */
1374 /* FIXME: should we check string length as well? */
1375 if ((UINT_PTR)lpOTM->otmpFamilyName >= lpOTM->otmSize)
1376 lpOTM->otmpFamilyName = 0; /* doesn't fit */
1377
1378 if ((UINT_PTR)lpOTM->otmpFaceName >= lpOTM->otmSize)
1379 lpOTM->otmpFaceName = 0; /* doesn't fit */
1380
1381 if ((UINT_PTR)lpOTM->otmpStyleName >= lpOTM->otmSize)
1382 lpOTM->otmpStyleName = 0; /* doesn't fit */
1383
1384 if ((UINT_PTR)lpOTM->otmpFullName >= lpOTM->otmSize)
1385 lpOTM->otmpFullName = 0; /* doesn't fit */
1386 }
1387
1388end:
1389 if(lpOTMW != (OUTLINETEXTMETRICW *)buf)
1390 HeapFree(GetProcessHeap(), 0, lpOTMW);
1391
1392 return ret;
1393}
#define CP_ACP
Definition: compat.h:109
int intptr_t
Definition: corecrt.h:176
GLuint GLuint end
Definition: gl.h:1545
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLint left
Definition: glext.h:7726
#define ASSERT(a)
Definition: mode.c:44
static PVOID ptr
Definition: dispmode.c:27
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
int otmsStrikeoutPosition
Definition: wingdi.h:2950
POINT otmptSuperscriptOffset
Definition: wingdi.h:2948
POINT otmptSubscriptSize
Definition: wingdi.h:2945
PANOSE otmPanoseNumber
Definition: wingdi.h:2928
POINT otmptSubscriptOffset
Definition: wingdi.h:2946
TEXTMETRICA otmTextMetrics
Definition: wingdi.h:2926
POINT otmptSuperscriptSize
Definition: wingdi.h:2947
int otmsUnderscorePosition
Definition: wingdi.h:2952
UINT otmsStrikeoutSize
Definition: wingdi.h:2949
PANOSE otmPanoseNumber
Definition: wingdi.h:2962
POINT otmptSuperscriptOffset
Definition: wingdi.h:2982
POINT otmptSuperscriptSize
Definition: wingdi.h:2981
POINT otmptSubscriptSize
Definition: wingdi.h:2979
int otmsStrikeoutPosition
Definition: wingdi.h:2984
int otmsUnderscorePosition
Definition: wingdi.h:2986
TEXTMETRICW otmTextMetrics
Definition: wingdi.h:2960
POINT otmptSubscriptOffset
Definition: wingdi.h:2980
UINT otmsStrikeoutSize
Definition: wingdi.h:2983
VOID FASTCALL FONT_TextMetricWToA(const TEXTMETRICW *ptmW, LPTEXTMETRICA ptmA)
Definition: font.c:81
struct _OUTLINETEXTMETRICA OUTLINETEXTMETRICA
UINT WINAPI GetOutlineTextMetricsW(_In_ HDC hdc, _In_ UINT cjCopy, _Out_writes_bytes_opt_(cjCopy) LPOUTLINETEXTMETRICW potm)

◆ GetOutlineTextMetricsW()

UINT APIENTRY GetOutlineTextMetricsW ( HDC  hdc,
UINT  cbData,
LPOUTLINETEXTMETRICW  lpOTM 
)

Definition at line 1424 of file font.c.

1429{
1430 TMDIFF Tmd; // Should not be zero.
1431 UINT Size, AvailableSize = 0, StringSize;
1432 XFORM DevToWorld;
1433 OUTLINETEXTMETRICW* LocalOTM;
1434 WCHAR* Str;
1435 BYTE* Ptr;
1436
1437 /* Get the structure */
1439 if (!Size)
1440 return 0;
1441 if (!lpOTM || (cbData < sizeof(*lpOTM)))
1442 return Size;
1443
1444 LocalOTM = HeapAlloc(GetProcessHeap(), 0, Size);
1445 LocalOTM->otmSize = Size;
1447 if (!Size)
1448 {
1449 HeapFree(GetProcessHeap(), 0, LocalOTM);
1450 return 0;
1451 }
1452
1454 {
1455 DPRINT1("NtGdiGetTransform failed!\n");
1456 HeapFree(GetProcessHeap(), 0, LocalOTM);
1458 return 0;
1459 }
1460
1461 /* Fill in DC specific data */
1464 LocalOTM->otmTextMetrics.tmHeight = height_to_LP( &DevToWorld, LocalOTM->otmTextMetrics.tmHeight );
1465 LocalOTM->otmTextMetrics.tmAscent = height_to_LP( &DevToWorld, LocalOTM->otmTextMetrics.tmAscent );
1466 LocalOTM->otmTextMetrics.tmDescent = height_to_LP( &DevToWorld, LocalOTM->otmTextMetrics.tmDescent );
1469 LocalOTM->otmTextMetrics.tmAveCharWidth = width_to_LP( &DevToWorld, LocalOTM->otmTextMetrics.tmAveCharWidth );
1470 LocalOTM->otmTextMetrics.tmMaxCharWidth = width_to_LP( &DevToWorld, LocalOTM->otmTextMetrics.tmMaxCharWidth );
1471 LocalOTM->otmTextMetrics.tmOverhang = width_to_LP( &DevToWorld, LocalOTM->otmTextMetrics.tmOverhang );
1472 LocalOTM->otmAscent = height_to_LP( &DevToWorld, LocalOTM->otmAscent);
1473 LocalOTM->otmDescent = height_to_LP( &DevToWorld, LocalOTM->otmDescent);
1474 LocalOTM->otmLineGap = abs(INTERNAL_YDSTOWS(&DevToWorld,LocalOTM->otmLineGap));
1475 LocalOTM->otmsCapEmHeight = abs(INTERNAL_YDSTOWS(&DevToWorld,LocalOTM->otmsCapEmHeight));
1476 LocalOTM->otmsXHeight = abs(INTERNAL_YDSTOWS(&DevToWorld,LocalOTM->otmsXHeight));
1477 LocalOTM->otmrcFontBox.top = height_to_LP( &DevToWorld, LocalOTM->otmrcFontBox.top);
1478 LocalOTM->otmrcFontBox.bottom = height_to_LP( &DevToWorld, LocalOTM->otmrcFontBox.bottom);
1479 LocalOTM->otmrcFontBox.left = width_to_LP( &DevToWorld, LocalOTM->otmrcFontBox.left);
1480 LocalOTM->otmrcFontBox.right = width_to_LP( &DevToWorld, LocalOTM->otmrcFontBox.right);
1481 LocalOTM->otmMacAscent = height_to_LP( &DevToWorld, LocalOTM->otmMacAscent);
1482 LocalOTM->otmMacDescent = height_to_LP( &DevToWorld, LocalOTM->otmMacDescent);
1483 LocalOTM->otmMacLineGap = abs(INTERNAL_YDSTOWS(&DevToWorld,LocalOTM->otmMacLineGap));
1484 LocalOTM->otmptSubscriptSize.x = width_to_LP( &DevToWorld, LocalOTM->otmptSubscriptSize.x);
1485 LocalOTM->otmptSubscriptSize.y = height_to_LP( &DevToWorld, LocalOTM->otmptSubscriptSize.y);
1486 LocalOTM->otmptSubscriptOffset.x = width_to_LP( &DevToWorld, LocalOTM->otmptSubscriptOffset.x);
1487 LocalOTM->otmptSubscriptOffset.y = height_to_LP( &DevToWorld, LocalOTM->otmptSubscriptOffset.y);
1488 LocalOTM->otmptSuperscriptSize.x = width_to_LP( &DevToWorld, LocalOTM->otmptSuperscriptSize.x);
1489 LocalOTM->otmptSuperscriptSize.y = height_to_LP( &DevToWorld, LocalOTM->otmptSuperscriptSize.y);
1490 LocalOTM->otmptSuperscriptOffset.x = width_to_LP( &DevToWorld, LocalOTM->otmptSuperscriptOffset.x);
1491 LocalOTM->otmptSuperscriptOffset.y = height_to_LP( &DevToWorld, LocalOTM->otmptSuperscriptOffset.y);
1492 LocalOTM->otmsStrikeoutSize = abs(INTERNAL_YDSTOWS(&DevToWorld,LocalOTM->otmsStrikeoutSize));
1493 LocalOTM->otmsStrikeoutPosition = height_to_LP( &DevToWorld, LocalOTM->otmsStrikeoutPosition);
1494 LocalOTM->otmsUnderscoreSize = height_to_LP( &DevToWorld, LocalOTM->otmsUnderscoreSize);
1495 LocalOTM->otmsUnderscorePosition = height_to_LP( &DevToWorld, LocalOTM->otmsUnderscorePosition);
1496
1497 /* Copy what we can */
1498 CopyMemory(lpOTM, LocalOTM, min(Size, cbData));
1499
1500 lpOTM->otmpFamilyName = NULL;
1501 lpOTM->otmpFaceName = NULL;
1502 lpOTM->otmpStyleName = NULL;
1503 lpOTM->otmpFullName = NULL;
1504
1505 Size = sizeof(*lpOTM);
1506 AvailableSize = cbData - Size;
1507 Ptr = (BYTE*)lpOTM + sizeof(*lpOTM);
1508
1509 /* Fix string values up */
1510 if (LocalOTM->otmpFamilyName)
1511 {
1512 Str = (WCHAR*)((char*)LocalOTM + (ptrdiff_t)LocalOTM->otmpFamilyName);
1513 StringSize = (wcslen(Str) + 1) * sizeof(WCHAR);
1514 if (AvailableSize >= StringSize)
1515 {
1516 CopyMemory(Ptr, Str, StringSize);
1517 lpOTM->otmpFamilyName = (PSTR)(Ptr - (BYTE*)lpOTM);
1518 Ptr += StringSize;
1519 AvailableSize -= StringSize;
1520 Size += StringSize;
1521 }
1522 }
1523
1524 if (LocalOTM->otmpFaceName)
1525 {
1526 Str = (WCHAR*)((char*)LocalOTM + (ptrdiff_t)LocalOTM->otmpFaceName);
1527 StringSize = (wcslen(Str) + 1) * sizeof(WCHAR);
1528 if (AvailableSize >= StringSize)
1529 {
1530 CopyMemory(Ptr, Str, StringSize);
1531 lpOTM->otmpFaceName = (PSTR)(Ptr - (BYTE*)lpOTM);
1532 Ptr += StringSize;
1533 AvailableSize -= StringSize;
1534 Size += StringSize;
1535 }
1536 }
1537
1538 if (LocalOTM->otmpStyleName)
1539 {
1540 Str = (WCHAR*)((char*)LocalOTM + (ptrdiff_t)LocalOTM->otmpStyleName);
1541 StringSize = (wcslen(Str) + 1) * sizeof(WCHAR);
1542 if (AvailableSize >= StringSize)
1543 {
1544 CopyMemory(Ptr, Str, StringSize);
1545 lpOTM->otmpStyleName = (PSTR)(Ptr - (BYTE*)lpOTM);
1546 Ptr += StringSize;
1547 AvailableSize -= StringSize;
1548 Size += StringSize;
1549 }
1550 }
1551
1552 if (LocalOTM->otmpFullName)
1553 {
1554 Str = (WCHAR*)((char*)LocalOTM + (ptrdiff_t)LocalOTM->otmpFullName);
1555 StringSize = (wcslen(Str) + 1) * sizeof(WCHAR);
1556 if (AvailableSize >= StringSize)
1557 {
1558 CopyMemory(Ptr, Str, StringSize);
1559 lpOTM->otmpFullName = (PSTR)(Ptr - (BYTE*)lpOTM);
1560 Ptr += StringSize;
1561 AvailableSize -= StringSize;
1562 Size += StringSize;
1563 }
1564 }
1565
1566 lpOTM->otmSize = Size;
1567
1568 HeapFree(GetProcessHeap(), 0, LocalOTM);
1569
1570 return Size;
1571}
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
int ptrdiff_t
Definition: corecrt.h:194
#define abs(i)
Definition: fconv.c:206
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
Definition: fsrtlfuncs.h:898
BOOL APIENTRY NtGdiGetTransform(_In_ HDC hdc, _In_ DWORD iXform, _Out_ LPXFORM pxf)
#define CopyMemory
Definition: minwinbase.h:29
__kernel_entry W32KAPI ULONG APIENTRY NtGdiGetOutlineTextMetricsInternalW(_In_ HDC hdc, _In_ ULONG cjotm, _Out_writes_bytes_opt_(cjotm) POUTLINETEXTMETRICW potmw, _Out_ PTMDIFF ptmd)
#define GdiDeviceSpaceToWorldSpace
Definition: ntgdityp.h:185
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
LONG right
Definition: windef.h:108
LONG bottom
Definition: windef.h:109
LONG top
Definition: windef.h:107
LONG left
Definition: windef.h:106
char * PSTR
Definition: typedefs.h:51
static INT width_to_LP(XFORM *xForm, INT width)
Definition: font.c:1409
static INT INTERNAL_YDSTOWS(XFORM *xForm, INT height)
Definition: font.c:1398
static INT height_to_LP(XFORM *xForm, INT height)
Definition: font.c:1414
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
#define LOGPIXELSY
Definition: wingdi.h:719
#define LOGPIXELSX
Definition: wingdi.h:718

◆ height_to_LP()

static INT height_to_LP ( XFORM xForm,
INT  height 
)
inlinestatic

Definition at line 1414 of file font.c.

1415{
1416 return GDI_ROUND( (double)height * fabs( xForm->eM22 ));
1417}
_ACRTIMP double __cdecl fabs(double)
FLOAT eM22
Definition: wingdi.h:2170
static __inline INT GDI_ROUND(FLOAT val)
Definition: font.c:24

Referenced by GetOutlineTextMetricsW().

◆ IntConvertFontPaths()

PWSTR FASTCALL IntConvertFontPaths ( _In_ PCWSTR  pszFiles,
_Out_ PDWORD  pcFiles,
_Out_ PDWORD  pcwc,
_Inout_ PDWORD  pfl,
_In_ BOOL  bFlag 
)

Definition at line 1968 of file font.c.

1974{
1975 // FIXME: pfl
1976 // FIXME: bFlag
1977
1978 *pcwc = *pcFiles = 0;
1979
1980 if (!*pszFiles)
1981 {
1983 return NULL;
1984 }
1985
1986 // Build "Fonts" path
1987 WCHAR szFontsDir[MAX_PATH];
1988 GetWindowsDirectoryW(szFontsDir, _countof(szFontsDir));
1989 StringCchCatW(szFontsDir, _countof(szFontsDir), L"\\Fonts");
1990
1991 // Count the number of paths separated by '|'.
1992 ULONG pathCount = 1;
1993 for (PCWSTR pch1 = pszFiles; *pch1; ++pch1)
1994 {
1995 if (*pch1 == L'|')
1996 pathCount++;
1997 }
1998
1999 // Allocate memory for the paths.
2000 SIZE_T cchBuff = pathCount * MAX_PATH;
2001 PWSTR pszBuff = HEAP_alloc(cchBuff * sizeof(WCHAR));
2002 if (!pszBuff)
2003 return NULL;
2004
2005 pszBuff[0] = UNICODE_NULL;
2006 *pcFiles = pathCount;
2007
2008 // Convert paths
2009 DWORD dwError = ERROR_SUCCESS;
2010 PCWSTR pch1, pch1Prev;
2011 BOOL bFirst = TRUE;
2012 for (pch1 = pch1Prev = pszFiles;; ++pch1)
2013 {
2014 if (*pch1 && *pch1 != L'|')
2015 continue;
2016
2017 UINT_PTR spanLen = pch1 - pch1Prev;
2018 if (spanLen < _countof(L".ttf") || spanLen >= MAX_PATH)
2019 {
2020 dwError = ERROR_INVALID_FUNCTION;
2021 break;
2022 }
2023
2024 WCHAR szFileName[MAX_PATH], szFullPath[MAX_PATH];
2025 StringCchCopyNW(szFileName, _countof(szFileName), pch1Prev, spanLen);
2026
2027 // Search file
2028 if (!SearchPathW(L".", szFileName, NULL, _countof(szFullPath), szFullPath, NULL) &&
2029 !SearchPathW(szFontsDir, szFileName, NULL, _countof(szFullPath), szFullPath, NULL))
2030 {
2031 dwError = ERROR_FILE_NOT_FOUND;
2032 break;
2033 }
2034
2035 if (bFirst)
2036 {
2037 bFirst = FALSE;
2038 }
2039 else
2040 {
2041 SIZE_T cch = wcslen(szFullPath);
2042 if (cch < _countof(L".pfb"))
2043 {
2044 dwError = ERROR_INVALID_FUNCTION;
2045 break;
2046 }
2047
2048 // Check filename extension
2049 PCWSTR pchDotExt = &szFullPath[cch - 4];
2050 if (_wcsicmp(pchDotExt, L".pfb") != 0 &&
2051 _wcsicmp(pchDotExt, L".mmm") != 0)
2052 {
2053 dwError = ERROR_INVALID_FUNCTION;
2054 break;
2055 }
2056 }
2057
2058 // Convert to an NT path
2059 UNICODE_STRING NtAbsPath;
2060 if (!RtlDosPathNameToNtPathName_U(szFullPath, &NtAbsPath, NULL, NULL))
2061 {
2062 dwError = ERROR_OUTOFMEMORY;
2063 break;
2064 }
2065
2066 // Append a path and '|' to pszBuff
2067 if (StringCchCatW(pszBuff, cchBuff, NtAbsPath.Buffer) != S_OK ||
2068 StringCchCatW(pszBuff, cchBuff, L"|") != S_OK)
2069 {
2070 RtlFreeUnicodeString(&NtAbsPath);
2071 dwError = ERROR_INVALID_FUNCTION;
2072 break;
2073 }
2074
2075 RtlFreeUnicodeString(&NtAbsPath);
2076
2077 if (!*pch1)
2078 break;
2079
2080 pch1Prev = pch1 + 1;
2081 }
2082
2083 if (dwError != ERROR_SUCCESS)
2084 {
2085 HEAP_free(pszBuff);
2086 *pcwc = *pcFiles = 0;
2087 if (dwError != ERROR_INVALID_FUNCTION)
2088 SetLastError(dwError);
2089 return NULL;
2090 }
2091
2092 *pcwc = (DWORD)wcslen(pszBuff);
2093
2094 // Convert '|' to '\0'
2095 for (PWSTR pch2 = pszBuff; *pch2; ++pch2)
2096 {
2097 if (*pch2 == L'|')
2098 *pch2 = UNICODE_NULL;
2099 }
2100
2101 return pszBuff;
2102}
#define ERROR_INVALID_FUNCTION
Definition: dderror.h:6
#define ERROR_SUCCESS
Definition: deptool.c:10
DWORD WINAPI SearchPathW(IN LPCWSTR lpPath OPTIONAL, IN LPCWSTR lpFileName, IN LPCWSTR lpExtension OPTIONAL, IN DWORD nBufferLength, OUT LPWSTR lpBuffer, OUT LPWSTR *lpFilePart OPTIONAL)
Definition: path.c:1298
UINT WINAPI GetWindowsDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2271
_ACRTIMP int __cdecl _wcsicmp(const wchar_t *, const wchar_t *)
Definition: wcs.c:159
#define S_OK
Definition: intsafe.h:52
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
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)
#define DWORD
Definition: nt_native.h:44
#define UNICODE_NULL
_In_ UINT _In_ UINT cch
Definition: shellapi.h:432
STRSAFEAPI StringCchCatW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:325
STRSAFEAPI StringCchCopyNW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc, size_t cchToCopy)
Definition: strsafe.h:236
const uint16_t * PCWSTR
Definition: typedefs.h:57
ULONG_PTR SIZE_T
Definition: typedefs.h:80

Referenced by GdiAddFontResourceW(), and RemoveFontResourceExW().

◆ IntEnumFontFamilies()

static int FASTCALL IntEnumFontFamilies ( HDC  Dc,
const LOGFONTW LogFont,
PVOID  EnumProc,
LPARAM  lParam,
DWORD  dwFlags 
)
static

Definition at line 290 of file font.c.

292{
293 int FontFamilyCount;
295 int Ret = 1;
296 int i;
297 ENUMLOGFONTEXA EnumLogFontExA;
298 NEWTEXTMETRICEXA NewTextMetricExA;
299 LOGFONTW lfW;
300 LONG InfoCount;
303
306 if (Info == NULL)
307 {
308 return 1;
309 }
310
311 /* Initialize the LOGFONT structure */
312 ZeroMemory(&lfW, sizeof(lfW));
313 if (!LogFont)
314 {
316 }
317 else
318 {
319 lfW.lfCharSet = LogFont->lfCharSet;
320 lfW.lfPitchAndFamily = LogFont->lfPitchAndFamily;
321 StringCbCopyW(lfW.lfFaceName, sizeof(lfW.lfFaceName), LogFont->lfFaceName);
322 }
323
324 /* Retrieve the font information */
325 InfoCount = INITIAL_FAMILY_COUNT;
326 FontFamilyCount = NtGdiGetFontFamilyInfo(Dc, &lfW, Info, &InfoCount);
327 if (FontFamilyCount < 0)
328 {
330 return 1;
331 }
332
333 /* Resize the buffer if the buffer is too small */
334 if (INITIAL_FAMILY_COUNT < InfoCount)
335 {
337
338 Status = RtlULongMult(InfoCount, sizeof(FONTFAMILYINFO), &DataSize);
340 {
341 DPRINT1("Overflowed.\n");
342 return 1;
343 }
345 if (Info == NULL)
346 {
347 return 1;
348 }
349 FontFamilyCount = NtGdiGetFontFamilyInfo(Dc, &lfW, Info, &InfoCount);
350 if (FontFamilyCount < 0 || FontFamilyCount < InfoCount)
351 {
353 return 1;
354 }
355 }
356
357 /* Sort and remove redundant information */
358 qsort(Info, FontFamilyCount, sizeof(*Info), IntFontFamilyCompare);
359 FontFamilyCount = IntFontFamilyListUnique(Info, FontFamilyCount, &lfW, dwFlags);
360
361 /* call the callback */
362 for (i = 0; i < FontFamilyCount; i++)
363 {
364 if (dwFlags & IEFF_UNICODE)
365 {
366 Ret = ((FONTENUMPROCW) EnumProc)(
367 (VOID*)&Info[i].EnumLogFontEx,
368 (VOID*)&Info[i].NewTextMetricEx,
369 Info[i].FontType, lParam);
370 }
371 else
372 {
373 // Could use EnumLogFontExW2A here?
374 LogFontW2A(&EnumLogFontExA.elfLogFont, &Info[i].EnumLogFontEx.elfLogFont);
375 WideCharToMultiByte(CP_THREAD_ACP, 0, Info[i].EnumLogFontEx.elfFullName, -1,
376 (LPSTR)EnumLogFontExA.elfFullName, LF_FULLFACESIZE, NULL, NULL);
377 WideCharToMultiByte(CP_THREAD_ACP, 0, Info[i].EnumLogFontEx.elfStyle, -1,
378 (LPSTR)EnumLogFontExA.elfStyle, LF_FACESIZE, NULL, NULL);
379 WideCharToMultiByte(CP_THREAD_ACP, 0, Info[i].EnumLogFontEx.elfScript, -1,
380 (LPSTR)EnumLogFontExA.elfScript, LF_FACESIZE, NULL, NULL);
381 NewTextMetricExW2A(&NewTextMetricExA,
382 &Info[i].NewTextMetricEx);
383 Ret = ((FONTENUMPROCA) EnumProc)(
384 (VOID*)&EnumLogFontExA,
385 (VOID*)&NewTextMetricExA,
386 Info[i].FontType, lParam);
387 }
388
389 if(Ret == 0)
390 break;
391 }
392
394
395 return Ret;
396}
static BOOL CALLBACK EnumProc(_In_ HWND hWnd, _In_ LPARAM lParam)
Definition: SetParent.c:53
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:616
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:634
#define LONG_MAX
Definition: limits.h:30
_ACRTIMP void __cdecl qsort(void *, size_t, size_t, int(__cdecl *)(const void *, const void *))
LONG NTAPI NtGdiGetFontFamilyInfo(_In_ HDC Dc, _In_ const LOGFONTW *UnsafeLogFont, _Out_ PFONTFAMILYINFO UnsafeInfo, _Inout_ PLONG UnsafeInfoCount)
Definition: freetype.c:6555
VOID NTAPI LogFontW2A(LPLOGFONTA pA, CONST LOGFONTW *pW)
Definition: utils.c:375
_In_ NDIS_STATUS _In_ ULONG _In_ USHORT _In_opt_ PVOID _In_ ULONG DataSize
Definition: ndis.h:4755
struct tagFONTFAMILYINFO FONTFAMILYINFO
long LONG
Definition: pedump.c:60
STRSAFEAPI StringCbCopyW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:166
LOGFONTA elfLogFont
Definition: wingdi.h:3142
BYTE elfFullName[LF_FULLFACESIZE]
Definition: wingdi.h:3143
BYTE elfScript[LF_FACESIZE]
Definition: wingdi.h:3145
BYTE elfStyle[LF_FACESIZE]
Definition: wingdi.h:3144
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:690
VOID FASTCALL NewTextMetricExW2A(NEWTEXTMETRICEXA *tma, NEWTEXTMETRICEXW *tmw)
Definition: font.c:203
static int __cdecl IntFontFamilyCompare(const void *ffi1, const void *ffi2)
Definition: font.c:247
int FASTCALL IntFontFamilyListUnique(FONTFAMILYINFO *InfoList, INT nCount, const LOGFONTW *plf, DWORD dwFlags)
Definition: font.c:257
#define INITIAL_FAMILY_COUNT
Definition: font.c:74
FARPROC FONTENUMPROCW
Definition: wingdi.h:3343
FARPROC FONTENUMPROCA
Definition: wingdi.h:3342
#define LF_FULLFACESIZE
Definition: wingdi.h:41

Referenced by EnumFontFamiliesA(), EnumFontFamiliesExA(), EnumFontFamiliesExW(), and EnumFontFamiliesW().

◆ INTERNAL_YDSTOWS()

static INT INTERNAL_YDSTOWS ( XFORM xForm,
INT  height 
)
inlinestatic

Definition at line 1398 of file font.c.

1399{
1400 double floatHeight;
1401
1402 /* Perform operation with floating point */
1403 floatHeight = (double)height * xForm->eM22;
1404 /* Round to integers */
1405 return GDI_ROUND(floatHeight);
1406}
static const char mbstate_t *static wchar_t const char mbstate_t *static const wchar_t int *static double
Definition: string.c:91

Referenced by GetOutlineTextMetricsW().

◆ IntFontFamilyCompare()

static int __cdecl IntFontFamilyCompare ( const void ffi1,
const void ffi2 
)
static

Definition at line 247 of file font.c.

248{
250}
FORCEINLINE int FASTCALL IntFontFamilyCompareEx(const FONTFAMILYINFO *ffi1, const FONTFAMILYINFO *ffi2, DWORD dwCompareFlags)
Definition: font.c:214
#define IFFCX_STYLE
Definition: font.c:211
#define IFFCX_CHARSET
Definition: font.c:210

Referenced by IntEnumFontFamilies().

◆ IntFontFamilyCompareEx()

FORCEINLINE int FASTCALL IntFontFamilyCompareEx ( const FONTFAMILYINFO ffi1,
const FONTFAMILYINFO ffi2,
DWORD  dwCompareFlags 
)

Definition at line 214 of file font.c.

216{
217 const LOGFONTW *plf1 = &ffi1->EnumLogFontEx.elfLogFont;
218 const LOGFONTW *plf2 = &ffi2->EnumLogFontEx.elfLogFont;
219 ULONG WeightDiff1, WeightDiff2;
220 int cmp = _wcsicmp(plf1->lfFaceName, plf2->lfFaceName);
221 if (cmp)
222 return cmp;
223 if (dwCompareFlags & IFFCX_CHARSET)
224 {
225 if (plf1->lfCharSet < plf2->lfCharSet)
226 return -1;
227 if (plf1->lfCharSet > plf2->lfCharSet)
228 return 1;
229 }
230 if (dwCompareFlags & IFFCX_STYLE)
231 {
232 WeightDiff1 = labs(plf1->lfWeight - FW_NORMAL);
233 WeightDiff2 = labs(plf2->lfWeight - FW_NORMAL);
234 if (WeightDiff1 < WeightDiff2)
235 return -1;
236 if (WeightDiff1 > WeightDiff2)
237 return 1;
238 if (plf1->lfItalic < plf2->lfItalic)
239 return -1;
240 if (plf1->lfItalic > plf2->lfItalic)
241 return 1;
242 }
243 return 0;
244}
_ACRTIMP __msvcrt_long __cdecl labs(__msvcrt_long)
Definition: math.c:680
#define cmp(status, error)
Definition: error.c:114
ENUMLOGFONTEXW EnumLogFontEx
Definition: ntgdibad.h:47
#define FW_NORMAL
Definition: wingdi.h:373

Referenced by IntFontFamilyCompare(), and IntFontFamilyListUnique().

◆ IntFontFamilyListUnique()

int FASTCALL IntFontFamilyListUnique ( FONTFAMILYINFO InfoList,
INT  nCount,
const LOGFONTW plf,
DWORD  dwFlags 
)

Definition at line 257 of file font.c.

259{
261 DWORD dwCompareFlags = 0;
262
263 if (plf->lfFaceName[0])
264 dwCompareFlags |= IFFCX_STYLE;
265
267 dwCompareFlags |= IFFCX_CHARSET;
268
269 first = InfoList;
270 last = &InfoList[nCount];
271
272 /* std::unique(first, last, IntFontFamilyCompareEx); */
273 if (first == last)
274 return 0;
275
276 result = first;
277 while (++first != last)
278 {
279 if (IntFontFamilyCompareEx(result, first, dwCompareFlags) != 0)
280 {
281 *(++result) = *first;
282 }
283 }
284 nCount = (int)(++result - InfoList);
285
286 return nCount;
287}
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
GLuint64EXT * result
Definition: glext.h:11304
static UINT UINT last
Definition: font.c:45

Referenced by IntEnumFontFamilies().

◆ NewEnumFontFamiliesExW()

INT WINAPI NewEnumFontFamiliesExW ( HDC  hDC,
LPLOGFONTW  lpLogfont,
FONTENUMPROCW  lpEnumFontFamExProcW,
LPARAM  lParam,
DWORD  dwFlags 
)

Definition at line 2495 of file font.c.

2501{
2502 ULONG_PTR idEnum;
2503 ULONG cbDataSize, cbRetSize;
2504 PENUMFONTDATAW pEfdw;
2505 PBYTE pBuffer;
2506 PBYTE pMax;
2507 INT ret = 1;
2508
2509 /* Open enumeration handle and find out how much memory we need */
2510 idEnum = NtGdiEnumFontOpen(hDC,
2512 0,
2514 (lpLogfont && lpLogfont->lfFaceName[0])? lpLogfont->lfFaceName : NULL,
2515 lpLogfont? lpLogfont->lfCharSet : DEFAULT_CHARSET,
2516 &cbDataSize);
2517 if (idEnum == 0)
2518 {
2519 return 0;
2520 }
2521 if (cbDataSize == 0)
2522 {
2523 NtGdiEnumFontClose(idEnum);
2524 return 0;
2525 }
2526
2527 /* Allocate memory */
2528 pBuffer = HeapAlloc(GetProcessHeap(), 0, cbDataSize);
2529 if (pBuffer == NULL)
2530 {
2532 NtGdiEnumFontClose(idEnum);
2533 return 0;
2534 }
2535
2536 /* Do the enumeration */
2537 if (!NtGdiEnumFontChunk(hDC, idEnum, cbDataSize, &cbRetSize, (PVOID)pBuffer))
2538 {
2540 NtGdiEnumFontClose(idEnum);
2541 return 0;
2542 }
2543
2544 /* Get start and end address */
2545 pEfdw = (PENUMFONTDATAW)pBuffer;
2546 pMax = pBuffer + cbDataSize;
2547
2548 /* Iterate through the structures */
2549 while ((PBYTE)pEfdw < pMax && ret)
2550 {
2551 PNTMW_INTERNAL pNtmwi = (PNTMW_INTERNAL)((ULONG_PTR)pEfdw + pEfdw->ulNtmwiOffset);
2552
2553 ret = lpEnumFontFamExProcW((VOID*)&pEfdw->elfexdv.elfEnumLogfontEx,
2554 (VOID*)&pNtmwi->ntmw,
2555 pEfdw->dwFontType,
2556 lParam);
2557
2558 pEfdw = (PENUMFONTDATAW)((ULONG_PTR)pEfdw + pEfdw->cbSize);
2559 }
2560
2561 /* Release the memory and close handle */
2563 NtGdiEnumFontClose(idEnum);
2564
2565 return ret;
2566}
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
__kernel_entry W32KAPI BOOL APIENTRY NtGdiEnumFontChunk(_In_ HDC hdc, _In_ ULONG_PTR idEnum, _In_ ULONG cjEfdw, _Out_ ULONG *pcjEfdw, _Out_ PENUMFONTDATAW pefdw)
__kernel_entry W32KAPI BOOL APIENTRY NtGdiEnumFontClose(_In_ ULONG_PTR idEnum)
__kernel_entry W32KAPI ULONG_PTR APIENTRY NtGdiEnumFontOpen(_In_ HDC hdc, _In_ ULONG iEnumType, _In_ FLONG flWin31Compat, _In_ ULONG cwchMax, _In_opt_ LPWSTR pwszFaceName, _In_ ULONG lfCharSet, _Out_ ULONG *pulCount)
struct _ENUMFONTDATAW * PENUMFONTDATAW
struct _NTMW_INTERNAL * PNTMW_INTERNAL
BYTE * PBYTE
Definition: pedump.c:66
PVOID pBuffer
ULONG cbSize
Definition: ntgdityp.h:382
DWORD dwFontType
Definition: ntgdityp.h:384
ENUMLOGFONTEXDVW elfexdv
Definition: ntgdityp.h:385
ULONG ulNtmwiOffset
Definition: ntgdityp.h:383
NEWTEXTMETRICEXW ntmw
Definition: ntgdityp.h:377
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define EfdFontFamilies
Definition: font.c:2491

◆ NewGetCharacterPlacementW()

DWORD WINAPI NewGetCharacterPlacementW ( HDC  hdc,
LPCWSTR  lpString,
INT  uCount,
INT  nMaxExtent,
GCP_RESULTSW lpResults,
DWORD  dwFlags 
)

Definition at line 643 of file font.c.

651{
652 ULONG nSet;
653 SIZE Size = {0,0};
654
655 if ( !lpString || uCount <= 0 || (nMaxExtent < 0 && nMaxExtent != -1 ) )
656 {
658 return 0;
659 }
660
661 if ( !lpResults )
662 {
663 if ( GetTextExtentPointW(hdc, lpString, uCount, &Size) )
664 {
665 return MAKELONG(Size.cx, Size.cy);
666 }
667 return 0;
668 }
669
670 nSet = uCount;
671 if ( nSet > lpResults->nGlyphs )
672 nSet = lpResults->nGlyphs;
673
675 lpString,
676 nSet,
677 nMaxExtent,
678 lpResults,
679 dwFlags);
680}
__kernel_entry W32KAPI DWORD APIENTRY NtGdiGetCharacterPlacementW(_In_ HDC hdc, _In_reads_(nCount) PCWCH pwsz, _In_ INT nCount, _In_ INT nMaxExtent, _Inout_opt_ LPGCP_RESULTSW pgcpw, _In_ DWORD dwFlags)
Definition: font.c:652

◆ NewTextMetricExW2A()

VOID FASTCALL NewTextMetricExW2A ( NEWTEXTMETRICEXA tma,
NEWTEXTMETRICEXW tmw 
)

Definition at line 203 of file font.c.

204{
205 NewTextMetricW2A(&tma->ntmTm, &tmw->ntmTm);
206 tma->ntmFontSig = tmw->ntmFontSig;
207}
NEWTEXTMETRICA ntmTm
Definition: wingdi.h:3117
FONTSIGNATURE ntmFontSig
Definition: wingdi.h:3118
NEWTEXTMETRICW ntmTm
Definition: wingdi.h:3121
FONTSIGNATURE ntmFontSig
Definition: wingdi.h:3122
VOID FASTCALL NewTextMetricW2A(NEWTEXTMETRICA *tma, NEWTEXTMETRICW *tmw)
Definition: font.c:193

Referenced by IntEnumFontFamilies().

◆ NewTextMetricW2A()

VOID FASTCALL NewTextMetricW2A ( NEWTEXTMETRICA tma,
NEWTEXTMETRICW tmw 
)

Definition at line 193 of file font.c.

194{
196 tma->ntmFlags = tmw->ntmFlags;
197 tma->ntmSizeEM = tmw->ntmSizeEM;
198 tma->ntmCellHeight = tmw->ntmCellHeight;
199 tma->ntmAvgWidth = tmw->ntmAvgWidth;
200}
UINT ntmCellHeight
Definition: wingdi.h:3086

Referenced by NewTextMetricExW2A().

◆ QueryFontAssocStatus()

DWORD WINAPI QueryFontAssocStatus ( VOID  )

Definition at line 2777 of file font.c.

2778{
2781 return 0;
2782}

◆ RemoveFontMemResourceEx()

BOOL WINAPI RemoveFontMemResourceEx ( HANDLE  fh)

Definition at line 2622 of file font.c.

2623{
2624 if (fh)
2625 {
2627 }
2629 return FALSE;
2630}
__kernel_entry W32KAPI BOOL APIENTRY NtGdiRemoveFontMemResourceEx(_In_ HANDLE hMMFont)
Definition: font.c:640

Referenced by START_TEST().

◆ RemoveFontResourceA()

BOOL WINAPI RemoveFontResourceA ( _In_ LPCSTR  lpFileName)

Definition at line 2204 of file font.c.

2205{
2207}
BOOL WINAPI RemoveFontResourceExA(_In_ LPCSTR lpFileName, _In_ DWORD fl, _In_opt_ PVOID pdv)
Definition: font.c:2212
_In_ LPCSTR lpFileName
Definition: winbase.h:2824

Referenced by Test_AddFontResourceA().

◆ RemoveFontResourceExA()

BOOL WINAPI RemoveFontResourceExA ( _In_ LPCSTR  lpFileName,
_In_ DWORD  fl,
_In_opt_ PVOID  pdv 
)

Definition at line 2212 of file font.c.

2216{
2217 if (fl & ~(FR_PRIVATE | FR_NOT_ENUM))
2218 {
2220 return FALSE;
2221 }
2222
2223 if (!lpFileName)
2224 return FALSE;
2225
2226 WCHAR szBuff[MAX_PATH];
2227 PWSTR FilenameW;
2228
2229 _SEH2_TRY
2230 {
2231 FilenameW = HEAP_strdupA2W_buf(lpFileName, szBuff, _countof(szBuff));
2232 }
2234 {
2235 FilenameW = NULL;
2236 }
2237 _SEH2_END;
2238
2239 if (!FilenameW)
2240 {
2242 return FALSE;
2243 }
2244
2245 BOOL result = RemoveFontResourceExW(FilenameW, fl, pdv);
2246 HEAP_strdupA2W_buf_free(FilenameW, szBuff);
2247 return result;
2248}
BOOL WINAPI RemoveFontResourceExW(_In_ LPCWSTR lpFileName, _In_ DWORD fl, _In_opt_ PVOID pdv)
Definition: font.c:2253

Referenced by RemoveFontResourceA(), and test_long_names().

◆ RemoveFontResourceExW()

BOOL WINAPI RemoveFontResourceExW ( _In_ LPCWSTR  lpFileName,
_In_ DWORD  fl,
_In_opt_ PVOID  pdv 
)

Definition at line 2253 of file font.c.

2257{
2258 DPRINT("RemoveFontResourceExW\n");
2259
2260 if (fl & ~(FR_PRIVATE | FR_NOT_ENUM))
2261 {
2263 return FALSE;
2264 }
2265
2266 if (!lpFileName)
2267 return FALSE;
2268
2269 ULONG cFiles, cwc;
2270 PWSTR pszConverted = IntConvertFontPaths(lpFileName, &cFiles, &cwc, &fl, TRUE);
2271 if (!pszConverted)
2272 return FALSE;
2273
2274 BOOL ret = NtGdiRemoveFontResourceW(pszConverted, cwc, cFiles, fl, 0, NULL);
2275 HEAP_free(pszConverted);
2276 return ret;
2277}
__kernel_entry W32KAPI BOOL APIENTRY NtGdiRemoveFontResourceW(_In_reads_(cwc) PCWCH pwszFiles, _In_ ULONG cwc, _In_ ULONG cFiles, _In_ ULONG fl, _In_ DWORD dwPidTid, _In_opt_ const DESIGNVECTOR *pdv)
Definition: font.c:530

Referenced by DeleteFontFiles(), DoInstallFontFile(), RemoveFontResourceExA(), RemoveFontResourceW(), and RemoveTempFont().

◆ RemoveFontResourceTracking()

int WINAPI RemoveFontResourceTracking ( LPCSTR  lpString,
int  unknown 
)

Definition at line 2653 of file font.c.

2654{
2657 return 0;
2658}

◆ RemoveFontResourceW()

BOOL WINAPI RemoveFontResourceW ( _In_ LPCWSTR  lpFileName)

Definition at line 2196 of file font.c.

2197{
2199}

Referenced by DeleteFontFiles(), DoEntry(), DoInstallFontFile(), and wWinMain().

◆ SetMapperFlags()

DWORD WINAPI SetMapperFlags ( HDC  hDC,
DWORD  flags 
)

Definition at line 2404 of file font.c.

2408{
2409 DWORD Ret = GDI_ERROR;
2410 PDC_ATTR Dc_Attr;
2411
2412 /* Get the DC attribute */
2413 Dc_Attr = GdiGetDcAttr(hDC);
2414 if (Dc_Attr == NULL)
2415 {
2417 return GDI_ERROR;
2418 }
2419
2420 if (NtCurrentTeb()->GdiTebBatch.HDC == hDC)
2421 {
2422 if (Dc_Attr->ulDirty_ & DC_FONTTEXT_DIRTY)
2423 {
2424 NtGdiFlush();
2426 }
2427 }
2428
2429 if ( flags & ~1 )
2431 else
2432 {
2433 Ret = Dc_Attr->flFontMapper;
2434 Dc_Attr->flFontMapper = flags;
2435 }
2436 return Ret;
2437}
FORCEINLINE PDC_ATTR GdiGetDcAttr(HDC hdc)
Definition: gdi32p.h:477
#define NtCurrentTeb
__kernel_entry W32KAPI NTSTATUS APIENTRY NtGdiFlush(VOID)
Definition: gdibatch.c:471
#define DC_FONTTEXT_DIRTY
Definition: ntgdihdl.h:145
#define DC_MODE_DIRTY
Definition: ntgdihdl.h:144
ULONG ulDirty_
Definition: ntgdihdl.h:294
FLONG flFontMapper
Definition: ntgdihdl.h:316

◆ TranslateCharsetInfo()

BOOL WINAPI TranslateCharsetInfo ( LPDWORD  lpSrc,
LPCHARSETINFO  lpCs,
DWORD  flags 
)

Definition at line 2355 of file font.c.

2363{
2364 int index = 0;
2365 switch (flags)
2366 {
2367 case TCI_SRCFONTSIG:
2368 while (index < MAXTCIINDEX && !(*lpSrc>>index & 0x0001)) index++;
2369 break;
2370 case TCI_SRCCODEPAGE:
2371 while (index < MAXTCIINDEX && PtrToUlong(lpSrc) != FONT_tci[index].ciACP) index++;
2372 break;
2373 case TCI_SRCCHARSET:
2374 while (index < MAXTCIINDEX && PtrToUlong(lpSrc) != FONT_tci[index].ciCharset) index++;
2375 break;
2376 case TCI_SRCLOCALE:
2377 {
2378 LCID lCid = (LCID)PtrToUlong(lpSrc);
2379 LOCALESIGNATURE LocSig;
2380 INT Ret = GetLocaleInfoW(lCid, LOCALE_FONTSIGNATURE, (LPWSTR)&LocSig, 0);
2381 if ( GetLocaleInfoW(lCid, LOCALE_FONTSIGNATURE, (LPWSTR)&LocSig, Ret))
2382 {
2383 while (index < MAXTCIINDEX && !(LocSig.lsCsbDefault[0]>>index & 0x0001)) index++;
2384 break;
2385 }
2386 }
2387 default:
2389 return FALSE;
2390 }
2391 if (index >= MAXTCIINDEX || FONT_tci[index].ciCharset == DEFAULT_CHARSET) return FALSE;
2392 DPRINT("Index %d Charset %u CodePage %u FontSig %lu\n",
2393 index,FONT_tci[index].ciCharset,FONT_tci[index].ciACP,FONT_tci[index].fs.fsCsb[0]);
2394 memcpy(lpCs, &FONT_tci[index], sizeof(CHARSETINFO));
2395 return TRUE;
2396}
INT WINAPI GetLocaleInfoW(LCID lcid, LCTYPE lctype, LPWSTR buffer, INT len)
Definition: locale.c:1675
#define PtrToUlong(u)
Definition: config.h:107
VOID WINAPI GdiSetLastError(DWORD dwErrCode)
Definition: misc.c:873
GLuint index
Definition: glext.h:6031
DWORD LCID
Definition: nls.h:13
Definition: ffs.h:70
static const CHARSETINFO FONT_tci[MAXTCIINDEX]
Definition: font.c:33
#define MAXTCIINDEX
Definition: font.c:32
#define TCI_SRCLOCALE
Definition: wingdi.h:964
#define TCI_SRCFONTSIG
Definition: wingdi.h:963
#define TCI_SRCCODEPAGE
Definition: wingdi.h:962
#define LOCALE_FONTSIGNATURE
Definition: winnls.h:132

◆ UnloadNetworkFonts()

VOID WINAPI UnloadNetworkFonts ( DWORD  unknown)

Definition at line 2789 of file font.c.

◆ width_to_LP()

static INT width_to_LP ( XFORM xForm,
INT  width 
)
inlinestatic

Definition at line 1409 of file font.c.

1410{
1411 return GDI_ROUND( (double)width * fabs( xForm->eM11));
1412}
GLint GLint GLsizei width
Definition: gl.h:1546
FLOAT eM11
Definition: wingdi.h:2167

Referenced by GetOutlineTextMetricsW().

Variable Documentation

◆ FONT_tci

const CHARSETINFO FONT_tci[MAXTCIINDEX]
static

Definition at line 33 of file font.c.

Referenced by TranslateCharsetInfo().