ReactOS 0.4.15-dev-5865-g640e228
freetype.c File Reference
#include <win32k.h>
#include <gdi/eng/floatobj.h>
#include "font.h"
#include <debug.h>
Include dependency graph for freetype.c:

Go to the source code of this file.

Classes

struct  FONT_NAMES
 

Macros

#define FT_INTERNAL_INTERNAL_H   <freetype/internal/internal.h>
 
#define NDEBUG
 
#define _TMPF_VARIABLE_PITCH   TMPF_FIXED_PITCH
 
#define EMUBOLD_NEEDED(original, request)    (((request) != FW_DONTCARE) && ((request) - (original) >= FW_BOLD - FW_MEDIUM))
 
#define gmxWorldToDeviceDefault   gmxWorldToPageDefault
 
#define IntLockGlobalFonts()    ExEnterCriticalRegionAndAcquireFastMutexUnsafe(g_FontListLock)
 
#define IntUnLockGlobalFonts()    ExReleaseFastMutexUnsafeAndLeaveCriticalRegion(g_FontListLock)
 
#define ASSERT_GLOBALFONTS_LOCK_HELD()    ASSERT(g_FontListLock->Owner == KeGetCurrentThread())
 
#define IntLockFreeType()    ExEnterCriticalRegionAndAcquireFastMutexUnsafe(g_FreeTypeLock)
 
#define IntUnLockFreeType()    ExReleaseFastMutexUnsafeAndLeaveCriticalRegion(g_FreeTypeLock)
 
#define ASSERT_FREETYPE_LOCK_HELD()    ASSERT(g_FreeTypeLock->Owner == KeGetCurrentThread())
 
#define ASSERT_FREETYPE_LOCK_NOT_HELD()    ASSERT(g_FreeTypeLock->Owner != KeGetCurrentThread())
 
#define MAX_FONT_CACHE   256
 
#define CP_SYMBOL   42
 
#define MAXTCIINDEX   32
 
#define CP_OEMCP   1
 
#define CP_MACCP   2
 
#define PX2PT(pixels)   FT_MulDiv((pixels), 72, 96)
 
#define SCALE_X(value)   ((FT_MulFix((value), XScale) + 32) >> 6)
 
#define SCALE_Y(value)   ((FT_MulFix((value), YScale) + 32) >> 6)
 
#define FM_SEL_USE_TYPO_METRICS   0x80
 
#define GOT_PENALTY(name, value)   Penalty += (value)
 
#define VALIGN_MASK   (TA_TOP | TA_BASELINE | TA_BOTTOM)
 
#define STACK_TEXT_BUFFER_SIZE   100
 

Typedefs

typedef struct FONT_NAMES FONT_NAMES
 
typedef struct FONT_NAMESLPFONT_NAMES
 

Functions

BYTE FASTCALL IntCharSetFromCodePage (UINT uCodePage)
 
static RTL_STATIC_LIST_HEAD (g_FontSubstListHead)
 
static void SharedMem_AddRef (PSHARED_MEM Ptr)
 
static void SharedFaceCache_Init (PSHARED_FACE_CACHE Cache)
 
static PSHARED_FACE SharedFace_Create (FT_Face Face, PSHARED_MEM Memory)
 
static PSHARED_MEM SharedMem_Create (PBYTE Buffer, ULONG BufferSize, BOOL IsMapping)
 
static void SharedFace_AddRef (PSHARED_FACE Ptr)
 
static void RemoveCachedEntry (PFONT_CACHE_ENTRY Entry)
 
static void RemoveCacheEntries (FT_Face Face)
 
static void SharedMem_Release (PSHARED_MEM Ptr)
 
static void SharedFaceCache_Release (PSHARED_FACE_CACHE Cache)
 
static void SharedFace_Release (PSHARED_FACE Ptr)
 
static VOID FASTCALL CleanupFontEntryEx (PFONT_ENTRY FontEntry, PFONTGDI FontGDI)
 
static __inline VOID FASTCALL CleanupFontEntry (PFONT_ENTRY FontEntry)
 
static __inline void FTVectorToPOINTFX (FT_Vector *vec, POINTFX *pt)
 
static __inline FT_Fixed FT_FixedFromFIXED (FIXED f)
 
BOOL FASTCALL IntLoadFontSubstList (PLIST_ENTRY pHead)
 
BOOL FASTCALL InitFontSupport (VOID)
 
static LONG IntNormalizeAngle (LONG nTenthsOfDegrees)
 
static VOID FASTCALL IntEscapeMatrix (FT_Matrix *pmat, LONG lfEscapement)
 
static VOID FASTCALL IntMatrixFromMx (FT_Matrix *pmat, const MATRIX *pmx)
 
static BOOL SubstituteFontByList (PLIST_ENTRY pHead, PUNICODE_STRING pOutputName, PUNICODE_STRING pInputName, BYTE RequestedCharSet, BYTE CharSetMap[FONTSUBST_FROM_AND_TO])
 
static VOID IntUnicodeStringToBuffer (LPWSTR pszBuffer, SIZE_T cbBuffer, const UNICODE_STRING *pString)
 
static NTSTATUS DuplicateUnicodeString (PUNICODE_STRING Source, PUNICODE_STRING Destination)
 
static BOOL SubstituteFontRecurse (LOGFONTW *pLogFont)
 
VOID FASTCALL IntLoadSystemFonts (VOID)
 
UINT FASTCALL IntGetCharSet (INT nIndex, FT_ULong CodePageRange1)
 
static INT FASTCALL IntGdiLoadFontsFromMemory (PGDI_LOAD_FONT pLoadFont, PSHARED_FACE SharedFace, FT_Long FontIndex, INT CharSetIndex)
 
static LPCWSTR FASTCALL NameFromCharSet (BYTE CharSet)
 
INT FASTCALL IntGdiAddFontResourceEx (PUNICODE_STRING FileName, DWORD Characteristics, DWORD dwFlags)
 
INT FASTCALL IntGdiAddFontResource (PUNICODE_STRING FileName, DWORD Characteristics)
 
BOOL WINAPI PathIsRelativeW (LPCWSTR lpszPath)
 
BOOL FASTCALL IntLoadFontsInRegistry (VOID)
 
HANDLE FASTCALL IntGdiAddFontMemResource (PVOID Buffer, DWORD dwSize, PDWORD pNumAdded)
 
VOID FASTCALL IntGdiCleanupMemEntry (PFONT_ENTRY_MEM Head)
 
static VOID FASTCALL UnlinkFontMemCollection (PFONT_ENTRY_COLL_MEM Collection)
 
BOOL FASTCALL IntGdiRemoveFontMemResource (HANDLE hMMFont)
 
VOID FASTCALL IntGdiCleanupPrivateFontsForProcess (VOID)
 
BOOL FASTCALL IntIsFontRenderingEnabled (VOID)
 
VOID FASTCALL IntEnableFontRendering (BOOL Enable)
 
FT_Render_Mode FASTCALL IntGetFontRenderMode (LOGFONTW *logfont)
 
NTSTATUS FASTCALL TextIntCreateFontIndirect (CONST LPLOGFONTW lf, HFONT *NewFont)
 
static BOOLEAN IntTranslateCharsetInfo (PDWORD Src, LPCHARSETINFO Cs, DWORD Flags)
 
static BOOL face_has_symbol_charmap (FT_Face ft_face)
 
static void FASTCALL FillTM (TEXTMETRICW *TM, PFONTGDI FontGDI, TT_OS2 *pOS2, TT_HoriHeader *pHori, FT_WinFNT_HeaderRec *pFNT)
 
static NTSTATUS IntGetFontLocalizedName (PUNICODE_STRING pNameW, PSHARED_FACE SharedFace, FT_UShort NameID, FT_UShort LangID)
 
static __inline void FASTCALL IntInitFontNames (FONT_NAMES *Names, PSHARED_FACE SharedFace)
 
static __inline SIZE_T FASTCALL IntStoreName (const UNICODE_STRING *pName, BYTE *pb)
 
static __inline BYTE *FASTCALL IntStoreFontNames (const FONT_NAMES *Names, OUTLINETEXTMETRICW *Otm)
 
static __inline void FASTCALL IntFreeFontNames (FONT_NAMES *Names)
 
INT FASTCALL IntGetOutlineTextMetrics (PFONTGDI FontGDI, UINT Size, OUTLINETEXTMETRICW *Otm)
 
static BYTE CharSetFromLangID (LANGID LangID)
 
static void SwapEndian (LPVOID pvData, DWORD Size)
 
static void FASTCALL FontFamilyFillInfo (PFONTFAMILYINFO Info, LPCWSTR FaceName, LPCWSTR FullName, PFONTGDI FontGDI)
 
static BOOLEAN FASTCALL GetFontFamilyInfoForList (const LOGFONTW *LogFont, PFONTFAMILYINFO Info, LPCWSTR NominalName, LONG *pCount, LONG MaxCount, PLIST_ENTRY Head)
 
static BOOLEAN FASTCALL GetFontFamilyInfoForSubstitutes (const LOGFONTW *LogFont, PFONTFAMILYINFO Info, LONG *pCount, LONG MaxCount)
 
BOOL FASTCALL ftGdiGetRasterizerCaps (LPRASTERIZER_STATUS lprs)
 
static DWORD IntGetHash (IN LPCVOID pv, IN DWORD cdw)
 
static FT_BitmapGlyph IntFindGlyphCache (IN const FONT_CACHE_ENTRY *pCache)
 
static FT_BitmapGlyph IntGetBitmapGlyphNoCache (FT_Face Face, FT_GlyphSlot GlyphSlot, FT_Render_Mode RenderMode)
 
static FT_BitmapGlyph IntGetBitmapGlyphWithCache (IN OUT PFONT_CACHE_ENTRY Cache, IN FT_GlyphSlot GlyphSlot)
 
static unsigned int get_native_glyph_outline (FT_Outline *outline, unsigned int buflen, char *buf)
 
static unsigned int get_bezier_glyph_outline (FT_Outline *outline, unsigned int buflen, char *buf)
 
static FT_Error IntRequestFontSize (PDC dc, PFONTGDI FontGDI, LONG lfWidth, LONG lfHeight)
 
BOOL FASTCALL TextIntUpdateSize (PDC dc, PTEXTOBJ TextObj, PFONTGDI FontGDI, BOOL bDoLock)
 
static FT_UInt FASTCALL get_glyph_index_symbol (FT_Face ft_face, UINT glyph)
 
static FT_UInt FASTCALL get_glyph_index (FT_Face ft_face, UINT glyph)
 
static FT_UInt FASTCALL get_glyph_index_flagged (FT_Face face, FT_ULong code, DWORD indexed_flag, DWORD flags)
 
ULONG FASTCALL ftGdiGetGlyphOutline (PDC dc, WCHAR wch, UINT iFormat, LPGLYPHMETRICS pgm, ULONG cjBuf, PVOID pvBuf, LPMAT2 pmat2, BOOL bIgnoreRotation)
 
static FT_BitmapGlyph IntGetRealGlyph (IN OUT PFONT_CACHE_ENTRY Cache)
 
BOOL FASTCALL TextIntGetTextExtentPoint (PDC dc, PTEXTOBJ TextObj, LPCWSTR String, INT Count, ULONG MaxExtent, LPINT Fit, LPINT Dx, LPSIZE Size, FLONG fl)
 
INT FASTCALL ftGdiGetTextCharsetInfo (PDC Dc, LPFONTSIGNATURE lpSig, DWORD dwFlags)
 
DWORD FASTCALL ftGetFontUnicodeRanges (PFONTGDI Font, PGLYPHSET glyphset)
 
BOOL FASTCALL ftGdiGetTextMetricsW (HDC hDC, PTMW_INTERNAL ptmwi)
 
DWORD FASTCALL ftGdiGetFontData (PFONTGDI FontGdi, DWORD Table, DWORD Offset, PVOID Buffer, DWORD Size)
 
static UINT GetFontPenalty (const LOGFONTW *LogFont, const OUTLINETEXTMETRICW *Otm, const char *style_name)
 
static __inline VOID FindBestFontFromList (FONTOBJ **FontObj, ULONG *MatchPenalty, const LOGFONTW *LogFont, const PLIST_ENTRY Head)
 
static VOID FASTCALL IntFontType (PFONTGDI Font)
 
static BOOL MatchFontName (PSHARED_FACE SharedFace, PUNICODE_STRING Name1, FT_UShort NameID, FT_UShort LangID)
 
static BOOL MatchFontNames (PSHARED_FACE SharedFace, LPCWSTR lfFaceName)
 
NTSTATUS FASTCALL TextIntRealizeFont (HFONT FontHandle, PTEXTOBJ pTextObj)
 
static BOOL FASTCALL IntGetFullFileName (POBJECT_NAME_INFORMATION NameInfo, ULONG Size, PUNICODE_STRING FileName)
 
static BOOL EqualFamilyInfo (const FONTFAMILYINFO *pInfo1, const FONTFAMILYINFO *pInfo2)
 
static VOID IntAddNameFromFamInfo (LPWSTR psz, FONTFAMILYINFO *FamInfo)
 
BOOL FASTCALL IntGdiGetFontResourceInfo (PUNICODE_STRING FileName, PVOID pBuffer, DWORD *pdwBytes, DWORD dwType)
 
BOOL FASTCALL ftGdiRealizationInfo (PFONTGDI Font, PREALIZATION_INFO Info)
 
DWORD FASTCALL ftGdiGetKerningPairs (PFONTGDI Font, DWORD cPairs, LPKERNINGPAIR pKerningPair)
 
LONG FASTCALL IntGetFontFamilyInfo (HDC Dc, const LOGFONTW *SafeLogFont, PFONTFAMILYINFO SafeInfo, LONG InfoCount)
 
LONG NTAPI NtGdiGetFontFamilyInfo (HDC Dc, const LOGFONTW *UnsafeLogFont, PFONTFAMILYINFO UnsafeInfo, LPLONG UnsafeInfoCount)
 
static LONG ScaleLong (LONG lValue, PFLOATOBJ pef)
 
static BOOL IntGetTextDisposition (OUT LONGLONG *pX64, OUT LONGLONG *pY64, IN LPCWSTR String, IN INT Count, IN OPTIONAL LPINT Dx, IN OUT PFONT_CACHE_ENTRY Cache, IN UINT fuOptions)
 
VOID APIENTRY IntEngFillPolygon (IN OUT PDC dc, IN POINTL *pPoints, IN UINT cPoints, IN BRUSHOBJ *BrushObj)
 
VOID FASTCALL IntEngFillBox (IN OUT PDC dc, IN INT X, IN INT Y, IN INT Width, IN INT Height, IN BRUSHOBJ *BrushObj)
 
BOOL APIENTRY IntExtTextOutW (IN PDC dc, IN INT XStart, IN INT YStart, IN UINT fuOptions, IN OPTIONAL PRECTL lprc, IN LPCWSTR String, IN INT Count, IN OPTIONAL LPINT Dx, IN DWORD dwCodePage)
 
BOOL APIENTRY GreExtTextOutW (IN HDC hDC, IN INT XStart, IN INT YStart, IN UINT fuOptions, IN OPTIONAL PRECTL lprc, IN LPCWSTR String, IN INT Count, IN OPTIONAL LPINT Dx, IN DWORD dwCodePage)
 
BOOL APIENTRY NtGdiExtTextOutW (IN HDC hDC, IN INT XStart, IN INT YStart, IN UINT fuOptions, IN OPTIONAL LPRECT UnsafeRect, IN LPWSTR UnsafeString, IN INT Count, IN OPTIONAL LPINT UnsafeDx, IN DWORD dwCodePage)
 
BOOL APIENTRY NtGdiGetCharABCWidthsW (IN HDC hDC, IN UINT FirstChar, IN ULONG Count, IN OPTIONAL PWCHAR UnSafepwch, IN FLONG fl, OUT PVOID Buffer)
 
BOOL APIENTRY NtGdiGetCharWidthW (IN HDC hDC, IN UINT FirstChar, IN UINT Count, IN OPTIONAL PWCHAR UnSafepwc, IN FLONG fl, OUT PVOID Buffer)
 
__kernel_entry W32KAPI DWORD APIENTRY NtGdiGetGlyphIndicesW (_In_ HDC hdc, _In_reads_opt_(cwc) LPCWSTR pwc, _In_ INT cwc, _Out_writes_opt_(cwc) LPWORD pgi, _In_ DWORD iMode)
 

Variables

const MATRIX gmxWorldToDeviceDefault
 
const MATRIX gmxWorldToPageDefault
 
static const FT_Matrix identityMat = {(1 << 16), 0, 0, (1 << 16)}
 
static POINTL PointZero = { 0, 0 }
 
FT_Library g_FreeTypeLibrary
 
static UNICODE_STRING g_FontRegPath
 
static PFAST_MUTEX g_FreeTypeLock
 
static LIST_ENTRY g_FontListHead
 
static PFAST_MUTEX g_FontListLock
 
static BOOL g_RenderingEnabled = TRUE
 
static LIST_ENTRY g_FontCacheListHead
 
static UINT g_FontCacheNumEntries
 
static PWCHAR g_ElfScripts [32]
 
static const CHARSETINFO g_FontTci [MAXTCIINDEX]
 

Macro Definition Documentation

◆ _TMPF_VARIABLE_PITCH

#define _TMPF_VARIABLE_PITCH   TMPF_FIXED_PITCH

Definition at line 41 of file freetype.c.

◆ ASSERT_FREETYPE_LOCK_HELD

#define ASSERT_FREETYPE_LOCK_HELD ( )     ASSERT(g_FreeTypeLock->Owner == KeGetCurrentThread())

Definition at line 86 of file freetype.c.

◆ ASSERT_FREETYPE_LOCK_NOT_HELD

#define ASSERT_FREETYPE_LOCK_NOT_HELD ( )     ASSERT(g_FreeTypeLock->Owner != KeGetCurrentThread())

Definition at line 89 of file freetype.c.

◆ ASSERT_GLOBALFONTS_LOCK_HELD

#define ASSERT_GLOBALFONTS_LOCK_HELD ( )     ASSERT(g_FontListLock->Owner == KeGetCurrentThread())

Definition at line 77 of file freetype.c.

◆ CP_MACCP

#define CP_MACCP   2

Definition at line 168 of file freetype.c.

◆ CP_OEMCP

#define CP_OEMCP   1

Definition at line 167 of file freetype.c.

◆ CP_SYMBOL

#define CP_SYMBOL   42

Definition at line 123 of file freetype.c.

◆ EMUBOLD_NEEDED

#define EMUBOLD_NEEDED (   original,
  request 
)     (((request) != FW_DONTCARE) && ((request) - (original) >= FW_BOLD - FW_MEDIUM))

Definition at line 45 of file freetype.c.

◆ FM_SEL_USE_TYPO_METRICS

#define FM_SEL_USE_TYPO_METRICS   0x80

◆ FT_INTERNAL_INTERNAL_H

#define FT_INTERNAL_INTERNAL_H   <freetype/internal/internal.h>

Includes

Definition at line 28 of file freetype.c.

◆ gmxWorldToDeviceDefault

#define gmxWorldToDeviceDefault   gmxWorldToPageDefault

Definition at line 54 of file freetype.c.

◆ GOT_PENALTY

#define GOT_PENALTY (   name,
  value 
)    Penalty += (value)

Definition at line 4696 of file freetype.c.

◆ IntLockFreeType

Definition at line 80 of file freetype.c.

◆ IntLockGlobalFonts

Definition at line 71 of file freetype.c.

◆ IntUnLockFreeType

Definition at line 83 of file freetype.c.

◆ IntUnLockGlobalFonts

Definition at line 74 of file freetype.c.

◆ MAX_FONT_CACHE

#define MAX_FONT_CACHE   256

Definition at line 92 of file freetype.c.

◆ MAXTCIINDEX

#define MAXTCIINDEX   32

Definition at line 124 of file freetype.c.

◆ NDEBUG

#define NDEBUG

Definition at line 36 of file freetype.c.

◆ PX2PT

#define PX2PT (   pixels)    FT_MulDiv((pixels), 72, 96)

Definition at line 1051 of file freetype.c.

◆ SCALE_X

#define SCALE_X (   value)    ((FT_MulFix((value), XScale) + 32) >> 6)

◆ SCALE_Y

#define SCALE_Y (   value)    ((FT_MulFix((value), YScale) + 32) >> 6)

◆ STACK_TEXT_BUFFER_SIZE

#define STACK_TEXT_BUFFER_SIZE   100

Definition at line 6581 of file freetype.c.

◆ VALIGN_MASK

#define VALIGN_MASK   (TA_TOP | TA_BASELINE | TA_BOTTOM)

Typedef Documentation

◆ FONT_NAMES

◆ LPFONT_NAMES

Function Documentation

◆ CharSetFromLangID()

static BYTE CharSetFromLangID ( LANGID  LangID)
static

Definition at line 2551 of file freetype.c.

