ReactOS 0.4.15-dev-7136-g77ab709
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 40 of file freetype.c.

◆ ASSERT_FREETYPE_LOCK_HELD

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

Definition at line 85 of file freetype.c.

◆ ASSERT_FREETYPE_LOCK_NOT_HELD

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

Definition at line 88 of file freetype.c.

◆ ASSERT_GLOBALFONTS_LOCK_HELD

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

Definition at line 76 of file freetype.c.

◆ CP_MACCP

#define CP_MACCP   2

Definition at line 167 of file freetype.c.

◆ CP_OEMCP

#define CP_OEMCP   1

Definition at line 166 of file freetype.c.

◆ CP_SYMBOL

#define CP_SYMBOL   42

Definition at line 122 of file freetype.c.

◆ EMUBOLD_NEEDED

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

Definition at line 44 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 27 of file freetype.c.

◆ gmxWorldToDeviceDefault

#define gmxWorldToDeviceDefault   gmxWorldToPageDefault

Definition at line 53 of file freetype.c.

◆ GOT_PENALTY

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

Definition at line 4690 of file freetype.c.

◆ IntLockFreeType

Definition at line 79 of file freetype.c.

◆ IntLockGlobalFonts

Definition at line 70 of file freetype.c.

◆ IntUnLockFreeType

Definition at line 82 of file freetype.c.

◆ IntUnLockGlobalFonts

Definition at line 73 of file freetype.c.

◆ MAX_FONT_CACHE

#define MAX_FONT_CACHE   256

Definition at line 91 of file freetype.c.

◆ MAXTCIINDEX

#define MAXTCIINDEX   32

Definition at line 123 of file freetype.c.

◆ NDEBUG

#define NDEBUG

Definition at line 35 of file freetype.c.

◆ PX2PT

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

Definition at line 1047 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 6575 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 2545 of file freetype.c.

2546{
2547 /* FIXME: Add more and fix if wrong */
2548 switch (PRIMARYLANGID(LangID))
2549 {
2550 case LANG_CHINESE:
2551 switch (SUBLANGID(LangID))
2552 {
2554 return CHINESEBIG5_CHARSET;
2556 default:
2557 break;
2558 }
2559 return GB2312_CHARSET;
2560
2561 case LANG_CZECH: case LANG_HUNGARIAN: case LANG_POLISH:
2562 case LANG_SLOVAK: case LANG_SLOVENIAN: case LANG_ROMANIAN:
2563 return EASTEUROPE_CHARSET;
2564
2566 case LANG_SERBIAN: case LANG_UKRAINIAN:
2567 return RUSSIAN_CHARSET;
2568
2569 case LANG_ARABIC: return ARABIC_CHARSET;
2570 case LANG_GREEK: return GREEK_CHARSET;
2571 case LANG_HEBREW: return HEBREW_CHARSET;
2572 case LANG_JAPANESE: return SHIFTJIS_CHARSET;
2573 case LANG_KOREAN: return JOHAB_CHARSET;
2574 case LANG_TURKISH: return TURKISH_CHARSET;
2575 case LANG_THAI: return THAI_CHARSET;
2576 case LANG_LATVIAN: return BALTIC_CHARSET;
2578
2579 case LANG_ENGLISH: case LANG_BASQUE: case LANG_CATALAN:
2580 case LANG_DANISH: case LANG_DUTCH: case LANG_FINNISH:
2581 case LANG_FRENCH: case LANG_GERMAN: case LANG_ITALIAN:
2583 case LANG_SWEDISH: default:
2584 return ANSI_CHARSET;
2585 }
2586}
#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 362 of file freetype.c.

363{
364 CleanupFontEntryEx(FontEntry, FontEntry->Font);
365}
static VOID FASTCALL CleanupFontEntryEx(PFONT_ENTRY FontEntry, PFONTGDI FontGDI)
Definition: freetype.c:342
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 342 of file freetype.c.

343{
344 // PFONTGDI FontGDI = FontEntry->Font;
345 PSHARED_FACE SharedFace = FontGDI->SharedFace;
346
347 if (FontGDI->Filename)
349
350 if (FontEntry->StyleName.Buffer)
351 RtlFreeUnicodeString(&FontEntry->StyleName);
352
353 if (FontEntry->FaceName.Buffer)
354 RtlFreeUnicodeString(&FontEntry->FaceName);
355
356 EngFreeMem(FontGDI);
357 SharedFace_Release(SharedFace);
358 ExFreePoolWithTag(FontEntry, TAG_FONT);
359}
static void SharedFace_Release(PSHARED_FACE Ptr)
Definition: freetype.c:318
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
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 830 of file freetype.c.

831{
833 UNICODE_STRING Tmp;
834
835 Tmp.Buffer = ExAllocatePoolWithTag(PagedPool, Source->MaximumLength, TAG_USTR);
836 if (Tmp.Buffer)
837 {
838 Tmp.MaximumLength = Source->MaximumLength;
839 Tmp.Length = 0;
841
845
847 }
848
849 return Status;
850}
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:3004
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 5346 of file freetype.c.

5347{
5348 const ENUMLOGFONTEXW *pLog1 = &pInfo1->EnumLogFontEx;
5349 const ENUMLOGFONTEXW *pLog2 = &pInfo2->EnumLogFontEx;
5350 const LOGFONTW *plf1 = &pLog1->elfLogFont;
5351 const LOGFONTW *plf2 = &pLog2->elfLogFont;
5352
5353 if (_wcsicmp(plf1->lfFaceName, plf2->lfFaceName) != 0)
5354 {
5355 return FALSE;
5356 }
5357
5358 if (_wcsicmp(pLog1->elfStyle, pLog2->elfStyle) != 0)
5359 {
5360 return FALSE;
5361 }
5362
5363 return TRUE;
5364}
#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 2080 of file freetype.c.

2081{
2082 int i;
2083
2084 for(i = 0; i < ft_face->num_charmaps; i++)
2085 {
2086 if (ft_face->charmaps[i]->platform_id == TT_PLATFORM_MICROSOFT &&
2087 ft_face->charmaps[i]->encoding == FT_ENCODING_MS_SYMBOL)
2088 {
2089 return TRUE;
2090 }
2091 }
2092 return FALSE;
2093}
#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 2096 of file freetype.c.

