ReactOS 0.4.17-dev-478-g4117217
font.c File Reference
#include <precomp.h>
#include <math.h>
#include <strsafe.h>
#include <cjkcode.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)
 
static __inline DWORD APIENTRY IntGetGlyphOutlineW (HDC hdc, UINT uChar, UINT fuFormat, LPGLYPHMETRICS lpgm, DWORD cbBuffer, LPVOID lpvBuffer, CONST MAT2 *lpmat2, BOOL bIgnoreRotation)
 
static DWORD APIENTRY IntGetGlyphOutlineA (HDC hdc, UINT uChar, UINT fuFormat, LPGLYPHMETRICS lpgm, DWORD cbBuffer, LPVOID lpvBuffer, CONST MAT2 *lpmat2, BOOL bIgnoreRotation)
 
DWORD WINAPI GetGlyphOutlineA (_In_ HDC hdc, _In_ UINT uChar, _In_ UINT fuFormat, _Out_ LPGLYPHMETRICS lpgm, _In_ DWORD cbBuffer, _Out_writes_bytes_opt_(cbBuffer) LPVOID lpvBuffer, _In_ CONST MAT2 *lpmat2)
 
DWORD WINAPI GetGlyphOutlineW (_In_ HDC hdc, _In_ UINT uChar, _In_ UINT fuFormat, _Out_ LPGLYPHMETRICS lpgm, _In_ DWORD cbBuffer, _Out_writes_bytes_opt_(cbBuffer) LPVOID lpvBuffer, _In_ CONST MAT2 *lpmat2)
 
DWORD WINAPI GetGlyphOutlineWow (_In_ HDC hdc, _In_ UINT uChar, _In_ UINT fuFormat, _Out_ LPGLYPHMETRICS lpgm, _In_ DWORD cbBuffer, _Out_writes_bytes_opt_(cbBuffer) LPVOID lpvBuffer, _In_ CONST MAT2 *lpmat2)
 
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 2518 of file font.c.

◆ IEFF_EXTENDED

#define IEFF_EXTENDED   2

Definition at line 255 of file font.c.

◆ IEFF_UNICODE

#define IEFF_UNICODE   1

Definition at line 254 of file font.c.

◆ IFFCX_CHARSET

#define IFFCX_CHARSET   1

Definition at line 211 of file font.c.

◆ IFFCX_STYLE

#define IFFCX_STYLE   2

Definition at line 212 of file font.c.

◆ INITIAL_FAMILY_COUNT

#define INITIAL_FAMILY_COUNT   64

Definition at line 75 of file font.c.

◆ MAXTCIINDEX

#define MAXTCIINDEX   32

Definition at line 33 of file font.c.

◆ NDEBUG

#define NDEBUG

Definition at line 18 of file font.c.

Function Documentation

◆ AddFontMemResourceEx()

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

Definition at line 2629 of file font.c.

2635{
2636 if ( pbFont && cbFont && pcFonts)
2637 {
2638 return NtGdiAddFontMemResourceEx(pbFont, cbFont, NULL, 0, pcFonts);
2639 }
2641 return NULL;
2642}
#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 2207 of file font.c.

2208{
2209 return AddFontResourceExA(lpszFilename, 0, NULL);
2210}
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 2166 of file font.c.

2170{
2171 if (fl & ~(FR_PRIVATE | FR_NOT_ENUM))
2172 {
2174 return 0;
2175 }
2176
2177 if (!lpszFilename)
2178 return 0;
2179
2180 PWSTR FilenameW;
2181 WCHAR szBuff[MAX_PATH];
2182
2183 _SEH2_TRY
2184 {
2185 FilenameW = HEAP_strdupA2W_buf(lpszFilename, szBuff, _countof(szBuff));
2186 }
2188 {
2189 _SEH2_YIELD(return 0);
2190 }
2191 _SEH2_END;
2192
2193 if (!FilenameW)
2194 {
2196 return 0;
2197 }
2198
2199 INT ret = GdiAddFontResourceW(FilenameW, fl, NULL);
2200 HEAP_strdupA2W_buf_free(FilenameW, szBuff);
2201 return ret;
2202}
#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
short WCHAR
Definition: pedump.c:58
#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:2598
_In_ FLONG fl
Definition: winddi.h:1279

◆ AddFontResourceExW()

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

Definition at line 2149 of file font.c.

2153{
2154 if (fl & ~(FR_PRIVATE | FR_NOT_ENUM))
2155 {
2157 return 0;
2158 }
2159
2160 return GdiAddFontResourceW(lpszFilename, fl, NULL);
2161}

◆ AddFontResourceTracking()

int WINAPI AddFontResourceTracking ( LPCSTR  lpString,
int  unknown 
)

Definition at line 2665 of file font.c.

2669{
2672 return 0;
2673}
#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 2215 of file font.c.

2216{
2217 return GdiAddFontResourceW(lpszFilename, 0, NULL);
2218}

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

◆ bInitSystemAndFontsDirectoriesW()

BOOL WINAPI bInitSystemAndFontsDirectoriesW ( LPWSTR SystemDir,
LPWSTR FontsDir 
)

Definition at line 2720 of file font.c.

2721{
2724 return 0;
2725}

◆ cGetTTFFromFOT()

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

Definition at line 2843 of file font.c.

2844{
2847 return 0;
2848}

◆ 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 1894 of file font.c.

1910{
1911 ANSI_STRING StringA;
1912 UNICODE_STRING StringU;
1913 HFONT ret;
1914
1915 RtlInitAnsiString(&StringA, lpszFace);
1916 RtlAnsiStringToUnicodeString(&StringU, &StringA, TRUE);
1917
1918 ret = CreateFontW(nHeight,
1919 nWidth,
1920 nEscapement,
1921 nOrientation,
1922 fnWeight,
1923 fdwItalic,
1924 fdwUnderline,
1925 fdwStrikeOut,
1926 fdwCharSet,
1927 fdwOutputPrecision,
1928 fdwClipPrecision,
1929 fdwQuality,
1930 fdwPitchAndFamily,
1931 StringU.Buffer);
1932
1933 RtlFreeUnicodeString(&StringU);
1934
1935 return ret;
1936}
#define TRUE
Definition: types.h:120
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 1749 of file font.c.

1752{
1753 if (lplf)
1754 {
1755 LOGFONTW tlf;
1756
1757 LogFontA2W(&tlf, lplf);
1758 return CreateFontIndirectW(&tlf);
1759 }
1760 else return NULL;
1761}
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 1707 of file font.c.

1708{
1709 if (elfexd)
1710 {
1711 ENUMLOGFONTEXDVW Logfont;
1712
1714 &Logfont.elfEnumLogfontEx );
1715
1717 &elfexd->elfDesignVector,
1718 sizeof(DESIGNVECTOR));
1719
1720 return NtGdiHfontCreate( &Logfont, 0, 0, 0, NULL);
1721 }
1722 else return NULL;
1723}
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_CreateFontIndirectEx(), and Test_CreateFontIndirectExA().

◆ CreateFontIndirectExW()

HFONT WINAPI CreateFontIndirectExW ( const ENUMLOGFONTEXDVW elfexd)

Definition at line 1731 of file font.c.

1732{
1733 /* Msdn: Note, this function ignores the elfDesignVector member in
1734 ENUMLOGFONTEXDV.
1735 */
1736 if ( elfexd )
1737 {
1738 return NtGdiHfontCreate((PENUMLOGFONTEXDVW) elfexd, 0, 0, 0, NULL );
1739 }
1740 else return NULL;
1741}

Referenced by CreateFontIndirectW(), and Test_CreateFontIndirectExW().

◆ CreateFontIndirectW()

HFONT WINAPI CreateFontIndirectW ( CONST LOGFONTW lplf)

Definition at line 1853 of file font.c.

1856{
1857#if 0
1858 static BOOL bDidTest = FALSE;
1859 if (!bDidTest)
1860 {
1861 bDidTest = TRUE;
1862 DoFontSystemUnittest();
1863 }
1864#endif
1865 if (lplf)
1866 {
1867 ENUMLOGFONTEXDVW Logfont;
1868
1869 RtlCopyMemory( &Logfont.elfEnumLogfontEx.elfLogFont, lplf, sizeof(LOGFONTW));
1870 // Need something other than just cleaning memory here.
1871 // Guess? Use caller data to determine the rest.
1873 sizeof(Logfont.elfEnumLogfontEx.elfFullName));
1875 sizeof(Logfont.elfEnumLogfontEx.elfStyle));
1877 sizeof(Logfont.elfEnumLogfontEx.elfScript));
1878
1879 Logfont.elfDesignVector.dvNumAxes = 0; // No more than MM_MAX_NUMAXES
1880
1881 RtlZeroMemory( &Logfont.elfDesignVector, sizeof(DESIGNVECTOR));
1882
1883 return CreateFontIndirectExW(&Logfont);
1884 }
1885 else return NULL;
1886}
#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:1731

◆ 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 1944 of file font.c.

1960{
1961 LOGFONTW logfont;
1962
1963 logfont.lfHeight = nHeight;
1964 logfont.lfWidth = nWidth;
1965 logfont.lfEscapement = nEscapement;
1966 logfont.lfOrientation = nOrientation;
1967 logfont.lfWeight = nWeight;
1968 logfont.lfItalic = (BYTE)fnItalic;
1969 logfont.lfUnderline = (BYTE)fdwUnderline;
1970 logfont.lfStrikeOut = (BYTE)fdwStrikeOut;
1971 logfont.lfCharSet = (BYTE)fdwCharSet;
1972 logfont.lfOutPrecision = (BYTE)fdwOutputPrecision;
1973 logfont.lfClipPrecision = (BYTE)fdwClipPrecision;
1974 logfont.lfQuality = (BYTE)fdwQuality;
1975 logfont.lfPitchAndFamily = (BYTE)fdwPitchAndFamily;
1976
1977 if (NULL != lpszFace)
1978 {
1979 int Size = sizeof(logfont.lfFaceName) / sizeof(WCHAR);
1980 wcsncpy((wchar_t *)logfont.lfFaceName, lpszFace, Size - 1);
1981 /* Be 101% sure to have '\0' at end of string */
1982 logfont.lfFaceName[Size - 1] = '\0';
1983 }
1984 else
1985 {
1986 logfont.lfFaceName[0] = L'\0';
1987 }
1988
1989 return CreateFontIndirectW(&logfont);
1990}
#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 2136 of file font.c.