2552{
2553 /* FIXME: Add more and fix if wrong */
2554 switch (PRIMARYLANGID(LangID))
2555 {
2556 case LANG_CHINESE:
2557 switch (SUBLANGID(LangID))
2558 {
2560 return CHINESEBIG5_CHARSET;
2562 default:
2563 break;
2564 }
2565 return GB2312_CHARSET;
2566
2567 case LANG_CZECH: case LANG_HUNGARIAN: case LANG_POLISH:
2568 case LANG_SLOVAK: case LANG_SLOVENIAN: case LANG_ROMANIAN:
2569 return EASTEUROPE_CHARSET;
2570
2572 case LANG_SERBIAN: case LANG_UKRAINIAN:
2573 return RUSSIAN_CHARSET;
2574
2575 case LANG_ARABIC: return ARABIC_CHARSET;
2576 case LANG_GREEK: return GREEK_CHARSET;
2577 case LANG_HEBREW: return HEBREW_CHARSET;
2578 case LANG_JAPANESE: return SHIFTJIS_CHARSET;
2579 case LANG_KOREAN: return JOHAB_CHARSET;
2580 case LANG_TURKISH: return TURKISH_CHARSET;
2581 case LANG_THAI: return THAI_CHARSET;
2582 case LANG_LATVIAN: return BALTIC_CHARSET;
2584
2585 case LANG_ENGLISH: case LANG_BASQUE: case LANG_CATALAN:
2586 case LANG_DANISH: case LANG_DUTCH: case LANG_FINNISH:
2587 case LANG_FRENCH: case LANG_GERMAN: case LANG_ITALIAN:
2589 case LANG_SWEDISH: default:
2590 return ANSI_CHARSET;
2591 }
2592}
#define LANG_THAI
Definition: nls.h:132
#define LANG_NORWEGIAN
Definition: nls.h:102
#define SUBLANGID(l)
Definition: nls.h:17
#define LANG_TURKISH
Definition: nls.h:136
#define LANG_DANISH
Definition: nls.h:48
#define LANG_SPANISH
Definition: nls.h:123
#define LANG_POLISH
Definition: nls.h:107
#define LANG_GERMAN
Definition: nls.h:62
#define LANG_HEBREW
Definition: nls.h:67
#define LANG_UKRAINIAN
Definition: nls.h:139
#define LANG_BULGARIAN
Definition: nls.h:40
#define LANG_FINNISH
Definition: nls.h:57
#define LANG_GREEK
Definition: nls.h:63
#define LANG_BASQUE
Definition: nls.h:34
#define LANG_MACEDONIAN
Definition: nls.h:91
#define LANG_ENGLISH
Definition: nls.h:52
#define LANG_ROMANIAN
Definition: nls.h:111
#define SUBLANG_CHINESE_TRADITIONAL
Definition: nls.h:208
#define LANG_DUTCH
Definition: nls.h:51
#define SUBLANG_CHINESE_SIMPLIFIED
Definition: nls.h:209
#define LANG_RUSSIAN
Definition: nls.h:113
#define LANG_VIETNAMESE
Definition: nls.h:143
#define LANG_CZECH
Definition: nls.h:47
#define LANG_HUNGARIAN
Definition: nls.h:69
#define LANG_SWEDISH
Definition: nls.h:125
#define LANG_ARABIC
Definition: nls.h:29
#define LANG_CHINESE
Definition: nls.h:42
#define LANG_SERBIAN
Definition: nls.h:116
#define LANG_JAPANESE
Definition: nls.h:76
#define PRIMARYLANGID(l)
Definition: nls.h:16
#define LANG_LATVIAN
Definition: nls.h:87
#define LANG_SLOVAK
Definition: nls.h:120
#define LANG_KOREAN
Definition: nls.h:84
#define LANG_SLOVENIAN
Definition: nls.h:121
#define LANG_FRENCH
Definition: nls.h:58
#define LANG_ITALIAN
Definition: nls.h:75
#define LANG_PORTUGUESE
Definition: nls.h:108
#define LANG_CATALAN
Definition: nls.h:41
_Must_inspect_result_ _In_ WDFUSBDEVICE _In_opt_ WDFREQUEST _In_opt_ PWDF_REQUEST_SEND_OPTIONS _Out_writes_opt_ NumCharacters PUSHORT _Inout_ PUSHORT _In_ UCHAR _In_opt_ USHORT LangID
Definition: wdfusb.h:1083
#define RUSSIAN_CHARSET
Definition: wingdi.h:396
#define ARABIC_CHARSET
Definition: wingdi.h:394
#define THAI_CHARSET
Definition: wingdi.h:397
#define GREEK_CHARSET
Definition: wingdi.h:391
#define JOHAB_CHARSET
Definition: wingdi.h:401
#define CHINESEBIG5_CHARSET
Definition: wingdi.h:390
#define ANSI_CHARSET
Definition: wingdi.h:383
#define VIETNAMESE_CHARSET
Definition: wingdi.h:402
#define HEBREW_CHARSET
Definition: wingdi.h:393
#define SHIFTJIS_CHARSET
Definition: wingdi.h:386
#define EASTEUROPE_CHARSET
Definition: wingdi.h:399
#define GB2312_CHARSET
Definition: wingdi.h:389
#define BALTIC_CHARSET
Definition: wingdi.h:395
#define TURKISH_CHARSET
Definition: wingdi.h:392

Referenced by GetFontPenalty().

◆ CleanupFontEntry()

static __inline VOID FASTCALL CleanupFontEntry ( PFONT_ENTRY  FontEntry)
static

Definition at line 363 of file freetype.c.

364{
365 CleanupFontEntryEx(FontEntry, FontEntry->Font);
366}
static VOID FASTCALL CleanupFontEntryEx(PFONT_ENTRY FontEntry, PFONTGDI FontGDI)
Definition: freetype.c:343
FONTGDI * Font
Definition: font.h:7

Referenced by IntGdiCleanupMemEntry(), and IntGdiCleanupPrivateFontsForProcess().

◆ CleanupFontEntryEx()

static VOID FASTCALL CleanupFontEntryEx ( PFONT_ENTRY  FontEntry,
PFONTGDI  FontGDI 
)
static

Definition at line 343 of file freetype.c.

344{
345 // PFONTGDI FontGDI = FontEntry->Font;
346 PSHARED_FACE SharedFace = FontGDI->SharedFace;
347
348 if (FontGDI->Filename)
350
351 if (FontEntry->StyleName.Buffer)
352 RtlFreeUnicodeString(&FontEntry->StyleName);
353
354 if (FontEntry->FaceName.Buffer)
355 RtlFreeUnicodeString(&FontEntry->FaceName);
356
357 EngFreeMem(FontGDI);
358 SharedFace_Release(SharedFace);
359 ExFreePoolWithTag(FontEntry, TAG_FONT);
360}
static void SharedFace_Release(PSHARED_FACE Ptr)
Definition: freetype.c:319
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
#define EngFreeMem
Definition: polytest.cpp:56
LPWSTR Filename
Definition: engobjects.h:151
PSHARED_FACE SharedFace
Definition: engobjects.h:145
UNICODE_STRING StyleName
Definition: font.h:9
UNICODE_STRING FaceName
Definition: font.h:8
#define TAG_FONT
Definition: tags.h:12
#define GDITAG_PFF
Definition: tags.h:149

Referenced by CleanupFontEntry().

◆ DuplicateUnicodeString()

static NTSTATUS DuplicateUnicodeString ( PUNICODE_STRING  Source,
PUNICODE_STRING  Destination 
)
static

Definition at line 834 of file freetype.c.

835{
837 UNICODE_STRING Tmp;
838
839 Tmp.Buffer = ExAllocatePoolWithTag(PagedPool, Source->MaximumLength, TAG_USTR);
840 if (Tmp.Buffer)
841 {
842 Tmp.MaximumLength = Source->MaximumLength;
843 Tmp.Length = 0;
845
849
851 }
852
853 return Status;
854}
LONG NTSTATUS
Definition: precomp.h:26
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define PagedPool
Definition: env_spec_w32.h:308
Status
Definition: gdiplustypes.h:25
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3169
_In_ PUNICODE_STRING _Inout_ PUNICODE_STRING Destination
Definition: rtlfuncs.h:2992
NTSYSAPI VOID NTAPI RtlCopyUnicodeString(PUNICODE_STRING DestinationString, PUNICODE_STRING SourceString)
#define STATUS_NO_MEMORY
Definition: ntstatus.h:260
#define STATUS_SUCCESS
Definition: shellext.h:65
USHORT MaximumLength
Definition: env_spec_w32.h:370
#define TAG_USTR
Definition: tag.h:145

Referenced by IntGdiAddFontResourceEx(), and IntGetFontLocalizedName().

◆ EqualFamilyInfo()

static BOOL EqualFamilyInfo ( const FONTFAMILYINFO pInfo1,
const FONTFAMILYINFO pInfo2 
)
static

Definition at line 5352 of file freetype.c.

5353{
5354 const ENUMLOGFONTEXW *pLog1 = &pInfo1->EnumLogFontEx;
5355 const ENUMLOGFONTEXW *pLog2 = &pInfo2->EnumLogFontEx;
5356 const LOGFONTW *plf1 = &pLog1->elfLogFont;
5357 const LOGFONTW *plf2 = &pLog2->elfLogFont;
5358
5359 if (_wcsicmp(plf1->lfFaceName, plf2->lfFaceName) != 0)
5360 {
5361 return FALSE;
5362 }
5363
5364 if (_wcsicmp(pLog1->elfStyle, pLog2->elfStyle) != 0)
5365 {
5366 return FALSE;
5367 }
5368
5369 return TRUE;
5370}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
WCHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:72
WCHAR elfStyle[LF_FACESIZE]
Definition: wingdi.h:2704
LOGFONTW elfLogFont
Definition: wingdi.h:2702
ENUMLOGFONTEXW EnumLogFontEx
Definition: ntgdibad.h:47

Referenced by IntGdiGetFontResourceInfo().

◆ face_has_symbol_charmap()

static BOOL face_has_symbol_charmap ( FT_Face  ft_face)
static

Definition at line 2086 of file freetype.c.

2087{
2088 int i;
2089
2090 for(i = 0; i < ft_face->num_charmaps; i++)
2091 {
2092 if (ft_face->charmaps[i]->platform_id == TT_PLATFORM_MICROSOFT &&
2093 ft_face->charmaps[i]->encoding == FT_ENCODING_MS_SYMBOL)
2094 {
2095 return TRUE;
2096 }
2097 }
2098 return FALSE;
2099}
#define TT_PLATFORM_MICROSOFT
Definition: font.c:1174
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
FT_Encoding encoding
Definition: freetype.h:843
FT_UShort platform_id
Definition: freetype.h:844
FT_Int num_charmaps
Definition: freetype.h:1084
FT_CharMap * charmaps
Definition: freetype.h:1085

Referenced by FillTM(), and get_glyph_index().

◆ FillTM()

static void FASTCALL FillTM ( TEXTMETRICW TM,
PFONTGDI  FontGDI,
TT_OS2 pOS2,
TT_HoriHeader pHori,
FT_WinFNT_HeaderRec pFNT 
)
static

Definition at line 2102 of file freetype.c.

2105{
2106 FT_Fixed XScale, YScale;
2107 int Ascent, Descent;
2108 FT_Face Face = FontGDI->SharedFace->Face;
2109
2111
2112 XScale = Face->size->metrics.x_scale;
2113 YScale = Face->size->metrics.y_scale;
2114
2115 if (pFNT)
2116 {
2117 TM->tmHeight = pFNT->pixel_height;
2118 TM->tmAscent = pFNT->ascent;
2119 TM->tmDescent = TM->tmHeight - TM->tmAscent;
2122 TM->tmAveCharWidth = pFNT->avg_width;
2123 TM->tmMaxCharWidth = pFNT->max_width;
2124 TM->tmOverhang = 0;
2127 TM->tmFirstChar = pFNT->first_char;
2128 TM->tmLastChar = pFNT->last_char;
2129 TM->tmDefaultChar = pFNT->default_char + pFNT->first_char;
2130 TM->tmBreakChar = pFNT->break_char + pFNT->first_char;
2132 TM->tmWeight = FontGDI->RequestWeight;
2133 TM->tmItalic = FontGDI->RequestItalic;
2134 TM->tmUnderlined = FontGDI->RequestUnderline;
2135 TM->tmStruckOut = FontGDI->RequestStrikeOut;
2136 TM->tmCharSet = FontGDI->CharSet;
2137 return;
2138 }
2139
2140 ASSERT(pOS2);
2141 if (!pOS2)
2142 return;
2143
2144 if ((FT_Short)pOS2->usWinAscent + (FT_Short)pOS2->usWinDescent == 0)
2145 {
2146 Ascent = pHori->Ascender;
2147 Descent = -pHori->Descender;
2148 }
2149 else
2150 {
2151 Ascent = (FT_Short)pOS2->usWinAscent;
2152 Descent = (FT_Short)pOS2->usWinDescent;
2153 }
2154
2155 TM->tmAscent = FontGDI->tmAscent;
2156 TM->tmDescent = FontGDI->tmDescent;
2157 TM->tmHeight = TM->tmAscent + TM->tmDescent;
2158 TM->tmInternalLeading = FontGDI->tmInternalLeading;
2159
2160 /* MSDN says:
2161 * el = MAX(0, LineGap - ((WinAscent + WinDescent) - (Ascender - Descender)))
2162 */
2163 TM->tmExternalLeading = max(0, (FT_MulFix(pHori->Line_Gap
2164 - ((Ascent + Descent)
2165 - (pHori->Ascender - pHori->Descender)),
2166 YScale) + 32) >> 6);
2167 if (FontGDI->lfWidth != 0)
2168 TM->tmAveCharWidth = FontGDI->lfWidth;
2169 else
2170 TM->tmAveCharWidth = (FT_MulFix(pOS2->xAvgCharWidth, XScale) + 32) >> 6;
2171
2172 if (TM->tmAveCharWidth == 0)
2173 TM->tmAveCharWidth = 1;
2174
2175 /* Correct forumla to get the maxcharwidth from unicode and ansi font */
2176 TM->tmMaxCharWidth = (FT_MulFix(Face->max_advance_width, XScale) + 32) >> 6;
2177
2178 if (FontGDI->OriginalWeight != FW_DONTCARE &&
2179 FontGDI->OriginalWeight != FW_NORMAL)
2180 {
2181 TM->tmWeight = FontGDI->OriginalWeight;
2182 }
2183 else
2184 {
2185 TM->tmWeight = FontGDI->RequestWeight;
2186 }
2187
2188 TM->tmOverhang = 0;
2189 TM->tmDigitizedAspectX = 96;
2190 TM->tmDigitizedAspectY = 96;
2191 if (face_has_symbol_charmap(Face) ||
2192 (pOS2->usFirstCharIndex >= 0xf000 && pOS2->usFirstCharIndex < 0xf100))
2193 {
2194 USHORT cpOEM, cpAnsi;
2195
2196 EngGetCurrentCodePage(&cpOEM, &cpAnsi);
2197 TM->tmFirstChar = 0;
2198 switch(cpAnsi)
2199 {
2200 case 1257: /* Baltic */
2201 TM->tmLastChar = 0xf8fd;
2202 break;
2203 default:
2204 TM->tmLastChar = 0xf0ff;
2205 }
2206 TM->tmBreakChar = 0x20;
2207 TM->tmDefaultChar = 0x1f;
2208 }
2209 else
2210 {
2211 TM->tmFirstChar = pOS2->usFirstCharIndex; /* Should be the first char in the cmap */
2212 TM->tmLastChar = pOS2->usLastCharIndex; /* Should be min(cmap_last, os2_last) */
2213
2214 if(pOS2->usFirstCharIndex <= 1)
2215 TM->tmBreakChar = pOS2->usFirstCharIndex + 2;
2216 else if (pOS2->usFirstCharIndex > 0xff)
2217 TM->tmBreakChar = 0x20;
2218 else
2219 TM->tmBreakChar = pOS2->usFirstCharIndex;
2220 TM->tmDefaultChar = TM->tmBreakChar - 1;
2221 }
2222
2223 if (FontGDI->OriginalItalic || FontGDI->RequestItalic)
2224 {
2225 TM->tmItalic = 0xFF;
2226 }
2227 else
2228 {
2229 TM->tmItalic = 0;
2230 }
2231 TM->tmUnderlined = (FontGDI->RequestUnderline ? 0xFF : 0);
2232 TM->tmStruckOut = (FontGDI->RequestStrikeOut ? 0xFF : 0);
2233
2234 if (!FT_IS_FIXED_WIDTH(Face))
2235 {
2236 switch (pOS2->panose[PAN_PROPORTION_INDEX])
2237 {
2239 TM->tmPitchAndFamily = 0;
2240 break;
2241 default:
2243 break;
2244 }
2245 }
2246 else
2247 {
2248 TM->tmPitchAndFamily = 0;
2249 }
2250
2251 switch (pOS2->panose[PAN_FAMILYTYPE_INDEX])
2252 {
2253 case PAN_FAMILY_SCRIPT:
2255 break;
2258 break;
2259
2260 case PAN_ANY:
2261 case PAN_NO_FIT:
2263 case PAN_FAMILY_PICTORIAL: /* Symbol fonts get treated as if they were text */
2264 /* Which is clearly not what the panose spec says. */
2265 if (TM->tmPitchAndFamily == 0) /* Fixed */
2266 {
2268 }
2269 else
2270 {
2271 switch (pOS2->panose[PAN_SERIFSTYLE_INDEX])
2272 {
2273 case PAN_ANY:
2274 case PAN_NO_FIT:
2275 default:
2277 break;
2278
2279 case PAN_SERIF_COVE:
2283 case PAN_SERIF_SQUARE:
2284 case PAN_SERIF_THIN:
2285 case PAN_SERIF_BONE:
2287 case PAN_SERIF_TRIANGLE:
2289 break;
2290
2294 case PAN_SERIF_FLARED:
2295 case PAN_SERIF_ROUNDED:
2297 break;
2298 }
2299 }
2300 break;
2301 default:
2303 }
2304
2305 if (FT_IS_SCALABLE(Face))
2306 {
2308 }
2309 if (FT_IS_SFNT(Face))
2310 {
2312 }
2313
2314 TM->tmCharSet = FontGDI->CharSet;
2315}
static BOOL face_has_symbol_charmap(FT_Face ft_face)
Definition: freetype.c:2086
#define ASSERT_FREETYPE_LOCK_HELD()
Definition: freetype.c:86
#define _TMPF_VARIABLE_PITCH
Definition: freetype.c:41
#define FT_IS_SFNT(face)
Definition: freetype.h:1331
#define FT_IS_SCALABLE(face)
Definition: freetype.h:1312
#define FT_IS_FIXED_WIDTH(face)
Definition: freetype.h:1346
FT_MulFix(FT_Long a, FT_Long b)
Definition: ftcalc.c:509
signed long FT_Fixed
Definition: fttypes.h:288
signed short FT_Short
Definition: fttypes.h:198
#define ASSERT(a)
Definition: mode.c:44
unsigned short USHORT
Definition: pedump.c:61
FT_Size size
Definition: freetype.h:1106
FT_Short max_advance_width
Definition: freetype.h:1099
FT_Size_Metrics metrics
Definition: freetype.h:1677
FT_Fixed y_scale
Definition: freetype.h:1644
FT_Fixed x_scale
Definition: freetype.h:1643
FT_UShort horizontal_resolution
Definition: ftwinfnt.h:192
FT_Byte pitch_and_family
Definition: ftwinfnt.h:203
FT_Byte default_char
Definition: ftwinfnt.h:208
FT_UShort internal_leading
Definition: ftwinfnt.h:194
FT_UShort avg_width
Definition: ftwinfnt.h:204
FT_UShort external_leading
Definition: ftwinfnt.h:195
FT_UShort ascent
Definition: ftwinfnt.h:193
FT_UShort max_width
Definition: ftwinfnt.h:205
FT_UShort pixel_height
Definition: ftwinfnt.h:202
FT_UShort vertical_resolution
Definition: ftwinfnt.h:191
FT_Short Line_Gap
Definition: tttables.h:204
FT_Short Ascender
Definition: tttables.h:202
FT_Short Descender
Definition: tttables.h:203
FT_UShort usLastCharIndex
Definition: tttables.h:410
FT_Byte panose[10]
Definition: tttables.h:399
FT_UShort usWinDescent
Definition: tttables.h:415
FT_UShort usWinAscent
Definition: tttables.h:414
FT_Short xAvgCharWidth
Definition: tttables.h:383
FT_UShort usFirstCharIndex
Definition: tttables.h:409
LONG tmInternalLeading
Definition: engobjects.h:164
BYTE RequestItalic
Definition: engobjects.h:154
LONG RequestWeight
Definition: engobjects.h:155
LONG lfWidth
Definition: engobjects.h:167
LONG tmAscent
Definition: engobjects.h:162
BYTE RequestStrikeOut
Definition: engobjects.h:153
LONG tmDescent
Definition: engobjects.h:163
BYTE OriginalItalic
Definition: engobjects.h:156
BYTE CharSet
Definition: engobjects.h:158
LONG OriginalWeight
Definition: engobjects.h:157
BYTE RequestUnderline
Definition: engobjects.h:152
FT_Face Face
Definition: engobjects.h:132
WCHAR tmFirstChar
Definition: wingdi.h:2394
LONG tmDigitizedAspectX
Definition: wingdi.h:2392
LONG tmDigitizedAspectY
Definition: wingdi.h:2393
LONG tmOverhang
Definition: wingdi.h:2391
LONG tmAveCharWidth
Definition: wingdi.h:2388
LONG tmAscent
Definition: wingdi.h:2384
LONG tmMaxCharWidth
Definition: wingdi.h:2389
BYTE tmItalic
Definition: wingdi.h:2398
BYTE tmStruckOut
Definition: wingdi.h:2400
LONG tmInternalLeading
Definition: wingdi.h:2386
BYTE tmUnderlined
Definition: wingdi.h:2399
LONG tmExternalLeading
Definition: wingdi.h:2387
BYTE tmPitchAndFamily
Definition: wingdi.h:2401
LONG tmWeight
Definition: wingdi.h:2390
WCHAR tmBreakChar
Definition: wingdi.h:2397
WCHAR tmDefaultChar
Definition: wingdi.h:2396
BYTE tmCharSet
Definition: wingdi.h:2402
WCHAR tmLastChar
Definition: wingdi.h:2395
LONG tmHeight
Definition: wingdi.h:2383
LONG tmDescent
Definition: wingdi.h:2385
#define max(a, b)
Definition: svc.c:63
ENGAPI VOID APIENTRY EngGetCurrentCodePage(_Out_ PUSHORT OemCodePage, _Out_ PUSHORT AnsiCodePage)
Definition: engmisc.c:232
#define PAN_SERIF_THIN
Definition: wingdi.h:476
#define PAN_FAMILY_TEXT_DISPLAY
Definition: wingdi.h:467
#define PAN_PROP_MONOSPACED
Definition: wingdi.h:502
#define FW_DONTCARE
Definition: wingdi.h:368
#define PAN_SERIFSTYLE_INDEX
Definition: wingdi.h:455
#define FF_MODERN
Definition: wingdi.h:449
#define FF_DECORATIVE
Definition: wingdi.h:447
#define PAN_SERIF_NORMAL_SANS
Definition: wingdi.h:480
#define FF_SCRIPT
Definition: wingdi.h:451
#define PAN_SERIF_BONE
Definition: wingdi.h:477
#define FF_ROMAN
Definition: wingdi.h:450
#define PAN_SERIF_OBTUSE_SANS
Definition: wingdi.h:481
#define PAN_FAMILY_PICTORIAL
Definition: wingdi.h:470
#define FF_DONTCARE
Definition: wingdi.h:448
#define PAN_SERIF_TRIANGLE
Definition: wingdi.h:479
#define TMPF_TRUETYPE
Definition: wingdi.h:1313
#define PAN_PROPORTION_INDEX
Definition: wingdi.h:457
#define PAN_NO_FIT
Definition: wingdi.h:466
#define PAN_SERIF_SQUARE_COVE
Definition: wingdi.h:473
#define PAN_SERIF_SQUARE
Definition: wingdi.h:475
#define PAN_SERIF_OBTUSE_SQUARE_COVE
Definition: wingdi.h:474
#define PAN_SERIF_COVE
Definition: wingdi.h:471
#define TMPF_VECTOR
Definition: wingdi.h:1312
#define PAN_SERIF_EXAGGERATED
Definition: wingdi.h:478
#define PAN_SERIF_ROUNDED
Definition: wingdi.h:484
#define PAN_FAMILYTYPE_INDEX
Definition: wingdi.h:454
#define PAN_FAMILY_DECORATIVE
Definition: wingdi.h:469
#define PAN_SERIF_PERP_SANS
Definition: wingdi.h:482
#define FW_NORMAL
Definition: wingdi.h:373
#define PAN_SERIF_FLARED
Definition: wingdi.h:483
#define PAN_FAMILY_SCRIPT
Definition: wingdi.h:468
#define PAN_SERIF_OBTUSE_COVE
Definition: wingdi.h:472
#define PAN_ANY
Definition: wingdi.h:465
#define FF_SWISS
Definition: wingdi.h:452