2099{
2100 FT_Fixed XScale, YScale;
2101 int Ascent, Descent;
2102 FT_Face Face = FontGDI->SharedFace->Face;
2103
2105
2106 XScale = Face->size->metrics.x_scale;
2107 YScale = Face->size->metrics.y_scale;
2108
2109 if (pFNT)
2110 {
2111 TM->tmHeight = pFNT->pixel_height;
2112 TM->tmAscent = pFNT->ascent;
2113 TM->tmDescent = TM->tmHeight - TM->tmAscent;
2116 TM->tmAveCharWidth = pFNT->avg_width;
2117 TM->tmMaxCharWidth = pFNT->max_width;
2118 TM->tmOverhang = 0;
2121 TM->tmFirstChar = pFNT->first_char;
2122 TM->tmLastChar = pFNT->last_char;
2123 TM->tmDefaultChar = pFNT->default_char + pFNT->first_char;
2124 TM->tmBreakChar = pFNT->break_char + pFNT->first_char;
2126 TM->tmWeight = FontGDI->RequestWeight;
2127 TM->tmItalic = FontGDI->RequestItalic;
2128 TM->tmUnderlined = FontGDI->RequestUnderline;
2129 TM->tmStruckOut = FontGDI->RequestStrikeOut;
2130 TM->tmCharSet = FontGDI->CharSet;
2131 return;
2132 }
2133
2134 ASSERT(pOS2);
2135 if (!pOS2)
2136 return;
2137
2138 if ((FT_Short)pOS2->usWinAscent + (FT_Short)pOS2->usWinDescent == 0)
2139 {
2140 Ascent = pHori->Ascender;
2141 Descent = -pHori->Descender;
2142 }
2143 else
2144 {
2145 Ascent = (FT_Short)pOS2->usWinAscent;
2146 Descent = (FT_Short)pOS2->usWinDescent;
2147 }
2148
2149 TM->tmAscent = FontGDI->tmAscent;
2150 TM->tmDescent = FontGDI->tmDescent;
2151 TM->tmHeight = TM->tmAscent + TM->tmDescent;
2152 TM->tmInternalLeading = FontGDI->tmInternalLeading;
2153
2154 /* MSDN says:
2155 * el = MAX(0, LineGap - ((WinAscent + WinDescent) - (Ascender - Descender)))
2156 */
2157 TM->tmExternalLeading = max(0, (FT_MulFix(pHori->Line_Gap
2158 - ((Ascent + Descent)
2159 - (pHori->Ascender - pHori->Descender)),
2160 YScale) + 32) >> 6);
2161 if (FontGDI->lfWidth != 0)
2162 TM->tmAveCharWidth = FontGDI->lfWidth;
2163 else
2164 TM->tmAveCharWidth = (FT_MulFix(pOS2->xAvgCharWidth, XScale) + 32) >> 6;
2165
2166 if (TM->tmAveCharWidth == 0)
2167 TM->tmAveCharWidth = 1;
2168
2169 /* Correct forumla to get the maxcharwidth from unicode and ansi font */
2170 TM->tmMaxCharWidth = (FT_MulFix(Face->max_advance_width, XScale) + 32) >> 6;
2171
2172 if (FontGDI->OriginalWeight != FW_DONTCARE &&
2173 FontGDI->OriginalWeight != FW_NORMAL)
2174 {
2175 TM->tmWeight = FontGDI->OriginalWeight;
2176 }
2177 else
2178 {
2179 TM->tmWeight = FontGDI->RequestWeight;
2180 }
2181
2182 TM->tmOverhang = 0;
2183 TM->tmDigitizedAspectX = 96;
2184 TM->tmDigitizedAspectY = 96;
2185 if (face_has_symbol_charmap(Face) ||
2186 (pOS2->usFirstCharIndex >= 0xf000 && pOS2->usFirstCharIndex < 0xf100))
2187 {
2188 USHORT cpOEM, cpAnsi;
2189
2190 EngGetCurrentCodePage(&cpOEM, &cpAnsi);
2191 TM->tmFirstChar = 0;
2192 switch(cpAnsi)
2193 {
2194 case 1257: /* Baltic */
2195 TM->tmLastChar = 0xf8fd;
2196 break;
2197 default:
2198 TM->tmLastChar = 0xf0ff;
2199 }
2200 TM->tmBreakChar = 0x20;
2201 TM->tmDefaultChar = 0x1f;
2202 }
2203 else
2204 {
2205 TM->tmFirstChar = pOS2->usFirstCharIndex; /* Should be the first char in the cmap */
2206 TM->tmLastChar = pOS2->usLastCharIndex; /* Should be min(cmap_last, os2_last) */
2207
2208 if(pOS2->usFirstCharIndex <= 1)
2209 TM->tmBreakChar = pOS2->usFirstCharIndex + 2;
2210 else if (pOS2->usFirstCharIndex > 0xff)
2211 TM->tmBreakChar = 0x20;
2212 else
2213 TM->tmBreakChar = pOS2->usFirstCharIndex;
2214 TM->tmDefaultChar = TM->tmBreakChar - 1;
2215 }
2216
2217 if (FontGDI->OriginalItalic || FontGDI->RequestItalic)
2218 {
2219 TM->tmItalic = 0xFF;
2220 }
2221 else
2222 {
2223 TM->tmItalic = 0;
2224 }
2225 TM->tmUnderlined = (FontGDI->RequestUnderline ? 0xFF : 0);
2226 TM->tmStruckOut = (FontGDI->RequestStrikeOut ? 0xFF : 0);
2227
2228 if (!FT_IS_FIXED_WIDTH(Face))
2229 {
2230 switch (pOS2->panose[PAN_PROPORTION_INDEX])
2231 {
2233 TM->tmPitchAndFamily = 0;
2234 break;
2235 default:
2237 break;
2238 }
2239 }
2240 else
2241 {
2242 TM->tmPitchAndFamily = 0;
2243 }
2244
2245 switch (pOS2->panose[PAN_FAMILYTYPE_INDEX])
2246 {
2247 case PAN_FAMILY_SCRIPT:
2249 break;
2252 break;
2253
2254 case PAN_ANY:
2255 case PAN_NO_FIT:
2257 case PAN_FAMILY_PICTORIAL: /* Symbol fonts get treated as if they were text */
2258 /* Which is clearly not what the panose spec says. */
2259 if (TM->tmPitchAndFamily == 0) /* Fixed */
2260 {
2262 }
2263 else
2264 {
2265 switch (pOS2->panose[PAN_SERIFSTYLE_INDEX])
2266 {
2267 case PAN_ANY:
2268 case PAN_NO_FIT:
2269 default:
2271 break;
2272
2273 case PAN_SERIF_COVE:
2277 case PAN_SERIF_SQUARE:
2278 case PAN_SERIF_THIN:
2279 case PAN_SERIF_BONE:
2281 case PAN_SERIF_TRIANGLE:
2283 break;
2284
2288 case PAN_SERIF_FLARED:
2289 case PAN_SERIF_ROUNDED:
2291 break;
2292 }
2293 }
2294 break;
2295 default:
2297 }
2298
2299 if (FT_IS_SCALABLE(Face))
2300 {
2302 }
2303 if (FT_IS_SFNT(Face))
2304 {
2306 }
2307
2308 TM->tmCharSet = FontGDI->CharSet;
2309}
static BOOL face_has_symbol_charmap(FT_Face ft_face)
Definition: freetype.c:2080
#define ASSERT_FREETYPE_LOCK_HELD()
Definition: freetype.c:85
#define _TMPF_VARIABLE_PITCH
Definition: freetype.c:40
#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 5040 of file freetype.c.

5043{
5044 ULONG Penalty;
5046 PFONT_ENTRY CurrentEntry;
5047 FONTGDI *FontGDI;
5048 OUTLINETEXTMETRICW *Otm = NULL;
5049 UINT OtmSize, OldOtmSize = 0;
5050 FT_Face Face;
5051
5052 ASSERT(FontObj);
5053 ASSERT(MatchPenalty);
5054 ASSERT(LogFont);
5055 ASSERT(Head);
5056
5057 /* Start with a pretty big buffer */
5058 OldOtmSize = 0x200;
5059 Otm = ExAllocatePoolWithTag(PagedPool, OldOtmSize, GDITAG_TEXT);
5060
5061 /* get the FontObj of lowest penalty */
5062 for (Entry = Head->Flink; Entry != Head; Entry = Entry->Flink)
5063 {
5064 CurrentEntry = CONTAINING_RECORD(Entry, FONT_ENTRY, ListEntry);
5065
5066 FontGDI = CurrentEntry->Font;
5067 ASSERT(FontGDI);
5068 Face = FontGDI->SharedFace->Face;
5069
5070 /* get text metrics */
5071 OtmSize = IntGetOutlineTextMetrics(FontGDI, 0, NULL);
5072 if (OtmSize > OldOtmSize)
5073 {
5074 if (Otm)
5077 }
5078
5079 /* update FontObj if lowest penalty */
5080 if (Otm)
5081 {
5083 IntRequestFontSize(NULL, FontGDI, LogFont->lfWidth, LogFont->lfHeight);
5085
5086 OtmSize = IntGetOutlineTextMetrics(FontGDI, OtmSize, Otm);
5087 if (!OtmSize)
5088 continue;
5089
5090 OldOtmSize = OtmSize;
5091
5092 Penalty = GetFontPenalty(LogFont, Otm, Face->style_name);
5093 if (*MatchPenalty == 0xFFFFFFFF || Penalty < *MatchPenalty)
5094 {
5095 *FontObj = GDIToObj(FontGDI, FONT);
5096 *MatchPenalty = Penalty;
5097 }
5098 }
5099 }
5100
5101 if (Otm)
5103}
#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:4694
static FT_Error IntRequestFontSize(PDC dc, PFONTGDI FontGDI, LONG lfWidth, LONG lfHeight)
Definition: freetype.c:3445
#define IntUnLockFreeType()
Definition: freetype.c:82
#define IntLockFreeType()
Definition: freetype.c:79
INT FASTCALL IntGetOutlineTextMetrics(PFONTGDI FontGDI, UINT Size, OUTLINETEXTMETRICW *Otm)
Definition: freetype.c:2398
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 2763 of file freetype.c.