2142{
2143 return FALSE;
2144}

◆ CreateScalableFontResourceW()

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

Definition at line 2689 of file font.c.

2695{
2696 HANDLE f;
2697
2699
2700 /* fHidden=1 - only visible for the calling app, read-only, not
2701 * enumerated with EnumFonts/EnumFontFamilies
2702 * lpszCurrentPath can be NULL
2703 */
2704
2705 /* If the output file already exists, return the ERROR_FILE_EXISTS error as specified in MSDN */
2706 if ((f = CreateFileW(lpszFontRes, 0, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0)) != INVALID_HANDLE_VALUE)
2707 {
2708 CloseHandle(f);
2710 return FALSE;
2711 }
2712 return FALSE; /* create failed */
2713}
#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 483 of file font.c.

485{
486 LOGFONTW LogFont;
487
488 DPRINT("EnumFontFamiliesA(%p, %s, %p, %p)\n",
489 hdc, lpszFamily, lpEnumFontFamProc, lParam);
490
491 ZeroMemory(&LogFont, sizeof(LOGFONTW));
492 LogFont.lfCharSet = DEFAULT_CHARSET;
493 if (NULL != lpszFamily)
494 {
495 if (!*lpszFamily) return 1;
496 MultiByteToWideChar(CP_THREAD_ACP, 0, lpszFamily, -1, LogFont.lfFaceName, LF_FACESIZE);
497 }
498
499 return IntEnumFontFamilies(hdc, &LogFont, lpEnumFontFamProc, lParam, 0);
500}
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:291
#define DEFAULT_CHARSET
Definition: wingdi.h:384
#define CP_THREAD_ACP
Definition: winnls.h:261

◆ EnumFontFamiliesExA()

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

Definition at line 450 of file font.c.

452{
453 LOGFONTW LogFontW, *pLogFontW;
454
455 if (lpLogfont)
456 {
457 DPRINT("EnumFontFamiliesExA(%p, %p(%s, %u, %u), %p, %p, 0x%08lX)\n",
458 hdc, lpLogfont, lpLogfont->lfFaceName, lpLogfont->lfCharSet,
459 lpLogfont->lfPitchAndFamily, lpEnumFontFamExProc, lParam, dwFlags);
460 }
461 else
462 {
463 DPRINT("EnumFontFamiliesExA(%p, NULL, %p, %p, 0x%08lX)\n",
464 hdc, lpEnumFontFamExProc, lParam, dwFlags);
465 }
466
467 if (lpLogfont)
468 {
469 LogFontA2W(&LogFontW,lpLogfont);
470 pLogFontW = &LogFontW;
471 }
472 else pLogFontW = NULL;
473
474 /* no need to convert LogFontW back to lpLogFont b/c it's an [in] parameter only */
475 return IntEnumFontFamilies(hdc, pLogFontW, lpEnumFontFamExProc, lParam, IEFF_EXTENDED);
476}
_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:255

◆ EnumFontFamiliesExW()

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

Definition at line 403 of file font.c.

405{
406 if (lpLogfont)
407 {
408 DPRINT("EnumFontFamiliesExW(%p, %p(%S, %u, %u), %p, %p, 0x%08lX)\n",
409 hdc, lpLogfont, lpLogfont->lfFaceName, lpLogfont->lfCharSet,
410 lpLogfont->lfPitchAndFamily, lpEnumFontFamExProc, lParam, dwFlags);
411 }
412 else
413 {
414 DPRINT("EnumFontFamiliesExW(%p, NULL, %p, %p, 0x%08lX)\n",
415 hdc, lpEnumFontFamExProc, lParam, dwFlags);
416 }
417 return IntEnumFontFamilies(hdc, lpLogfont, lpEnumFontFamExProc, lParam,
419}
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:254

◆ EnumFontFamiliesW()

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

Definition at line 426 of file font.c.

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

◆ EnumFontsA()

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

Definition at line 2491 of file font.c.

2497{
2498#if 0
2500 LPWSTR lpFaceNameW;
2501 int rc = 0;
2502
2503 Status = HEAP_strdupA2W ( &lpFaceNameW, lpFaceName );
2504 if (!NT_SUCCESS (Status))
2506 else
2507 {
2508 rc = NtGdiEnumFonts ( hDC, lpFaceNameW, FontFunc, lParam );
2509
2510 HEAP_free ( lpFaceNameW );
2511 }
2512 return rc;
2513#else
2514 return EnumFontFamiliesA( hDC, lpFaceName, FontFunc, lParam );
2515#endif
2516}
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:24
__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)
uint16_t * LPWSTR
Definition: typedefs.h:56
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
int WINAPI EnumFontFamiliesA(_In_ HDC, _In_opt_ LPCSTR, _In_ FONTENUMPROCA, _In_ LPARAM)

◆ EnumFontsW()

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

Definition at line 2472 of file font.c.

2478{
2479#if 0
2480 return NtGdiEnumFonts ( hDC, lpFaceName, FontFunc, lParam );
2481#else
2482 return EnumFontFamiliesW( hDC, lpFaceName, FontFunc, lParam );
2483#endif
2484}
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 2732 of file font.c.

2733{
2736 return 0;
2737}

◆ EudcUnloadLinkW()

BOOL WINAPI EudcUnloadLinkW ( LPCWSTR  pBaseFaceName,
LPCWSTR  pEudcFontPath 
)

Definition at line 2744 of file font.c.

2745{
2748 return 0;
2749}

◆ FONT_GetCharsByRangeA()

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

Definition at line 149 of file font.c.

150{
151 INT i, count = lastChar - firstChar + 1;
152 UINT c;
153 LPSTR str;
154
155 if (count <= 0)
156 return NULL;
157
158 switch (GdiGetCodePage(hdc))
159 {
160 case 932:
161 case 936:
162 case 949:
163 case 950:
164 case 1361:
165 if (lastChar > 0xffff)
166 return NULL;
167 if ((firstChar ^ lastChar) > 0xff)
168 return NULL;
169 break;
170 default:
171 if (lastChar > 0xff)
172 return NULL;
173 break;
174 }
175
176 str = HeapAlloc(GetProcessHeap(), 0, count * 2 + 1);
177 if (str == NULL)
178 return NULL;
179
180 for(i = 0, c = firstChar; c <= lastChar; i++, c++)
181 {
182 if (c > 0xff)
183 str[i++] = (BYTE)(c >> 8);
184 str[i] = (BYTE)c;
185 }
186 str[i] = '\0';
187
188 *pByteLen = i;
189
190 return str;
191}
#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
unsigned int UINT
Definition: sysinfo.c:13
#define c
Definition: ke_i.h:80
const WCHAR * str
char * LPSTR
Definition: typedefs.h:51
DWORD WINAPI GdiGetCodePage(HDC)

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 127 of file font.c.

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

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

◆ FONT_TextMetricWToA()

VOID FASTCALL FONT_TextMetricWToA ( const TEXTMETRICW ptmW,
LPTEXTMETRICA  ptmA 
)

Definition at line 82 of file font.c.

83{
84 ptmA->tmHeight = ptmW->tmHeight;
85 ptmA->tmAscent = ptmW->tmAscent;
86 ptmA->tmDescent = ptmW->tmDescent;
89 ptmA->tmAveCharWidth = ptmW->tmAveCharWidth;
90 ptmA->tmMaxCharWidth = ptmW->tmMaxCharWidth;
91 ptmA->tmWeight = ptmW->tmWeight;
92 ptmA->tmOverhang = ptmW->tmOverhang;
95 ptmA->tmFirstChar = min(ptmW->tmFirstChar, 255);
96 if (ptmW->tmCharSet == SYMBOL_CHARSET)
97 {
98 ptmA->tmFirstChar = 0x1e;
99 ptmA->tmLastChar = 0xff; /* win9x behaviour - we need the OS2 table data to calculate correctly */
100 }
101 else
102 {
103 ptmA->tmFirstChar = ptmW->tmDefaultChar - 1;
104 ptmA->tmLastChar = min(ptmW->tmLastChar, 0xff);
105 }
106 ptmA->tmDefaultChar = (CHAR)ptmW->tmDefaultChar;
107 ptmA->tmBreakChar = (CHAR)ptmW->tmBreakChar;
108 ptmA->tmItalic = ptmW->tmItalic;
109 ptmA->tmUnderlined = ptmW->tmUnderlined;
110 ptmA->tmStruckOut = ptmW->tmStruckOut;
112 ptmA->tmCharSet = ptmW->tmCharSet;
113}
#define CHAR(Char)
#define min(a, b)
Definition: monoChain.cc:55
char CHAR
Definition: pedump.c:57
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

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

◆ GDI_ROUND()

static __inline INT GDI_ROUND ( FLOAT  val)
static

Definition at line 25 of file font.c.

26{
27 return (int)floor(val + 0.5);
28}
_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 2598 of file font.c.

2602{
2603 ULONG cFiles, cwc;
2604 PWSTR pszConverted = IntConvertFontPaths(lpszFilename, &cFiles, &cwc, &fl, FALSE);
2605 if (!pszConverted)
2606 return 0;
2607
2608 INT ret = NtGdiAddFontResourceW(pszConverted, cwc, cFiles, fl, 0, pdv);
2609 HEAP_free(pszConverted);
2610 if (ret)
2611 return ret;
2612
2613 pszConverted = IntConvertFontPaths(lpszFilename, &cFiles, &cwc, &fl, TRUE);
2614 if (!pszConverted)
2615 return 0;
2616
2617 ret = NtGdiAddFontResourceW(pszConverted, cwc, cFiles, fl, 0, pdv);
2618 HEAP_free(pszConverted);
2619 if (!ret)
2621 return ret;
2622}
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:1995
_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 2341 of file font.c.