Referenced by ftGdiGetTextMetricsW(), and IntGetOutlineTextMetrics().

◆ FindBestFontFromList()

static __inline VOID FindBestFontFromList ( FONTOBJ **  FontObj,
ULONG MatchPenalty,
const LOGFONTW LogFont,
const PLIST_ENTRY  Head 
)
static

Definition at line 5046 of file freetype.c.

5049{
5050 ULONG Penalty;
5052 PFONT_ENTRY CurrentEntry;
5053 FONTGDI *FontGDI;
5054 OUTLINETEXTMETRICW *Otm = NULL;
5055 UINT OtmSize, OldOtmSize = 0;
5056 FT_Face Face;
5057
5058 ASSERT(FontObj);
5059 ASSERT(MatchPenalty);
5060 ASSERT(LogFont);
5061 ASSERT(Head);
5062
5063 /* Start with a pretty big buffer */
5064 OldOtmSize = 0x200;
5065 Otm = ExAllocatePoolWithTag(PagedPool, OldOtmSize, GDITAG_TEXT);
5066
5067 /* get the FontObj of lowest penalty */
5068 for (Entry = Head->Flink; Entry != Head; Entry = Entry->Flink)
5069 {
5070 CurrentEntry = CONTAINING_RECORD(Entry, FONT_ENTRY, ListEntry);
5071
5072 FontGDI = CurrentEntry->Font;
5073 ASSERT(FontGDI);
5074 Face = FontGDI->SharedFace->Face;
5075
5076 /* get text metrics */
5077 OtmSize = IntGetOutlineTextMetrics(FontGDI, 0, NULL);
5078 if (OtmSize > OldOtmSize)
5079 {
5080 if (Otm)
5083 }
5084
5085 /* update FontObj if lowest penalty */
5086 if (Otm)
5087 {
5089 IntRequestFontSize(NULL, FontGDI, LogFont->lfWidth, LogFont->lfHeight);
5091
5092 OtmSize = IntGetOutlineTextMetrics(FontGDI, OtmSize, Otm);
5093 if (!OtmSize)
5094 continue;
5095
5096 OldOtmSize = OtmSize;
5097
5098 Penalty = GetFontPenalty(LogFont, Otm, Face->style_name);
5099 if (*MatchPenalty == 0xFFFFFFFF || Penalty < *MatchPenalty)
5100 {
5101 *FontObj = GDIToObj(FontGDI, FONT);
5102 *MatchPenalty = Penalty;
5103 }
5104 }
5105 }
5106
5107 if (Otm)
5109}
#define NULL
Definition: types.h:112
#define GDIToObj(ClipGDI, Type)
Definition: engobjects.h:185
static UINT GetFontPenalty(const LOGFONTW *LogFont, const OUTLINETEXTMETRICW *Otm, const char *style_name)
Definition: freetype.c:4700
static FT_Error IntRequestFontSize(PDC dc, PFONTGDI FontGDI, LONG lfWidth, LONG lfHeight)
Definition: freetype.c:3451
#define IntUnLockFreeType()
Definition: freetype.c:83
#define IntLockFreeType()
Definition: freetype.c:80
INT FASTCALL IntGetOutlineTextMetrics(PFONTGDI FontGDI, UINT Size, OUTLINETEXTMETRICW *Otm)
Definition: freetype.c:2404
unsigned int UINT
Definition: ndis.h:50
base of all file and directory entries
Definition: entries.h:83
FT_String * style_name
Definition: freetype.h:1079
LONG lfHeight
Definition: dimm.idl:59
LONG lfWidth
Definition: dimm.idl:60
Definition: font.h:5
Definition: typedefs.h:120
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
#define GDITAG_TEXT
Definition: tags.h:172

Referenced by TextIntRealizeFont().

◆ FontFamilyFillInfo()

static void FASTCALL FontFamilyFillInfo ( PFONTFAMILYINFO  Info,
LPCWSTR  FaceName,
LPCWSTR  FullName,
PFONTGDI  FontGDI 
)
static

Definition at line 2769 of file freetype.c.

2771{
2772 ANSI_STRING StyleA;
2773 UNICODE_STRING StyleW;
2774 TT_OS2 *pOS2;
2776 CHARSETINFO CharSetInfo;
2777 unsigned i, Size;
2778 OUTLINETEXTMETRICW *Otm;
2779 LOGFONTW *Lf;
2780 TEXTMETRICW *TM;
2781 NEWTEXTMETRICW *Ntm;
2782 DWORD fs0;
2784 PSHARED_FACE SharedFace = FontGDI->SharedFace;
2785 FT_Face Face = SharedFace->Face;
2786 UNICODE_STRING NameW;
2787
2788 RtlInitUnicodeString(&NameW, NULL);
2790 Size = IntGetOutlineTextMetrics(FontGDI, 0, NULL);
2792 if (!Otm)
2793 {
2794 return;
2795 }
2796 Size = IntGetOutlineTextMetrics(FontGDI, Size, Otm);
2797 if (!Size)
2798 {
2800 return;
2801 }
2802
2803 Lf = &Info->EnumLogFontEx.elfLogFont;
2804 TM = &Otm->otmTextMetrics;
2805
2806 Lf->lfHeight = TM->tmHeight;
2807 Lf->lfWidth = TM->tmAveCharWidth;
2808 Lf->lfWeight = TM->tmWeight;
2809 Lf->lfItalic = TM->tmItalic;
2810 Lf->lfPitchAndFamily = (TM->tmPitchAndFamily & 0xf1) + 1;
2811 Lf->lfCharSet = TM->tmCharSet;
2815
2816 Ntm = &Info->NewTextMetricEx.ntmTm;
2817 Ntm->tmHeight = TM->tmHeight;
2818 Ntm->tmAscent = TM->tmAscent;
2819 Ntm->tmDescent = TM->tmDescent;
2822 Ntm->tmAveCharWidth = TM->tmAveCharWidth;
2823 Ntm->tmMaxCharWidth = TM->tmMaxCharWidth;
2824 Ntm->tmWeight = TM->tmWeight;
2825 Ntm->tmOverhang = TM->tmOverhang;
2828 Ntm->tmFirstChar = TM->tmFirstChar;
2829 Ntm->tmLastChar = TM->tmLastChar;
2830 Ntm->tmDefaultChar = TM->tmDefaultChar;
2831 Ntm->tmBreakChar = TM->tmBreakChar;
2832 Ntm->tmItalic = TM->tmItalic;
2833 Ntm->tmUnderlined = TM->tmUnderlined;
2834 Ntm->tmStruckOut = TM->tmStruckOut;
2836 Ntm->tmCharSet = TM->tmCharSet;
2837 Ntm->ntmFlags = TM->tmItalic ? NTM_ITALIC : 0;
2838
2839 if (550 < TM->tmWeight) Ntm->ntmFlags |= NTM_BOLD;
2840
2841 if (0 == Ntm->ntmFlags) Ntm->ntmFlags = NTM_REGULAR;
2842
2843 Info->FontType = (0 != (TM->tmPitchAndFamily & TMPF_TRUETYPE)
2844 ? TRUETYPE_FONTTYPE : 0);
2845
2846 if (0 == (TM->tmPitchAndFamily & TMPF_VECTOR))
2847 Info->FontType |= RASTER_FONTTYPE;
2848
2849
2850 /* face name */
2851 if (!FaceName)
2852 FaceName = (WCHAR*)((ULONG_PTR)Otm + (ULONG_PTR)Otm->otmpFamilyName);
2853
2854 RtlStringCbCopyW(Lf->lfFaceName, sizeof(Lf->lfFaceName), FaceName);
2855
2856 /* full name */
2857 if (!FullName)
2858 FullName = (WCHAR*)((ULONG_PTR) Otm + (ULONG_PTR)Otm->otmpFaceName);
2859
2860 RtlStringCbCopyW(Info->EnumLogFontEx.elfFullName,
2861 sizeof(Info->EnumLogFontEx.elfFullName),
2862 FullName);
2863
2864 RtlInitAnsiString(&StyleA, Face->style_name);
2865 StyleW.Buffer = Info->EnumLogFontEx.elfStyle;
2866 StyleW.MaximumLength = sizeof(Info->EnumLogFontEx.elfStyle);
2867 status = RtlAnsiStringToUnicodeString(&StyleW, &StyleA, FALSE);
2868 if (!NT_SUCCESS(status))
2869 {
2871 return;
2872 }
2873 Info->EnumLogFontEx.elfScript[0] = UNICODE_NULL;
2874
2876 pOS2 = FT_Get_Sfnt_Table(Face, ft_sfnt_os2);
2877
2878 if (!pOS2)
2879 {
2882 return;
2883 }
2884
2885 Ntm->ntmSizeEM = Otm->otmEMSquare;
2887 Ntm->ntmAvgWidth = 0;
2888
2890
2891 fs.fsCsb[0] = pOS2->ulCodePageRange1;
2892 fs.fsCsb[1] = pOS2->ulCodePageRange2;
2893 fs.fsUsb[0] = pOS2->ulUnicodeRange1;
2894 fs.fsUsb[1] = pOS2->ulUnicodeRange2;
2895 fs.fsUsb[2] = pOS2->ulUnicodeRange3;
2896 fs.fsUsb[3] = pOS2->ulUnicodeRange4;
2897
2898 if (0 == pOS2->version)
2899 {
2900 FT_UInt Dummy;
2901
2902 if (FT_Get_First_Char(Face, &Dummy) < 0x100)
2903 fs.fsCsb[0] |= FS_LATIN1;
2904 else
2905 fs.fsCsb[0] |= FS_SYMBOL;
2906 }
2908
2909 if (fs.fsCsb[0] == 0)
2910 {
2911 /* Let's see if we can find any interesting cmaps */
2912 for (i = 0; i < (UINT)Face->num_charmaps; i++)
2913 {
2914 switch (Face->charmaps[i]->encoding)
2915 {
2916 case FT_ENCODING_UNICODE:
2917 case FT_ENCODING_APPLE_ROMAN:
2918 fs.fsCsb[0] |= FS_LATIN1;
2919 break;
2920 case FT_ENCODING_MS_SYMBOL:
2921 fs.fsCsb[0] |= FS_SYMBOL;
2922 break;
2923 default:
2924 break;
2925 }
2926 }
2927 }
2928
2929 for (i = 0; i < MAXTCIINDEX; i++)
2930 {
2931 fs0 = 1L << i;
2932 if (fs.fsCsb[0] & fs0)
2933 {
2934 if (!IntTranslateCharsetInfo(&fs0, &CharSetInfo, TCI_SRCFONTSIG))
2935 {
2936 CharSetInfo.ciCharset = DEFAULT_CHARSET;
2937 }
2938 if (DEFAULT_CHARSET != CharSetInfo.ciCharset)
2939 {
2940 if (g_ElfScripts[i])
2941 wcscpy(Info->EnumLogFontEx.elfScript, g_ElfScripts[i]);
2942 else
2943 {
2944 DPRINT1("Unknown elfscript for bit %u\n", i);
2945 }
2946 }
2947 }
2948 }
2949 Info->NewTextMetricEx.ntmFontSig = fs;
2950}
#define DPRINT1
Definition: precomp.h:8
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ULONG_PTR
Definition: config.h:101
unsigned long DWORD
Definition: ntddk_ex.h:95
static PWCHAR g_ElfScripts[32]
Definition: freetype.c:97
#define MAXTCIINDEX
Definition: freetype.c:124
static BOOLEAN IntTranslateCharsetInfo(PDWORD Src, LPCHARSETINFO Cs, DWORD Flags)
Definition: freetype.c:2039
FT_Get_First_Char(FT_Face face, FT_UInt *agindex)
Definition: ftobjs.c:3697
unsigned int FT_UInt
Definition: fttypes.h:231
#define fs
Definition: i386-dis.c:445
if(dx< 0)
Definition: linetemp.h:194
NTSYSAPI NTSTATUS NTAPI RtlAnsiStringToUnicodeString(PUNICODE_STRING DestinationString, PANSI_STRING SourceString, BOOLEAN AllocateDestinationString)
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
NTSYSAPI VOID NTAPI RtlInitAnsiString(PANSI_STRING DestinationString, PCSZ SourceString)
#define UNICODE_NULL
NTSTRSAFEAPI RtlStringCbCopyW(_Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest, _In_ size_t cbDest, _In_ NTSTRSAFE_PCWSTR pszSrc)
Definition: ntstrsafe.h:174
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
BYTE lfOutPrecision
Definition: dimm.idl:68
BYTE lfItalic
Definition: dimm.idl:64
LONG lfWeight
Definition: dimm.idl:63
BYTE lfClipPrecision
Definition: dimm.idl:69
BYTE lfCharSet
Definition: dimm.idl:67
BYTE lfQuality
Definition: dimm.idl:70
BYTE lfPitchAndFamily
Definition: dimm.idl:71
FT_UShort version
Definition: tttables.h:382
FT_ULong ulUnicodeRange1
Definition: tttables.h:401
FT_ULong ulCodePageRange1
Definition: tttables.h:419
FT_ULong ulUnicodeRange3
Definition: tttables.h:403
FT_ULong ulUnicodeRange2
Definition: tttables.h:402
FT_ULong ulCodePageRange2
Definition: tttables.h:420
FT_ULong ulUnicodeRange4
Definition: tttables.h:404
TEXTMETRICW otmTextMetrics
Definition: wingdi.h:2514
Definition: ffs.h:70
Definition: ps.c:97
UINT ciCharset
Definition: wingdi.h:1546
UINT ntmCellHeight
Definition: wingdi.h:2666
WCHAR tmFirstChar
Definition: wingdi.h:2655
LONG tmDigitizedAspectX
Definition: wingdi.h:2653
LONG tmInternalLeading
Definition: wingdi.h:2647
WCHAR tmDefaultChar
Definition: wingdi.h:2657
LONG tmMaxCharWidth
Definition: wingdi.h:2650
LONG tmAveCharWidth
Definition: wingdi.h:2649
WCHAR tmBreakChar
Definition: wingdi.h:2658
LONG tmExternalLeading
Definition: wingdi.h:2648
LONG tmDigitizedAspectY
Definition: wingdi.h:2654
BYTE tmPitchAndFamily
Definition: wingdi.h:2662
WCHAR tmLastChar
Definition: wingdi.h:2656
FT_Get_Sfnt_Table(FT_Face face, FT_Sfnt_Tag tag)
Definition: ftobjs.c:4113
#define ft_sfnt_os2
Definition: tttables.h:631
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
uint32_t ULONG_PTR
Definition: typedefs.h:65
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:690
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533
#define NTM_ITALIC
Definition: wingdi.h:1315
#define TRUETYPE_FONTTYPE
Definition: wingdi.h:1109
#define DEFAULT_CHARSET
Definition: wingdi.h:384
#define RASTER_FONTTYPE
Definition: wingdi.h:1107
#define FS_SYMBOL
Definition: wingdi.h:575
#define NTM_REGULAR
Definition: wingdi.h:1317
#define PROOF_QUALITY
Definition: wingdi.h:438
#define FS_LATIN1
Definition: wingdi.h:560
#define CLIP_DEFAULT_PRECIS
Definition: wingdi.h:426
#define NTM_BOLD
Definition: wingdi.h:1316
#define TCI_SRCFONTSIG
Definition: wingdi.h:963
#define OUT_OUTLINE_PRECIS
Definition: wingdi.h:423
_In_ PSTRING FullName
Definition: rtlfuncs.h:1648
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by GetFontFamilyInfoForList(), and IntGdiGetFontResourceInfo().

◆ FT_FixedFromFIXED()

static __inline FT_Fixed FT_FixedFromFIXED ( FIXED  f)
static

Definition at line 383 of file freetype.c.

384{
385 return (FT_Fixed)((long)f.value << 16 | (unsigned long)f.fract);
386}
GLfloat f
Definition: glext.h:7540
#define long
Definition: qsort.c:33

Referenced by ftGdiGetGlyphOutline().

◆ ftGdiGetFontData()

DWORD FASTCALL ftGdiGetFontData ( PFONTGDI  FontGdi,
DWORD  Table,
DWORD  Offset,
PVOID  Buffer,
DWORD  Size 
)

Definition at line 4658 of file freetype.c.

4664{
4666 FT_Face Face = FontGdi->SharedFace->Face;
4667
4669
4670 if (FT_IS_SFNT(Face))
4671 {
4672 if (Table)
4673 Table = Table >> 24 | Table << 24 | (Table >> 8 & 0xFF00) |
4674 (Table << 8 & 0xFF0000);
4675
4676 if (!Buffer) Size = 0;
4677
4678 if (Buffer && Size)
4679 {
4681 FT_ULong Needed = 0;
4682
4683 Error = FT_Load_Sfnt_Table(Face, Table, Offset, NULL, &Needed);
4684
4685 if ( !Error && Needed < Size) Size = Needed;
4686 }
4687 if (!FT_Load_Sfnt_Table(Face, Table, Offset, Buffer, &Size))
4688 Result = Size;
4689 }
4690
4692
4693 return Result;
4694}
BOOL Error
Definition: chkdsk.c:66
Definition: bufpool.h:45
unsigned long FT_ULong
Definition: fttypes.h:253
int FT_Error
Definition: fttypes.h:300
ASMGENDATA Table[]
Definition: genincdata.c:61
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
FT_Load_Sfnt_Table(FT_Face face, FT_ULong tag, FT_Long offset, FT_Byte *buffer, FT_ULong *length)
Definition: ftobjs.c:4134
#define GDI_ERROR
Definition: wingdi.h:1309
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426

Referenced by NtGdiGetFontData().

◆ ftGdiGetGlyphOutline()

ULONG FASTCALL ftGdiGetGlyphOutline ( PDC  dc,
WCHAR  wch,
UINT  iFormat,
LPGLYPHMETRICS  pgm,
ULONG  cjBuf,
PVOID  pvBuf,
LPMAT2  pmat2,
BOOL  bIgnoreRotation 
)

Definition at line 3729 of file freetype.c.