2765{
2766 ANSI_STRING StyleA;
2767 UNICODE_STRING StyleW;
2768 TT_OS2 *pOS2;
2770 CHARSETINFO CharSetInfo;
2771 unsigned i, Size;
2772 OUTLINETEXTMETRICW *Otm;
2773 LOGFONTW *Lf;
2774 TEXTMETRICW *TM;
2775 NEWTEXTMETRICW *Ntm;
2776 DWORD fs0;
2778 PSHARED_FACE SharedFace = FontGDI->SharedFace;
2779 FT_Face Face = SharedFace->Face;
2780 UNICODE_STRING NameW;
2781
2782 RtlInitUnicodeString(&NameW, NULL);
2784 Size = IntGetOutlineTextMetrics(FontGDI, 0, NULL);
2786 if (!Otm)
2787 {
2788 return;
2789 }
2790 Size = IntGetOutlineTextMetrics(FontGDI, Size, Otm);
2791 if (!Size)
2792 {
2794 return;
2795 }
2796
2797 Lf = &Info->EnumLogFontEx.elfLogFont;
2798 TM = &Otm->otmTextMetrics;
2799
2800 Lf->lfHeight = TM->tmHeight;
2801 Lf->lfWidth = TM->tmAveCharWidth;
2802 Lf->lfWeight = TM->tmWeight;
2803 Lf->lfItalic = TM->tmItalic;
2804 Lf->lfPitchAndFamily = (TM->tmPitchAndFamily & 0xf1) + 1;
2805 Lf->lfCharSet = TM->tmCharSet;
2809
2810 Ntm = &Info->NewTextMetricEx.ntmTm;
2811 Ntm->tmHeight = TM->tmHeight;
2812 Ntm->tmAscent = TM->tmAscent;
2813 Ntm->tmDescent = TM->tmDescent;
2816 Ntm->tmAveCharWidth = TM->tmAveCharWidth;
2817 Ntm->tmMaxCharWidth = TM->tmMaxCharWidth;
2818 Ntm->tmWeight = TM->tmWeight;
2819 Ntm->tmOverhang = TM->tmOverhang;
2822 Ntm->tmFirstChar = TM->tmFirstChar;
2823 Ntm->tmLastChar = TM->tmLastChar;
2824 Ntm->tmDefaultChar = TM->tmDefaultChar;
2825 Ntm->tmBreakChar = TM->tmBreakChar;
2826 Ntm->tmItalic = TM->tmItalic;
2827 Ntm->tmUnderlined = TM->tmUnderlined;
2828 Ntm->tmStruckOut = TM->tmStruckOut;
2830 Ntm->tmCharSet = TM->tmCharSet;
2831 Ntm->ntmFlags = TM->tmItalic ? NTM_ITALIC : 0;
2832
2833 if (550 < TM->tmWeight) Ntm->ntmFlags |= NTM_BOLD;
2834
2835 if (0 == Ntm->ntmFlags) Ntm->ntmFlags = NTM_REGULAR;
2836
2837 Info->FontType = (0 != (TM->tmPitchAndFamily & TMPF_TRUETYPE)
2838 ? TRUETYPE_FONTTYPE : 0);
2839
2840 if (0 == (TM->tmPitchAndFamily & TMPF_VECTOR))
2841 Info->FontType |= RASTER_FONTTYPE;
2842
2843
2844 /* face name */
2845 if (!FaceName)
2846 FaceName = (WCHAR*)((ULONG_PTR)Otm + (ULONG_PTR)Otm->otmpFamilyName);
2847
2848 RtlStringCbCopyW(Lf->lfFaceName, sizeof(Lf->lfFaceName), FaceName);
2849
2850 /* full name */
2851 if (!FullName)
2852 FullName = (WCHAR*)((ULONG_PTR) Otm + (ULONG_PTR)Otm->otmpFaceName);
2853
2854 RtlStringCbCopyW(Info->EnumLogFontEx.elfFullName,
2855 sizeof(Info->EnumLogFontEx.elfFullName),
2856 FullName);
2857
2858 RtlInitAnsiString(&StyleA, Face->style_name);
2859 StyleW.Buffer = Info->EnumLogFontEx.elfStyle;
2860 StyleW.MaximumLength = sizeof(Info->EnumLogFontEx.elfStyle);
2861 status = RtlAnsiStringToUnicodeString(&StyleW, &StyleA, FALSE);
2862 if (!NT_SUCCESS(status))
2863 {
2865 return;
2866 }
2867 Info->EnumLogFontEx.elfScript[0] = UNICODE_NULL;
2868
2870 pOS2 = FT_Get_Sfnt_Table(Face, ft_sfnt_os2);
2871
2872 if (!pOS2)
2873 {
2876 return;
2877 }
2878
2879 Ntm->ntmSizeEM = Otm->otmEMSquare;
2881 Ntm->ntmAvgWidth = 0;
2882
2884
2885 fs.fsCsb[0] = pOS2->ulCodePageRange1;
2886 fs.fsCsb[1] = pOS2->ulCodePageRange2;
2887 fs.fsUsb[0] = pOS2->ulUnicodeRange1;
2888 fs.fsUsb[1] = pOS2->ulUnicodeRange2;
2889 fs.fsUsb[2] = pOS2->ulUnicodeRange3;
2890 fs.fsUsb[3] = pOS2->ulUnicodeRange4;
2891
2892 if (0 == pOS2->version)
2893 {
2894 FT_UInt Dummy;
2895
2896 if (FT_Get_First_Char(Face, &Dummy) < 0x100)
2897 fs.fsCsb[0] |= FS_LATIN1;
2898 else
2899 fs.fsCsb[0] |= FS_SYMBOL;
2900 }
2902
2903 if (fs.fsCsb[0] == 0)
2904 {
2905 /* Let's see if we can find any interesting cmaps */
2906 for (i = 0; i < (UINT)Face->num_charmaps; i++)
2907 {
2908 switch (Face->charmaps[i]->encoding)
2909 {
2910 case FT_ENCODING_UNICODE:
2911 case FT_ENCODING_APPLE_ROMAN:
2912 fs.fsCsb[0] |= FS_LATIN1;
2913 break;
2914 case FT_ENCODING_MS_SYMBOL:
2915 fs.fsCsb[0] |= FS_SYMBOL;
2916 break;
2917 default:
2918 break;
2919 }
2920 }
2921 }
2922
2923 for (i = 0; i < MAXTCIINDEX; i++)
2924 {
2925 fs0 = 1L << i;
2926 if (fs.fsCsb[0] & fs0)
2927 {
2928 if (!IntTranslateCharsetInfo(&fs0, &CharSetInfo, TCI_SRCFONTSIG))
2929 {
2930 CharSetInfo.ciCharset = DEFAULT_CHARSET;
2931 }
2932 if (DEFAULT_CHARSET != CharSetInfo.ciCharset)
2933 {
2934 if (g_ElfScripts[i])
2935 wcscpy(Info->EnumLogFontEx.elfScript, g_ElfScripts[i]);
2936 else
2937 {
2938 DPRINT1("Unknown elfscript for bit %u\n", i);
2939 }
2940 }
2941 }
2942 }
2943 Info->NewTextMetricEx.ntmFontSig = fs;
2944}
#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:96
#define MAXTCIINDEX
Definition: freetype.c:123
static BOOLEAN IntTranslateCharsetInfo(PDWORD Src, LPCHARSETINFO Cs, DWORD Flags)
Definition: freetype.c:2033
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:444
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 382 of file freetype.c.

383{
384 return (FT_Fixed)((long)f.value << 16 | (unsigned long)f.fract);
385}
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 4652 of file freetype.c.

4658{
4660 FT_Face Face = FontGdi->SharedFace->Face;
4661
4663
4664 if (FT_IS_SFNT(Face))
4665 {
4666 if (Table)
4667 Table = Table >> 24 | Table << 24 | (Table >> 8 & 0xFF00) |
4668 (Table << 8 & 0xFF0000);
4669
4670 if (!Buffer) Size = 0;
4671
4672 if (Buffer && Size)
4673 {
4675 FT_ULong Needed = 0;
4676
4677 Error = FT_Load_Sfnt_Table(Face, Table, Offset, NULL, &Needed);
4678
4679 if ( !Error && Needed < Size) Size = Needed;
4680 }
4681 if (!FT_Load_Sfnt_Table(Face, Table, Offset, Buffer, &Size))
4682 Result = Size;
4683 }
4684
4686
4687 return Result;
4688}
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:409

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 3723 of file freetype.c.