2342{
2343 SIZE sz;
2345 static const WCHAR alphabet[] =
2346 {
2347 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q',
2348 'r','s','t','u','v','w','x','y','z','A','B','C','D','E','F','G','H',
2349 'I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',0
2350 };
2351
2352 if(!GetTextMetricsW(hdc, &tm)) return 0;
2353
2354 if(!GetTextExtentPointW(hdc, alphabet, 52, &sz)) return 0;
2355
2356 if (lptm) *lptm = tm;
2357 if (height) *height = tm.tmHeight;
2358
2359 return (sz.cx / 26 + 1) / 2;
2360}
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 950 of file font.c.

956{
957 INT wlen, count = 0;
958 LPSTR str;
959 LPWSTR wstr;
960 BOOL ret = TRUE;
961
962 DPRINT("GetCharABCWidthsA\n");
963
964 str = FONT_GetCharsByRangeA(hdc, iFirstChar, iLastChar, &count);
965 if (!str)
966 return FALSE;
967
968 wstr = FONT_mbtowc(hdc, str, count+1, &wlen, NULL);
969 if (!wstr)
970 {
972 return FALSE;
973 }
974
976 wstr[0],
977 wlen - 1,
978 (PWCHAR)wstr,
980 (PVOID)lpabc);
981
983 HeapFree(GetProcessHeap(), 0, wstr);
984
985 return ret;
986}
#define GCABCW_NOFLOAT
Definition: ntgdityp.h:209
__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)
uint16_t * PWCHAR
Definition: typedefs.h:56
static LPSTR FONT_GetCharsByRangeA(HDC hdc, UINT firstChar, UINT lastChar, PINT pByteLen)
Definition: font.c:149
static LPWSTR FONT_mbtowc(HDC hdc, LPCSTR str, INT count, INT *plenW, UINT *pCP)
Definition: font.c:127

◆ GetCharABCWidthsFloatA()

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

Definition at line 993 of file font.c.

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

◆ GetCharABCWidthsFloatW()

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

Definition at line 689 of file font.c.

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

◆ GetCharABCWidthsI()

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

Definition at line 1030 of file font.c.

1035{
1036 DPRINT("GetCharABCWidthsI\n");
1038 giFirst,
1039 (ULONG) cgi,
1040 (PWCHAR) pgi,
1042 (PVOID)lpabc);
1043}
#define GCABCW_INDICES
Definition: ntgdityp.h:210

◆ GetCharABCWidthsW()

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

Definition at line 788 of file font.c.

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

◆ GetCharacterPlacementA()

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

Definition at line 508 of file font.c.

515{
516 WCHAR *lpStringW;
517 INT uCountW;
518 GCP_RESULTSW resultsW;
519 DWORD ret;
520 UINT font_cp;
521
522 if ( !lpString || uCount <= 0 || !lpResults || (nMaxExtent < 0 && nMaxExtent != -1 ) )
523 {
525 return 0;
526 }
527 /* TRACE("%s, %d, %d, 0x%08x\n",
528 debugstr_an(lpString, uCount), uCount, nMaxExtent, dwFlags);
529 */
530 /* both structs are equal in size */
531 memcpy(&resultsW, lpResults, sizeof(resultsW));
532
533 lpStringW = FONT_mbtowc(hdc, lpString, uCount, &uCountW, &font_cp);
534 if (lpStringW == NULL)
535 {
536 return 0;
537 }
538 if(lpResults->lpOutString)
539 {
540 resultsW.lpOutString = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR)*uCountW);
541 if (resultsW.lpOutString == NULL)
542 {
543 HeapFree(GetProcessHeap(), 0, lpStringW);
544 return 0;
545 }
546 }
547
548 ret = GetCharacterPlacementW(hdc, lpStringW, uCountW, nMaxExtent, &resultsW, dwFlags);
549
550 lpResults->nGlyphs = resultsW.nGlyphs;
551 lpResults->nMaxFit = resultsW.nMaxFit;
552
553 if(lpResults->lpOutString)
554 {
555 WideCharToMultiByte(font_cp, 0, resultsW.lpOutString, uCountW,
556 lpResults->lpOutString, uCount, NULL, NULL );
557 }
558
559 HeapFree(GetProcessHeap(), 0, lpStringW);
560 HeapFree(GetProcessHeap(), 0, resultsW.lpOutString);
561
562 return ret;
563}
#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 571 of file font.c.

579{
580 DWORD ret=0;
581 SIZE size;
582 UINT i, nSet;
583 DPRINT("GetCharacterPlacementW\n");
584
585 if (dwFlags&(~GCP_REORDER)) DPRINT("flags 0x%08lx ignored\n", dwFlags);
586 if (lpResults->lpClass) DPRINT("classes not implemented\n");
587
588 nSet = (UINT)uCount;
589 if (nSet > lpResults->nGlyphs)
590 nSet = lpResults->nGlyphs;
591
592 /* return number of initialized fields */
593 lpResults->nGlyphs = nSet;
594
595 if (dwFlags & GCP_REORDER)
596 {
597 if (LoadLPK(LPK_GCP))
598 return LpkGetCharacterPlacement(hdc, lpString, uCount, nMaxExtent, lpResults, dwFlags, 0);
599 }
600
601 /* Treat the case where no special handling was requested in a fastpath way */
602 /* copy will do if the GCP_REORDER flag is not set */
603 if (lpResults->lpOutString)
604 lstrcpynW( lpResults->lpOutString, lpString, nSet );
605
606 if (lpResults->lpOrder)
607 {
608 for (i = 0; i < nSet; i++)
609 lpResults->lpOrder[i] = i;
610 }
611
612 /* FIXME: Will use the placement chars */
613 if (lpResults->lpDx)
614 {
615 int c;
616 for (i = 0; i < nSet; i++)
617 {
618 if (GetCharWidth32W(hdc, lpString[i], lpString[i], &c))
619 lpResults->lpDx[i]= c;
620 }
621 }
622
623 if (lpResults->lpCaretPos && !(dwFlags & GCP_REORDER))
624 {
625 int pos = 0;
626
627 lpResults->lpCaretPos[0] = 0;
628 for (i = 1; i < nSet; i++)
629 if (GetTextExtentPoint32W(hdc, &(lpString[i - 1]), 1, &size))
630 lpResults->lpCaretPos[i] = (pos += size.cx);
631 }
632
633 if (lpResults->lpGlyphs)
634 NtGdiGetGlyphIndicesW(hdc, lpString, nSet, lpResults->lpGlyphs, 0);
635
636 if (GetTextExtentPoint32W(hdc, lpString, uCount, &size))
637 ret = MAKELONG(size.cx, size.cy);
638
639 return ret;
640}
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
#define GCP_REORDER
Definition: wingdi.h:843
BOOL WINAPI GetCharWidth32W(_In_ HDC hdc, _In_ UINT iFirst, _In_ UINT iLast, _Out_writes_(iLast+1 - iFirst) LPINT lpBuffer)
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 860 of file font.c.

865{
866 INT wlen, count = 0;
867 LPSTR str;
868 LPWSTR wstr;
869 BOOL ret = TRUE;
870
871 DPRINT("GetCharWidths32A\n");
872
874 {
876 return FALSE;
877 }
878
879 str = FONT_GetCharsByRangeA(hdc, iFirstChar, iLastChar, &count);
880 if (!str)
881 return FALSE;
882
883 wstr = FONT_mbtowc(hdc, str, count+1, &wlen, NULL);
884 if (!wstr)
885 {
887 return FALSE;
888 }
889
891 wstr[0],
892 count,
893 wstr,
895 lpBuffer);
896
898 HeapFree(GetProcessHeap(), 0, wstr);
899
900 return ret;
901}
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
#define GCW_WIN32
Definition: ntgdityp.h:204
#define GCW_NOFLOAT
Definition: ntgdityp.h:205
__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)

◆ GetCharWidth32W()

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

Definition at line 763 of file font.c.

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

◆ GetCharWidthA()

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

Definition at line 812 of file font.c.

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

◆ GetCharWidthFloatA()

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

Definition at line 908 of file font.c.

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

◆ GetCharWidthFloatW()

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

Definition at line 713 of file font.c.

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

◆ GetCharWidthI()

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

Definition at line 1050 of file font.c.

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

◆ GetCharWidthW()

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

Definition at line 738 of file font.c.

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

◆ GetEUDCTimeStamp()

ULONG WINAPI GetEUDCTimeStamp ( VOID  )

Definition at line 2756 of file font.c.

2757{
2759}
__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 2766 of file font.c.

2767{
2768 DWORD retValue = 0;
2769
2770 if (!lpBaseFaceName)
2771 {
2772 retValue = NtGdiGetEudcTimeStampEx(NULL,0,FALSE);
2773 }
2774 else
2775 {
2776 retValue = NtGdiGetEudcTimeStampEx(lpBaseFaceName, wcslen(lpBaseFaceName), FALSE);
2777 }
2778
2779 return retValue;
2780}
_ACRTIMP size_t __cdecl wcslen(const wchar_t *)
Definition: wcs.c:2988

◆ GetFontAssocStatus()

ULONG WINAPI GetFontAssocStatus ( HDC  hdc)

Definition at line 2787 of file font.c.

2788{
2789 ULONG retValue = 0;
2790
2791 if (hdc)
2792 {
2793 retValue = NtGdiQueryFontAssocInfo(hdc);
2794 }
2795
2796 return retValue;
2797}
__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 2828 of file font.c.