3738{
3739 PDC_ATTR pdcattr;
3740 PTEXTOBJ TextObj;
3741 PFONTGDI FontGDI;
3742 HFONT hFont = 0;
3743 GLYPHMETRICS gm;
3744 ULONG Size;
3745 FT_Face ft_face;
3746 FT_UInt glyph_index;
3747 DWORD width, height, pitch, needed = 0;
3748 FT_Bitmap ft_bitmap;
3750 INT left, right, top = 0, bottom = 0;
3752 FLOATOBJ eM11, widthRatio, eTemp;
3753 FT_Matrix mat, transMat = identityMat;
3754 BOOL needsTransform = FALSE;
3755 INT orientation;
3756 LONG aveWidth;
3757 INT adv, lsb, bbx; /* These three hold to widths of the unrotated chars */
3758 OUTLINETEXTMETRICW *potm;
3759 XFORMOBJ xo;
3760 XFORML xform;
3761 LOGFONTW *plf;
3762
3763 DPRINT("%u, %08x, %p, %08lx, %p, %p\n", wch, iFormat, pgm,
3764 cjBuf, pvBuf, pmat2);
3765
3766 pdcattr = dc->pdcattr;
3767
3768 XFORMOBJ_vInit(&xo, &dc->pdcattr->mxWorldToDevice);
3769 XFORMOBJ_iGetXform(&xo, &xform);
3770 FLOATOBJ_SetFloat(&eM11, xform.eM11);
3771
3772 hFont = pdcattr->hlfntNew;
3773 TextObj = RealizeFontInit(hFont);
3774
3775 if (!TextObj)
3776 {
3778 return GDI_ERROR;
3779 }
3780 FontGDI = ObjToGDI(TextObj->Font, FONT);
3781 ft_face = FontGDI->SharedFace->Face;
3782
3783 plf = &TextObj->logfont.elfEnumLogfontEx.elfLogFont;
3784 aveWidth = FT_IS_SCALABLE(ft_face) ? abs(plf->lfWidth) : 0;
3785 orientation = FT_IS_SCALABLE(ft_face) ? plf->lfOrientation : 0;
3786
3787 Size = IntGetOutlineTextMetrics(FontGDI, 0, NULL);
3789 if (!potm)
3790 {
3792 TEXTOBJ_UnlockText(TextObj);
3793 return GDI_ERROR;
3794 }
3795 Size = IntGetOutlineTextMetrics(FontGDI, Size, potm);
3796 if (!Size)
3797 {
3798 /* FIXME: last error? */
3800 TEXTOBJ_UnlockText(TextObj);
3801 return GDI_ERROR;
3802 }
3803
3805 TextIntUpdateSize(dc, TextObj, FontGDI, FALSE);
3807 FT_Set_Transform(ft_face, &mat, NULL);
3808
3809 TEXTOBJ_UnlockText(TextObj);
3810
3811 glyph_index = get_glyph_index_flagged(ft_face, wch, GGO_GLYPH_INDEX, iFormat);
3812 iFormat &= ~GGO_GLYPH_INDEX;
3813
3814 if (orientation || (iFormat != GGO_METRICS && iFormat != GGO_BITMAP) || aveWidth || pmat2)
3815 load_flags |= FT_LOAD_NO_BITMAP;
3816
3817 if (iFormat & GGO_UNHINTED)
3818 {
3819 load_flags |= FT_LOAD_NO_HINTING;
3820 iFormat &= ~GGO_UNHINTED;
3821 }
3822
3823 error = FT_Load_Glyph(ft_face, glyph_index, load_flags);
3824 if (error)
3825 {
3826 DPRINT1("WARNING: Failed to load and render glyph! [index: %u]\n", glyph_index);
3828 if (potm) ExFreePoolWithTag(potm, GDITAG_TEXT);
3829 return GDI_ERROR;
3830 }
3832
3833 FLOATOBJ_Set1(&widthRatio);
3834 if (aveWidth && potm)
3835 {
3836 // widthRatio = aveWidth * eM11 / potm->otmTextMetrics.tmAveCharWidth
3837 FLOATOBJ_SetLong(&widthRatio, aveWidth);
3838 FLOATOBJ_Mul(&widthRatio, &eM11);
3840 }
3841
3842 //left = (INT)(ft_face->glyph->metrics.horiBearingX * widthRatio) & -64;
3843 FLOATOBJ_SetLong(&eTemp, ft_face->glyph->metrics.horiBearingX);
3844 FLOATOBJ_Mul(&eTemp, &widthRatio);
3845 left = FLOATOBJ_GetLong(&eTemp) & -64;
3846
3847 //right = (INT)((ft_face->glyph->metrics.horiBearingX +
3848 // ft_face->glyph->metrics.width) * widthRatio + 63) & -64;
3849 FLOATOBJ_SetLong(&eTemp, ft_face->glyph->metrics.horiBearingX * ft_face->glyph->metrics.width);
3850 FLOATOBJ_Mul(&eTemp, &widthRatio);
3851 FLOATOBJ_AddLong(&eTemp, 63);
3852 right = FLOATOBJ_GetLong(&eTemp) & -64;
3853
3854 //adv = (INT)((ft_face->glyph->metrics.horiAdvance * widthRatio) + 63) >> 6;
3855 FLOATOBJ_SetLong(&eTemp, ft_face->glyph->metrics.horiAdvance);
3856 FLOATOBJ_Mul(&eTemp, &widthRatio);
3857 FLOATOBJ_AddLong(&eTemp, 63);
3858 adv = FLOATOBJ_GetLong(&eTemp) >> 6;
3859
3860 lsb = left >> 6;
3861 bbx = (right - left) >> 6;
3862
3863 DPRINT("Advance = %d, lsb = %d, bbx = %d\n",adv, lsb, bbx);
3864
3866
3867 /* Width scaling transform */
3868 if (!FLOATOBJ_Equal1(&widthRatio))
3869 {
3870 FT_Matrix scaleMat;
3871
3872 eTemp = widthRatio;
3873 FLOATOBJ_MulLong(&eTemp, 1 << 16);
3874
3875 scaleMat.xx = FLOATOBJ_GetLong(&eTemp);
3876 scaleMat.xy = 0;
3877 scaleMat.yx = 0;
3878 scaleMat.yy = INT_TO_FIXED(1);
3879 FT_Matrix_Multiply(&scaleMat, &transMat);
3880 needsTransform = TRUE;
3881 }
3882
3883 /* World transform */
3884 {
3885 FT_Matrix ftmatrix;
3887
3888 /* Create a freetype matrix, by converting to 16.16 fixpoint format */
3889 IntMatrixFromMx(&ftmatrix, pmx);
3890
3891 if (memcmp(&ftmatrix, &identityMat, sizeof(identityMat)) != 0)
3892 {
3893 FT_Matrix_Multiply(&ftmatrix, &transMat);
3894 needsTransform = TRUE;
3895 }
3896 }
3897
3898 /* Rotation transform */
3899 if (orientation)
3900 {
3901 FT_Matrix rotationMat;
3902 DPRINT("Rotation Trans!\n");
3903 IntEscapeMatrix(&rotationMat, orientation);
3904 FT_Matrix_Multiply(&rotationMat, &transMat);
3905 needsTransform = TRUE;
3906 }
3907
3908 /* Extra transformation specified by caller */
3909 if (pmat2)
3910 {
3911 FT_Matrix extraMat;
3912 DPRINT("MAT2 Matrix Trans!\n");
3913 extraMat.xx = FT_FixedFromFIXED(pmat2->eM11);
3914 extraMat.xy = FT_FixedFromFIXED(pmat2->eM21);
3915 extraMat.yx = FT_FixedFromFIXED(pmat2->eM12);
3916 extraMat.yy = FT_FixedFromFIXED(pmat2->eM22);
3917 FT_Matrix_Multiply(&extraMat, &transMat);
3918 needsTransform = TRUE;
3919 }
3920
3921 if (potm) ExFreePoolWithTag(potm, GDITAG_TEXT); /* It looks like we are finished with potm ATM. */
3922
3923 if (!needsTransform)
3924 {
3925 DPRINT("No Need to be Transformed!\n");
3926 top = (ft_face->glyph->metrics.horiBearingY + 63) & -64;
3927 bottom = (ft_face->glyph->metrics.horiBearingY -
3928 ft_face->glyph->metrics.height) & -64;
3929 gm.gmCellIncX = adv;
3930 gm.gmCellIncY = 0;
3931 }
3932 else
3933 {
3934 INT xc, yc;
3935 FT_Vector vec;
3936 for (xc = 0; xc < 2; xc++)
3937 {
3938 for (yc = 0; yc < 2; yc++)
3939 {
3940 vec.x = (ft_face->glyph->metrics.horiBearingX +
3941 xc * ft_face->glyph->metrics.width);
3942 vec.y = ft_face->glyph->metrics.horiBearingY -
3943 yc * ft_face->glyph->metrics.height;
3944 DPRINT("Vec %ld,%ld\n", vec.x, vec.y);
3945 FT_Vector_Transform(&vec, &transMat);
3946 if (xc == 0 && yc == 0)
3947 {
3948 left = right = vec.x;
3949 top = bottom = vec.y;
3950 }
3951 else
3952 {
3953 if (vec.x < left) left = vec.x;
3954 else if (vec.x > right) right = vec.x;
3955 if (vec.y < bottom) bottom = vec.y;
3956 else if (vec.y > top) top = vec.y;
3957 }
3958 }
3959 }
3960 left = left & -64;
3961 right = (right + 63) & -64;
3962 bottom = bottom & -64;
3963 top = (top + 63) & -64;
3964
3965 DPRINT("Transformed box: (%d,%d - %d,%d)\n", left, top, right, bottom);
3966 vec.x = ft_face->glyph->metrics.horiAdvance;
3967 vec.y = 0;
3968 FT_Vector_Transform(&vec, &transMat);
3969 gm.gmCellIncX = (vec.x+63) >> 6;
3970 gm.gmCellIncY = -((vec.y+63) >> 6);
3971 }
3972 gm.gmBlackBoxX = (right - left) >> 6;
3973 gm.gmBlackBoxY = (top - bottom) >> 6;
3974 gm.gmptGlyphOrigin.x = left >> 6;
3975 gm.gmptGlyphOrigin.y = top >> 6;
3976
3977 DPRINT("CX %d CY %d BBX %u BBY %u GOX %d GOY %d\n",
3978 gm.gmCellIncX, gm.gmCellIncY,
3979 gm.gmBlackBoxX, gm.gmBlackBoxY,
3981
3983
3984
3985 if (iFormat == GGO_METRICS)
3986 {
3987 DPRINT("GGO_METRICS Exit!\n");
3988 *pgm = gm;
3989 return 1; /* FIXME */
3990 }
3991
3992 if (ft_face->glyph->format != ft_glyph_format_outline && iFormat != GGO_BITMAP)
3993 {
3994 DPRINT1("Loaded a bitmap\n");
3995 return GDI_ERROR;
3996 }
3997
3998 switch (iFormat)
3999 {
4000 case GGO_BITMAP:
4001 {
4002 width = gm.gmBlackBoxX;
4003 height = gm.gmBlackBoxY;
4004 pitch = ((width + 31) >> 5) << 2;
4005 needed = pitch * height;
4006
4007 if (!pvBuf || !cjBuf) break;
4008 if (!needed) return GDI_ERROR; /* empty glyph */
4009 if (needed > cjBuf)
4010 return GDI_ERROR;
4011
4012 switch (ft_face->glyph->format)
4013 {
4015 {
4016 BYTE *src = ft_face->glyph->bitmap.buffer, *dst = pvBuf;
4017 INT w = min( pitch, (ft_face->glyph->bitmap.width + 7) >> 3 );
4018 INT h = min( height, ft_face->glyph->bitmap.rows );
4019 while (h--)
4020 {
4022 src += ft_face->glyph->bitmap.pitch;
4023 dst += pitch;
4024 }
4025 break;
4026 }
4027
4029 {
4030 ft_bitmap.width = width;
4031 ft_bitmap.rows = height;
4032 ft_bitmap.pitch = pitch;
4033 ft_bitmap.pixel_mode = FT_PIXEL_MODE_MONO;
4034 ft_bitmap.buffer = pvBuf;
4035
4037 if (needsTransform)
4038 {
4039 FT_Outline_Transform(&ft_face->glyph->outline, &transMat);
4040 }
4041 FT_Outline_Translate(&ft_face->glyph->outline, -left, -bottom );
4042 /* Note: FreeType will only set 'black' bits for us. */
4043 RtlZeroMemory(pvBuf, needed);
4044 FT_Outline_Get_Bitmap(g_FreeTypeLibrary, &ft_face->glyph->outline, &ft_bitmap);
4046 break;
4047 }
4048
4049 default:
4050 DPRINT1("Loaded glyph format %x\n", ft_face->glyph->format);
4051 return GDI_ERROR;
4052 }
4053
4054 break;
4055 }
4056
4057 case GGO_GRAY2_BITMAP:
4058 case GGO_GRAY4_BITMAP:
4059 case GGO_GRAY8_BITMAP:
4060 {
4061 unsigned int mult, row, col;
4062 BYTE *start, *ptr;
4063
4064 width = gm.gmBlackBoxX;
4065 height = gm.gmBlackBoxY;
4066 pitch = (width + 3) / 4 * 4;
4067 needed = pitch * height;
4068
4069 if (!pvBuf || !cjBuf) break;
4070 if (!needed) return GDI_ERROR; /* empty glyph */
4071 if (needed > cjBuf)
4072 return GDI_ERROR;
4073
4074 switch (ft_face->glyph->format)
4075 {
4077 {
4078 BYTE *src = ft_face->glyph->bitmap.buffer, *dst = pvBuf;
4079 INT h = min( height, ft_face->glyph->bitmap.rows );
4080 INT x;
4081 while (h--)
4082 {
4083 for (x = 0; (UINT)x < pitch; x++)
4084 {
4085 if (x < ft_face->glyph->bitmap.width)
4086 dst[x] = (src[x / 8] & (1 << ( (7 - (x % 8))))) ? 0xff : 0;
4087 else
4088 dst[x] = 0;
4089 }
4090 src += ft_face->glyph->bitmap.pitch;
4091 dst += pitch;
4092 }
4093 break;
4094 }
4096 {
4097 ft_bitmap.width = width;
4098 ft_bitmap.rows = height;
4099 ft_bitmap.pitch = pitch;
4100 ft_bitmap.pixel_mode = FT_PIXEL_MODE_GRAY;
4101 ft_bitmap.buffer = pvBuf;
4102
4104 if (needsTransform)
4105 {
4106 FT_Outline_Transform(&ft_face->glyph->outline, &transMat);
4107 }
4108 FT_Outline_Translate(&ft_face->glyph->outline, -left, -bottom );
4109 RtlZeroMemory(ft_bitmap.buffer, cjBuf);
4110 FT_Outline_Get_Bitmap(g_FreeTypeLibrary, &ft_face->glyph->outline, &ft_bitmap);
4112
4114 mult = 4;
4115 else if (iFormat == GGO_GRAY4_BITMAP)
4116 mult = 16;
4117 else if (iFormat == GGO_GRAY8_BITMAP)
4118 mult = 64;
4119 else
4120 {
4121 return GDI_ERROR;
4122 }
4123
4124 start = pvBuf;
4125 for (row = 0; row < height; row++)
4126 {
4127 ptr = start;
4128 for (col = 0; col < width; col++, ptr++)
4129 {
4130 *ptr = (((int)*ptr) * mult + 128) / 256;
4131 }
4132 start += pitch;
4133 }
4134
4135 break;
4136 }
4137 default:
4138 DPRINT1("Loaded glyph format %x\n", ft_face->glyph->format);
4139 return GDI_ERROR;
4140 }
4141
4142 break;
4143 }
4144
4145 case GGO_NATIVE:
4146 {
4147 FT_Outline *outline = &ft_face->glyph->outline;
4148
4149 if (cjBuf == 0) pvBuf = NULL; /* This is okay, need cjBuf to allocate. */
4150
4152 if (needsTransform && pvBuf) FT_Outline_Transform(outline, &transMat);
4153
4155
4156 if (!pvBuf || !cjBuf)
4157 {
4159 break;
4160 }
4161 if (needed > cjBuf)
4162 {
4164 return GDI_ERROR;
4165 }
4168 break;
4169 }
4170
4171 case GGO_BEZIER:
4172 {
4173 FT_Outline *outline = &ft_face->glyph->outline;
4174 if (cjBuf == 0) pvBuf = NULL;
4175
4176 if (needsTransform && pvBuf)
4177 {
4179 FT_Outline_Transform(outline, &transMat);
4181 }
4183
4184 if (!pvBuf || !cjBuf)
4185 break;
4186 if (needed > cjBuf)
4187 return GDI_ERROR;
4188
4190 break;
4191 }
4192
4193 default:
4194 DPRINT1("Unsupported format %u\n", iFormat);
4195 return GDI_ERROR;
4196 }
4197
4198 DPRINT("ftGdiGetGlyphOutline END and needed %lu\n", needed);
4199
4200 if (gm.gmBlackBoxX == 0)
4201 gm.gmBlackBoxX = 1;
4202 if (gm.gmBlackBoxY == 0)
4203 gm.gmBlackBoxY = 1;
4204
4205 *pgm = gm;
4206 return needed;
4207}
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
HFONT hFont
Definition: main.c:53
FORCEINLINE PMATRIX DC_pmxWorldToDevice(PDC pdc)
Definition: coord.h:135
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
struct png_info_def *typedef unsigned char **typedef struct png_info_def *typedef struct png_info_def *typedef struct png_info_def *typedef unsigned char ** row
Definition: typeof.h:78
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
#define ObjToGDI(ClipObj, Type)
Definition: engobjects.h:184
#define abs(i)
Definition: fconv.c:206
unsigned int BOOL
Definition: ntddk_ex.h:94
#define FLOATOBJ_Set1(fo)
Definition: floatobj.h:119
#define FLOATOBJ_Equal1(pf)
Definition: floatobj.h:105
BOOL FASTCALL TextIntUpdateSize(PDC dc, PTEXTOBJ TextObj, PFONTGDI FontGDI, BOOL bDoLock)
Definition: freetype.c:3591
FT_Library g_FreeTypeLibrary
Definition: freetype.c:56
static unsigned int get_bezier_glyph_outline(FT_Outline *outline, unsigned int buflen, char *buf)
Definition: freetype.c:3326
static unsigned int get_native_glyph_outline(FT_Outline *outline, unsigned int buflen, char *buf)
Definition: freetype.c:3253
static VOID FASTCALL IntMatrixFromMx(FT_Matrix *pmat, const MATRIX *pmx)
Definition: freetype.c:728
static VOID FASTCALL IntEscapeMatrix(FT_Matrix *pmat, LONG lfEscapement)
Definition: freetype.c:715
static FT_UInt FASTCALL get_glyph_index_flagged(FT_Face face, FT_ULong code, DWORD indexed_flag, DWORD flags)
Definition: freetype.c:3709
static const FT_Matrix identityMat
Definition: freetype.c:50
static __inline FT_Fixed FT_FixedFromFIXED(FIXED f)
Definition: freetype.c:383
FT_Load_Glyph(FT_Face face, FT_UInt glyph_index, FT_Int32 load_flags)
Definition: ftobjs.c:760
#define FT_LOAD_NO_BITMAP
Definition: freetype.h:3012
FT_Set_Transform(FT_Face face, FT_Matrix *matrix, FT_Vector *delta)
Definition: ftobjs.c:653
FT_Vector_Transform(FT_Vector *vec, const FT_Matrix *matrix)
Definition: ftoutln.c:688
#define FT_LOAD_NO_HINTING
Definition: freetype.h:3010
#define FT_LOAD_DEFAULT
Definition: freetype.h:3008
#define FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH
Definition: freetype.h:3017
FT_Vector * vec
Definition: ftbbox.c:448
#define INT_TO_FIXED(x)
Definition: ftcalc.h:404
FT_Matrix_Multiply(const FT_Matrix *a, FT_Matrix *b)
Definition: ftcalc.c:661
#define ft_glyph_format_bitmap
Definition: ftimage.h:731
@ FT_PIXEL_MODE_MONO
Definition: ftimage.h:183
@ FT_PIXEL_MODE_GRAY
Definition: ftimage.h:184
#define ft_glyph_format_outline
Definition: ftimage.h:732
FT_Outline_Translate(const FT_Outline *outline, FT_Pos xOffset, FT_Pos yOffset)
Definition: ftoutln.c:528
FT_Outline_Get_Bitmap(FT_Library library, FT_Outline *outline, const FT_Bitmap *abitmap)
Definition: ftoutln.c:661
FT_Outline_Transform(const FT_Outline *outline, const FT_Matrix *matrix)
Definition: ftoutln.c:711
signed int FT_Int
Definition: fttypes.h:220
GLuint start
Definition: gl.h:1545
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546
GLenum src
Definition: glext.h:6340
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859
GLdouble GLdouble right
Definition: glext.h:10859
GLint left
Definition: glext.h:7726
GLenum GLenum dst
Definition: glext.h:6340
GLint GLint bottom
Definition: glext.h:7726
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
static const WCHAR dc[]
#define error(str)
Definition: mkdosfs.c:1605
static PVOID ptr
Definition: dispmode.c:27
static const MAT2 mat
Definition: font.c:66
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
#define min(a, b)
Definition: monoChain.cc:55
long LONG
Definition: pedump.c:60
#define DPRINT
Definition: sndvol32.h:71
unsigned int width
Definition: ftimage.h:264
unsigned char * buffer
Definition: ftimage.h:266
unsigned char pixel_mode
Definition: ftimage.h:268
unsigned int rows
Definition: ftimage.h:263
int pitch
Definition: ftimage.h:265
FT_GlyphSlot glyph
Definition: freetype.h:1105
FT_Bitmap bitmap
Definition: freetype.h:1923
FT_Outline outline
Definition: freetype.h:1927
FT_Glyph_Metrics metrics
Definition: freetype.h:1916
FT_Glyph_Format format
Definition: freetype.h:1921
FT_Fixed xx
Definition: fttypes.h:387
FT_Fixed yx
Definition: fttypes.h:388
FT_Fixed yy
Definition: fttypes.h:388
FT_Fixed xy
Definition: fttypes.h:387
FT_Pos x
Definition: ftimage.h:76
FT_Pos y
Definition: ftimage.h:77
LONG lfOrientation
Definition: dimm.idl:62
HANDLE hlfntNew
Definition: ntgdihdl.h:330
short gmCellIncX
Definition: wingdi.h:2445
UINT gmBlackBoxY
Definition: wingdi.h:2443
UINT gmBlackBoxX
Definition: wingdi.h:2442
short gmCellIncY
Definition: wingdi.h:2446
POINT gmptGlyphOrigin
Definition: wingdi.h:2444
Definition: text.h:60
ENUMLOGFONTEXDVW logfont
Definition: text.h:70
FONTOBJ * Font
Definition: text.h:66
FIXED eM22
Definition: wingdi.h:2476
FIXED eM21
Definition: wingdi.h:2475
FIXED eM11
Definition: wingdi.h:2473
FIXED eM12
Definition: wingdi.h:2474
FLOATL eM11
Definition: winddi.h:1234
Definition: mesh.c:5330
ENUMLOGFONTEXW elfEnumLogfontEx
Definition: wingdi.h:2779
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
int32_t INT
Definition: typedefs.h:58
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
PTEXTOBJ FASTCALL RealizeFontInit(HFONT hFont)
Definition: font.c:422
FORCEINLINE VOID TEXTOBJ_UnlockText(PLFONT plfnt)
Definition: text.h:96
#define FLOATOBJ_DivLong(pf, l)
Definition: winddi.h:2829
_In_ DWORD cjBuf
Definition: winddi.h:3827
FLOAT FLOATOBJ
Definition: winddi.h:677
#define FLOATOBJ_Mul(pf, pf1)
Definition: winddi.h:2824
#define FLOATOBJ_MulLong(pf, l)
Definition: winddi.h:2826
#define FLOATOBJ_GetLong(pf)
Definition: winddi.h:2817
#define FLOATOBJ_SetFloat(pf, f)
Definition: winddi.h:2814
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:28
#define FLOATOBJ_SetLong(pf, l)
Definition: winddi.h:2815
_In_ SIZEL _In_ ULONG iFormat
Definition: winddi.h:3468
#define FLOATOBJ_AddLong(pf, l)
Definition: winddi.h:2820
#define GGO_GRAY2_BITMAP
Definition: wingdi.h:852
#define GGO_GLYPH_INDEX
Definition: wingdi.h:855
#define GGO_UNHINTED
Definition: wingdi.h:856
#define GGO_GRAY8_BITMAP
Definition: wingdi.h:854
#define GGO_BITMAP
Definition: wingdi.h:849
#define GGO_GRAY4_BITMAP
Definition: wingdi.h:853
#define GGO_NATIVE
Definition: wingdi.h:850
#define GGO_METRICS
Definition: wingdi.h:848
#define GGO_BEZIER
Definition: wingdi.h:851
#define XFORMOBJ_vInit
Definition: xformobj.h:12
#define XFORMOBJ_iGetXform
Definition: xformobj.h:9
unsigned char BYTE
Definition: xxhash.c:193

Referenced by NtGdiGetGlyphOutline(), and PATH_ExtTextOut().

◆ ftGdiGetKerningPairs()

DWORD FASTCALL ftGdiGetKerningPairs ( PFONTGDI  Font,
DWORD  cPairs,
LPKERNINGPAIR  pKerningPair 
)

Definition at line 5673 of file freetype.c.

5676{
5677 DWORD Count = 0;
5678 INT i = 0;
5679 FT_Face face = Font->SharedFace->Face;
5680
5681 if (FT_HAS_KERNING(face) && face->charmap->encoding == FT_ENCODING_UNICODE)
5682 {
5683 FT_UInt previous_index = 0, glyph_index = 0;
5684 FT_ULong char_code, char_previous;
5685 FT_Vector delta;
5686
5687 char_previous = char_code = FT_Get_First_Char(face, &glyph_index);
5688
5690
5691 while (glyph_index)
5692 {
5693 if (previous_index && glyph_index)
5694 {
5695 FT_Get_Kerning(face, previous_index, glyph_index, FT_KERNING_DEFAULT, &delta);
5696
5697 if (pKerningPair && cPairs)
5698 {
5699 pKerningPair[i].wFirst = char_previous;
5700 pKerningPair[i].wSecond = char_code;
5701 pKerningPair[i].iKernAmount = delta.x;
5702 i++;
5703 if (i == cPairs) break;
5704 }
5705 Count++;
5706 }
5707 previous_index = glyph_index;
5708 char_previous = char_code;
5709 char_code = FT_Get_Next_Char(face, char_code, &glyph_index);
5710 }
5712 }
5713 return Count;
5714}
FT_Get_Next_Char(FT_Face face, FT_ULong char_code, FT_UInt *agindex)
Definition: ftobjs.c:3722
FT_Get_Kerning(FT_Face face, FT_UInt left_glyph, FT_UInt right_glyph, FT_UInt kern_mode, FT_Vector *akerning)
Definition: ftobjs.c:3347
@ FT_KERNING_DEFAULT
Definition: freetype.h:3389
#define FT_HAS_KERNING(face)
Definition: freetype.h:1297
GLenum GLuint GLint GLenum face
Definition: glext.h:7025
int Count
Definition: noreturn.cpp:7
WORD wSecond
Definition: wingdi.h:2465
int iKernAmount
Definition: wingdi.h:2466

Referenced by GreGetKerningPairs(), and NtGdiGetKerningPairs().

◆ ftGdiGetRasterizerCaps()

BOOL FASTCALL ftGdiGetRasterizerCaps ( LPRASTERIZER_STATUS  lprs)

Definition at line 3079 of file freetype.c.

3080{
3081 if ( lprs )
3082 {
3083 lprs->nSize = sizeof(RASTERIZER_STATUS);
3084 lprs->wFlags = TT_AVAILABLE | TT_ENABLED;
3085 lprs->nLanguageID = gusLanguageID;
3086 return TRUE;
3087 }
3089 return FALSE;
3090}
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
USHORT gusLanguageID
Definition: main.c:29
#define TT_ENABLED
Definition: wingdi.h:889
struct _RASTERIZER_STATUS RASTERIZER_STATUS
#define TT_AVAILABLE
Definition: wingdi.h:888

Referenced by NtGdiGetRasterizerCaps().

◆ ftGdiGetTextCharsetInfo()

INT FASTCALL ftGdiGetTextCharsetInfo ( PDC  Dc,
LPFONTSIGNATURE  lpSig,
DWORD  dwFlags 
)

Definition at line 4374 of file freetype.c.

4378{
4379 PDC_ATTR pdcattr;
4380 UINT Ret = DEFAULT_CHARSET;
4381 INT i;
4382 HFONT hFont;
4383 PTEXTOBJ TextObj;
4384 PFONTGDI FontGdi;
4386 TT_OS2 *pOS2;
4387 FT_Face Face;
4388 CHARSETINFO csi;
4389 DWORD cp, fs0;
4390 USHORT usACP, usOEM;
4391
4392 pdcattr = Dc->pdcattr;
4393 hFont = pdcattr->hlfntNew;
4394 TextObj = RealizeFontInit(hFont);
4395
4396 if (!TextObj)
4397 {
4399 return Ret;
4400 }
4401 FontGdi = ObjToGDI(TextObj->Font, FONT);
4402 Face = FontGdi->SharedFace->Face;
4403 TEXTOBJ_UnlockText(TextObj);
4404
4405 memset(&fs, 0, sizeof(FONTSIGNATURE));
4407 pOS2 = FT_Get_Sfnt_Table(Face, ft_sfnt_os2);
4408 if (NULL != pOS2)
4409 {
4410 fs.fsCsb[0] = pOS2->ulCodePageRange1;
4411 fs.fsCsb[1] = pOS2->ulCodePageRange2;
4412 fs.fsUsb[0] = pOS2->ulUnicodeRange1;
4413 fs.fsUsb[1] = pOS2->ulUnicodeRange2;
4414 fs.fsUsb[2] = pOS2->ulUnicodeRange3;
4415 fs.fsUsb[3] = pOS2->ulUnicodeRange4;
4416 if (pOS2->version == 0)
4417 {
4418 FT_UInt dummy;
4419
4420 if (FT_Get_First_Char( Face, &dummy ) < 0x100)
4421 fs.fsCsb[0] |= FS_LATIN1;
4422 else
4423 fs.fsCsb[0] |= FS_SYMBOL;
4424 }
4425 }
4426 pOS2 = NULL;
4428 DPRINT("Csb 1=%x 0=%x\n", fs.fsCsb[1],fs.fsCsb[0]);
4429 if (fs.fsCsb[0] == 0)
4430 { /* Let's see if we can find any interesting cmaps */
4431 for (i = 0; i < Face->num_charmaps; i++)
4432 {
4433 switch (Face->charmaps[i]->encoding)
4434 {
4435 case FT_ENCODING_UNICODE:
4436 case FT_ENCODING_APPLE_ROMAN:
4437 fs.fsCsb[0] |= FS_LATIN1;
4438 break;
4439 case FT_ENCODING_MS_SYMBOL:
4440 fs.fsCsb[0] |= FS_SYMBOL;
4441 break;
4442 default:
4443 break;
4444 }
4445 }
4446 }
4447 if (lpSig)
4448 {
4449 RtlCopyMemory(lpSig, &fs, sizeof(FONTSIGNATURE));
4450 }
4451
4452 RtlGetDefaultCodePage(&usACP, &usOEM);
4453 cp = usACP;
4454
4456 if (csi.fs.fsCsb[0] & fs.fsCsb[0])
4457 {
4458 DPRINT("Hit 1\n");
4459 Ret = csi.ciCharset;
4460 goto Exit;
4461 }
4462
4463 for (i = 0; i < MAXTCIINDEX; i++)
4464 {
4465 fs0 = 1L << i;
4466 if (fs.fsCsb[0] & fs0)
4467 {
4468 if (IntTranslateCharsetInfo(&fs0, &csi, TCI_SRCFONTSIG))
4469 {
4470 // *cp = csi.ciACP;
4471 DPRINT("Hit 2\n");
4472 Ret = csi.ciCharset;
4473 goto Exit;
4474 }
4475 else
4476 DPRINT1("TCI failing on %x\n", fs0);
4477 }
4478 }
4479Exit:
4480 DPRINT("CharSet %u CodePage %u\n", csi.ciCharset, csi.ciACP);
4481 return (MAKELONG(csi.ciACP, csi.ciCharset));
4482}
POINT cp
Definition: magnifier.c:59
NTSYSAPI VOID NTAPI RtlGetDefaultCodePage(_Out_ PUSHORT AnsiCodePage, _Out_ PUSHORT OemCodePage)
#define memset(x, y, z)
Definition: compat.h:39
static void Exit(void)
Definition: sock.c:1330
FONTSIGNATURE fs
Definition: wingdi.h:1548
DWORD fsCsb[2]
Definition: wingdi.h:1543
#define MAKELONG(a, b)
Definition: typedefs.h:249
#define TCI_SRCCODEPAGE
Definition: wingdi.h:962

Referenced by DC_InitHack(), IntGetFontLanguageInfo(), NtGdiGetCharSet(), and NtGdiGetTextCharsetInfo().

◆ ftGdiGetTextMetricsW()

BOOL FASTCALL ftGdiGetTextMetricsW ( HDC  hDC,
PTMW_INTERNAL  ptmwi 
)

Definition at line 4561 of file freetype.c.

4564{
4565 PDC dc;
4566 PDC_ATTR pdcattr;
4567 PTEXTOBJ TextObj;
4568 PFONTGDI FontGDI;
4569 FT_Face Face;
4570 TT_OS2 *pOS2;
4571 TT_HoriHeader *pHori;
4573 ULONG Error;
4575 LOGFONTW *plf;
4576
4577 if (!ptmwi)
4578 {
4580 return FALSE;
4581 }
4582 RtlZeroMemory(ptmwi, sizeof(TMW_INTERNAL));
4583
4584 if (!(dc = DC_LockDc(hDC)))
4585 {
4587 return FALSE;
4588 }
4589 pdcattr = dc->pdcattr;
4590 TextObj = RealizeFontInit(pdcattr->hlfntNew);
4591 if (NULL != TextObj)
4592 {
4593 plf = &TextObj->logfont.elfEnumLogfontEx.elfLogFont;
4594 FontGDI = ObjToGDI(TextObj->Font, FONT);
4595
4596 Face = FontGDI->SharedFace->Face;
4597
4598 // NOTE: GetTextMetrics simply ignores lfEscapement and XFORM.
4600 Error = IntRequestFontSize(dc, FontGDI, plf->lfWidth, plf->lfHeight);
4601 FT_Set_Transform(Face, NULL, NULL);
4602
4604
4605 if (0 != Error)
4606 {
4607 DPRINT1("Error in setting pixel sizes: %u\n", Error);
4609 }
4610 else
4611 {
4613
4615 pOS2 = FT_Get_Sfnt_Table(Face, ft_sfnt_os2);
4616 if (NULL == pOS2)
4617 {
4618 DPRINT1("Can't find OS/2 table - not TT font?\n");
4620 }
4621
4622 pHori = FT_Get_Sfnt_Table(Face, ft_sfnt_hhea);
4623 if (NULL == pHori)
4624 {
4625 DPRINT1("Can't find HHEA table - not TT font?\n");
4627 }
4628
4629 Error = FT_Get_WinFNT_Header(Face, &Win);
4630
4631 if (NT_SUCCESS(Status) || !Error)
4632 {
4633 FillTM(&ptmwi->TextMetric, FontGDI, pOS2, pHori, !Error ? &Win : 0);
4634
4635 /* FIXME: Fill Diff member */
4636 }
4637
4639 }
4640 TEXTOBJ_UnlockText(TextObj);
4641 }
4642 else
4643 {
4645 }
4646 DC_UnlockDc(dc);
4647
4648 if (!NT_SUCCESS(Status))
4649 {
4651 return FALSE;
4652 }
4653 return TRUE;
4654}
static HDC hDC
Definition: 3dtext.c:33
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:238
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:220
static void FASTCALL FillTM(TEXTMETRICW *TM, PFONTGDI FontGDI, TT_OS2 *pOS2, TT_HoriHeader *pHori, FT_WinFNT_HeaderRec *pFNT)
Definition: freetype.c:2102
FT_Get_WinFNT_Header(FT_Face face, FT_WinFNT_HeaderRec *aheader)
Definition: ftwinfnt.c:29
#define STATUS_INTERNAL_ERROR
Definition: ntstatus.h:465
#define STATUS_INVALID_HANDLE
Definition: ntstatus.h:245
Definition: polytest.cpp:41
TEXTMETRICW TextMetric
Definition: ntgdityp.h:370
#define ft_sfnt_hhea
Definition: tttables.h:632
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
VOID FASTCALL SetLastNtError(NTSTATUS Status)
Definition: error.c:37

Referenced by GreGetTextMetricsW(), IntGetCharDimensions(), and NtGdiGetTextMetricsW().

◆ ftGdiRealizationInfo()

BOOL FASTCALL ftGdiRealizationInfo ( PFONTGDI  Font,
PREALIZATION_INFO  Info 
)

Definition at line 5654 of file freetype.c.

5655{
5656 if (FT_HAS_FIXED_SIZES(Font->SharedFace->Face))
5657 Info->iTechnology = RI_TECH_BITMAP;
5658 else
5659 {
5660 if (FT_IS_SCALABLE(Font->SharedFace->Face))
5661 Info->iTechnology = RI_TECH_SCALABLE;
5662 else
5663 Info->iTechnology = RI_TECH_FIXED;
5664 }
5665 Info->iUniq = Font->FontObj.iUniq;
5666 Info->dwUnknown = -1;
5667 return TRUE;
5668}
#define FT_HAS_FIXED_SIZES(face)
Definition: freetype.h:1361
#define RI_TECH_SCALABLE
Definition: ntgdityp.h:273
#define RI_TECH_FIXED
Definition: ntgdityp.h:272
#define RI_TECH_BITMAP
Definition: ntgdityp.h:271

Referenced by NtGdiGetRealizationInfo().

◆ ftGetFontUnicodeRanges()

DWORD FASTCALL ftGetFontUnicodeRanges ( PFONTGDI  Font,
PGLYPHSET  glyphset 
)

Definition at line 4487 of file freetype.c.

4488{
4489 DWORD size = 0;
4490 DWORD num_ranges = 0;
4491 FT_Face face = Font->SharedFace->Face;
4492
4493 if (face->charmap == NULL)
4494 {
4495 DPRINT1("FIXME: No charmap selected! This is a BUG!\n");
4496 return 0;
4497 }
4498
4499 if (face->charmap->encoding == FT_ENCODING_UNICODE)
4500 {
4501 FT_UInt glyph_code = 0;
4502 FT_ULong char_code, char_code_prev;
4503
4504 char_code_prev = char_code = FT_Get_First_Char(face, &glyph_code);
4505
4506 DPRINT("Face encoding FT_ENCODING_UNICODE, number of glyphs %ld, first glyph %u, first char %04lx\n",
4507 face->num_glyphs, glyph_code, char_code);
4508
4509 if (!glyph_code) return 0;
4510
4511 if (glyphset)
4512 {
4513 glyphset->ranges[0].wcLow = (USHORT)char_code;
4514 glyphset->ranges[0].cGlyphs = 0;
4515 glyphset->cGlyphsSupported = 0;
4516 }
4517
4518 num_ranges = 1;
4519 while (glyph_code)
4520 {
4521 if (char_code < char_code_prev)
4522 {
4523 DPRINT1("Expected increasing char code from FT_Get_Next_Char\n");
4524 return 0;
4525 }
4526 if (char_code - char_code_prev > 1)
4527 {
4528 num_ranges++;
4529 if (glyphset)
4530 {
4531 glyphset->ranges[num_ranges - 1].wcLow = (USHORT)char_code;
4532 glyphset->ranges[num_ranges - 1].cGlyphs = 1;
4533 glyphset->cGlyphsSupported++;
4534 }
4535 }
4536 else if (glyphset)
4537 {
4538 glyphset->ranges[num_ranges - 1].cGlyphs++;
4539 glyphset->cGlyphsSupported++;
4540 }
4541 char_code_prev = char_code;
4542 char_code = FT_Get_Next_Char(face, char_code, &glyph_code);
4543 }
4544 }
4545 else
4546 DPRINT1("Encoding %i not supported\n", face->charmap->encoding);
4547
4548 size = sizeof(GLYPHSET) + sizeof(WCRANGE) * (num_ranges - 1);
4549 if (glyphset)
4550 {
4551 glyphset->cbThis = size;
4552 glyphset->cRanges = num_ranges;
4553 glyphset->flAccel = 0;
4554 }
4555 return size;
4556}
GLsizeiptr size
Definition: glext.h:5919

Referenced by NtGdiGetFontUnicodeRanges().

◆ FTVectorToPOINTFX()

static __inline void FTVectorToPOINTFX ( FT_Vector vec,
POINTFX pt 
)
static

Definition at line 369 of file freetype.c.

370{
371 pt->x.value = vec->x >> 6;
372 pt->x.fract = (vec->x & 0x3f) << 10;
373 pt->x.fract |= ((pt->x.fract >> 6) | (pt->x.fract >> 12));
374 pt->y.value = vec->y >> 6;
375 pt->y.fract = (vec->y & 0x3f) << 10;
376 pt->y.fract |= ((pt->y.fract >> 6) | (pt->y.fract >> 12));
377}
#define pt(x, y)
Definition: drawing.c:79
char * value
Definition: compiler.c:67

Referenced by get_bezier_glyph_outline(), and get_native_glyph_outline().

◆ get_bezier_glyph_outline()

static unsigned int get_bezier_glyph_outline ( FT_Outline outline,
unsigned int  buflen,
char buf 
)
static

Definition at line 3326 of file freetype.c.

3327{
3328 /* Convert the quadratic Beziers to cubic Beziers.
3329 The parametric eqn for a cubic Bezier is, from PLRM:
3330 r(t) = at^3 + bt^2 + ct + r0
3331 with the control points:
3332 r1 = r0 + c/3
3333 r2 = r1 + (c + b)/3
3334 r3 = r0 + c + b + a
3335
3336 A quadratic Bezier has the form:
3337 p(t) = (1-t)^2 p0 + 2(1-t)t p1 + t^2 p2
3338
3339 So equating powers of t leads to:
3340 r1 = 2/3 p1 + 1/3 p0
3341 r2 = 2/3 p1 + 1/3 p2
3342 and of course r0 = p0, r3 = p2
3343 */
3344 int contour, point = 0, first_pt;
3345 TTPOLYGONHEADER *pph;
3346 TTPOLYCURVE *ppc;
3347 DWORD pph_start, cpfx, type;
3348 FT_Vector cubic_control[4];
3349 unsigned int needed = 0;
3350
3351 for (contour = 0; contour < outline->n_contours; contour++)
3352 {
3353 pph_start = needed;
3354 pph = (TTPOLYGONHEADER *)(buf + needed);
3355 first_pt = point;
3356 if (buf)
3357 {
3358 pph->dwType = TT_POLYGON_TYPE;
3359 FTVectorToPOINTFX(&outline->points[point], &pph->pfxStart);
3360 }
3361 needed += sizeof(*pph);
3362 point++;
3363 while (point <= outline->contours[contour])
3364 {
3365 ppc = (TTPOLYCURVE *)(buf + needed);
3366 type = (outline->tags[point] & FT_Curve_Tag_On) ?
3368 cpfx = 0;
3369 do
3370 {
3371 if (type == TT_PRIM_LINE)
3372 {
3373 if (buf)
3374 FTVectorToPOINTFX(&outline->points[point], &ppc->apfx[cpfx]);
3375 cpfx++;
3376 point++;
3377 }
3378 else
3379 {
3380 /* Unlike QSPLINEs, CSPLINEs always have their endpoint
3381 so cpfx = 3n */
3382
3383 /* FIXME: Possible optimization in endpoint calculation
3384 if there are two consecutive curves */
3385 cubic_control[0] = outline->points[point-1];
3386 if (!(outline->tags[point-1] & FT_Curve_Tag_On))
3387 {
3388 cubic_control[0].x += outline->points[point].x + 1;
3389 cubic_control[0].y += outline->points[point].y + 1;
3390 cubic_control[0].x >>= 1;
3391 cubic_control[0].y >>= 1;
3392 }
3393 if (point+1 > outline->contours[contour])
3394 cubic_control[3] = outline->points[first_pt];
3395 else
3396 {
3397 cubic_control[3] = outline->points[point+1];
3398 if (!(outline->tags[point+1] & FT_Curve_Tag_On))
3399 {
3400 cubic_control[3].x += outline->points[point].x + 1;
3401 cubic_control[3].y += outline->points[point].y + 1;
3402 cubic_control[3].x >>= 1;
3403 cubic_control[3].y >>= 1;
3404 }
3405 }
3406 /* r1 = 1/3 p0 + 2/3 p1
3407 r2 = 1/3 p2 + 2/3 p1 */
3408 cubic_control[1].x = (2 * outline->points[point].x + 1) / 3;
3409 cubic_control[1].y = (2 * outline->points[point].y + 1) / 3;
3410 cubic_control[2] = cubic_control[1];
3411 cubic_control[1].x += (cubic_control[0].x + 1) / 3;
3412 cubic_control[1].y += (cubic_control[0].y + 1) / 3;
3413 cubic_control[2].x += (cubic_control[3].x + 1) / 3;
3414 cubic_control[2].y += (cubic_control[3].y + 1) / 3;
3415 if (buf)
3416 {
3417 FTVectorToPOINTFX(&cubic_control[1], &ppc->apfx[cpfx]);
3418 FTVectorToPOINTFX(&cubic_control[2], &ppc->apfx[cpfx+1]);
3419 FTVectorToPOINTFX(&cubic_control[3], &ppc->apfx[cpfx+2]);
3420 }
3421 cpfx += 3;
3422 point++;
3423 }
3424 } while (point <= outline->contours[contour] &&
3425 (outline->tags[point] & FT_Curve_Tag_On) ==
3426 (outline->tags[point-1] & FT_Curve_Tag_On));
3427 /* At the end of a contour Windows adds the start point,
3428 but only for Beziers and we've already done that.
3429 */
3430 if (point <= outline->contours[contour] &&
3431 outline->tags[point] & FT_Curve_Tag_On)
3432 {
3433 /* This is the closing pt of a bezier, but we've already
3434 added it, so just inc point and carry on */
3435 point++;
3436 }
3437 if (buf)
3438 {
3439 ppc->wType = type;
3440 ppc->cpfx = cpfx;
3441 }
3442 needed += sizeof(*ppc) + (cpfx - 1) * sizeof(POINTFX);
3443 }
3444 if (buf)
3445 pph->cb = needed - pph_start;
3446 }
3447 return needed;
3448}
POINTL point
Definition: edittest.c:50
static __inline void FTVectorToPOINTFX(FT_Vector *vec, POINTFX *pt)
Definition: freetype.c:369
#define FT_Curve_Tag_On
Definition: ftimage.h:465
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
POINTFX apfx[1]
Definition: wingdi.h:2714
POINTFX pfxStart
Definition: wingdi.h:2719
#define TT_PRIM_CSPLINE
Definition: wingdi.h:1321
#define TT_POLYGON_TYPE
Definition: wingdi.h:1318
#define TT_PRIM_LINE
Definition: wingdi.h:1319

Referenced by ftGdiGetGlyphOutline().

◆ get_glyph_index()

static FT_UInt FASTCALL get_glyph_index ( FT_Face  ft_face,
UINT  glyph 
)
inlinestatic

Definition at line 3694 of file freetype.c.

3695{
3696 FT_UInt ret;
3697
3698 if (face_has_symbol_charmap(ft_face))
3699 {
3700 ret = get_glyph_index_symbol(ft_face, glyph);
3701 if (ret != 0)
3702 return ret;
3703 }
3704
3705 return FT_Get_Char_Index(ft_face, glyph);
3706}
static FT_UInt FASTCALL get_glyph_index_symbol(FT_Face ft_face, UINT glyph)
Definition: freetype.c:3680
FT_Get_Char_Index(FT_Face face, FT_ULong charcode)
Definition: ftobjs.c:3668
int ret

Referenced by get_glyph_index_flagged(), and NtGdiGetGlyphIndicesW().

◆ get_glyph_index_flagged()

static FT_UInt FASTCALL get_glyph_index_flagged ( FT_Face  face,
FT_ULong  code,
DWORD  indexed_flag,
DWORD  flags 
)
inlinestatic

Definition at line 3709 of file freetype.c.

3710{
3711 FT_UInt glyph_index;
3712 if (flags & indexed_flag)
3713 {
3714 glyph_index = code;
3715 }
3716 else
3717 {
3718 glyph_index = get_glyph_index(face, code);
3719 }
3720 return glyph_index;
3721}
static FT_UInt FASTCALL get_glyph_index(FT_Face ft_face, UINT glyph)
Definition: freetype.c:3694
GLbitfield flags
Definition: glext.h:7161
Definition: inflate.c:139

Referenced by ftGdiGetGlyphOutline(), IntExtTextOutW(), IntGetTextDisposition(), NtGdiGetCharABCWidthsW(), NtGdiGetCharWidthW(), and TextIntGetTextExtentPoint().

◆ get_glyph_index_symbol()

static FT_UInt FASTCALL get_glyph_index_symbol ( FT_Face  ft_face,
UINT  glyph 
)
inlinestatic

Definition at line 3680 of file freetype.c.

3681{
3682 FT_UInt ret;
3683
3684 if (glyph < 0x100) glyph += 0xf000;
3685 /* there are a number of old pre-Unicode "broken" TTFs, which
3686 do have symbols at U+00XX instead of U+f0XX */
3687 if (!(ret = FT_Get_Char_Index(ft_face, glyph)))
3688 ret = FT_Get_Char_Index(ft_face, glyph - 0xf000);
3689
3690 return ret;
3691}

Referenced by get_glyph_index().

◆ get_native_glyph_outline()

static unsigned int get_native_glyph_outline ( FT_Outline outline,
unsigned int  buflen,
char buf 
)
static

Definition at line 3253 of file freetype.c.

3254{
3255 TTPOLYGONHEADER *pph;
3256 TTPOLYCURVE *ppc;
3257 int needed = 0, point = 0, contour, first_pt;
3258 unsigned int pph_start, cpfx;
3259 DWORD type;
3260
3261 for (contour = 0; contour < outline->n_contours; contour++)
3262 {
3263 /* Ignore contours containing one point */
3264 if (point == outline->contours[contour])
3265 {
3266 point++;
3267 continue;
3268 }
3269
3270 pph_start = needed;
3271 pph = (TTPOLYGONHEADER *)(buf + needed);
3272 first_pt = point;
3273 if (buf)
3274 {
3275 pph->dwType = TT_POLYGON_TYPE;
3276 FTVectorToPOINTFX(&outline->points[point], &pph->pfxStart);
3277 }
3278 needed += sizeof(*pph);
3279 point++;
3280 while (point <= outline->contours[contour])
3281 {
3282 ppc = (TTPOLYCURVE *)(buf + needed);
3283 type = (outline->tags[point] & FT_Curve_Tag_On) ?
3285 cpfx = 0;
3286 do
3287 {
3288 if (buf)
3289 FTVectorToPOINTFX(&outline->points[point], &ppc->apfx[cpfx]);
3290 cpfx++;
3291 point++;
3292 } while (point <= outline->contours[contour] &&
3293 (outline->tags[point] & FT_Curve_Tag_On) ==
3294 (outline->tags[point-1] & FT_Curve_Tag_On));
3295 /* At the end of a contour Windows adds the start point, but
3296 only for Beziers */
3297 if (point > outline->contours[contour] &&
3298 !(outline->tags[point-1] & FT_Curve_Tag_On))
3299 {
3300 if (buf)
3301 FTVectorToPOINTFX(&outline->points[first_pt], &ppc->apfx[cpfx]);
3302 cpfx++;
3303 }
3304 else if (point <= outline->contours[contour] &&
3305 outline->tags[point] & FT_Curve_Tag_On)
3306 {
3307 /* add closing pt for bezier */
3308 if (buf)
3309 FTVectorToPOINTFX(&outline->points[point], &ppc->apfx[cpfx]);
3310 cpfx++;
3311 point++;
3312 }
3313 if (buf)
3314 {
3315 ppc->wType = type;
3316 ppc->cpfx = cpfx;
3317 }
3318 needed += sizeof(*ppc) + (cpfx - 1) * sizeof(POINTFX);
3319 }
3320 if (buf)
3321 pph->cb = needed - pph_start;
3322 }
3323 return needed;
3324}
#define TT_PRIM_QSPLINE
Definition: wingdi.h:1320

Referenced by ftGdiGetGlyphOutline().

◆ GetFontFamilyInfoForList()

static BOOLEAN FASTCALL GetFontFamilyInfoForList ( const LOGFONTW LogFont,
PFONTFAMILYINFO  Info,
LPCWSTR  NominalName,
LONG pCount,
LONG  MaxCount,
PLIST_ENTRY  Head 
)
static

Definition at line 2953 of file freetype.c.

2959{
2961 PFONT_ENTRY CurrentEntry;
2962 FONTGDI *FontGDI;
2963 FONTFAMILYINFO InfoEntry;
2964 LONG Count = *pCount;
2965
2966 for (Entry = Head->Flink; Entry != Head; Entry = Entry->Flink)
2967 {
2968 CurrentEntry = CONTAINING_RECORD(Entry, FONT_ENTRY, ListEntry);
2969 FontGDI = CurrentEntry->Font;
2970 ASSERT(FontGDI);
2971
2972 if (LogFont->lfCharSet != DEFAULT_CHARSET &&
2973 LogFont->lfCharSet != FontGDI->CharSet)
2974 {
2975 continue; /* charset mismatch */
2976 }
2977
2978 /* get one info entry */
2979 FontFamilyFillInfo(&InfoEntry, NULL, NULL, FontGDI);
2980
2981 if (LogFont->lfFaceName[0] != UNICODE_NULL)
2982 {
2983 /* check name */
2984 if (_wcsnicmp(LogFont->lfFaceName,
2986 RTL_NUMBER_OF(LogFont->lfFaceName) - 1) != 0 &&
2987 _wcsnicmp(LogFont->lfFaceName,
2988 InfoEntry.EnumLogFontEx.elfFullName,
2989 RTL_NUMBER_OF(LogFont->lfFaceName) - 1) != 0)
2990 {
2991 continue;
2992 }
2993 }
2994
2995 if (NominalName)
2996 {
2997 /* store the nominal name */
2999 sizeof(InfoEntry.EnumLogFontEx.elfLogFont.lfFaceName),
3000 NominalName);
3001 }
3002
3003 /* store one entry to Info */
3004 if (0 <= Count && Count < MaxCount)
3005 {
3006 RtlCopyMemory(&Info[Count], &InfoEntry, sizeof(InfoEntry));
3007 }
3008 Count++;
3009 }
3010
3011 *pCount = Count;
3012
3013 return TRUE;
3014}
#define RTL_NUMBER_OF(x)
Definition: RtlRegistry.c:12
static void FASTCALL FontFamilyFillInfo(PFONTFAMILYINFO Info, LPCWSTR FaceName, LPCWSTR FullName, PFONTGDI FontGDI)
Definition: freetype.c:2769
_Check_return_ _CRTIMP int __cdecl _wcsnicmp(_In_reads_or_z_(_MaxCount) const wchar_t *_Str1, _In_reads_or_z_(_MaxCount) const wchar_t *_Str2, _In_ size_t _MaxCount)
WCHAR elfFullName[LF_FULLFACESIZE]
Definition: wingdi.h:2703
WCHAR lfFaceName[LF_FACESIZE]
Definition: wingdi.h:1910