3732{
3733 PDC_ATTR pdcattr;
3734 PTEXTOBJ TextObj;
3735 PFONTGDI FontGDI;
3736 HFONT hFont = 0;
3737 GLYPHMETRICS gm;
3738 ULONG Size;
3739 FT_Face ft_face;
3740 FT_UInt glyph_index;
3741 DWORD width, height, pitch, needed = 0;
3742 FT_Bitmap ft_bitmap;
3744 INT left, right, top = 0, bottom = 0;
3746 FLOATOBJ eM11, widthRatio, eTemp;
3747 FT_Matrix mat, transMat = identityMat;
3748 BOOL needsTransform = FALSE;
3749 INT orientation;
3750 LONG aveWidth;
3751 INT adv, lsb, bbx; /* These three hold to widths of the unrotated chars */
3752 OUTLINETEXTMETRICW *potm;
3753 XFORMOBJ xo;
3754 XFORML xform;
3755 LOGFONTW *plf;
3756
3757 DPRINT("%u, %08x, %p, %08lx, %p, %p\n", wch, iFormat, pgm,
3758 cjBuf, pvBuf, pmat2);
3759
3760 pdcattr = dc->pdcattr;
3761
3762 XFORMOBJ_vInit(&xo, &dc->pdcattr->mxWorldToDevice);
3763 XFORMOBJ_iGetXform(&xo, &xform);
3764 FLOATOBJ_SetFloat(&eM11, xform.eM11);
3765
3766 hFont = pdcattr->hlfntNew;
3767 TextObj = RealizeFontInit(hFont);
3768
3769 if (!TextObj)
3770 {
3772 return GDI_ERROR;
3773 }
3774 FontGDI = ObjToGDI(TextObj->Font, FONT);
3775 ft_face = FontGDI->SharedFace->Face;
3776
3777 plf = &TextObj->logfont.elfEnumLogfontEx.elfLogFont;
3778 aveWidth = FT_IS_SCALABLE(ft_face) ? abs(plf->lfWidth) : 0;
3779 orientation = FT_IS_SCALABLE(ft_face) ? plf->lfOrientation : 0;
3780
3781 Size = IntGetOutlineTextMetrics(FontGDI, 0, NULL);
3783 if (!potm)
3784 {
3786 TEXTOBJ_UnlockText(TextObj);
3787 return GDI_ERROR;
3788 }
3789 Size = IntGetOutlineTextMetrics(FontGDI, Size, potm);
3790 if (!Size)
3791 {
3792 /* FIXME: last error? */
3794 TEXTOBJ_UnlockText(TextObj);
3795 return GDI_ERROR;
3796 }
3797
3799 TextIntUpdateSize(dc, TextObj, FontGDI, FALSE);
3801 FT_Set_Transform(ft_face, &mat, NULL);
3802
3803 TEXTOBJ_UnlockText(TextObj);
3804
3805 glyph_index = get_glyph_index_flagged(ft_face, wch, GGO_GLYPH_INDEX, iFormat);
3806 iFormat &= ~GGO_GLYPH_INDEX;
3807
3808 if (orientation || (iFormat != GGO_METRICS && iFormat != GGO_BITMAP) || aveWidth || pmat2)
3809 load_flags |= FT_LOAD_NO_BITMAP;
3810
3811 if (iFormat & GGO_UNHINTED)
3812 {
3813 load_flags |= FT_LOAD_NO_HINTING;
3814 iFormat &= ~GGO_UNHINTED;
3815 }
3816
3817 error = FT_Load_Glyph(ft_face, glyph_index, load_flags);
3818 if (error)
3819 {
3820 DPRINT1("WARNING: Failed to load and render glyph! [index: %u]\n", glyph_index);
3822 if (potm) ExFreePoolWithTag(potm, GDITAG_TEXT);
3823 return GDI_ERROR;
3824 }
3826
3827 FLOATOBJ_Set1(&widthRatio);
3828 if (aveWidth && potm)
3829 {
3830 // widthRatio = aveWidth * eM11 / potm->otmTextMetrics.tmAveCharWidth
3831 FLOATOBJ_SetLong(&widthRatio, aveWidth);
3832 FLOATOBJ_Mul(&widthRatio, &eM11);
3834 }
3835
3836 //left = (INT)(ft_face->glyph->metrics.horiBearingX * widthRatio) & -64;
3837 FLOATOBJ_SetLong(&eTemp, ft_face->glyph->metrics.horiBearingX);
3838 FLOATOBJ_Mul(&eTemp, &widthRatio);
3839 left = FLOATOBJ_GetLong(&eTemp) & -64;
3840
3841 //right = (INT)((ft_face->glyph->metrics.horiBearingX +
3842 // ft_face->glyph->metrics.width) * widthRatio + 63) & -64;
3843 FLOATOBJ_SetLong(&eTemp, ft_face->glyph->metrics.horiBearingX * ft_face->glyph->metrics.width);
3844 FLOATOBJ_Mul(&eTemp, &widthRatio);
3845 FLOATOBJ_AddLong(&eTemp, 63);
3846 right = FLOATOBJ_GetLong(&eTemp) & -64;
3847
3848 //adv = (INT)((ft_face->glyph->metrics.horiAdvance * widthRatio) + 63) >> 6;
3849 FLOATOBJ_SetLong(&eTemp, ft_face->glyph->metrics.horiAdvance);
3850 FLOATOBJ_Mul(&eTemp, &widthRatio);
3851 FLOATOBJ_AddLong(&eTemp, 63);
3852 adv = FLOATOBJ_GetLong(&eTemp) >> 6;
3853
3854 lsb = left >> 6;
3855 bbx = (right - left) >> 6;
3856
3857 DPRINT("Advance = %d, lsb = %d, bbx = %d\n",adv, lsb, bbx);
3858
3860
3861 /* Width scaling transform */
3862 if (!FLOATOBJ_Equal1(&widthRatio))
3863 {
3864 FT_Matrix scaleMat;
3865
3866 eTemp = widthRatio;
3867 FLOATOBJ_MulLong(&eTemp, 1 << 16);
3868
3869 scaleMat.xx = FLOATOBJ_GetLong(&eTemp);
3870 scaleMat.xy = 0;
3871 scaleMat.yx = 0;
3872 scaleMat.yy = INT_TO_FIXED(1);
3873 FT_Matrix_Multiply(&scaleMat, &transMat);
3874 needsTransform = TRUE;
3875 }
3876
3877 /* World transform */
3878 {
3879 FT_Matrix ftmatrix;
3881
3882 /* Create a freetype matrix, by converting to 16.16 fixpoint format */
3883 IntMatrixFromMx(&ftmatrix, pmx);
3884
3885 if (memcmp(&ftmatrix, &identityMat, sizeof(identityMat)) != 0)
3886 {
3887 FT_Matrix_Multiply(&ftmatrix, &transMat);
3888 needsTransform = TRUE;
3889 }
3890 }
3891
3892 /* Rotation transform */
3893 if (orientation)
3894 {
3895 FT_Matrix rotationMat;
3896 DPRINT("Rotation Trans!\n");
3897 IntEscapeMatrix(&rotationMat, orientation);
3898 FT_Matrix_Multiply(&rotationMat, &transMat);
3899 needsTransform = TRUE;
3900 }
3901
3902 /* Extra transformation specified by caller */
3903 if (pmat2)
3904 {
3905 FT_Matrix extraMat;
3906 DPRINT("MAT2 Matrix Trans!\n");
3907 extraMat.xx = FT_FixedFromFIXED(pmat2->eM11);
3908 extraMat.xy = FT_FixedFromFIXED(pmat2->eM21);
3909 extraMat.yx = FT_FixedFromFIXED(pmat2->eM12);
3910 extraMat.yy = FT_FixedFromFIXED(pmat2->eM22);
3911 FT_Matrix_Multiply(&extraMat, &transMat);
3912 needsTransform = TRUE;
3913 }
3914
3915 if (potm) ExFreePoolWithTag(potm, GDITAG_TEXT); /* It looks like we are finished with potm ATM. */
3916
3917 if (!needsTransform)
3918 {
3919 DPRINT("No Need to be Transformed!\n");
3920 top = (ft_face->glyph->metrics.horiBearingY + 63) & -64;
3921 bottom = (ft_face->glyph->metrics.horiBearingY -
3922 ft_face->glyph->metrics.height) & -64;
3923 gm.gmCellIncX = adv;
3924 gm.gmCellIncY = 0;
3925 }
3926 else
3927 {
3928 INT xc, yc;
3929 FT_Vector vec;
3930 for (xc = 0; xc < 2; xc++)
3931 {
3932 for (yc = 0; yc < 2; yc++)
3933 {
3934 vec.x = (ft_face->glyph->metrics.horiBearingX +
3935 xc * ft_face->glyph->metrics.width);
3936 vec.y = ft_face->glyph->metrics.horiBearingY -
3937 yc * ft_face->glyph->metrics.height;
3938 DPRINT("Vec %ld,%ld\n", vec.x, vec.y);
3939 FT_Vector_Transform(&vec, &transMat);
3940 if (xc == 0 && yc == 0)
3941 {
3942 left = right = vec.x;
3943 top = bottom = vec.y;
3944 }
3945 else
3946 {
3947 if (vec.x < left) left = vec.x;
3948 else if (vec.x > right) right = vec.x;
3949 if (vec.y < bottom) bottom = vec.y;
3950 else if (vec.y > top) top = vec.y;
3951 }
3952 }
3953 }
3954 left = left & -64;
3955 right = (right + 63) & -64;
3956 bottom = bottom & -64;
3957 top = (top + 63) & -64;
3958
3959 DPRINT("Transformed box: (%d,%d - %d,%d)\n", left, top, right, bottom);
3960 vec.x = ft_face->glyph->metrics.horiAdvance;
3961 vec.y = 0;
3962 FT_Vector_Transform(&vec, &transMat);
3963 gm.gmCellIncX = (vec.x+63) >> 6;
3964 gm.gmCellIncY = -((vec.y+63) >> 6);
3965 }
3966 gm.gmBlackBoxX = (right - left) >> 6;
3967 gm.gmBlackBoxY = (top - bottom) >> 6;
3968 gm.gmptGlyphOrigin.x = left >> 6;
3969 gm.gmptGlyphOrigin.y = top >> 6;
3970
3971 DPRINT("CX %d CY %d BBX %u BBY %u GOX %d GOY %d\n",
3972 gm.gmCellIncX, gm.gmCellIncY,
3973 gm.gmBlackBoxX, gm.gmBlackBoxY,
3975
3977
3978
3979 if (iFormat == GGO_METRICS)
3980 {
3981 DPRINT("GGO_METRICS Exit!\n");
3982 *pgm = gm;
3983 return 1; /* FIXME */
3984 }
3985
3986 if (ft_face->glyph->format != ft_glyph_format_outline && iFormat != GGO_BITMAP)
3987 {
3988 DPRINT1("Loaded a bitmap\n");
3989 return GDI_ERROR;
3990 }
3991
3992 switch (iFormat)
3993 {
3994 case GGO_BITMAP:
3995 {
3996 width = gm.gmBlackBoxX;
3997 height = gm.gmBlackBoxY;
3998 pitch = ((width + 31) >> 5) << 2;
3999 needed = pitch * height;
4000
4001 if (!pvBuf || !cjBuf) break;
4002 if (!needed) return GDI_ERROR; /* empty glyph */
4003 if (needed > cjBuf)
4004 return GDI_ERROR;
4005
4006 switch (ft_face->glyph->format)
4007 {
4009 {
4010 BYTE *src = ft_face->glyph->bitmap.buffer, *dst = pvBuf;
4011 INT w = min( pitch, (ft_face->glyph->bitmap.width + 7) >> 3 );
4012 INT h = min( height, ft_face->glyph->bitmap.rows );
4013 while (h--)
4014 {
4016 src += ft_face->glyph->bitmap.pitch;
4017 dst += pitch;
4018 }
4019 break;
4020 }
4021
4023 {
4024 ft_bitmap.width = width;
4025 ft_bitmap.rows = height;
4026 ft_bitmap.pitch = pitch;
4027 ft_bitmap.pixel_mode = FT_PIXEL_MODE_MONO;
4028 ft_bitmap.buffer = pvBuf;
4029
4031 if (needsTransform)
4032 {
4033 FT_Outline_Transform(&ft_face->glyph->outline, &transMat);
4034 }
4035 FT_Outline_Translate(&ft_face->glyph->outline, -left, -bottom );
4036 /* Note: FreeType will only set 'black' bits for us. */
4037 RtlZeroMemory(pvBuf, needed);
4038 FT_Outline_Get_Bitmap(g_FreeTypeLibrary, &ft_face->glyph->outline, &ft_bitmap);
4040 break;
4041 }
4042
4043 default:
4044 DPRINT1("Loaded glyph format %x\n", ft_face->glyph->format);
4045 return GDI_ERROR;
4046 }
4047
4048 break;
4049 }
4050
4051 case GGO_GRAY2_BITMAP:
4052 case GGO_GRAY4_BITMAP:
4053 case GGO_GRAY8_BITMAP:
4054 {
4055 unsigned int mult, row, col;
4056 BYTE *start, *ptr;
4057
4058 width = gm.gmBlackBoxX;
4059 height = gm.gmBlackBoxY;
4060 pitch = (width + 3) / 4 * 4;
4061 needed = pitch * height;
4062
4063 if (!pvBuf || !cjBuf) break;
4064 if (!needed) return GDI_ERROR; /* empty glyph */
4065 if (needed > cjBuf)
4066 return GDI_ERROR;
4067
4068 switch (ft_face->glyph->format)
4069 {
4071 {
4072 BYTE *src = ft_face->glyph->bitmap.buffer, *dst = pvBuf;
4073 INT h = min( height, ft_face->glyph->bitmap.rows );
4074 INT x;
4075 while (h--)
4076 {
4077 for (x = 0; (UINT)x < pitch; x++)
4078 {
4079 if (x < ft_face->glyph->bitmap.width)
4080 dst[x] = (src[x / 8] & (1 << ( (7 - (x % 8))))) ? 0xff : 0;
4081 else
4082 dst[x] = 0;
4083 }
4084 src += ft_face->glyph->bitmap.pitch;
4085 dst += pitch;
4086 }
4087 break;
4088 }
4090 {
4091 ft_bitmap.width = width;
4092 ft_bitmap.rows = height;
4093 ft_bitmap.pitch = pitch;
4094 ft_bitmap.pixel_mode = FT_PIXEL_MODE_GRAY;
4095 ft_bitmap.buffer = pvBuf;
4096
4098 if (needsTransform)
4099 {
4100 FT_Outline_Transform(&ft_face->glyph->outline, &transMat);
4101 }
4102 FT_Outline_Translate(&ft_face->glyph->outline, -left, -bottom );
4103 RtlZeroMemory(ft_bitmap.buffer, cjBuf);
4104 FT_Outline_Get_Bitmap(g_FreeTypeLibrary, &ft_face->glyph->outline, &ft_bitmap);
4106
4108 mult = 4;
4109 else if (iFormat == GGO_GRAY4_BITMAP)
4110 mult = 16;
4111 else if (iFormat == GGO_GRAY8_BITMAP)
4112 mult = 64;
4113 else
4114 {
4115 return GDI_ERROR;
4116 }
4117
4118 start = pvBuf;
4119 for (row = 0; row < height; row++)
4120 {
4121 ptr = start;
4122 for (col = 0; col < width; col++, ptr++)
4123 {
4124 *ptr = (((int)*ptr) * mult + 128) / 256;
4125 }
4126 start += pitch;
4127 }
4128
4129 break;
4130 }
4131 default:
4132 DPRINT1("Loaded glyph format %x\n", ft_face->glyph->format);
4133 return GDI_ERROR;
4134 }
4135
4136 break;
4137 }
4138
4139 case GGO_NATIVE:
4140 {
4141 FT_Outline *outline = &ft_face->glyph->outline;
4142
4143 if (cjBuf == 0) pvBuf = NULL; /* This is okay, need cjBuf to allocate. */
4144
4146 if (needsTransform && pvBuf) FT_Outline_Transform(outline, &transMat);
4147
4149
4150 if (!pvBuf || !cjBuf)
4151 {
4153 break;
4154 }
4155 if (needed > cjBuf)
4156 {
4158 return GDI_ERROR;
4159 }
4162 break;
4163 }
4164
4165 case GGO_BEZIER:
4166 {
4167 FT_Outline *outline = &ft_face->glyph->outline;
4168 if (cjBuf == 0) pvBuf = NULL;
4169
4170 if (needsTransform && pvBuf)
4171 {
4173 FT_Outline_Transform(outline, &transMat);
4175 }
4177
4178 if (!pvBuf || !cjBuf)
4179 break;
4180 if (needed > cjBuf)
4181 return GDI_ERROR;
4182
4184 break;
4185 }
4186
4187 default:
4188 DPRINT1("Unsupported format %u\n", iFormat);
4189 return GDI_ERROR;
4190 }
4191
4192 DPRINT("ftGdiGetGlyphOutline END and needed %lu\n", needed);
4193
4194 if (gm.gmBlackBoxX == 0)
4195 gm.gmBlackBoxX = 1;
4196 if (gm.gmBlackBoxY == 0)
4197 gm.gmBlackBoxY = 1;
4198
4199 *pgm = gm;
4200 return needed;
4201}
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:3585
FT_Library g_FreeTypeLibrary
Definition: freetype.c:55
static unsigned int get_bezier_glyph_outline(FT_Outline *outline, unsigned int buflen, char *buf)
Definition: freetype.c:3320
static unsigned int get_native_glyph_outline(FT_Outline *outline, unsigned int buflen, char *buf)
Definition: freetype.c:3247
static VOID FASTCALL IntMatrixFromMx(FT_Matrix *pmat, const MATRIX *pmx)
Definition: freetype.c:724
static VOID FASTCALL IntEscapeMatrix(FT_Matrix *pmat, LONG lfEscapement)
Definition: freetype.c:711
static FT_UInt FASTCALL get_glyph_index_flagged(FT_Face face, FT_ULong code, DWORD indexed_flag, DWORD flags)
Definition: freetype.c:3703
static const FT_Matrix identityMat
Definition: freetype.c:49
static __inline FT_Fixed FT_FixedFromFIXED(FIXED f)
Definition: freetype.c:382
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 5667 of file freetype.c.

5670{
5671 DWORD Count = 0;
5672 INT i = 0;
5673 FT_Face face = Font->SharedFace->Face;
5674
5675 if (FT_HAS_KERNING(face) && face->charmap->encoding == FT_ENCODING_UNICODE)
5676 {
5677 FT_UInt previous_index = 0, glyph_index = 0;
5678 FT_ULong char_code, char_previous;
5679 FT_Vector delta;
5680
5681 char_previous = char_code = FT_Get_First_Char(face, &glyph_index);
5682
5684
5685 while (glyph_index)
5686 {
5687 if (previous_index && glyph_index)
5688 {
5689 FT_Get_Kerning(face, previous_index, glyph_index, FT_KERNING_DEFAULT, &delta);
5690
5691 if (pKerningPair && cPairs)
5692 {
5693 pKerningPair[i].wFirst = char_previous;
5694 pKerningPair[i].wSecond = char_code;
5695 pKerningPair[i].iKernAmount = delta.x;
5696 i++;
5697 if (i == cPairs) break;
5698 }
5699 Count++;
5700 }
5701 previous_index = glyph_index;
5702 char_previous = char_code;
5703 char_code = FT_Get_Next_Char(face, char_code, &glyph_index);
5704 }
5706 }
5707 return Count;
5708}
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 3073 of file freetype.c.

3074{
3075 if ( lprs )
3076 {
3077 lprs->nSize = sizeof(RASTERIZER_STATUS);
3078 lprs->wFlags = TT_AVAILABLE | TT_ENABLED;
3079 lprs->nLanguageID = gusLanguageID;
3080 return TRUE;
3081 }
3083 return FALSE;
3084}
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
USHORT gusLanguageID
Definition: init.c:12
#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 4368 of file freetype.c.

4372{
4373 PDC_ATTR pdcattr;
4374 UINT Ret = DEFAULT_CHARSET;
4375 INT i;
4376 HFONT hFont;
4377 PTEXTOBJ TextObj;
4378 PFONTGDI FontGdi;
4380 TT_OS2 *pOS2;
4381 FT_Face Face;
4382 CHARSETINFO csi;
4383 DWORD cp, fs0;
4384 USHORT usACP, usOEM;
4385
4386 pdcattr = Dc->pdcattr;
4387 hFont = pdcattr->hlfntNew;
4388 TextObj = RealizeFontInit(hFont);
4389
4390 if (!TextObj)
4391 {
4393 return Ret;
4394 }
4395 FontGdi = ObjToGDI(TextObj->Font, FONT);
4396 Face = FontGdi->SharedFace->Face;
4397 TEXTOBJ_UnlockText(TextObj);
4398
4399 memset(&fs, 0, sizeof(FONTSIGNATURE));
4401 pOS2 = FT_Get_Sfnt_Table(Face, ft_sfnt_os2);
4402 if (NULL != pOS2)
4403 {
4404 fs.fsCsb[0] = pOS2->ulCodePageRange1;
4405 fs.fsCsb[1] = pOS2->ulCodePageRange2;
4406 fs.fsUsb[0] = pOS2->ulUnicodeRange1;
4407 fs.fsUsb[1] = pOS2->ulUnicodeRange2;
4408 fs.fsUsb[2] = pOS2->ulUnicodeRange3;
4409 fs.fsUsb[3] = pOS2->ulUnicodeRange4;
4410 if (pOS2->version == 0)
4411 {
4412 FT_UInt dummy;
4413
4414 if (FT_Get_First_Char( Face, &dummy ) < 0x100)
4415 fs.fsCsb[0] |= FS_LATIN1;
4416 else
4417 fs.fsCsb[0] |= FS_SYMBOL;
4418 }
4419 }
4420 pOS2 = NULL;
4422 DPRINT("Csb 1=%x 0=%x\n", fs.fsCsb[1],fs.fsCsb[0]);
4423 if (fs.fsCsb[0] == 0)
4424 { /* Let's see if we can find any interesting cmaps */
4425 for (i = 0; i < Face->num_charmaps; i++)
4426 {
4427 switch (Face->charmaps[i]->encoding)
4428 {
4429 case FT_ENCODING_UNICODE:
4430 case FT_ENCODING_APPLE_ROMAN:
4431 fs.fsCsb[0] |= FS_LATIN1;
4432 break;
4433 case FT_ENCODING_MS_SYMBOL:
4434 fs.fsCsb[0] |= FS_SYMBOL;
4435 break;
4436 default:
4437 break;
4438 }
4439 }
4440 }
4441 if (lpSig)
4442 {
4443 RtlCopyMemory(lpSig, &fs, sizeof(FONTSIGNATURE));
4444 }
4445
4446 RtlGetDefaultCodePage(&usACP, &usOEM);
4447 cp = usACP;
4448
4450 if (csi.fs.fsCsb[0] & fs.fsCsb[0])
4451 {
4452 DPRINT("Hit 1\n");
4453 Ret = csi.ciCharset;
4454 goto Exit;
4455 }
4456
4457 for (i = 0; i < MAXTCIINDEX; i++)
4458 {
4459 fs0 = 1L << i;
4460 if (fs.fsCsb[0] & fs0)
4461 {
4462 if (IntTranslateCharsetInfo(&fs0, &csi, TCI_SRCFONTSIG))
4463 {
4464 // *cp = csi.ciACP;
4465 DPRINT("Hit 2\n");
4466 Ret = csi.ciCharset;
4467 goto Exit;
4468 }
4469 else
4470 DPRINT1("TCI failing on %x\n", fs0);
4471 }
4472 }
4473Exit:
4474 DPRINT("CharSet %u CodePage %u\n", csi.ciCharset, csi.ciACP);
4475 return (MAKELONG(csi.ciACP, csi.ciCharset));
4476}
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 4555 of file freetype.c.

4558{
4559 PDC dc;
4560 PDC_ATTR pdcattr;
4561 PTEXTOBJ TextObj;
4562 PFONTGDI FontGDI;
4563 FT_Face Face;
4564 TT_OS2 *pOS2;
4565 TT_HoriHeader *pHori;
4567 ULONG Error;
4569 LOGFONTW *plf;
4570
4571 if (!ptmwi)
4572 {
4574 return FALSE;
4575 }
4576 RtlZeroMemory(ptmwi, sizeof(TMW_INTERNAL));
4577
4578 if (!(dc = DC_LockDc(hDC)))
4579 {
4581 return FALSE;
4582 }
4583 pdcattr = dc->pdcattr;
4584 TextObj = RealizeFontInit(pdcattr->hlfntNew);
4585 if (NULL != TextObj)
4586 {
4587 plf = &TextObj->logfont.elfEnumLogfontEx.elfLogFont;
4588 FontGDI = ObjToGDI(TextObj->Font, FONT);
4589
4590 Face = FontGDI->SharedFace->Face;
4591
4592 // NOTE: GetTextMetrics simply ignores lfEscapement and XFORM.
4594 Error = IntRequestFontSize(dc, FontGDI, plf->lfWidth, plf->lfHeight);
4595 FT_Set_Transform(Face, NULL, NULL);
4596
4598
4599 if (0 != Error)
4600 {
4601 DPRINT1("Error in setting pixel sizes: %u\n", Error);
4603 }
4604 else
4605 {
4607
4609 pOS2 = FT_Get_Sfnt_Table(Face, ft_sfnt_os2);
4610 if (NULL == pOS2)
4611 {
4612 DPRINT1("Can't find OS/2 table - not TT font?\n");
4614 }
4615
4616 pHori = FT_Get_Sfnt_Table(Face, ft_sfnt_hhea);
4617 if (NULL == pHori)
4618 {
4619 DPRINT1("Can't find HHEA table - not TT font?\n");
4621 }
4622
4623 Error = FT_Get_WinFNT_Header(Face, &Win);
4624
4625 if (NT_SUCCESS(Status) || !Error)
4626 {
4627 FillTM(&ptmwi->TextMetric, FontGDI, pOS2, pHori, !Error ? &Win : 0);
4628
4629 /* FIXME: Fill Diff member */
4630 }
4631
4633 }
4634 TEXTOBJ_UnlockText(TextObj);
4635 }
4636 else
4637 {
4639 }
4640 DC_UnlockDc(dc);
4641
4642 if (!NT_SUCCESS(Status))
4643 {
4645 return FALSE;
4646 }
4647 return TRUE;
4648}
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:2096
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 5648 of file freetype.c.

5649{
5650 if (FT_HAS_FIXED_SIZES(Font->SharedFace->Face))
5651 Info->iTechnology = RI_TECH_BITMAP;
5652 else
5653 {
5654 if (FT_IS_SCALABLE(Font->SharedFace->Face))
5655 Info->iTechnology = RI_TECH_SCALABLE;
5656 else
5657 Info->iTechnology = RI_TECH_FIXED;
5658 }
5659 Info->iUniq = Font->FontObj.iUniq;
5660 Info->dwUnknown = -1;
5661 return TRUE;
5662}
#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 4481 of file freetype.c.

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

Referenced by NtGdiGetFontUnicodeRanges().

◆ FTVectorToPOINTFX()

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

Definition at line 368 of file freetype.c.

369{
370 pt->x.value = vec->x >> 6;
371 pt->x.fract = (vec->x & 0x3f) << 10;
372 pt->x.fract |= ((pt->x.fract >> 6) | (pt->x.fract >> 12));
373 pt->y.value = vec->y >> 6;
374 pt->y.fract = (vec->y & 0x3f) << 10;
375 pt->y.fract |= ((pt->y.fract >> 6) | (pt->y.fract >> 12));
376}
#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 3320 of file freetype.c.

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

3689{
3690 FT_UInt ret;
3691
3692 if (face_has_symbol_charmap(ft_face))
3693 {
3694 ret = get_glyph_index_symbol(ft_face, glyph);
3695 if (ret != 0)
3696 return ret;
3697 }
3698
3699 return FT_Get_Char_Index(ft_face, glyph);
3700}
static FT_UInt FASTCALL get_glyph_index_symbol(FT_Face ft_face, UINT glyph)
Definition: freetype.c:3674
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 3703 of file freetype.c.

3704{
3705 FT_UInt glyph_index;
3706 if (flags & indexed_flag)
3707 {
3708 glyph_index = code;
3709 }
3710 else
3711 {
3712 glyph_index = get_glyph_index(face, code);
3713 }
3714 return glyph_index;
3715}
static FT_UInt FASTCALL get_glyph_index(FT_Face ft_face, UINT glyph)
Definition: freetype.c:3688
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 3674 of file freetype.c.

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

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 3247 of file freetype.c.

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

2953{
2955 PFONT_ENTRY CurrentEntry;
2956 FONTGDI *FontGDI;
2957 FONTFAMILYINFO InfoEntry;
2958 LONG Count = *pCount;
2959
2960 for (Entry = Head->Flink; Entry != Head; Entry = Entry->Flink)
2961 {
2962 CurrentEntry = CONTAINING_RECORD(Entry, FONT_ENTRY, ListEntry);
2963 FontGDI = CurrentEntry->Font;
2964 ASSERT(FontGDI);
2965
2966 if (LogFont->lfCharSet != DEFAULT_CHARSET &&
2967 LogFont->lfCharSet != FontGDI->CharSet)
2968 {
2969 continue; /* charset mismatch */
2970 }
2971
2972 /* get one info entry */
2973 FontFamilyFillInfo(&InfoEntry, NULL, NULL, FontGDI);
2974
2975 if (LogFont->lfFaceName[0] != UNICODE_NULL)
2976 {
2977 /* check name */
2978 if (_wcsnicmp(LogFont->lfFaceName,
2980 RTL_NUMBER_OF(LogFont->lfFaceName) - 1) != 0 &&
2981 _wcsnicmp(LogFont->lfFaceName,
2982 InfoEntry.EnumLogFontEx.elfFullName,
2983 RTL_NUMBER_OF(LogFont->lfFaceName) - 1) != 0)
2984 {
2985 continue;
2986 }
2987 }
2988
2989 if (NominalName)
2990 {
2991 /* store the nominal name */
2993 sizeof(InfoEntry.EnumLogFontEx.elfLogFont.lfFaceName),
2994 NominalName);
2995 }
2996
2997 /* store one entry to Info */
2998 if (0 <= Count && Count < MaxCount)
2999 {
3000 RtlCopyMemory(&Info[Count], &InfoEntry, sizeof(InfoEntry));
3001 }
3002 Count++;
3003 }
3004
3005 *pCount = Count;
3006
3007 return TRUE;
3008}
#define RTL_NUMBER_OF(x)
Definition: RtlRegistry.c:12
static void FASTCALL FontFamilyFillInfo(PFONTFAMILYINFO Info, LPCWSTR FaceName, LPCWSTR FullName, PFONTGDI FontGDI)
Definition: freetype.c:2763
_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 3011 of file freetype.c.