2833{
2834 if (!lpvBuffer)
2835 {
2836 cbData = 0;
2837 }
2838 return NtGdiGetFontData(hdc, dwTable, dwOffset, lpvBuffer, cbData);
2839}
_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
W32KAPI DWORD WINAPI NtGdiGetFontData(HDC hdc, DWORD table, DWORD offset, void *buffer, DWORD length)

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(), test_GetCharWidthInfo(), and test_text_metrics().

◆ GetFontLanguageInfo()

DWORD WINAPI GetFontLanguageInfo ( HDC  hDc)

Definition at line 1080 of file font.c.

1083{
1084 DWORD Gcp = 0, Ret = 0;
1085 if (gbLpk)
1086 {
1087 Ret = NtGdiGetTextCharsetInfo(hDc, NULL, 0);
1088 if ((Ret == ARABIC_CHARSET) || (Ret == HEBREW_CHARSET))
1090 }
1092 if ( Gcp == GCP_ERROR)
1093 return Gcp;
1094 else
1095 Ret = Gcp | Ret;
1096 return Ret;
1097}
BOOL gbLpk
Definition: dllmain.c:12
DWORD WINAPI GetDCDWord(_In_ HDC hdc, _In_ UINT u, _In_ DWORD dwError)
Definition: dc.c:787
@ GdiGetFontLanguageInfo
Definition: ntgdityp.h:54
__kernel_entry W32KAPI INT APIENTRY NtGdiGetTextCharsetInfo(_In_ HDC hdc, _Out_opt_ LPFONTSIGNATURE lpSig, _In_ DWORD dwFlags)
Definition: text.c:265
#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 1104 of file font.c.

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

◆ GetGlyphOutlineA()

DWORD WINAPI GetGlyphOutlineA ( _In_ HDC  hdc,
_In_ UINT  uChar,
_In_ UINT  fuFormat,
_Out_ LPGLYPHMETRICS  lpgm,
_In_ DWORD  cbBuffer,
_Out_writes_bytes_opt_(cbBuffer) LPVOID  lpvBuffer,
_In_ CONST MAT2 lpmat2 
)

Definition at line 1202 of file font.c.

1210{
1211 return IntGetGlyphOutlineA(hdc, uChar, fuFormat, lpgm, cbBuffer, lpvBuffer, lpmat2, FALSE);
1212}
static DWORD APIENTRY IntGetGlyphOutlineA(HDC hdc, UINT uChar, UINT fuFormat, LPGLYPHMETRICS lpgm, DWORD cbBuffer, LPVOID lpvBuffer, CONST MAT2 *lpmat2, BOOL bIgnoreRotation)
Definition: font.c:1151

◆ GetGlyphOutlineW()

DWORD WINAPI GetGlyphOutlineW ( _In_ HDC  hdc,
_In_ UINT  uChar,
_In_ UINT  fuFormat,
_Out_ LPGLYPHMETRICS  lpgm,
_In_ DWORD  cbBuffer,
_Out_writes_bytes_opt_(cbBuffer) LPVOID  lpvBuffer,
_In_ CONST MAT2 lpmat2 
)

Definition at line 1219 of file font.c.

1227{
1228 return IntGetGlyphOutlineW(hdc, uChar, fuFormat, lpgm, cbBuffer, lpvBuffer, lpmat2, FALSE);
1229}
static __inline DWORD APIENTRY IntGetGlyphOutlineW(HDC hdc, UINT uChar, UINT fuFormat, LPGLYPHMETRICS lpgm, DWORD cbBuffer, LPVOID lpvBuffer, CONST MAT2 *lpmat2, BOOL bIgnoreRotation)
Definition: font.c:1132

◆ GetGlyphOutlineWow()

DWORD WINAPI GetGlyphOutlineWow ( _In_ HDC  hdc,
_In_ UINT  uChar,
_In_ UINT  fuFormat,
_Out_ LPGLYPHMETRICS  lpgm,
_In_ DWORD  cbBuffer,
_Out_writes_bytes_opt_(cbBuffer) LPVOID  lpvBuffer,
_In_ CONST MAT2 lpmat2 
)

Definition at line 1235 of file font.c.

1243{
1244 return IntGetGlyphOutlineA(hdc, uChar, fuFormat, lpgm, cbBuffer, lpvBuffer, lpmat2, TRUE);
1245}

◆ GetKerningPairsA()

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

Definition at line 1625 of file font.c.

1628{
1629 INT charset;
1630 CHARSETINFO csi;
1631 CPINFO cpi;
1632 DWORD i, total_kern_pairs, kern_pairs_copied = 0;
1633 KERNINGPAIR *kern_pairW;
1634
1635 if (!cPairs && kern_pairA)
1636 {
1638 return 0;
1639 }
1640
1643 {
1644 DPRINT1("Can't find codepage for charset %d\n", charset);
1645 return 0;
1646 }
1647 /* GetCPInfo() will fail on CP_SYMBOL, and WideCharToMultiByte is supposed
1648 * to fail on an invalid character for CP_SYMBOL.
1649 */
1650 cpi.DefaultChar[0] = 0;
1651 if (csi.ciACP != CP_SYMBOL && !GetCPInfo(csi.ciACP, &cpi))
1652 {
1653 DPRINT1("Can't find codepage %u info\n", csi.ciACP);
1654 return 0;
1655 }
1656 DPRINT("charset %d => codepage %u\n", charset, csi.ciACP);
1657
1658 total_kern_pairs = NtGdiGetKerningPairs(hDC, 0, NULL);
1659 if (!total_kern_pairs) return 0;
1660
1661 if (!cPairs && !kern_pairA) return total_kern_pairs;
1662
1663 kern_pairW = HeapAlloc(GetProcessHeap(), 0, total_kern_pairs * sizeof(*kern_pairW));
1664 if (kern_pairW == NULL)
1665 {
1666 return 0;
1667 }
1668 GetKerningPairsW(hDC, total_kern_pairs, kern_pairW);
1669
1670 for (i = 0; i < total_kern_pairs; i++)
1671 {
1672 char first, second;
1673
1674 if (!WideCharToMultiByte(csi.ciACP, 0, &kern_pairW[i].wFirst, 1, &first, 1, NULL, NULL))
1675 continue;
1676
1677 if (!WideCharToMultiByte(csi.ciACP, 0, &kern_pairW[i].wSecond, 1, &second, 1, NULL, NULL))
1678 continue;
1679
1680 if (first == cpi.DefaultChar[0] || second == cpi.DefaultChar[0])
1681 continue;
1682
1683 if (kern_pairA)
1684 {
1685 if (kern_pairs_copied >= cPairs) break;
1686
1687 kern_pairA->wFirst = (BYTE)first;
1688 kern_pairA->wSecond = (BYTE)second;
1689 kern_pairA->iKernAmount = kern_pairW[i].iKernAmount;
1690 kern_pairA++;
1691 }
1692 kern_pairs_copied++;
1693 }
1694
1695 HeapFree(GetProcessHeap(), 0, kern_pairW);
1696
1697 return kern_pairs_copied;
1698}
#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
__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:662
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:262

◆ GetKerningPairsW()

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

Definition at line 1605 of file font.c.

1608{
1609 if ((cPairs != 0) || (pkpDst == 0))
1610 {
1611 return NtGdiGetKerningPairs(hdc,cPairs,pkpDst);
1612 }
1613 else
1614 {
1616 return 0;
1617 }
1618}

◆ GetOutlineTextMetricsA()

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

Definition at line 1252 of file font.c.