Referenced by GetFontFamilyInfoForSubstitutes(), and IntGetFontFamilyInfo().

◆ GetFontFamilyInfoForSubstitutes()

static BOOLEAN FASTCALL GetFontFamilyInfoForSubstitutes ( const LOGFONTW LogFont,
PFONTFAMILYINFO  Info,
LONG pCount,
LONG  MaxCount 
)
static

Definition at line 3017 of file freetype.c.

3021{
3022 PLIST_ENTRY pEntry, pHead = &g_FontSubstListHead;
3023 PFONTSUBST_ENTRY pCurrentEntry;
3024 PUNICODE_STRING pFromW, pToW;
3025 LOGFONTW lf = *LogFont;
3027
3028 for (pEntry = pHead->Flink; pEntry != pHead; pEntry = pEntry->Flink)
3029 {
3030 pCurrentEntry = CONTAINING_RECORD(pEntry, FONTSUBST_ENTRY, ListEntry);
3031
3032 pFromW = &pCurrentEntry->FontNames[FONTSUBST_FROM];
3033 if (LogFont->lfFaceName[0] != UNICODE_NULL)
3034 {
3035 /* check name */
3036 if (_wcsicmp(LogFont->lfFaceName, pFromW->Buffer) != 0)
3037 continue; /* mismatch */
3038 }
3039
3040 pToW = &pCurrentEntry->FontNames[FONTSUBST_TO];
3041 if (RtlEqualUnicodeString(pFromW, pToW, TRUE) &&
3042 pCurrentEntry->CharSets[FONTSUBST_FROM] ==
3043 pCurrentEntry->CharSets[FONTSUBST_TO])
3044 {
3045 /* identical mapping */
3046 continue;
3047 }
3048
3049 /* substitute and get the real name */
3050 IntUnicodeStringToBuffer(lf.lfFaceName, sizeof(lf.lfFaceName), pFromW);
3052 if (LogFont->lfCharSet != DEFAULT_CHARSET && LogFont->lfCharSet != lf.lfCharSet)
3053 continue;
3054
3055 /* search in global fonts */
3057 GetFontFamilyInfoForList(&lf, Info, pFromW->Buffer, pCount, MaxCount, &g_FontListHead);
3059
3060 /* search in private fonts */
3061 IntLockProcessPrivateFonts(Win32Process);
3062 GetFontFamilyInfoForList(&lf, Info, pFromW->Buffer, pCount, MaxCount,
3063 &Win32Process->PrivateFontListHead);
3064 IntUnLockProcessPrivateFonts(Win32Process);
3065
3066 if (LogFont->lfFaceName[0] != UNICODE_NULL)
3067 {
3068 /* it's already matched to the exact name and charset if the name
3069 was specified at here, then so don't scan more for another name */
3070 break;
3071 }
3072 }
3073
3074 return TRUE;
3075}
static BOOLEAN FASTCALL GetFontFamilyInfoForList(const LOGFONTW *LogFont, PFONTFAMILYINFO Info, LPCWSTR NominalName, LONG *pCount, LONG MaxCount, PLIST_ENTRY Head)
Definition: freetype.c:2953
static LIST_ENTRY g_FontListHead
Definition: freetype.c:67
static BOOL SubstituteFontRecurse(LOGFONTW *pLogFont)
Definition: freetype.c:857
static VOID IntUnicodeStringToBuffer(LPWSTR pszBuffer, SIZE_T cbBuffer, const UNICODE_STRING *pString)
Definition: freetype.c:819
#define IntUnLockGlobalFonts()
Definition: freetype.c:74
#define IntLockGlobalFonts()
Definition: freetype.c:71
PLIST_ENTRY pEntry
Definition: fxioqueue.cpp:4484
#define FONTSUBST_FROM
Definition: font.h:69
#define FONTSUBST_TO
Definition: font.h:70
NTSYSAPI BOOLEAN NTAPI RtlEqualUnicodeString(PUNICODE_STRING String1, PUNICODE_STRING String2, BOOLEAN CaseInSensitive)
PVOID NTAPI PsGetCurrentProcessWin32Process(VOID)
Definition: process.c:1183
Definition: font.h:77
UNICODE_STRING FontNames[FONTSUBST_FROM_AND_TO]
Definition: font.h:79
BYTE CharSets[FONTSUBST_FROM_AND_TO]
Definition: font.h:80
LIST_ENTRY PrivateFontListHead
Definition: win32.h:284
#define IntLockProcessPrivateFonts(W32Process)
Definition: text.h:147
#define IntUnLockProcessPrivateFonts(W32Process)
Definition: text.h:150