3015{
3016 PLIST_ENTRY pEntry, pHead = &g_FontSubstListHead;
3017 PFONTSUBST_ENTRY pCurrentEntry;
3018 PUNICODE_STRING pFromW, pToW;
3019 LOGFONTW lf = *LogFont;
3021
3022 for (pEntry = pHead->Flink; pEntry != pHead; pEntry = pEntry->Flink)
3023 {
3024 pCurrentEntry = CONTAINING_RECORD(pEntry, FONTSUBST_ENTRY, ListEntry);
3025
3026 pFromW = &pCurrentEntry->FontNames[FONTSUBST_FROM];
3027 if (LogFont->lfFaceName[0] != UNICODE_NULL)
3028 {
3029 /* check name */
3030 if (_wcsicmp(LogFont->lfFaceName, pFromW->Buffer) != 0)
3031 continue; /* mismatch */
3032 }
3033
3034 pToW = &pCurrentEntry->FontNames[FONTSUBST_TO];
3035 if (RtlEqualUnicodeString(pFromW, pToW, TRUE) &&
3036 pCurrentEntry->CharSets[FONTSUBST_FROM] ==
3037 pCurrentEntry->CharSets[FONTSUBST_TO])
3038 {
3039 /* identical mapping */
3040 continue;
3041 }
3042
3043 /* substitute and get the real name */
3044 IntUnicodeStringToBuffer(lf.lfFaceName, sizeof(lf.lfFaceName), pFromW);
3046 if (LogFont->lfCharSet != DEFAULT_CHARSET && LogFont->lfCharSet != lf.lfCharSet)
3047 continue;
3048
3049 /* search in global fonts */
3051 GetFontFamilyInfoForList(&lf, Info, pFromW->Buffer, pCount, MaxCount, &g_FontListHead);
3053
3054 /* search in private fonts */
3055 IntLockProcessPrivateFonts(Win32Process);
3056 GetFontFamilyInfoForList(&lf, Info, pFromW->Buffer, pCount, MaxCount,
3057 &Win32Process->PrivateFontListHead);
3058 IntUnLockProcessPrivateFonts(Win32Process);
3059
3060 if (LogFont->lfFaceName[0] != UNICODE_NULL)
3061 {
3062 /* it's already matched to the exact name and charset if the name
3063 was specified at here, then so don't scan more for another name */
3064 break;
3065 }
3066 }
3067
3068 return TRUE;
3069}
static BOOLEAN FASTCALL GetFontFamilyInfoForList(const LOGFONTW *LogFont, PFONTFAMILYINFO Info, LPCWSTR NominalName, LONG *pCount, LONG MaxCount, PLIST_ENTRY Head)
Definition: freetype.c:2947
static LIST_ENTRY g_FontListHead
Definition: freetype.c:66
static BOOL SubstituteFontRecurse(LOGFONTW *pLogFont)
Definition: freetype.c:853
static VOID IntUnicodeStringToBuffer(LPWSTR pszBuffer, SIZE_T cbBuffer, const UNICODE_STRING *pString)
Definition: freetype.c:815
#define IntUnLockGlobalFonts()
Definition: freetype.c:73
#define IntLockGlobalFonts()
Definition: freetype.c:70
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 4694 of file freetype.c.

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