1257{
1258 char buf[512], *ptr;
1259 UINT ret, needed;
1261 OUTLINETEXTMETRICA *output = lpOTM;
1262 INT left, len;
1263
1264 if((ret = GetOutlineTextMetricsW(hdc, 0, NULL)) == 0)
1265 return 0;
1266 if(ret > sizeof(buf))
1267 {
1268 lpOTMW = HeapAlloc(GetProcessHeap(), 0, ret);
1269 if (lpOTMW == NULL)
1270 {
1271 return 0;
1272 }
1273 }
1274 GetOutlineTextMetricsW(hdc, ret, lpOTMW);
1275
1276 needed = sizeof(OUTLINETEXTMETRICA);
1277 if(lpOTMW->otmpFamilyName)
1278 needed += WideCharToMultiByte(CP_ACP, 0,
1279 (WCHAR*)((char*)lpOTMW + (intptr_t)lpOTMW->otmpFamilyName), -1,
1280 NULL, 0, NULL, NULL);
1281 if(lpOTMW->otmpFaceName)
1282 needed += WideCharToMultiByte(CP_ACP, 0,
1283 (WCHAR*)((char*)lpOTMW + (intptr_t)lpOTMW->otmpFaceName), -1,
1284 NULL, 0, NULL, NULL);
1285 if(lpOTMW->otmpStyleName)
1286 needed += WideCharToMultiByte(CP_ACP, 0,
1287 (WCHAR*)((char*)lpOTMW + (intptr_t)lpOTMW->otmpStyleName), -1,
1288 NULL, 0, NULL, NULL);
1289 if(lpOTMW->otmpFullName)
1290 needed += WideCharToMultiByte(CP_ACP, 0,
1291 (WCHAR*)((char*)lpOTMW + (intptr_t)lpOTMW->otmpFullName), -1,
1292 NULL, 0, NULL, NULL);
1293
1294 if(!lpOTM)
1295 {
1296 ret = needed;
1297 goto end;
1298 }
1299
1300 DPRINT("needed = %u\n", needed);
1301 if(needed > cbData)
1302 {
1303 /* Since the supplied buffer isn't big enough, we'll alloc one
1304 that is and memcpy the first cbData bytes into the lpOTM at
1305 the end. */
1306 output = HeapAlloc(GetProcessHeap(), 0, needed);
1307 if (output == NULL)
1308 {
1309 goto end;
1310 }
1311 }
1312
1313 ret = output->otmSize = min(needed, cbData);
1315 output->otmFiller = 0;
1316 output->otmPanoseNumber = lpOTMW->otmPanoseNumber;
1317 output->otmfsSelection = lpOTMW->otmfsSelection;
1318 output->otmfsType = lpOTMW->otmfsType;
1319 output->otmsCharSlopeRise = lpOTMW->otmsCharSlopeRise;
1320 output->otmsCharSlopeRun = lpOTMW->otmsCharSlopeRun;
1321 output->otmItalicAngle = lpOTMW->otmItalicAngle;
1322 output->otmEMSquare = lpOTMW->otmEMSquare;
1323 output->otmAscent = lpOTMW->otmAscent;
1324 output->otmDescent = lpOTMW->otmDescent;
1325 output->otmLineGap = lpOTMW->otmLineGap;
1326 output->otmsCapEmHeight = lpOTMW->otmsCapEmHeight;
1327 output->otmsXHeight = lpOTMW->otmsXHeight;
1328 output->otmrcFontBox = lpOTMW->otmrcFontBox;
1329 output->otmMacAscent = lpOTMW->otmMacAscent;
1330 output->otmMacDescent = lpOTMW->otmMacDescent;
1331 output->otmMacLineGap = lpOTMW->otmMacLineGap;
1332 output->otmusMinimumPPEM = lpOTMW->otmusMinimumPPEM;
1333 output->otmptSubscriptSize = lpOTMW->otmptSubscriptSize;
1337 output->otmsStrikeoutSize = lpOTMW->otmsStrikeoutSize;
1339 output->otmsUnderscoreSize = lpOTMW->otmsUnderscoreSize;
1341
1342
1343 ptr = (char*)(output + 1);
1344 left = needed - sizeof(*output);
1345
1346 if(lpOTMW->otmpFamilyName)
1347 {
1348 output->otmpFamilyName = (LPSTR)(ptr - (char*)output);
1350 (WCHAR*)((char*)lpOTMW + (intptr_t)lpOTMW->otmpFamilyName), -1,
1351 ptr, left, NULL, NULL);
1352 left -= len;
1353 ptr += len;
1354 }
1355 else
1356 output->otmpFamilyName = 0;
1357
1358 if(lpOTMW->otmpFaceName)
1359 {
1360 output->otmpFaceName = (LPSTR)(ptr - (char*)output);
1362 (WCHAR*)((char*)lpOTMW + (intptr_t)lpOTMW->otmpFaceName), -1,
1363 ptr, left, NULL, NULL);
1364 left -= len;
1365 ptr += len;
1366 }
1367 else
1368 output->otmpFaceName = 0;
1369
1370 if(lpOTMW->otmpStyleName)
1371 {
1372 output->otmpStyleName = (LPSTR)(ptr - (char*)output);
1374 (WCHAR*)((char*)lpOTMW + (intptr_t)lpOTMW->otmpStyleName), -1,
1375 ptr, left, NULL, NULL);
1376 left -= len;
1377 ptr += len;
1378 }
1379 else
1380 output->otmpStyleName = 0;
1381
1382 if(lpOTMW->otmpFullName)
1383 {
1384 output->otmpFullName = (LPSTR)(ptr - (char*)output);
1386 (WCHAR*)((char*)lpOTMW + (intptr_t)lpOTMW->otmpFullName), -1,
1387 ptr, left, NULL, NULL);
1388 left -= len;
1389 }
1390 else
1391 output->otmpFullName = 0;
1392
1393 ASSERT(left == 0);
1394
1395 if(output != lpOTM)
1396 {
1397 memcpy(lpOTM, output, cbData);
1398 HeapFree(GetProcessHeap(), 0, output);
1399
1400 /* check if the string offsets really fit into the provided size */
1401 /* FIXME: should we check string length as well? */
1402 if ((UINT_PTR)lpOTM->otmpFamilyName >= lpOTM->otmSize)
1403 lpOTM->otmpFamilyName = 0; /* doesn't fit */
1404
1405 if ((UINT_PTR)lpOTM->otmpFaceName >= lpOTM->otmSize)
1406 lpOTM->otmpFaceName = 0; /* doesn't fit */
1407
1408 if ((UINT_PTR)lpOTM->otmpStyleName >= lpOTM->otmSize)
1409 lpOTM->otmpStyleName = 0; /* doesn't fit */
1410
1411 if ((UINT_PTR)lpOTM->otmpFullName >= lpOTM->otmSize)
1412 lpOTM->otmpFullName = 0; /* doesn't fit */
1413 }
1414
1415end:
1416 if(lpOTMW != (OUTLINETEXTMETRICW *)buf)
1417 HeapFree(GetProcessHeap(), 0, lpOTMW);
1418
1419 return ret;
1420}
#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
GLenum GLsizei len
Definition: glext.h:6722
#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:82
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 1451 of file font.c.

1456{
1457 TMDIFF Tmd; // Should not be zero.
1458 UINT Size, AvailableSize = 0, StringSize;
1459 XFORM DevToWorld;
1460 OUTLINETEXTMETRICW* LocalOTM;
1461 WCHAR* Str;
1462 BYTE* Ptr;
1463
1464 /* Get the structure */
1466 if (!Size)
1467 return 0;
1468 if (!lpOTM || (cbData < sizeof(*lpOTM)))
1469 return Size;
1470
1471 LocalOTM = HeapAlloc(GetProcessHeap(), 0, Size);
1472 LocalOTM->otmSize = Size;
1474 if (!Size)
1475 {
1476 HeapFree(GetProcessHeap(), 0, LocalOTM);
1477 return 0;
1478 }
1479
1481 {
1482 DPRINT1("NtGdiGetTransform failed!\n");
1483 HeapFree(GetProcessHeap(), 0, LocalOTM);
1485 return 0;
1486 }
1487
1488 /* Fill in DC specific data */
1491 LocalOTM->otmTextMetrics.tmHeight = height_to_LP( &DevToWorld, LocalOTM->otmTextMetrics.tmHeight );
1492 LocalOTM->otmTextMetrics.tmAscent = height_to_LP( &DevToWorld, LocalOTM->otmTextMetrics.tmAscent );
1493 LocalOTM->otmTextMetrics.tmDescent = height_to_LP( &DevToWorld, LocalOTM->otmTextMetrics.tmDescent );
1496 LocalOTM->otmTextMetrics.tmAveCharWidth = width_to_LP( &DevToWorld, LocalOTM->otmTextMetrics.tmAveCharWidth );
1497 LocalOTM->otmTextMetrics.tmMaxCharWidth = width_to_LP( &DevToWorld, LocalOTM->otmTextMetrics.tmMaxCharWidth );
1498 LocalOTM->otmTextMetrics.tmOverhang = width_to_LP( &DevToWorld, LocalOTM->otmTextMetrics.tmOverhang );
1499 LocalOTM->otmAscent = height_to_LP( &DevToWorld, LocalOTM->otmAscent);
1500 LocalOTM->otmDescent = height_to_LP( &DevToWorld, LocalOTM->otmDescent);
1501 LocalOTM->otmLineGap = abs(INTERNAL_YDSTOWS(&DevToWorld,LocalOTM->otmLineGap));
1502 LocalOTM->otmsCapEmHeight = abs(INTERNAL_YDSTOWS(&DevToWorld,LocalOTM->otmsCapEmHeight));
1503 LocalOTM->otmsXHeight = abs(INTERNAL_YDSTOWS(&DevToWorld,LocalOTM->otmsXHeight));
1504 LocalOTM->otmrcFontBox.top = height_to_LP( &DevToWorld, LocalOTM->otmrcFontBox.top);
1505 LocalOTM->otmrcFontBox.bottom = height_to_LP( &DevToWorld, LocalOTM->otmrcFontBox.bottom);
1506 LocalOTM->otmrcFontBox.left = width_to_LP( &DevToWorld, LocalOTM->otmrcFontBox.left);
1507 LocalOTM->otmrcFontBox.right = width_to_LP( &DevToWorld, LocalOTM->otmrcFontBox.right);
1508 LocalOTM->otmMacAscent = height_to_LP( &DevToWorld, LocalOTM->otmMacAscent);
1509 LocalOTM->otmMacDescent = height_to_LP( &DevToWorld, LocalOTM->otmMacDescent);
1510 LocalOTM->otmMacLineGap = abs(INTERNAL_YDSTOWS(&DevToWorld,LocalOTM->otmMacLineGap));
1511 LocalOTM->otmptSubscriptSize.x = width_to_LP( &DevToWorld, LocalOTM->otmptSubscriptSize.x);
1512 LocalOTM->otmptSubscriptSize.y = height_to_LP( &DevToWorld, LocalOTM->otmptSubscriptSize.y);
1513 LocalOTM->otmptSubscriptOffset.x = width_to_LP( &DevToWorld, LocalOTM->otmptSubscriptOffset.x);
1514 LocalOTM->otmptSubscriptOffset.y = height_to_LP( &DevToWorld, LocalOTM->otmptSubscriptOffset.y);
1515 LocalOTM->otmptSuperscriptSize.x = width_to_LP( &DevToWorld, LocalOTM->otmptSuperscriptSize.x);
1516 LocalOTM->otmptSuperscriptSize.y = height_to_LP( &DevToWorld, LocalOTM->otmptSuperscriptSize.y);
1517 LocalOTM->otmptSuperscriptOffset.x = width_to_LP( &DevToWorld, LocalOTM->otmptSuperscriptOffset.x);
1518 LocalOTM->otmptSuperscriptOffset.y = height_to_LP( &DevToWorld, LocalOTM->otmptSuperscriptOffset.y);
1519 LocalOTM->otmsStrikeoutSize = abs(INTERNAL_YDSTOWS(&DevToWorld,LocalOTM->otmsStrikeoutSize));
1520 LocalOTM->otmsStrikeoutPosition = height_to_LP( &DevToWorld, LocalOTM->otmsStrikeoutPosition);
1521 LocalOTM->otmsUnderscoreSize = height_to_LP( &DevToWorld, LocalOTM->otmsUnderscoreSize);
1522 LocalOTM->otmsUnderscorePosition = height_to_LP( &DevToWorld, LocalOTM->otmsUnderscorePosition);
1523
1524 /* Copy what we can */
1525 CopyMemory(lpOTM, LocalOTM, min(Size, cbData));
1526
1527 lpOTM->otmpFamilyName = NULL;
1528 lpOTM->otmpFaceName = NULL;
1529 lpOTM->otmpStyleName = NULL;
1530 lpOTM->otmpFullName = NULL;
1531
1532 Size = sizeof(*lpOTM);
1533 AvailableSize = cbData - Size;
1534 Ptr = (BYTE*)lpOTM + sizeof(*lpOTM);
1535
1536 /* Fix string values up */
1537 if (LocalOTM->otmpFamilyName)
1538 {
1539 Str = (WCHAR*)((char*)LocalOTM + (ptrdiff_t)LocalOTM->otmpFamilyName);
1540 StringSize = (wcslen(Str) + 1) * sizeof(WCHAR);
1541 if (AvailableSize >= StringSize)
1542 {
1543 CopyMemory(Ptr, Str, StringSize);
1544 lpOTM->otmpFamilyName = (PSTR)(Ptr - (BYTE*)lpOTM);
1545 Ptr += StringSize;
1546 AvailableSize -= StringSize;
1547 Size += StringSize;
1548 }
1549 }
1550
1551 if (LocalOTM->otmpFaceName)
1552 {
1553 Str = (WCHAR*)((char*)LocalOTM + (ptrdiff_t)LocalOTM->otmpFaceName);
1554 StringSize = (wcslen(Str) + 1) * sizeof(WCHAR);
1555 if (AvailableSize >= StringSize)
1556 {
1557 CopyMemory(Ptr, Str, StringSize);
1558 lpOTM->otmpFaceName = (PSTR)(Ptr - (BYTE*)lpOTM);
1559 Ptr += StringSize;
1560 AvailableSize -= StringSize;
1561 Size += StringSize;
1562 }
1563 }
1564
1565 if (LocalOTM->otmpStyleName)
1566 {
1567 Str = (WCHAR*)((char*)LocalOTM + (ptrdiff_t)LocalOTM->otmpStyleName);
1568 StringSize = (wcslen(Str) + 1) * sizeof(WCHAR);
1569 if (AvailableSize >= StringSize)
1570 {
1571 CopyMemory(Ptr, Str, StringSize);
1572 lpOTM->otmpStyleName = (PSTR)(Ptr - (BYTE*)lpOTM);
1573 Ptr += StringSize;
1574 AvailableSize -= StringSize;
1575 Size += StringSize;
1576 }
1577 }
1578
1579 if (LocalOTM->otmpFullName)
1580 {
1581 Str = (WCHAR*)((char*)LocalOTM + (ptrdiff_t)LocalOTM->otmpFullName);
1582 StringSize = (wcslen(Str) + 1) * sizeof(WCHAR);
1583 if (AvailableSize >= StringSize)
1584 {
1585 CopyMemory(Ptr, Str, StringSize);
1586 lpOTM->otmpFullName = (PSTR)(Ptr - (BYTE*)lpOTM);
1587 Ptr += StringSize;
1588 AvailableSize -= StringSize;
1589 Size += StringSize;
1590 }
1591 }
1592
1593 lpOTM->otmSize = Size;
1594
1595 HeapFree(GetProcessHeap(), 0, LocalOTM);
1596
1597 return Size;
1598}
#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
#define CopyMemory
Definition: minwinbase.h:29
#define GdiDeviceSpaceToWorldSpace
Definition: ntgdityp.h:185
__kernel_entry W32KAPI ULONG APIENTRY NtGdiGetOutlineTextMetricsInternalW(_In_ HDC hdc, _In_ ULONG cjotm, _Out_writes_bytes_opt_(cjotm) POUTLINETEXTMETRICW potmw, _Out_ PTMDIFF ptmd)
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:1436
static INT INTERNAL_YDSTOWS(XFORM *xForm, INT height)
Definition: font.c:1425
static INT height_to_LP(XFORM *xForm, INT height)
Definition: font.c:1441
W32KAPI BOOL WINAPI NtGdiGetTransform(HDC hdc, DWORD which, XFORM *xform)
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 1441 of file font.c.