Referenced by IntGetFontFamilyInfo().

◆ GetFontPenalty()

static UINT GetFontPenalty ( const LOGFONTW LogFont,
const OUTLINETEXTMETRICW Otm,
const char style_name 
)
static

Definition at line 4700 of file freetype.c.

4703{
4704 ULONG Penalty = 0;
4705 BYTE Byte;
4706 LONG Long;
4707 BOOL fNeedScaling = FALSE;
4708 const BYTE UserCharSet = CharSetFromLangID(gusLanguageID);
4709 const TEXTMETRICW * TM = &Otm->otmTextMetrics;
4710 WCHAR* ActualNameW;
4711
4712 ASSERT(Otm);
4713 ASSERT(LogFont);
4714
4715 /* FIXME: IntSizeSynth Penalty 20 */
4716 /* FIXME: SmallPenalty Penalty 1 */
4717 /* FIXME: FaceNameSubst Penalty 500 */
4718
4719 Byte = LogFont->lfCharSet;
4720
4721 if (Byte != TM->tmCharSet)
4722 {
4724 {
4725 /* CharSet Penalty 65000 */
4726 /* Requested charset does not match the candidate's. */
4727 GOT_PENALTY("CharSet", 65000);
4728 }
4729 else
4730 {
4731 if (UserCharSet != TM->tmCharSet)
4732 {
4733 /* UNDOCUMENTED: Not user language */
4734 GOT_PENALTY("UNDOCUMENTED:NotUserLanguage", 100);
4735
4736 if (ANSI_CHARSET != TM->tmCharSet)
4737 {
4738 /* UNDOCUMENTED: Not ANSI charset */
4739 GOT_PENALTY("UNDOCUMENTED:NotAnsiCharSet", 100);
4740 }
4741 }
4742 }
4743 }
4744
4745 Byte = LogFont->lfOutPrecision;
4746 switch (Byte)
4747 {
4748 case OUT_DEFAULT_PRECIS:
4749 /* nothing to do */
4750 break;
4751 case OUT_DEVICE_PRECIS:
4752 if (!(TM->tmPitchAndFamily & TMPF_DEVICE) ||
4754 {
4755 /* OutputPrecision Penalty 19000 */
4756 /* Requested OUT_STROKE_PRECIS, but the device can't do it
4757 or the candidate is not a vector font. */
4758 GOT_PENALTY("OutputPrecision", 19000);
4759 }
4760 break;
4761 default:
4763 {
4764 /* OutputPrecision Penalty 19000 */
4765 /* Or OUT_STROKE_PRECIS not requested, and the candidate
4766 is a vector font that requires GDI support. */
4767 GOT_PENALTY("OutputPrecision", 19000);
4768 }
4769 break;
4770 }
4771
4772 Byte = (LogFont->lfPitchAndFamily & 0x0F);
4773 if (Byte == DEFAULT_PITCH)
4775 if (Byte == FIXED_PITCH)
4776 {
4778 {
4779 /* FixedPitch Penalty 15000 */
4780 /* Requested a fixed pitch font, but the candidate is a
4781 variable pitch font. */
4782 GOT_PENALTY("FixedPitch", 15000);
4783 }
4784 }
4785 if (Byte == VARIABLE_PITCH)
4786 {
4788 {
4789 /* PitchVariable Penalty 350 */
4790 /* Requested a variable pitch font, but the candidate is not a
4791 variable pitch font. */
4792 GOT_PENALTY("PitchVariable", 350);
4793 }
4794 }
4795
4796 Byte = (LogFont->lfPitchAndFamily & 0x0F);
4797 if (Byte == DEFAULT_PITCH)
4798 {
4800 {
4801 /* DefaultPitchFixed Penalty 1 */
4802 /* Requested DEFAULT_PITCH, but the candidate is fixed pitch. */
4803 GOT_PENALTY("DefaultPitchFixed", 1);
4804 }
4805 }
4806
4807 ActualNameW = (WCHAR*)((ULONG_PTR)Otm + (ULONG_PTR)Otm->otmpFamilyName);
4808
4809 if (LogFont->lfFaceName[0] != UNICODE_NULL)
4810 {
4811 BOOL Found = FALSE;
4812
4813 /* localized family name */
4814 if (!Found)
4815 {
4816 Found = (_wcsicmp(LogFont->lfFaceName, ActualNameW) == 0);
4817 }
4818 /* localized full name */
4819 if (!Found)
4820 {
4821 ActualNameW = (WCHAR*)((ULONG_PTR)Otm + (ULONG_PTR)Otm->otmpFaceName);
4822 Found = (_wcsicmp(LogFont->lfFaceName, ActualNameW) == 0);
4823 }
4824 if (!Found)
4825 {
4826 /* FaceName Penalty 10000 */
4827 /* Requested a face name, but the candidate's face name
4828 does not match. */
4829 GOT_PENALTY("FaceName", 10000);
4830 }
4831 }
4832
4833 Byte = (LogFont->lfPitchAndFamily & 0xF0);
4834 if (Byte != FF_DONTCARE)
4835 {
4836 if (Byte != (TM->tmPitchAndFamily & 0xF0))
4837 {
4838 /* Family Penalty 9000 */
4839 /* Requested a family, but the candidate's family is different. */
4840 GOT_PENALTY("Family", 9000);
4841 }
4842 }
4843
4844 if ((TM->tmPitchAndFamily & 0xF0) == FF_DONTCARE)
4845 {
4846 /* FamilyUnknown Penalty 8000 */
4847 /* Requested a family, but the candidate has no family. */
4848 GOT_PENALTY("FamilyUnknown", 8000);
4849 }
4850
4851 /* Is the candidate a non-vector font? */
4853 {
4854 /* Is lfHeight specified? */
4855 if (LogFont->lfHeight != 0)
4856 {
4857 if (labs(LogFont->lfHeight) < TM->tmHeight)
4858 {
4859 /* HeightBigger Penalty 600 */
4860 /* The candidate is a nonvector font and is bigger than the
4861 requested height. */
4862 GOT_PENALTY("HeightBigger", 600);
4863 /* HeightBiggerDifference Penalty 150 */
4864 /* The candidate is a raster font and is larger than the
4865 requested height. Penalty * height difference */
4866 GOT_PENALTY("HeightBiggerDifference", 150 * labs(TM->tmHeight - labs(LogFont->lfHeight)));
4867
4868 fNeedScaling = TRUE;
4869 }
4870 if (TM->tmHeight < labs(LogFont->lfHeight))
4871 {
4872 /* HeightSmaller Penalty 150 */
4873 /* The candidate is a raster font and is smaller than the
4874 requested height. Penalty * height difference */
4875 GOT_PENALTY("HeightSmaller", 150 * labs(TM->tmHeight - labs(LogFont->lfHeight)));
4876
4877 fNeedScaling = TRUE;
4878 }
4879 }
4880 }
4881
4882 switch (LogFont->lfPitchAndFamily & 0xF0)
4883 {
4884 case FF_ROMAN: case FF_MODERN: case FF_SWISS:
4885 switch (TM->tmPitchAndFamily & 0xF0)
4886 {
4887 case FF_DECORATIVE: case FF_SCRIPT:
4888 /* FamilyUnlikely Penalty 50 */
4889 /* Requested a roman/modern/swiss family, but the
4890 candidate is decorative/script. */
4891 GOT_PENALTY("FamilyUnlikely", 50);
4892 break;
4893 default:
4894 break;
4895 }
4896 break;
4897 case FF_DECORATIVE: case FF_SCRIPT:
4898 switch (TM->tmPitchAndFamily & 0xF0)
4899 {
4900 case FF_ROMAN: case FF_MODERN: case FF_SWISS:
4901 /* FamilyUnlikely Penalty 50 */
4902 /* Or requested decorative/script, and the candidate is
4903 roman/modern/swiss. */
4904 GOT_PENALTY("FamilyUnlikely", 50);
4905 break;
4906 default:
4907 break;
4908 }
4909 default:
4910 break;
4911 }
4912
4913 if (LogFont->lfWidth != 0)
4914 {
4915 if (LogFont->lfWidth != TM->tmAveCharWidth)
4916 {
4917 /* Width Penalty 50 */
4918 /* Requested a nonzero width, but the candidate's width
4919 doesn't match. Penalty * width difference */
4920 GOT_PENALTY("Width", 50 * labs(LogFont->lfWidth - TM->tmAveCharWidth));
4921
4923 fNeedScaling = TRUE;
4924 }
4925 }
4926
4927 if (fNeedScaling)
4928 {
4929 /* SizeSynth Penalty 50 */
4930 /* The candidate is a raster font that needs scaling by GDI. */
4931 GOT_PENALTY("SizeSynth", 50);
4932 }
4933
4934 if (!LogFont->lfItalic && TM->tmItalic)
4935 {
4936 /* Italic Penalty 4 */
4937 /* Requested font and candidate font do not agree on italic status,
4938 and the desired result cannot be simulated. */
4939 /* Adjusted to 40 to satisfy (Oblique Penalty > Book Penalty). */
4940 GOT_PENALTY("Italic", 40);
4941 }
4942 else if (LogFont->lfItalic && !TM->tmItalic)
4943 {
4944 /* ItalicSim Penalty 1 */
4945 /* Requested italic font but the candidate is not italic,
4946 although italics can be simulated. */
4947 GOT_PENALTY("ItalicSim", 1);
4948 }
4949
4950 if (LogFont->lfOutPrecision == OUT_TT_PRECIS)
4951 {
4952 if (!(TM->tmPitchAndFamily & TMPF_TRUETYPE))
4953 {
4954 /* NotTrueType Penalty 4 */
4955 /* Requested OUT_TT_PRECIS, but the candidate is not a
4956 TrueType font. */
4957 GOT_PENALTY("NotTrueType", 4);
4958 }
4959 }
4960
4961 Long = LogFont->lfWeight;
4962 if (LogFont->lfWeight == FW_DONTCARE)
4963 Long = FW_NORMAL;
4964 if (Long != TM->tmWeight)
4965 {
4966 /* Weight Penalty 3 */
4967 /* The candidate's weight does not match the requested weight.
4968 Penalty * (weight difference/10) */
4969 GOT_PENALTY("Weight", 3 * (labs(Long - TM->tmWeight) / 10));
4970 }
4971
4972 if (!LogFont->lfUnderline && TM->tmUnderlined)
4973 {
4974 /* Underline Penalty 3 */
4975 /* Requested font has no underline, but the candidate is
4976 underlined. */
4977 GOT_PENALTY("Underline", 3);
4978 }
4979
4980 if (!LogFont->lfStrikeOut && TM->tmStruckOut)
4981 {
4982 /* StrikeOut Penalty 3 */
4983 /* Requested font has no strike-out, but the candidate is
4984 struck out. */
4985 GOT_PENALTY("StrikeOut", 3);
4986 }
4987
4988 /* Is the candidate a non-vector font? */
4990 {
4991 if (LogFont->lfHeight != 0 && TM->tmHeight < LogFont->lfHeight)
4992 {
4993 /* VectorHeightSmaller Penalty 2 */
4994 /* Candidate is a vector font that is smaller than the
4995 requested height. Penalty * height difference */
4996 GOT_PENALTY("VectorHeightSmaller", 2 * labs(TM->tmHeight - LogFont->lfHeight));
4997 }
4998 if (LogFont->lfHeight != 0 && TM->tmHeight > LogFont->lfHeight)
4999 {
5000 /* VectorHeightBigger Penalty 1 */
5001 /* Candidate is a vector font that is bigger than the
5002 requested height. Penalty * height difference */
5003 GOT_PENALTY("VectorHeightBigger", 1 * labs(TM->tmHeight - LogFont->lfHeight));
5004 }
5005 }
5006
5007 if (!(TM->tmPitchAndFamily & TMPF_DEVICE))
5008 {
5009 /* DeviceFavor Penalty 2 */
5010 /* Extra penalty for all nondevice fonts. */
5011 GOT_PENALTY("DeviceFavor", 2);
5012 }
5013
5014 if (TM->tmAveCharWidth >= 5 && TM->tmHeight >= 5)
5015 {
5016 if (TM->tmAveCharWidth / TM->tmHeight >= 3)
5017 {
5018 /* Aspect Penalty 30 */
5019 /* The aspect rate is >= 3. It seems like a bad font. */
5020 GOT_PENALTY("Aspect", ((TM->tmAveCharWidth / TM->tmHeight) - 2) * 30);
5021 }
5022 else if (TM->tmHeight / TM->tmAveCharWidth >= 3)
5023 {
5024 /* Aspect Penalty 30 */
5025 /* The aspect rate is >= 3. It seems like a bad font. */
5026 GOT_PENALTY("Aspect", ((TM->tmHeight / TM->tmAveCharWidth) - 2) * 30);
5027 }
5028 }
5029
5030 if (Penalty < 200)
5031 {
5032 DPRINT("WARNING: Penalty:%ld < 200: RequestedNameW:%ls, "
5033 "ActualNameW:%ls, lfCharSet:%d, lfWeight:%ld, "
5034 "tmCharSet:%d, tmWeight:%ld\n",
5035 Penalty, LogFont->lfFaceName, ActualNameW,
5036 LogFont->lfCharSet, LogFont->lfWeight,
5037 TM->tmCharSet, TM->tmWeight);
5038 }
5039
5040 return Penalty; /* success */
5041}
return Found
Definition: dirsup.c:1270
unsigned char Byte
Definition: zlib.h:37
#define GOT_PENALTY(name, value)
Definition: freetype.c:4696
static BYTE CharSetFromLangID(LANGID LangID)
Definition: freetype.c:2551
long Long
Definition: ftraster.c:313
_Check_return_ long __cdecl labs(_In_ long x)
BYTE lfStrikeOut
Definition: dimm.idl:66
BYTE lfUnderline
Definition: dimm.idl:65
#define FIXED_PITCH
Definition: wingdi.h:444
#define DEFAULT_PITCH
Definition: wingdi.h:443
#define VARIABLE_PITCH
Definition: wingdi.h:445
#define OUT_DEVICE_PRECIS
Definition: wingdi.h:420
#define TMPF_DEVICE
Definition: wingdi.h:1314
#define OUT_DEFAULT_PRECIS
Definition: wingdi.h:415
#define OUT_TT_PRECIS
Definition: wingdi.h:419

Referenced by FindBestFontFromList().

◆ GreExtTextOutW()

BOOL APIENTRY GreExtTextOutW ( IN HDC  hDC,
IN INT  XStart,
IN INT  YStart,
IN UINT  fuOptions,
IN OPTIONAL PRECTL  lprc,
IN LPCWSTR  String,
IN INT  Count,
IN OPTIONAL LPINT  Dx,
IN DWORD  dwCodePage 
)

Definition at line 6543 of file freetype.c.

6553{
6554 BOOL bResult;
6555 DC *dc;
6556
6557 // TODO: Write test-cases to exactly match real Windows in different
6558 // bad parameters (e.g. does Windows check the DC or the RECT first?).
6559 dc = DC_LockDc(hDC);
6560 if (!dc)
6561 {
6563 return FALSE;
6564 }
6565
6566 bResult = IntExtTextOutW( dc,
6567 XStart,
6568 YStart,
6569 fuOptions,
6570 lprc,
6571 String,
6572 Count,
6573 Dx,
6574 dwCodePage );
6575
6576 DC_UnlockDc(dc);
6577
6578 return bResult;
6579}
BOOL APIENTRY IntExtTextOutW(IN PDC dc, IN INT XStart, IN INT YStart, IN UINT fuOptions, IN OPTIONAL PRECTL lprc, IN LPCWSTR String, IN INT Count, IN OPTIONAL LPINT Dx, IN DWORD dwCodePage)
Definition: freetype.c:6031
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFSTRING String
Definition: wdfdevice.h:2433
_In_ int _Inout_ LPRECT lprc
Definition: winuser.h:4456

Referenced by GreTextOutW(), IntPaintDesktop(), and NtGdiExtTextOutW().

◆ InitFontSupport()

BOOL FASTCALL InitFontSupport ( VOID  )

Definition at line 661 of file freetype.c.

662{
663 ULONG ulError;
664
668 /* Fast Mutexes must be allocated from non paged pool */
670 if (g_FontListLock == NULL)
671 {
672 return FALSE;
673 }
674
677 if (g_FreeTypeLock == NULL)
678 {
679 return FALSE;
680 }
682
684 if (ulError)
685 {
686 DPRINT1("FT_Init_FreeType failed with error code 0x%x\n", ulError);
687 return FALSE;
688 }
689
691 {
692 DPRINT1("Fonts registry is empty.\n");
693
694 /* Load font(s) with writing registry */
696 }
697
698 IntLoadFontSubstList(&g_FontSubstListHead);
699
700#if DBG
701 DumpFontInfo(TRUE);
702#endif
703
704 return TRUE;
705}
#define NonPagedPool
Definition: env_spec_w32.h:307
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
static PFAST_MUTEX g_FreeTypeLock
Definition: freetype.c:65
BOOL FASTCALL IntLoadFontSubstList(PLIST_ENTRY pHead)
Definition: freetype.c:511
static UINT g_FontCacheNumEntries
Definition: freetype.c:95
VOID FASTCALL IntLoadSystemFonts(VOID)
Definition: freetype.c:896
static LIST_ENTRY g_FontCacheListHead
Definition: freetype.c:94
static PFAST_MUTEX g_FontListLock
Definition: freetype.c:68
BOOL FASTCALL IntLoadFontsInRegistry(VOID)
Definition: freetype.c:1641
FT_Init_FreeType(FT_Library *alibrary)
Definition: ftinit.c:320
#define TAG_INTERNAL_SYNC
Definition: tags.h:18
FORCEINLINE VOID ExInitializeFastMutex(_Out_ PFAST_MUTEX FastMutex)
Definition: exfuncs.h:274
FAST_MUTEX
Definition: extypes.h:17

Referenced by DriverEntry().

◆ IntAddNameFromFamInfo()

static VOID IntAddNameFromFamInfo ( LPWSTR  psz,
FONTFAMILYINFO FamInfo 
)
static

Definition at line 5373 of file freetype.c.

5374{
5376 if (FamInfo->EnumLogFontEx.elfStyle[0] &&
5377 _wcsicmp(FamInfo->EnumLogFontEx.elfStyle, L"Regular") != 0)
5378 {
5379 wcscat(psz, L" ");
5380 wcscat(psz, FamInfo->EnumLogFontEx.elfStyle);
5381 }
5382}
#define L(x)
Definition: ntvdm.h:50
_CRTIMP wchar_t *__cdecl wcscat(_Inout_updates_z_(_String_length_(_Dest)+_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)

Referenced by IntGdiGetFontResourceInfo().

◆ IntCharSetFromCodePage()

BYTE FASTCALL IntCharSetFromCodePage ( UINT  uCodePage)

Definition at line 173 of file freetype.c.

174{
175 UINT i;
176
177 if (uCodePage == CP_OEMCP)
178 return OEM_CHARSET;
179
180 if (uCodePage == CP_MACCP)
181 return MAC_CHARSET;
182
183 for (i = 0; i < MAXTCIINDEX; ++i)
184 {
185 if (g_FontTci[i].ciACP == 0)
186 continue;
187
188 if (g_FontTci[i].ciACP == uCodePage)
189 return g_FontTci[i].ciCharset;
190 }
191
192 return DEFAULT_CHARSET;
193}
#define CP_OEMCP
Definition: freetype.c:167
static const CHARSETINFO g_FontTci[MAXTCIINDEX]
Definition: freetype.c:125
#define CP_MACCP
Definition: freetype.c:168
#define OEM_CHARSET
Definition: wingdi.h:400
#define MAC_CHARSET
Definition: wingdi.h:403

Referenced by CreateStockFonts().

◆ IntEnableFontRendering()

VOID FASTCALL IntEnableFontRendering ( BOOL  Enable)

Definition at line 1969 of file freetype.c.

1970{
1972}
static BOOL g_RenderingEnabled
Definition: freetype.c:69
_In_ ULONGLONG _In_ ULONGLONG _In_ BOOLEAN Enable
Definition: ntddpcm.h:142

◆ IntEngFillBox()

VOID FASTCALL IntEngFillBox ( IN OUT PDC  dc,
IN INT  X,
IN INT  Y,
IN INT  Width,
IN INT  Height,
IN BRUSHOBJ BrushObj 
)

Definition at line 5984 of file freetype.c.

5991{
5992 RECTL DestRect;
5993 SURFACE *psurf = dc->dclevel.pSurface;
5994
5996 ASSERT(psurf != NULL);
5997
5998 if (Width < 0)
5999 {
6000 X += Width;
6001 Width = -Width;
6002 }
6003
6004 if (Height < 0)
6005 {
6006 Y += Height;
6007 Height = -Height;
6008 }
6009
6010 DestRect.left = X;
6011 DestRect.right = X + Width;
6012 DestRect.top = Y;
6013 DestRect.bottom = Y + Height;
6014
6015 IntEngBitBlt(&psurf->SurfObj,
6016 NULL,
6017 NULL,
6018 (CLIPOBJ *)&dc->co,
6019 NULL,
6020 &DestRect,
6021 NULL,
6022 NULL,
6023 BrushObj,
6024 &PointZero,
6026}
#define ASSERT_DC_PREPARED(pdc)
Definition: dc.h:300
#define Y(I)
static POINTL PointZero
Definition: freetype.c:51
#define X(b, s)
#define ROP4_FROM_INDEX(index)
Definition: inteng.h:42
@ R3_OPINDEX_PATCOPY
Definition: inteng.h:35
long bottom
Definition: polytest.cpp:53
long right
Definition: polytest.cpp:53
long top
Definition: polytest.cpp:53
long left
Definition: polytest.cpp:53
SURFOBJ SurfObj
Definition: surface.h:8
_In_ HFONT _Out_ PUINT _Out_ PUINT Width
Definition: font.h:126
_In_ HFONT _Out_ PUINT Height
Definition: font.h:125
BOOL APIENTRY IntEngBitBlt(SURFOBJ *psoTrg, SURFOBJ *psoSrc, SURFOBJ *psoMask, CLIPOBJ *pco, XLATEOBJ *pxlo, RECTL *prclTrg, POINTL *pptlSrc, POINTL *pptlMask, BRUSHOBJ *pbo, POINTL *pptlBrush, ROP4 Rop4)
Definition: bitblt.c:656

Referenced by IntExtTextOutW().

◆ IntEngFillPolygon()

VOID APIENTRY IntEngFillPolygon ( IN OUT PDC  dc,
IN POINTL pPoints,
IN UINT  cPoints,
IN BRUSHOBJ BrushObj 
)

Definition at line 5948 of file freetype.c.

5953{
5954 SURFACE *psurf = dc->dclevel.pSurface;
5955 RECT Rect;
5956 UINT i;
5957 INT x, y;
5958
5960 ASSERT(psurf != NULL);
5961
5962 Rect.left = Rect.right = pPoints[0].x;
5963 Rect.top = Rect.bottom = pPoints[0].y;
5964 for (i = 1; i < cPoints; ++i)
5965 {
5966 x = pPoints[i].x;
5967 if (x < Rect.left)
5968 Rect.left = x;
5969 else if (Rect.right < x)
5970 Rect.right = x;
5971
5972 y = pPoints[i].y;
5973 if (y < Rect.top)
5974 Rect.top = y;
5975 else if (Rect.bottom < y)
5976 Rect.bottom = y;
5977 }
5978
5979 IntFillPolygon(dc, dc->dclevel.pSurface, BrushObj, pPoints, cPoints, Rect, &PointZero);
5980}
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
BOOL FASTCALL IntFillPolygon(PDC dc, SURFACE *psurf, BRUSHOBJ *BrushObj, CONST PPOINT Points, int Count, RECTL DestRect, POINTL *BrushOrigin)
Definition: polyfill.c:590

Referenced by IntExtTextOutW().

◆ IntEscapeMatrix()

static VOID FASTCALL IntEscapeMatrix ( FT_Matrix pmat,
LONG  lfEscapement 
)
static

Definition at line 715 of file freetype.c.

716{
717 FT_Vector vecAngle;
718 /* Convert the angle in tenths of degrees into degrees as a 16.16 fixed-point value */
719 FT_Angle angle = INT_TO_FIXED(lfEscapement) / 10;
720 FT_Vector_Unit(&vecAngle, angle);
721 pmat->xx = vecAngle.x;
722 pmat->xy = -vecAngle.y;
723 pmat->yx = -pmat->xy;
724 pmat->yy = pmat->xx;
725}
FT_BEGIN_HEADER typedef FT_Fixed FT_Angle
Definition: fttrigon.h:52
FT_Vector_Unit(FT_Vector *vec, FT_Angle angle)
Definition: fttrigon.c:361
GLfloat angle
Definition: glext.h:10853

Referenced by ftGdiGetGlyphOutline(), and IntExtTextOutW().

◆ IntExtTextOutW()

BOOL APIENTRY IntExtTextOutW ( IN PDC  dc,
IN INT  XStart,
IN INT  YStart,
IN UINT  fuOptions,
IN OPTIONAL PRECTL  lprc,
IN LPCWSTR  String,
IN INT  Count,
IN OPTIONAL LPINT  Dx,
IN DWORD  dwCodePage 
)

Definition at line 6031 of file freetype.c.

6041{
6042 /*
6043 * FIXME:
6044 * Call EngTextOut, which does the real work (calling DrvTextOut where
6045 * appropriate)
6046 */
6047
6048 PDC_ATTR pdcattr;
6049 SURFOBJ *SurfObj, *SourceGlyphSurf;
6050 SURFACE *psurf;
6051 INT glyph_index, i;
6052 FT_Face face;
6053 FT_BitmapGlyph realglyph;
6054 LONGLONG X64, Y64, RealXStart64, RealYStart64, DeltaX64, DeltaY64;
6055 ULONG previous;
6056 RECTL DestRect, MaskRect;
6057 HBITMAP HSourceGlyph;
6058 SIZEL bitSize;
6059 FONTOBJ *FontObj;
6060 PFONTGDI FontGDI;
6061 PTEXTOBJ TextObj = NULL;
6062 EXLATEOBJ exloRGB2Dst, exloDst2RGB;
6063 POINT Start;
6064 PMATRIX pmxWorldToDevice;
6065 FT_Vector delta, vecAscent64, vecDescent64;
6066 LOGFONTW *plf;
6067 BOOL use_kerning, bResult, DoBreak;
6069 FT_Matrix mat;
6070
6071 /* Check if String is valid */
6072 if (Count > 0xFFFF || (Count > 0 && String == NULL))
6073 {
6075 return FALSE;
6076 }
6077
6078 if (PATH_IsPathOpen(dc->dclevel))
6079 {
6080 return PATH_ExtTextOut(dc,
6081 XStart, YStart,
6082 fuOptions,
6083 lprc,
6084 String, Count,
6085 Dx);
6086 }
6087
6089
6090 if (!dc->dclevel.pSurface)
6091 {
6092 /* Memory DC with no surface selected */
6093 bResult = TRUE;
6094 goto Cleanup;
6095 }
6096
6097 pdcattr = dc->pdcattr;
6098 if (pdcattr->flTextAlign & TA_UPDATECP)
6099 {
6100 Start.x = pdcattr->ptlCurrent.x;
6101 Start.y = pdcattr->ptlCurrent.y;
6102 }
6103 else
6104 {
6105 Start.x = XStart;
6106 Start.y = YStart;
6107 }
6108
6109 IntLPtoDP(dc, &Start, 1);
6110 RealXStart64 = ((LONGLONG)Start.x + dc->ptlDCOrig.x) << 6;
6111 RealYStart64 = ((LONGLONG)Start.y + dc->ptlDCOrig.y) << 6;
6112
6113 MaskRect.left = 0;
6114 MaskRect.top = 0;
6115
6116 psurf = dc->dclevel.pSurface;
6117 SurfObj = &psurf->SurfObj;
6118
6119 if (pdcattr->iGraphicsMode == GM_ADVANCED)
6120 pmxWorldToDevice = DC_pmxWorldToDevice(dc);
6121 else
6122 pmxWorldToDevice = (PMATRIX)&gmxWorldToDeviceDefault;
6123
6124 if (pdcattr->ulDirty_ & DIRTY_BACKGROUND)
6126
6127 if (lprc && (fuOptions & (ETO_CLIPPED | ETO_OPAQUE)))
6128 {
6129 IntLPtoDP(dc, (POINT*)lprc, 2);
6130 lprc->left += dc->ptlDCOrig.x;
6131 lprc->top += dc->ptlDCOrig.y;
6132 lprc->right += dc->ptlDCOrig.x;
6133 lprc->bottom += dc->ptlDCOrig.y;
6134 }
6135
6136 if (lprc && (fuOptions & ETO_OPAQUE))
6137 {
6139 lprc->left, lprc->top,
6140 lprc->right - lprc->left, lprc->bottom - lprc->top,
6141 &dc->eboBackground.BrushObject);
6142 fuOptions &= ~ETO_OPAQUE;
6143 }
6144 else
6145 {
6146 if (pdcattr->jBkMode == OPAQUE)
6147 {
6148 fuOptions |= ETO_OPAQUE;
6149 }
6150 }
6151
6152 TextObj = RealizeFontInit(pdcattr->hlfntNew);
6153 if (TextObj == NULL)
6154 {
6155 bResult = FALSE;
6156 goto Cleanup;
6157 }
6158
6159 FontObj = TextObj->Font;
6160 ASSERT(FontObj);
6161 FontGDI = ObjToGDI(FontObj, FONT);
6162 ASSERT(FontGDI);
6163
6165 Cache.Hashed.Face = face = FontGDI->SharedFace->Face;
6166
6167 plf = &TextObj->logfont.elfEnumLogfontEx.elfLogFont;
6168 Cache.Hashed.lfHeight = plf->lfHeight;
6169 Cache.Hashed.lfWidth = plf->lfWidth;
6170 Cache.Hashed.Aspect.Emu.Bold = EMUBOLD_NEEDED(FontGDI->OriginalWeight, plf->lfWeight);
6171 Cache.Hashed.Aspect.Emu.Italic = (plf->lfItalic && !FontGDI->OriginalItalic);
6172
6174 Cache.Hashed.Aspect.RenderMode = (BYTE)IntGetFontRenderMode(plf);
6175 else
6176 Cache.Hashed.Aspect.RenderMode = (BYTE)FT_RENDER_MODE_MONO;
6177
6178 if (!TextIntUpdateSize(dc, TextObj, FontGDI, FALSE))
6179 {
6181 bResult = FALSE;
6182 goto Cleanup;
6183 }
6184
6185 /* Apply lfEscapement */
6186 if (FT_IS_SCALABLE(face) && plf->lfEscapement != 0)
6187 IntEscapeMatrix(&Cache.Hashed.matTransform, plf->lfEscapement);
6188 else
6189 Cache.Hashed.matTransform = identityMat;
6190
6191 /* Apply the world transformation */
6192 IntMatrixFromMx(&mat, pmxWorldToDevice);
6193 FT_Matrix_Multiply(&mat, &Cache.Hashed.matTransform);
6194 FT_Set_Transform(face, &Cache.Hashed.matTransform, NULL);
6195
6196 /* Calculate the ascent point and the descent point */
6197 vecAscent64.x = 0;
6198 vecAscent64.y = (FontGDI->tmAscent << 6);
6199 FT_Vector_Transform(&vecAscent64, &Cache.Hashed.matTransform);
6200 vecDescent64.x = 0;
6201 vecDescent64.y = -(FontGDI->tmDescent << 6);
6202 FT_Vector_Transform(&vecDescent64, &Cache.Hashed.matTransform);
6203
6204 /* Process the vertical alignment and fix the real starting point. */
6205#define VALIGN_MASK (TA_TOP | TA_BASELINE | TA_BOTTOM)
6206 if ((pdcattr->flTextAlign & VALIGN_MASK) == TA_BASELINE)
6207 {
6208 NOTHING;
6209 }
6210 else if ((pdcattr->flTextAlign & VALIGN_MASK) == TA_BOTTOM)
6211 {
6212 RealXStart64 -= vecDescent64.x;
6213 RealYStart64 += vecDescent64.y;
6214 }
6215 else /* TA_TOP */
6216 {
6217 RealXStart64 -= vecAscent64.x;
6218 RealYStart64 += vecAscent64.y;
6219 }
6220#undef VALIGN_MASK
6221
6222 use_kerning = FT_HAS_KERNING(face);
6223
6224 /* Calculate the text width if necessary */
6225 if ((fuOptions & ETO_OPAQUE) || (pdcattr->flTextAlign & (TA_CENTER | TA_RIGHT)))
6226 {
6227 if (!IntGetTextDisposition(&DeltaX64, &DeltaY64, String, Count, Dx, &Cache, fuOptions))
6228 {
6230 bResult = FALSE;
6231 goto Cleanup;
6232 }
6233
6234 /* Adjust the horizontal position by horizontal alignment */
6235 if ((pdcattr->flTextAlign & TA_CENTER) == TA_CENTER)
6236 {
6237 RealXStart64 -= DeltaX64 / 2;
6238 RealYStart64 -= DeltaY64 / 2;
6239 }
6240 else if ((pdcattr->flTextAlign & TA_RIGHT) == TA_RIGHT)
6241 {
6242 RealXStart64 -= DeltaX64;
6243 RealYStart64 -= DeltaY64;
6244 }
6245
6246 /* Fill background */
6247 if (fuOptions & ETO_OPAQUE)
6248 {
6249 INT X0 = (RealXStart64 + vecAscent64.x + 32) >> 6;
6250 INT Y0 = (RealYStart64 - vecAscent64.y + 32) >> 6;
6251 INT DX = (DeltaX64 >> 6);
6252 if (Cache.Hashed.matTransform.xy == 0 && Cache.Hashed.matTransform.yx == 0)
6253 {
6254 INT CY = (vecAscent64.y - vecDescent64.y + 32) >> 6;
6255 IntEngFillBox(dc, X0, Y0, DX, CY, &dc->eboBackground.BrushObject);
6256 }
6257 else
6258 {
6259 INT DY = (DeltaY64 >> 6);
6260 INT X1 = ((RealXStart64 + vecDescent64.x + 32) >> 6);
6261 INT Y1 = ((RealYStart64 - vecDescent64.y + 32) >> 6);
6262 POINT Points[4] =
6263 {
6264 { X0, Y0 },
6265 { X0 + DX, Y0 + DY },
6266 { X1 + DX, Y1 + DY },
6267 { X1, Y1 },
6268 };
6269 IntEngFillPolygon(dc, Points, 4, &dc->eboBackground.BrushObject);
6270 }
6271 }
6272 }
6273
6274 EXLATEOBJ_vInitialize(&exloRGB2Dst, &gpalRGB, psurf->ppal, 0, 0, 0);
6275 EXLATEOBJ_vInitialize(&exloDst2RGB, psurf->ppal, &gpalRGB, 0, 0, 0);
6276
6277 /* Assume success */
6278 bResult = TRUE;
6279
6280 if (pdcattr->ulDirty_ & DIRTY_TEXT)
6282
6283 /*
6284 * The main rendering loop.
6285 */
6286 X64 = RealXStart64;
6287 Y64 = RealYStart64;
6288 previous = 0;
6289 DoBreak = FALSE;
6290 for (i = 0; i < Count; ++i)
6291 {
6292 glyph_index = get_glyph_index_flagged(face, *String++, ETO_GLYPH_INDEX, fuOptions);
6293 Cache.Hashed.GlyphIndex = glyph_index;
6294
6295 realglyph = IntGetRealGlyph(&Cache);
6296 if (!realglyph)
6297 {
6298 bResult = FALSE;
6299 break;
6300 }
6301
6302 /* retrieve kerning distance and move pen position */
6303 if (use_kerning && previous && glyph_index && NULL == Dx)
6304 {
6305 FT_Get_Kerning(face, previous, glyph_index, 0, &delta);
6306 X64 += delta.x;
6307 Y64 -= delta.y;
6308 }
6309
6310 DPRINT("X64, Y64: %I64d, %I64d\n", X64, Y64);
6311 DPRINT("Advance: %d, %d\n", realglyph->root.advance.x, realglyph->root.advance.y);
6312
6313 bitSize.cx = realglyph->bitmap.width;
6314 bitSize.cy = realglyph->bitmap.rows;
6315
6316 MaskRect.right = realglyph->bitmap.width;
6317 MaskRect.bottom = realglyph->bitmap.rows;
6318
6319 DestRect.left = ((X64 + 32) >> 6) + realglyph->left;
6320 DestRect.right = DestRect.left + bitSize.cx;
6321 DestRect.top = ((Y64 + 32) >> 6) - realglyph->top;
6322 DestRect.bottom = DestRect.top + bitSize.cy;
6323
6324 /* Check if the bitmap has any pixels */
6325 if ((bitSize.cx != 0) && (bitSize.cy != 0))
6326 {
6327 /*
6328 * We should create the bitmap out of the loop at the biggest possible
6329 * glyph size. Then use memset with 0 to clear it and sourcerect to
6330 * limit the work of the transbitblt.
6331 */
6332 HSourceGlyph = EngCreateBitmap(bitSize, realglyph->bitmap.pitch,
6334 realglyph->bitmap.buffer);
6335 if (!HSourceGlyph)
6336 {
6337 DPRINT1("WARNING: EngCreateBitmap() failed!\n");
6338 bResult = FALSE;
6339 if (Cache.Hashed.Aspect.EmuBoldItalic)
6340 FT_Done_Glyph((FT_Glyph)realglyph);
6341 break;
6342 }
6343
6344 SourceGlyphSurf = EngLockSurface((HSURF)HSourceGlyph);
6345 if (!SourceGlyphSurf)
6346 {
6347 EngDeleteSurface((HSURF)HSourceGlyph);
6348 DPRINT1("WARNING: EngLockSurface() failed!\n");
6349 bResult = FALSE;
6350 if (Cache.Hashed.Aspect.EmuBoldItalic)
6351 FT_Done_Glyph((FT_Glyph)realglyph);
6352 break;
6353 }
6354
6355 /*
6356 * Use the font data as a mask to paint onto the DCs surface using a
6357 * brush.
6358 */
6359 if (lprc && (fuOptions & ETO_CLIPPED))
6360 {
6361 // We do the check '>=' instead of '>' to possibly save an iteration
6362 // through this loop, since it's breaking after the drawing is done,
6363 // and x is always incremented.
6364 if (DestRect.right >= lprc->right)
6365 {
6366 DestRect.right = lprc->right;
6367 DoBreak = TRUE;
6368 }
6369
6370 if (DestRect.bottom >= lprc->bottom)
6371 {
6372 DestRect.bottom = lprc->bottom;
6373 }
6374 }
6375
6376 if (!IntEngMaskBlt(SurfObj,
6377 SourceGlyphSurf,
6378 (CLIPOBJ *)&dc->co,
6379 &exloRGB2Dst.xlo,
6380 &exloDst2RGB.xlo,
6381 &DestRect,
6382 (PPOINTL)&MaskRect,
6383 &dc->eboText.BrushObject,
6384 &PointZero))
6385 {
6386 DPRINT1("Failed to MaskBlt a glyph!\n");
6387 }
6388
6389 EngUnlockSurface(SourceGlyphSurf);
6390 EngDeleteSurface((HSURF)HSourceGlyph);
6391 }
6392
6393 if (DoBreak)
6394 {
6395 if (Cache.Hashed.Aspect.EmuBoldItalic)
6396 FT_Done_Glyph((FT_Glyph)realglyph);
6397 break;
6398 }
6399
6400 if (NULL == Dx)
6401 {
6402 X64 += realglyph->root.advance.x >> 10;
6403 Y64 -= realglyph->root.advance.y >> 10;
6404 }
6405 else if (fuOptions & ETO_PDY)
6406 {
6407 FT_Vector vec = { Dx[2 * i + 0] << 6, Dx[2 * i + 1] << 6 };
6408 FT_Vector_Transform(&vec, &Cache.Hashed.matTransform);
6409 X64 += vec.x;
6410 Y64 -= vec.y;
6411 }
6412 else
6413 {
6414 FT_Vector vec = { Dx[i] << 6, 0 };
6415 FT_Vector_Transform(&vec, &Cache.Hashed.matTransform);
6416 X64 += vec.x;
6417 Y64 -= vec.y;
6418 }
6419
6420 DPRINT("New X64, New Y64: %I64d, %I64d\n", X64, Y64);
6421
6422 previous = glyph_index;
6423
6424 if (Cache.Hashed.Aspect.EmuBoldItalic)
6425 {
6426 FT_Done_Glyph((FT_Glyph)realglyph);
6427 }
6428 }
6429
6430 if (pdcattr->flTextAlign & TA_UPDATECP)
6431 pdcattr->ptlCurrent.x = DestRect.right - dc->ptlDCOrig.x;
6432
6433 if (plf->lfUnderline || plf->lfStrikeOut) /* Underline or strike-out? */
6434 {
6435 /* Calculate the position and the thickness */
6436 INT underline_position, thickness;
6437 FT_Vector vecA64, vecB64;
6438
6439 DeltaX64 = X64 - RealXStart64;
6440 DeltaY64 = Y64 - RealYStart64;
6441
6442 if (!face->units_per_EM)
6443 {
6445 thickness = 1;
6446 }
6447 else
6448 {
6450 face->underline_position * face->size->metrics.y_ppem / face->units_per_EM;
6451 thickness =
6452 face->underline_thickness * face->size->metrics.y_ppem / face->units_per_EM;
6453 if (thickness <= 0)
6454 thickness = 1;
6455 }
6456
6457 if (plf->lfUnderline) /* Draw underline */
6458 {
6459 vecA64.x = 0;
6460 vecA64.y = (-underline_position - thickness / 2) << 6;
6461 vecB64.x = 0;
6462 vecB64.y = vecA64.y + (thickness << 6);
6463 FT_Vector_Transform(&vecA64, &Cache.Hashed.matTransform);
6464 FT_Vector_Transform(&vecB64, &Cache.Hashed.matTransform);
6465 {
6466 INT X0 = (RealXStart64 - vecA64.x + 32) >> 6;
6467 INT Y0 = (RealYStart64 + vecA64.y + 32) >> 6;
6468 INT DX = (DeltaX64 >> 6);
6469 if (Cache.Hashed.matTransform.xy == 0 && Cache.Hashed.matTransform.yx == 0)
6470 {
6471 INT CY = (vecB64.y - vecA64.y + 32) >> 6;
6472 IntEngFillBox(dc, X0, Y0, DX, CY, &dc->eboText.BrushObject);
6473 }
6474 else
6475 {
6476 INT DY = (DeltaY64 >> 6);
6477 INT X1 = X0 + ((vecA64.x - vecB64.x + 32) >> 6);
6478 INT Y1 = Y0 + ((vecB64.y - vecA64.y + 32) >> 6);
6479 POINT Points[4] =
6480 {
6481 { X0, Y0 },
6482 { X0 + DX, Y0 + DY },
6483 { X1 + DX, Y1 + DY },
6484 { X1, Y1 },
6485 };
6486 IntEngFillPolygon(dc, Points, 4, &dc->eboText.BrushObject);
6487 }
6488 }
6489 }
6490
6491 if (plf->lfStrikeOut) /* Draw strike-out */
6492 {
6493 vecA64.x = 0;
6494 vecA64.y = -(FontGDI->tmAscent << 6) / 3;
6495 vecB64.x = 0;
6496 vecB64.y = vecA64.y + (thickness << 6);
6497 FT_Vector_Transform(&vecA64, &Cache.Hashed.matTransform);
6498 FT_Vector_Transform(&vecB64, &Cache.Hashed.matTransform);
6499 {
6500 INT X0 = (RealXStart64 - vecA64.x + 32) >> 6;
6501 INT Y0 = (RealYStart64 + vecA64.y + 32) >> 6;
6502 INT DX = (DeltaX64 >> 6);
6503 if (Cache.Hashed.matTransform.xy == 0 && Cache.Hashed.matTransform.yx == 0)
6504 {
6505 INT CY = (vecB64.y - vecA64.y + 32) >> 6;
6506 IntEngFillBox(dc, X0, Y0, DX, CY, &dc->eboText.BrushObject);
6507 }
6508 else
6509 {
6510 INT DY = (DeltaY64 >> 6);
6511 INT X1 = X0 + ((vecA64.x - vecB64.x + 32) >> 6);
6512 INT Y1 = Y0 + ((vecB64.y - vecA64.y + 32) >> 6);
6513 POINT Points[4] =
6514 {
6515 { X0, Y0 },
6516 { X0 + DX, Y0 + DY },
6517 { X1 + DX, Y1 + DY },
6518 { X1, Y1 },
6519 };
6520 IntEngFillPolygon(dc, Points, 4, &dc->eboText.BrushObject);
6521 }
6522 }
6523 }
6524 }
6525
6527
6528 EXLATEOBJ_vCleanup(&exloRGB2Dst);
6529 EXLATEOBJ_vCleanup(&exloDst2RGB);
6530
6531Cleanup:
6533
6534 if (TextObj != NULL)
6535 TEXTOBJ_UnlockText(TextObj);
6536
6537 return bResult;
6538}
static BOOLEAN IntLPtoDP(DC *pdc, PPOINTL ppt, UINT count)
Definition: coord.h:182
VOID FASTCALL DC_vPrepareDCsForBlit(PDC pdcDest, const RECT *rcDest, PDC pdcSrc, const RECT *rcSrc)
Definition: dclife.c:505
VOID FASTCALL DC_vFinishBlit(PDC pdc1, PDC pdc2)
Definition: dclife.c:614
VOID FASTCALL DC_vUpdateTextBrush(PDC pdc)
Definition: dcobjs.c:108
VOID FASTCALL DC_vUpdateBackgroundBrush(PDC pdc)
Definition: dcobjs.c:126
WORD face[3]
Definition: mesh.c:4747
static const WCHAR Cleanup[]
Definition: register.c:80
VOID APIENTRY IntEngFillPolygon(IN OUT PDC dc, IN POINTL *pPoints, IN UINT cPoints, IN BRUSHOBJ *BrushObj)
Definition: freetype.c:5948
static BOOL IntGetTextDisposition(OUT LONGLONG *pX64, OUT LONGLONG *pY64, IN LPCWSTR String, IN INT Count, IN OPTIONAL LPINT Dx, IN OUT PFONT_CACHE_ENTRY Cache, IN UINT fuOptions)
Definition: freetype.c:5880
#define EMUBOLD_NEEDED(original, request)
Definition: freetype.c:45
static FT_BitmapGlyph IntGetRealGlyph(IN OUT PFONT_CACHE_ENTRY Cache)
Definition: freetype.c:4210
#define VALIGN_MASK
BOOL FASTCALL IntIsFontRenderingEnabled(VOID)
Definition: freetype.c:1963
#define gmxWorldToDeviceDefault
Definition: freetype.c:54
FT_Render_Mode FASTCALL IntGetFontRenderMode(LOGFONTW *logfont)
Definition: freetype.c:1975
VOID FASTCALL IntEngFillBox(IN OUT PDC dc, IN INT X, IN INT Y, IN INT Width, IN INT Height, IN BRUSHOBJ *BrushObj)
Definition: freetype.c:5984
@ FT_RENDER_MODE_MONO
Definition: freetype.h:3236
FT_Done_Glyph(FT_Glyph glyph)
Definition: ftglyph.c:633
#define DX
Definition: i386-dis.c:426
#define NOTHING
Definition: input_list.c:10
static HBITMAP
Definition: button.c:44
#define DIRTY_TEXT
Definition: ntgdihdl.h:125
#define DIRTY_BACKGROUND
Definition: ntgdihdl.h:126
struct _MATRIX * PMATRIX
#define PATH_IsPathOpen(dclevel)
Definition: path.h:72
Definition: fatfs.h:173
FT_Bitmap bitmap
Definition: ftglyph.h:165
FT_GlyphRec root
Definition: ftglyph.h:162
FT_Vector advance
Definition: ftglyph.h:113
LONG lfEscapement
Definition: dimm.idl:61
POINTL ptlCurrent
Definition: ntgdihdl.h:311
BYTE jBkMode
Definition: ntgdihdl.h:308
INT iGraphicsMode
Definition: ntgdihdl.h:306
ULONG ulDirty_
Definition: ntgdihdl.h:294
FLONG flTextAlign
Definition: ntgdihdl.h:324
XLATEOBJ xlo
Definition: xlateobj.h:21
Definition: font.h:56
LONG y
Definition: windef.h:330
LONG x
Definition: windef.h:329
struct _PALETTE *const ppal
Definition: surface.h:11
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
LONG cx
Definition: windef.h:334
LONG cy
Definition: windef.h:335
T1_FIELD_DICT_FONTDICT T1_FIELD_DICT_FONTDICT T1_FIELD_DICT_FONTDICT underline_position
Definition: t1tokens.h:40
int64_t LONGLONG
Definition: typedefs.h:68
Definition: compat.h:2255
@ Start
Definition: partlist.h:33
BOOL APIENTRY IntEngMaskBlt(_Inout_ SURFOBJ *psoDest, _In_ SURFOBJ *psoMask, _In_ CLIPOBJ *pco, _In_ XLATEOBJ *pxloDest, _In_ XLATEOBJ *pxloSource, _In_ RECTL *prclDest, _In_ POINTL *pptlMask, _In_ BRUSHOBJ *pbo, _In_ POINTL *pptlBrushOrg)
Definition: bitblt.c:1103