6547{
6548 BOOL bResult;
6549 DC *dc;
6550
6551 // TODO: Write test-cases to exactly match real Windows in different
6552 // bad parameters (e.g. does Windows check the DC or the RECT first?).
6553 dc = DC_LockDc(hDC);
6554 if (!dc)
6555 {
6557 return FALSE;
6558 }
6559
6560 bResult = IntExtTextOutW( dc,
6561 XStart,
6562 YStart,
6563 fuOptions,
6564 lprc,
6565 String,
6566 Count,
6567 Dx,
6568 dwCodePage );
6569
6570 DC_UnlockDc(dc);
6571
6572 return bResult;
6573}
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:6025
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFSTRING String
Definition: wdfdevice.h:2433
_In_ int _Inout_ LPRECT lprc
Definition: winuser.h:4465

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

◆ InitFontSupport()

BOOL FASTCALL InitFontSupport ( VOID  )

Definition at line 657 of file freetype.c.

658{
659 ULONG ulError;
660
664 /* Fast Mutexes must be allocated from non paged pool */
666 if (g_FontListLock == NULL)
667 {
668 return FALSE;
669 }
670
673 if (g_FreeTypeLock == NULL)
674 {
675 return FALSE;
676 }
678
680 if (ulError)
681 {
682 DPRINT1("FT_Init_FreeType failed with error code 0x%x\n", ulError);
683 return FALSE;
684 }
685
687 {
688 DPRINT1("Fonts registry is empty.\n");
689
690 /* Load font(s) with writing registry */
692 }
693
694 IntLoadFontSubstList(&g_FontSubstListHead);
695
696#if DBG
697 DumpFontInfo(TRUE);
698#endif
699
700 return TRUE;
701}
#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:64
BOOL FASTCALL IntLoadFontSubstList(PLIST_ENTRY pHead)
Definition: freetype.c:510
static UINT g_FontCacheNumEntries
Definition: freetype.c:94
VOID FASTCALL IntLoadSystemFonts(VOID)
Definition: freetype.c:892
static LIST_ENTRY g_FontCacheListHead
Definition: freetype.c:93
static PFAST_MUTEX g_FontListLock
Definition: freetype.c:67
BOOL FASTCALL IntLoadFontsInRegistry(VOID)
Definition: freetype.c:1637
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 InitializeGreCSRSS().