1442{
1443 return GDI_ROUND( (double)height * fabs( xForm->eM22 ));
1444}
_ACRTIMP double __cdecl fabs(double)
FLOAT eM22
Definition: wingdi.h:2170
static __inline INT GDI_ROUND(FLOAT val)
Definition: font.c:25

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 1995 of file font.c.

2001{
2002 // FIXME: pfl
2003 // FIXME: bFlag
2004
2005 *pcwc = *pcFiles = 0;
2006
2007 if (!*pszFiles)
2008 {
2010 return NULL;
2011 }
2012
2013 // Build "Fonts" path
2014 WCHAR szFontsDir[MAX_PATH];
2015 GetWindowsDirectoryW(szFontsDir, _countof(szFontsDir));
2016 StringCchCatW(szFontsDir, _countof(szFontsDir), L"\\Fonts");
2017
2018 // Count the number of paths separated by '|'.
2019 ULONG pathCount = 1;
2020 for (PCWSTR pch1 = pszFiles; *pch1; ++pch1)
2021 {
2022 if (*pch1 == L'|')
2023 pathCount++;
2024 }
2025
2026 // Allocate memory for the paths.
2027 SIZE_T cchBuff = pathCount * MAX_PATH;
2028 PWSTR pszBuff = HEAP_alloc(cchBuff * sizeof(WCHAR));
2029 if (!pszBuff)
2030 return NULL;
2031
2032 pszBuff[0] = UNICODE_NULL;
2033 *pcFiles = pathCount;
2034
2035 // Convert paths
2036 DWORD dwError = ERROR_SUCCESS;
2037 PCWSTR pch1, pch1Prev;
2038 BOOL bFirst = TRUE;
2039 for (pch1 = pch1Prev = pszFiles;; ++pch1)
2040 {
2041 if (*pch1 && *pch1 != L'|')
2042 continue;
2043
2044 UINT_PTR spanLen = pch1 - pch1Prev;
2045 if (spanLen < _countof(L".ttf") || spanLen >= MAX_PATH)
2046 {
2047 dwError = ERROR_INVALID_FUNCTION;
2048 break;
2049 }
2050
2051 WCHAR szFileName[MAX_PATH], szFullPath[MAX_PATH];
2052 StringCchCopyNW(szFileName, _countof(szFileName), pch1Prev, spanLen);
2053
2054 // Search file
2055 if (!SearchPathW(L".", szFileName, NULL, _countof(szFullPath), szFullPath, NULL) &&
2056 !SearchPathW(szFontsDir, szFileName, NULL, _countof(szFullPath), szFullPath, NULL))
2057 {
2058 dwError = ERROR_FILE_NOT_FOUND;
2059 break;
2060 }
2061
2062 if (bFirst)
2063 {
2064 bFirst = FALSE;
2065 }
2066 else
2067 {
2068 SIZE_T cch = wcslen(szFullPath);
2069 if (cch < _countof(L".pfb"))
2070 {
2071 dwError = ERROR_INVALID_FUNCTION;
2072 break;
2073 }
2074
2075 // Check filename extension
2076 PCWSTR pchDotExt = &szFullPath[cch - 4];
2077 if (_wcsicmp(pchDotExt, L".pfb") != 0 &&
2078 _wcsicmp(pchDotExt, L".mmm") != 0)
2079 {
2080 dwError = ERROR_INVALID_FUNCTION;
2081 break;
2082 }
2083 }
2084
2085 // Convert to an NT path
2086 UNICODE_STRING NtAbsPath;
2087 if (!RtlDosPathNameToNtPathName_U(szFullPath, &NtAbsPath, NULL, NULL))
2088 {
2089 dwError = ERROR_OUTOFMEMORY;
2090 break;
2091 }
2092
2093 // Append a path and '|' to pszBuff
2094 if (StringCchCatW(pszBuff, cchBuff, NtAbsPath.Buffer) != S_OK ||
2095 StringCchCatW(pszBuff, cchBuff, L"|") != S_OK)
2096 {
2097 RtlFreeUnicodeString(&NtAbsPath);
2098 dwError = ERROR_INVALID_FUNCTION;
2099 break;
2100 }
2101
2102 RtlFreeUnicodeString(&NtAbsPath);
2103
2104 if (!*pch1)
2105 break;
2106
2107 pch1Prev = pch1 + 1;
2108 }
2109
2110 if (dwError != ERROR_SUCCESS)
2111 {
2112 HEAP_free(pszBuff);
2113 *pcwc = *pcFiles = 0;
2114 if (dwError != ERROR_INVALID_FUNCTION)
2115 SetLastError(dwError);
2116 return NULL;
2117 }
2118
2119 *pcwc = (DWORD)wcslen(pszBuff);
2120
2121 // Convert '|' to '\0'
2122 for (PWSTR pch2 = pszBuff; *pch2; ++pch2)
2123 {
2124 if (*pch2 == L'|')
2125 *pch2 = UNICODE_NULL;
2126 }
2127
2128 return pszBuff;
2129}
#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:164
#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 291 of file font.c.

293{
294 int FontFamilyCount;
296 int Ret = 1;
297 int i;
298 ENUMLOGFONTEXA EnumLogFontExA;
299 NEWTEXTMETRICEXA NewTextMetricExA;
300 LOGFONTW lfW;
301 LONG InfoCount;
304
307 if (Info == NULL)
308 {
309 return 1;
310 }
311
312 /* Initialize the LOGFONT structure */
313 ZeroMemory(&lfW, sizeof(lfW));
314 if (!LogFont)
315 {
317 }
318 else
319 {
320 lfW.lfCharSet = LogFont->lfCharSet;
321 lfW.lfPitchAndFamily = LogFont->lfPitchAndFamily;
322 StringCbCopyW(lfW.lfFaceName, sizeof(lfW.lfFaceName), LogFont->lfFaceName);
323 }
324
325 /* Retrieve the font information */
326 InfoCount = INITIAL_FAMILY_COUNT;
327 FontFamilyCount = NtGdiGetFontFamilyInfo(Dc, &lfW, Info, &InfoCount);
328 if (FontFamilyCount < 0)
329 {
331 return 1;
332 }
333
334 /* Resize the buffer if the buffer is too small */
335 if (INITIAL_FAMILY_COUNT < InfoCount)
336 {
338
339 Status = RtlULongMult(InfoCount, sizeof(FONTFAMILYINFO), &DataSize);
341 {
342 DPRINT1("Overflowed.\n");
343 return 1;
344 }
346 if (Info == NULL)
347 {
348 return 1;
349 }
350 FontFamilyCount = NtGdiGetFontFamilyInfo(Dc, &lfW, Info, &InfoCount);
351 if (FontFamilyCount < 0 || FontFamilyCount < InfoCount)
352 {
354 return 1;
355 }
356 }
357
358 /* Sort and remove redundant information */
359 qsort(Info, FontFamilyCount, sizeof(*Info), IntFontFamilyCompare);
360 FontFamilyCount = IntFontFamilyListUnique(Info, FontFamilyCount, &lfW, dwFlags);
361
362 /* call the callback */
363 for (i = 0; i < FontFamilyCount; i++)
364 {
365 if (dwFlags & IEFF_UNICODE)
366 {
367 Ret = ((FONTENUMPROCW) EnumProc)(
368 (VOID*)&Info[i].EnumLogFontEx,
369 (VOID*)&Info[i].NewTextMetricEx,
370 Info[i].FontType, lParam);
371 }
372 else
373 {
374 // Could use EnumLogFontExW2A here?
375 LogFontW2A(&EnumLogFontExA.elfLogFont, &Info[i].EnumLogFontEx.elfLogFont);
376 WideCharToMultiByte(CP_THREAD_ACP, 0, Info[i].EnumLogFontEx.elfFullName, -1,
377 (LPSTR)EnumLogFontExA.elfFullName, LF_FULLFACESIZE, NULL, NULL);
378 WideCharToMultiByte(CP_THREAD_ACP, 0, Info[i].EnumLogFontEx.elfStyle, -1,
379 (LPSTR)EnumLogFontExA.elfStyle, LF_FACESIZE, NULL, NULL);
380 WideCharToMultiByte(CP_THREAD_ACP, 0, Info[i].EnumLogFontEx.elfScript, -1,
381 (LPSTR)EnumLogFontExA.elfScript, LF_FACESIZE, NULL, NULL);
382 NewTextMetricExW2A(&NewTextMetricExA,
383 &Info[i].NewTextMetricEx);
384 Ret = ((FONTENUMPROCA) EnumProc)(
385 (VOID*)&EnumLogFontExA,
386 (VOID*)&NewTextMetricExA,
387 Info[i].FontType, lParam);
388 }
389
390 if(Ret == 0)
391 break;
392 }
393
395
396 return Ret;
397}
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:6485
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:204
static int __cdecl IntFontFamilyCompare(const void *ffi1, const void *ffi2)
Definition: font.c:248
int FASTCALL IntFontFamilyListUnique(FONTFAMILYINFO *InfoList, INT nCount, const LOGFONTW *plf, DWORD dwFlags)
Definition: font.c:258
#define INITIAL_FAMILY_COUNT
Definition: font.c:75
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 1425 of file font.c.

1426{
1427 double floatHeight;
1428
1429 /* Perform operation with floating point */
1430 floatHeight = (double)height * xForm->eM22;
1431 /* Round to integers */
1432 return GDI_ROUND(floatHeight);
1433}
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 248 of file font.c.

249{
251}
FORCEINLINE int FASTCALL IntFontFamilyCompareEx(const FONTFAMILYINFO *ffi1, const FONTFAMILYINFO *ffi2, DWORD dwCompareFlags)
Definition: font.c:215
#define IFFCX_STYLE
Definition: font.c:212
#define IFFCX_CHARSET
Definition: font.c:211

Referenced by IntEnumFontFamilies().

◆ IntFontFamilyCompareEx()

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

Definition at line 215 of file font.c.

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

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

Referenced by IntEnumFontFamilies().

◆ IntGetGlyphOutlineA()

static DWORD APIENTRY IntGetGlyphOutlineA ( HDC  hdc,
UINT  uChar,
UINT  fuFormat,
LPGLYPHMETRICS  lpgm,
DWORD  cbBuffer,
LPVOID  lpvBuffer,
CONST MAT2 lpmat2,
BOOL  bIgnoreRotation 
)
static

Definition at line 1151 of file font.c.

1160{
1161 UINT nCodePage, cchAnsi;
1162 CHAR szAnsi[4];
1163 WCHAR szWide[2];
1164
1165 if (fuFormat & GGO_GLYPH_INDEX)
1166 {
1167 szWide[0] = (WCHAR)uChar;
1168 return IntGetGlyphOutlineW(hdc, szWide[0], fuFormat, lpgm, cbBuffer, lpvBuffer, lpmat2,
1169 bIgnoreRotation);
1170 }
1171
1172 nCodePage = GdiGetCodePage(hdc);
1173 if ((nCodePage == CP_SHIFTJIS ||
1174 nCodePage == CP_HANGUL ||
1175 nCodePage == CP_BIG5 ||
1176 nCodePage == CP_GB2312) && IsDBCSLeadByteEx(nCodePage, HIBYTE(uChar)))
1177 {
1178 szAnsi[0] = HIBYTE(uChar);
1179 szAnsi[1] = LOBYTE(uChar);
1180 cchAnsi = 2;
1181 }
1182 else
1183 {
1184 szAnsi[0] = LOBYTE(uChar);
1185 cchAnsi = 1;
1186 }
1187
1188 if (!MultiByteToWideChar(nCodePage, 0, szAnsi, cchAnsi, szWide, _countof(szWide)))
1189 {
1191 return 0;
1192 }
1193
1194 return IntGetGlyphOutlineW(hdc, szWide[0], fuFormat, lpgm, cbBuffer, lpvBuffer, lpmat2,
1195 bIgnoreRotation);
1196}
#define CP_GB2312
Definition: cjkcode.h:14
#define CP_BIG5
Definition: cjkcode.h:15
#define CP_HANGUL
Definition: cjkcode.h:12
#define CP_SHIFTJIS
Definition: cjkcode.h:11
BOOL WINAPI IsDBCSLeadByteEx(UINT codepage, BYTE testchar)
Definition: locale.c:2106
VOID WINAPI GdiSetLastError(DWORD dwErrCode)
Definition: misc.c:873
#define LOBYTE(W)
Definition: jmemdos.c:487
#define HIBYTE(W)
Definition: jmemdos.c:486
#define GGO_GLYPH_INDEX
Definition: wingdi.h:855

Referenced by GetGlyphOutlineA(), and GetGlyphOutlineWow().

◆ IntGetGlyphOutlineW()

static __inline DWORD APIENTRY IntGetGlyphOutlineW ( HDC  hdc,
UINT  uChar,
UINT  fuFormat,
LPGLYPHMETRICS  lpgm,
DWORD  cbBuffer,
LPVOID  lpvBuffer,
CONST MAT2 lpmat2,
BOOL  bIgnoreRotation 
)
static

Definition at line 1132 of file font.c.

1141{
1142 if (!lpmat2 || !lpgm)
1143 return GDI_ERROR;
1144 if (!lpvBuffer)
1145 cbBuffer = 0;
1146 return NtGdiGetGlyphOutline(hdc, uChar, fuFormat, lpgm, cbBuffer, lpvBuffer, lpmat2,
1147 bIgnoreRotation);
1148}
__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)

Referenced by GetGlyphOutlineW(), and IntGetGlyphOutlineA().

◆ NewEnumFontFamiliesExW()

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

Definition at line 2522 of file font.c.

2528{
2529 ULONG_PTR idEnum;
2530 ULONG cbDataSize, cbRetSize;
2531 PENUMFONTDATAW pEfdw;
2532 PBYTE pBuffer;
2533 PBYTE pMax;
2534 INT ret = 1;
2535
2536 /* Open enumeration handle and find out how much memory we need */
2537 idEnum = NtGdiEnumFontOpen(hDC,
2539 0,
2541 (lpLogfont && lpLogfont->lfFaceName[0])? lpLogfont->lfFaceName : NULL,
2542 lpLogfont? lpLogfont->lfCharSet : DEFAULT_CHARSET,
2543 &cbDataSize);
2544 if (idEnum == 0)
2545 {
2546 return 0;
2547 }
2548 if (cbDataSize == 0)
2549 {
2550 NtGdiEnumFontClose(idEnum);
2551 return 0;
2552 }
2553
2554 /* Allocate memory */
2555 pBuffer = HeapAlloc(GetProcessHeap(), 0, cbDataSize);
2556 if (pBuffer == NULL)
2557 {
2559 NtGdiEnumFontClose(idEnum);
2560 return 0;
2561 }
2562
2563 /* Do the enumeration */
2564 if (!NtGdiEnumFontChunk(hDC, idEnum, cbDataSize, &cbRetSize, (PVOID)pBuffer))
2565 {
2567 NtGdiEnumFontClose(idEnum);
2568 return 0;
2569 }
2570
2571 /* Get start and end address */
2572 pEfdw = (PENUMFONTDATAW)pBuffer;
2573 pMax = pBuffer + cbDataSize;
2574
2575 /* Iterate through the structures */
2576 while ((PBYTE)pEfdw < pMax && ret)
2577 {
2578 PNTMW_INTERNAL pNtmwi = (PNTMW_INTERNAL)((ULONG_PTR)pEfdw + pEfdw->ulNtmwiOffset);
2579
2580 ret = lpEnumFontFamExProcW((VOID*)&pEfdw->elfexdv.elfEnumLogfontEx,
2581 (VOID*)&pNtmwi->ntmw,
2582 pEfdw->dwFontType,
2583 lParam);
2584
2585 pEfdw = (PENUMFONTDATAW)((ULONG_PTR)pEfdw + pEfdw->cbSize);
2586 }
2587
2588 /* Release the memory and close handle */
2590 NtGdiEnumFontClose(idEnum);
2591
2592 return ret;
2593}
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
struct _ENUMFONTDATAW * PENUMFONTDATAW
struct _NTMW_INTERNAL * PNTMW_INTERNAL
BYTE * PBYTE
Definition: pedump.c:66
__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)
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:2518