◆ IntAddNameFromFamInfo()

static VOID IntAddNameFromFamInfo ( LPWSTR  psz,
FONTFAMILYINFO FamInfo 
)
static

Definition at line 5367 of file freetype.c.

5368{
5370 if (FamInfo->EnumLogFontEx.elfStyle[0] &&
5371 _wcsicmp(FamInfo->EnumLogFontEx.elfStyle, L"Regular") != 0)
5372 {
5373 wcscat(psz, L" ");
5374 wcscat(psz, FamInfo->EnumLogFontEx.elfStyle);
5375 }
5376}
#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 172 of file freetype.c.

173{
174 UINT i;
175
176 if (uCodePage == CP_OEMCP)
177 return OEM_CHARSET;
178
179 if (uCodePage == CP_MACCP)
180 return MAC_CHARSET;
181
182 for (i = 0; i < MAXTCIINDEX; ++i)
183 {
184 if (g_FontTci[i].ciACP == 0)
185 continue;
186
187 if (g_FontTci[i].ciACP == uCodePage)
188 return g_FontTci[i].ciCharset;
189 }
190
191 return DEFAULT_CHARSET;
192}
#define CP_OEMCP
Definition: freetype.c:166
static const CHARSETINFO g_FontTci[MAXTCIINDEX]
Definition: freetype.c:124
#define CP_MACCP
Definition: freetype.c:167
#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 1963 of file freetype.c.