◆ NewGetCharacterPlacementW()

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

Definition at line 644 of file font.c.

652{
653 ULONG nSet;
654 SIZE Size = {0,0};
655
656 if ( !lpString || uCount <= 0 || (nMaxExtent < 0 && nMaxExtent != -1 ) )
657 {
659 return 0;
660 }
661
662 if ( !lpResults )
663 {
664 if ( GetTextExtentPointW(hdc, lpString, uCount, &Size) )
665 {
666 return MAKELONG(Size.cx, Size.cy);
667 }
668 return 0;
669 }
670
671 nSet = uCount;
672 if ( nSet > lpResults->nGlyphs )
673 nSet = lpResults->nGlyphs;
674
676 lpString,
677 nSet,
678 nMaxExtent,
679 lpResults,
680 dwFlags);
681}
__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 204 of file font.c.

205{
206 NewTextMetricW2A(&tma->ntmTm, &tmw->ntmTm);
207 tma->ntmFontSig = tmw->ntmFontSig;
208}
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:194

Referenced by IntEnumFontFamilies().

◆ NewTextMetricW2A()

VOID FASTCALL NewTextMetricW2A ( NEWTEXTMETRICA tma,
NEWTEXTMETRICW tmw 
)

Definition at line 194 of file font.c.

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

Referenced by NewTextMetricExW2A().

◆ QueryFontAssocStatus()

DWORD WINAPI QueryFontAssocStatus ( VOID  )

Definition at line 2804 of file font.c.

2805{
2808 return 0;
2809}

◆ RemoveFontMemResourceEx()

BOOL WINAPI RemoveFontMemResourceEx ( HANDLE  fh)

Definition at line 2649 of file font.c.

2650{
2651 if (fh)
2652 {
2654 }
2656 return FALSE;
2657}
__kernel_entry W32KAPI BOOL APIENTRY NtGdiRemoveFontMemResourceEx(_In_ HANDLE hMMFont)
Definition: font.c:640

Referenced by START_TEST(), test_AddFontMemResource(), and test_GetGlyphIndices().

◆ RemoveFontResourceA()

BOOL WINAPI RemoveFontResourceA ( _In_ LPCSTR  lpFileName)

Definition at line 2231 of file font.c.

2232{
2234}
BOOL WINAPI RemoveFontResourceExA(_In_ LPCSTR lpFileName, _In_ DWORD fl, _In_opt_ PVOID pdv)
Definition: font.c:2239
_In_ LPCSTR lpFileName
Definition: winbase.h:2800

Referenced by Test_AddFontResourceA().

◆ RemoveFontResourceExA()

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

Definition at line 2239 of file font.c.

2243{
2244 if (fl & ~(FR_PRIVATE | FR_NOT_ENUM))
2245 {
2247 return FALSE;
2248 }
2249
2250 if (!lpFileName)
2251 return FALSE;
2252
2253 WCHAR szBuff[MAX_PATH];
2254 PWSTR FilenameW;
2255
2256 _SEH2_TRY
2257 {
2258 FilenameW = HEAP_strdupA2W_buf(lpFileName, szBuff, _countof(szBuff));
2259 }
2261 {
2262 FilenameW = NULL;
2263 }
2264 _SEH2_END;
2265
2266 if (!FilenameW)
2267 {
2269 return FALSE;
2270 }
2271
2272 BOOL result = RemoveFontResourceExW(FilenameW, fl, pdv);
2273 HEAP_strdupA2W_buf_free(FilenameW, szBuff);
2274 return result;
2275}
BOOL WINAPI RemoveFontResourceExW(_In_ LPCWSTR lpFileName, _In_ DWORD fl, _In_opt_ PVOID pdv)
Definition: font.c:2280

Referenced by RemoveFontResourceA(), test_CreateScalableFontResource(), test_font_weight(), test_height_selection_vdmx(), test_lang_names(), test_long_names(), test_ttf_names(), and test_vertical_font().

◆ RemoveFontResourceExW()

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

Definition at line 2280 of file font.c.

2284{
2285 DPRINT("RemoveFontResourceExW\n");
2286
2287 if (fl & ~(FR_PRIVATE | FR_NOT_ENUM))
2288 {
2290 return FALSE;
2291 }
2292
2293 if (!lpFileName)
2294 return FALSE;
2295
2296 ULONG cFiles, cwc;
2297 PWSTR pszConverted = IntConvertFontPaths(lpFileName, &cFiles, &cwc, &fl, TRUE);
2298 if (!pszConverted)
2299 return FALSE;
2300
2301 BOOL ret = NtGdiRemoveFontResourceW(pszConverted, cwc, cFiles, fl, 0, NULL);
2302 HEAP_free(pszConverted);
2303 return ret;
2304}
__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 2680 of file font.c.

2681{
2684 return 0;
2685}

◆ RemoveFontResourceW()

BOOL WINAPI RemoveFontResourceW ( _In_ LPCWSTR  lpFileName)

Definition at line 2223 of file font.c.

2224{
2226}

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

◆ SetMapperFlags()

DWORD WINAPI SetMapperFlags ( HDC  hDC,
DWORD  flags 
)

Definition at line 2431 of file font.c.

2435{
2436 DWORD Ret = GDI_ERROR;
2437 PDC_ATTR Dc_Attr;
2438
2439 /* Get the DC attribute */
2440 Dc_Attr = GdiGetDcAttr(hDC);
2441 if (Dc_Attr == NULL)
2442 {
2444 return GDI_ERROR;
2445 }
2446
2447 if (NtCurrentTeb()->GdiTebBatch.HDC == hDC)
2448 {
2449 if (Dc_Attr->ulDirty_ & DC_FONTTEXT_DIRTY)
2450 {
2451 NtGdiFlush();
2453 }
2454 }
2455
2456 if ( flags & ~1 )
2458 else
2459 {
2460 Ret = Dc_Attr->flFontMapper;
2461 Dc_Attr->flFontMapper = flags;
2462 }
2463 return Ret;
2464}
FORCEINLINE PDC_ATTR GdiGetDcAttr(HDC hdc)
Definition: gdi32p.h:477
#define NtCurrentTeb
#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
W32KAPI BOOL WINAPI NtGdiFlush(void)
Definition: gdibatch.c:471

◆ TranslateCharsetInfo()

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

Definition at line 2382 of file font.c.

2390{
2391 int index = 0;
2392 switch (flags)
2393 {
2394 case TCI_SRCFONTSIG:
2395 while (index < MAXTCIINDEX && !(*lpSrc>>index & 0x0001)) index++;
2396 break;
2397 case TCI_SRCCODEPAGE:
2398 while (index < MAXTCIINDEX && PtrToUlong(lpSrc) != FONT_tci[index].ciACP) index++;
2399 break;
2400 case TCI_SRCCHARSET:
2401 while (index < MAXTCIINDEX && PtrToUlong(lpSrc) != FONT_tci[index].ciCharset) index++;
2402 break;
2403 case TCI_SRCLOCALE:
2404 {
2405 LCID lCid = (LCID)PtrToUlong(lpSrc);
2406 LOCALESIGNATURE LocSig;
2407 INT Ret = GetLocaleInfoW(lCid, LOCALE_FONTSIGNATURE, (LPWSTR)&LocSig, 0);
2408 if ( GetLocaleInfoW(lCid, LOCALE_FONTSIGNATURE, (LPWSTR)&LocSig, Ret))
2409 {
2410 while (index < MAXTCIINDEX && !(LocSig.lsCsbDefault[0]>>index & 0x0001)) index++;
2411 break;
2412 }
2413 }
2414 default:
2416 return FALSE;
2417 }
2418 if (index >= MAXTCIINDEX || FONT_tci[index].ciCharset == DEFAULT_CHARSET) return FALSE;
2419 DPRINT("Index %d Charset %u CodePage %u FontSig %lu\n",
2420 index,FONT_tci[index].ciCharset,FONT_tci[index].ciACP,FONT_tci[index].fs.fsCsb[0]);
2421 memcpy(lpCs, &FONT_tci[index], sizeof(CHARSETINFO));
2422 return TRUE;
2423}
INT WINAPI GetLocaleInfoW(LCID lcid, LCTYPE lctype, LPWSTR buffer, INT len)
Definition: locale.c:1675
#define PtrToUlong(u)
Definition: config.h:107
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:34
#define MAXTCIINDEX
Definition: font.c:33
#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:135

◆ UnloadNetworkFonts()

VOID WINAPI UnloadNetworkFonts ( DWORD  unknown)

Definition at line 2816 of file font.c.

◆ width_to_LP()

static INT width_to_LP ( XFORM xForm,
INT  width 
)
inlinestatic

Definition at line 1436 of file font.c.

1437{
1438 return GDI_ROUND( (double)width * fabs( xForm->eM11));
1439}
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 34 of file font.c.

Referenced by TranslateCharsetInfo().