1964{
1966}
static BOOL g_RenderingEnabled
Definition: freetype.c:68
_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 5978 of file freetype.c.

5985{
5986 RECTL DestRect;
5987 SURFACE *psurf = dc->dclevel.pSurface;
5988
5990 ASSERT(psurf != NULL);
5991
5992 if (Width < 0)
5993 {
5994 X += Width;
5995 Width = -Width;
5996 }
5997
5998 if (Height < 0)
5999 {
6000 Y += Height;
6001 Height = -Height;
6002 }
6003
6004 DestRect.left = X;
6005 DestRect.right = X + Width;
6006 DestRect.top = Y;
6007 DestRect.bottom = Y + Height;
6008
6009 IntEngBitBlt(&psurf->SurfObj,
6010 NULL,
6011 NULL,
6012 (CLIPOBJ *)&dc->co,
6013 NULL,
6014 &DestRect,
6015 NULL,
6016 NULL,
6017 BrushObj,
6018 &PointZero,
6020}
#define ASSERT_DC_PREPARED(pdc)
Definition: dc.h:300
#define Y(I)
static POINTL PointZero
Definition: freetype.c:50
#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:89
_In_ HFONT _Out_ PUINT Height
Definition: font.h:88
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 5942 of file freetype.c.

5947{
5948 SURFACE *psurf = dc->dclevel.pSurface;
5949 RECT Rect;
5950 UINT i;
5951 INT x, y;
5952
5954 ASSERT(psurf != NULL);
5955
5956 Rect.left = Rect.right = pPoints[0].x;
5957 Rect.top = Rect.bottom = pPoints[0].y;
5958 for (i = 1; i < cPoints; ++i)
5959 {
5960 x = pPoints[i].x;
5961 if (x < Rect.left)
5962 Rect.left = x;
5963 else if (Rect.right < x)
5964 Rect.right = x;
5965
5966 y = pPoints[i].y;
5967 if (y < Rect.top)
5968 Rect.top = y;
5969 else if (Rect.bottom < y)
5970 Rect.bottom = y;
5971 }
5972
5973 IntFillPolygon(dc, dc->dclevel.pSurface, BrushObj, pPoints, cPoints, Rect, &PointZero);
5974}
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 711 of file freetype.c.

712{
713 FT_Vector vecAngle;
714 /* Convert the angle in tenths of degrees into degrees as a 16.16 fixed-point value */
715 FT_Angle angle = INT_TO_FIXED(lfEscapement) / 10;
716 FT_Vector_Unit(&vecAngle, angle);
717 pmat->xx = vecAngle.x;
718 pmat->xy = -vecAngle.y;
719 pmat->yx = -pmat->xy;
720 pmat->yy = pmat->xx;
721}
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 6025 of file freetype.c.

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