ReactOS 0.4.15-dev-8131-g4988de4
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 HIGH_SURROGATE_MIN   0xD800U
 
#define HIGH_SURROGATE_MAX   0xDBFFU
 
#define LOW_SURROGATE_MIN   0xDC00U
 
#define LOW_SURROGATE_MAX   0xDFFFU
 
#define IS_HIGH_SURROGATE(ch0)   (HIGH_SURROGATE_MIN <= (ch0) && (ch0) <= HIGH_SURROGATE_MAX)
 
#define IS_LOW_SURROGATE(ch1)   (LOW_SURROGATE_MIN <= (ch1) && (ch1) <= LOW_SURROGATE_MAX)
 
#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   512
 

Typedefs

typedef struct FONT_NAMES FONT_NAMES
 
typedef struct FONT_NAMESLPFONT_NAMES
 

Functions

static DWORD Utf32FromSurrogatePair (DWORD ch0, DWORD ch1)
 
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 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, IN BOOL bNoTransform)
 
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 55 of file freetype.c.

◆ ASSERT_FREETYPE_LOCK_HELD

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

Definition at line 100 of file freetype.c.

◆ ASSERT_FREETYPE_LOCK_NOT_HELD

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

Definition at line 103 of file freetype.c.

◆ ASSERT_GLOBALFONTS_LOCK_HELD

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

Definition at line 91 of file freetype.c.

◆ CP_MACCP

#define CP_MACCP   2

Definition at line 182 of file freetype.c.

◆ CP_OEMCP

#define CP_OEMCP   1

Definition at line 181 of file freetype.c.

◆ CP_SYMBOL

#define CP_SYMBOL   42

Definition at line 137 of file freetype.c.

◆ EMUBOLD_NEEDED

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

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

◆ GOT_PENALTY

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

Definition at line 4653 of file freetype.c.

◆ HIGH_SURROGATE_MAX

#define HIGH_SURROGATE_MAX   0xDBFFU

Definition at line 40 of file freetype.c.

◆ HIGH_SURROGATE_MIN

#define HIGH_SURROGATE_MIN   0xD800U

Definition at line 39 of file freetype.c.

◆ IntLockFreeType

Definition at line 94 of file freetype.c.

◆ IntLockGlobalFonts

Definition at line 85 of file freetype.c.

◆ IntUnLockFreeType

Definition at line 97 of file freetype.c.

◆ IntUnLockGlobalFonts

Definition at line 88 of file freetype.c.

◆ IS_HIGH_SURROGATE

#define IS_HIGH_SURROGATE (   ch0)    (HIGH_SURROGATE_MIN <= (ch0) && (ch0) <= HIGH_SURROGATE_MAX)

Definition at line 44 of file freetype.c.

◆ IS_LOW_SURROGATE

#define IS_LOW_SURROGATE (   ch1)    (LOW_SURROGATE_MIN <= (ch1) && (ch1) <= LOW_SURROGATE_MAX)

Definition at line 45 of file freetype.c.

◆ LOW_SURROGATE_MAX

#define LOW_SURROGATE_MAX   0xDFFFU

Definition at line 42 of file freetype.c.

◆ LOW_SURROGATE_MIN

#define LOW_SURROGATE_MIN   0xDC00U

Definition at line 41 of file freetype.c.

◆ MAX_FONT_CACHE

#define MAX_FONT_CACHE   256

Definition at line 106 of file freetype.c.

◆ MAXTCIINDEX

#define MAXTCIINDEX   32

Definition at line 138 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 1062 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   512

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

2561{
2562 /* FIXME: Add more and fix if wrong */
2563 switch (PRIMARYLANGID(LangID))
2564 {
2565 case LANG_CHINESE:
2566 switch (SUBLANGID(LangID))
2567 {
2569 return CHINESEBIG5_CHARSET;
2571 default:
2572 break;
2573 }
2574 return GB2312_CHARSET;
2575
2576 case LANG_CZECH: case LANG_HUNGARIAN: case LANG_POLISH:
2577 case LANG_SLOVAK: case LANG_SLOVENIAN: case LANG_ROMANIAN:
2578 return EASTEUROPE_CHARSET;
2579
2581 case LANG_SERBIAN: case LANG_UKRAINIAN:
2582 return RUSSIAN_CHARSET;
2583
2584 case LANG_ARABIC: return ARABIC_CHARSET;
2585 case LANG_GREEK: return GREEK_CHARSET;
2586 case LANG_HEBREW: return HEBREW_CHARSET;
2587 case LANG_JAPANESE: return SHIFTJIS_CHARSET;
2588 case LANG_KOREAN: return JOHAB_CHARSET;
2589 case LANG_TURKISH: return TURKISH_CHARSET;
2590 case LANG_THAI: return THAI_CHARSET;
2591 case LANG_LATVIAN: return BALTIC_CHARSET;
2593
2594 case LANG_ENGLISH: case LANG_BASQUE: case LANG_CATALAN:
2595 case LANG_DANISH: case LANG_DUTCH: case LANG_FINNISH:
2596 case LANG_FRENCH: case LANG_GERMAN: case LANG_ITALIAN:
2598 case LANG_SWEDISH: default:
2599 return ANSI_CHARSET;
2600 }
2601}
#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 377 of file freetype.c.

378{
379 CleanupFontEntryEx(FontEntry, FontEntry->Font);
380}
static VOID FASTCALL CleanupFontEntryEx(PFONT_ENTRY FontEntry, PFONTGDI FontGDI)
Definition: freetype.c:357
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 357 of file freetype.c.

358{
359 // PFONTGDI FontGDI = FontEntry->Font;
360 PSHARED_FACE SharedFace = FontGDI->SharedFace;
361
362 if (FontGDI->Filename)
364
365 if (FontEntry->StyleName.Buffer)
366 RtlFreeUnicodeString(&FontEntry->StyleName);
367
368 if (FontEntry->FaceName.Buffer)
369 RtlFreeUnicodeString(&FontEntry->FaceName);
370
371 EngFreeMem(FontGDI);
372 SharedFace_Release(SharedFace);
373 ExFreePoolWithTag(FontEntry, TAG_FONT);
374}
static void SharedFace_Release(PSHARED_FACE Ptr)
Definition: freetype.c:333
#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 845 of file freetype.c.

846{
848 UNICODE_STRING Tmp;
849
850 Tmp.Buffer = ExAllocatePoolWithTag(PagedPool, Source->MaximumLength, TAG_USTR);
851 if (Tmp.Buffer)
852 {
853 Tmp.MaximumLength = Source->MaximumLength;
854 Tmp.Length = 0;
856
860
862 }
863
864 return Status;
865}
LONG NTSTATUS
Definition: precomp.h:26
#define TAG_USTR
Definition: libsupp.c:997
#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

Referenced by IntGdiAddFontResourceEx(), and IntGetFontLocalizedName().

◆ EqualFamilyInfo()

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

Definition at line 5309 of file freetype.c.

5310{
5311 const ENUMLOGFONTEXW *pLog1 = &pInfo1->EnumLogFontEx;
5312 const ENUMLOGFONTEXW *pLog2 = &pInfo2->EnumLogFontEx;
5313 const LOGFONTW *plf1 = &pLog1->elfLogFont;
5314 const LOGFONTW *plf2 = &pLog2->elfLogFont;
5315
5316 if (_wcsicmp(plf1->lfFaceName, plf2->lfFaceName) != 0)
5317 {
5318 return FALSE;
5319 }
5320
5321 if (_wcsicmp(pLog1->elfStyle, pLog2->elfStyle) != 0)
5322 {
5323 return FALSE;
5324 }
5325
5326 return TRUE;
5327}
#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 2095 of file freetype.c.

2096{
2097 int i;
2098
2099 for(i = 0; i < ft_face->num_charmaps; i++)
2100 {
2101 if (ft_face->charmaps[i]->platform_id == TT_PLATFORM_MICROSOFT &&
2102 ft_face->charmaps[i]->encoding == FT_ENCODING_MS_SYMBOL)
2103 {
2104 return TRUE;
2105 }
2106 }
2107 return FALSE;
2108}
#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 2111 of file freetype.c.

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

5006{
5007 ULONG Penalty;
5009 PFONT_ENTRY CurrentEntry;
5010 FONTGDI *FontGDI;
5011 OUTLINETEXTMETRICW *Otm = NULL;
5012 UINT OtmSize, OldOtmSize = 0;
5013 FT_Face Face;
5014
5015 ASSERT(FontObj);
5016 ASSERT(MatchPenalty);
5017 ASSERT(LogFont);
5018 ASSERT(Head);
5019
5020 /* Start with a pretty big buffer */
5021 OldOtmSize = 0x200;
5022 Otm = ExAllocatePoolWithTag(PagedPool, OldOtmSize, GDITAG_TEXT);
5023
5024 /* get the FontObj of lowest penalty */
5025 for (Entry = Head->Flink; Entry != Head; Entry = Entry->Flink)
5026 {
5027 CurrentEntry = CONTAINING_RECORD(Entry, FONT_ENTRY, ListEntry);
5028
5029 FontGDI = CurrentEntry->Font;
5030 ASSERT(FontGDI);
5031 Face = FontGDI->SharedFace->Face;
5032
5033 /* get text metrics */
5034 OtmSize = IntGetOutlineTextMetrics(FontGDI, 0, NULL);
5035 if (OtmSize > OldOtmSize)
5036 {
5037 if (Otm)
5040 }
5041
5042 /* update FontObj if lowest penalty */
5043 if (Otm)
5044 {
5046 IntRequestFontSize(NULL, FontGDI, LogFont->lfWidth, LogFont->lfHeight);
5048
5049 OtmSize = IntGetOutlineTextMetrics(FontGDI, OtmSize, Otm);
5050 if (!OtmSize)
5051 continue;
5052
5053 OldOtmSize = OtmSize;
5054
5055 Penalty = GetFontPenalty(LogFont, Otm, Face->style_name);
5056 if (*MatchPenalty == 0xFFFFFFFF || Penalty < *MatchPenalty)
5057 {
5058 *FontObj = GDIToObj(FontGDI, FONT);
5059 *MatchPenalty = Penalty;
5060 }
5061 }
5062 }
5063
5064 if (Otm)
5066}
#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:4657
static FT_Error IntRequestFontSize(PDC dc, PFONTGDI FontGDI, LONG lfWidth, LONG lfHeight)
Definition: freetype.c:3416
#define IntUnLockFreeType()
Definition: freetype.c:97
#define IntLockFreeType()
Definition: freetype.c:94
INT FASTCALL IntGetOutlineTextMetrics(PFONTGDI FontGDI, UINT Size, OUTLINETEXTMETRICW *Otm)
Definition: freetype.c:2413
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 2778 of file freetype.c.

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

398{
399 return (FT_Fixed)((long)f.value << 16 | (unsigned long)f.fract);
400}
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 4615 of file freetype.c.

4621{
4623 FT_Face Face = FontGdi->SharedFace->Face;
4624
4626
4627 if (FT_IS_SFNT(Face))
4628 {
4629 if (Table)
4630 Table = Table >> 24 | Table << 24 | (Table >> 8 & 0xFF00) |
4631 (Table << 8 & 0xFF0000);
4632
4633 if (!Buffer) Size = 0;
4634
4635 if (Buffer && Size)
4636 {
4638 FT_ULong Needed = 0;
4639
4640 Error = FT_Load_Sfnt_Table(Face, Table, Offset, NULL, &Needed);
4641
4642 if ( !Error && Needed < Size) Size = Needed;
4643 }
4644 if (!FT_Load_Sfnt_Table(Face, Table, Offset, Buffer, &Size))
4645 Result = Size;
4646 }
4647
4649
4650 return Result;
4651}
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 3694 of file freetype.c.

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

5633{
5634 DWORD Count = 0;
5635 INT i = 0;
5636 FT_Face face = Font->SharedFace->Face;
5637
5638 if (FT_HAS_KERNING(face) && face->charmap->encoding == FT_ENCODING_UNICODE)
5639 {
5640 FT_UInt previous_index = 0, glyph_index = 0;
5641 FT_ULong char_code, char_previous;
5642 FT_Vector delta;
5643
5644 char_previous = char_code = FT_Get_First_Char(face, &glyph_index);
5645
5647
5648 while (glyph_index)
5649 {
5650 if (previous_index && glyph_index)
5651 {
5652 FT_Get_Kerning(face, previous_index, glyph_index, FT_KERNING_DEFAULT, &delta);
5653
5654 if (pKerningPair && cPairs)
5655 {
5656 pKerningPair[i].wFirst = char_previous;
5657 pKerningPair[i].wSecond = char_code;
5658 pKerningPair[i].iKernAmount = delta.x;
5659 i++;
5660 if (i == cPairs) break;
5661 }
5662 Count++;
5663 }
5664 previous_index = glyph_index;
5665 char_previous = char_code;
5666 char_code = FT_Get_Next_Char(face, char_code, &glyph_index);
5667 }
5669 }
5670 return Count;
5671}
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 3088 of file freetype.c.

3089{
3090 if ( lprs )
3091 {
3092 lprs->nSize = sizeof(RASTERIZER_STATUS);
3093 lprs->wFlags = TT_AVAILABLE | TT_ENABLED;
3094 lprs->nLanguageID = gusLanguageID;
3095 return TRUE;
3096 }
3098 return FALSE;
3099}
#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 4331 of file freetype.c.

4335{
4336 PDC_ATTR pdcattr;
4337 UINT Ret = DEFAULT_CHARSET;
4338 INT i;
4339 HFONT hFont;
4340 PTEXTOBJ TextObj;
4341 PFONTGDI FontGdi;
4343 TT_OS2 *pOS2;
4344 FT_Face Face;
4345 CHARSETINFO csi;
4346 DWORD cp, fs0;
4347 USHORT usACP, usOEM;
4348
4349 pdcattr = Dc->pdcattr;
4350 hFont = pdcattr->hlfntNew;
4351 TextObj = RealizeFontInit(hFont);
4352
4353 if (!TextObj)
4354 {
4356 return Ret;
4357 }
4358 FontGdi = ObjToGDI(TextObj->Font, FONT);
4359 Face = FontGdi->SharedFace->Face;
4360 TEXTOBJ_UnlockText(TextObj);
4361
4362 memset(&fs, 0, sizeof(FONTSIGNATURE));
4364 pOS2 = FT_Get_Sfnt_Table(Face, ft_sfnt_os2);
4365 if (NULL != pOS2)
4366 {
4367 fs.fsCsb[0] = pOS2->ulCodePageRange1;
4368 fs.fsCsb[1] = pOS2->ulCodePageRange2;
4369 fs.fsUsb[0] = pOS2->ulUnicodeRange1;
4370 fs.fsUsb[1] = pOS2->ulUnicodeRange2;
4371 fs.fsUsb[2] = pOS2->ulUnicodeRange3;
4372 fs.fsUsb[3] = pOS2->ulUnicodeRange4;
4373 if (pOS2->version == 0)
4374 {
4375 FT_UInt dummy;
4376
4377 if (FT_Get_First_Char( Face, &dummy ) < 0x100)
4378 fs.fsCsb[0] |= FS_LATIN1;
4379 else
4380 fs.fsCsb[0] |= FS_SYMBOL;
4381 }
4382 }
4383 pOS2 = NULL;
4385 DPRINT("Csb 1=%x 0=%x\n", fs.fsCsb[1],fs.fsCsb[0]);
4386 if (fs.fsCsb[0] == 0)
4387 { /* Let's see if we can find any interesting cmaps */
4388 for (i = 0; i < Face->num_charmaps; i++)
4389 {
4390 switch (Face->charmaps[i]->encoding)
4391 {
4392 case FT_ENCODING_UNICODE:
4393 case FT_ENCODING_APPLE_ROMAN:
4394 fs.fsCsb[0] |= FS_LATIN1;
4395 break;
4396 case FT_ENCODING_MS_SYMBOL:
4397 fs.fsCsb[0] |= FS_SYMBOL;
4398 break;
4399 default:
4400 break;
4401 }
4402 }
4403 }
4404 if (lpSig)
4405 {
4406 RtlCopyMemory(lpSig, &fs, sizeof(FONTSIGNATURE));
4407 }
4408
4409 RtlGetDefaultCodePage(&usACP, &usOEM);
4410 cp = usACP;
4411
4413 if (csi.fs.fsCsb[0] & fs.fsCsb[0])
4414 {
4415 DPRINT("Hit 1\n");
4416 Ret = csi.ciCharset;
4417 goto Exit;
4418 }
4419
4420 for (i = 0; i < MAXTCIINDEX; i++)
4421 {
4422 fs0 = 1L << i;
4423 if (fs.fsCsb[0] & fs0)
4424 {
4425 if (IntTranslateCharsetInfo(&fs0, &csi, TCI_SRCFONTSIG))
4426 {
4427 // *cp = csi.ciACP;
4428 DPRINT("Hit 2\n");
4429 Ret = csi.ciCharset;
4430 goto Exit;
4431 }
4432 else
4433 DPRINT1("TCI failing on %x\n", fs0);
4434 }
4435 }
4436Exit:
4437 DPRINT("CharSet %u CodePage %u\n", csi.ciCharset, csi.ciACP);
4438 return (MAKELONG(csi.ciACP, csi.ciCharset));
4439}
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 4518 of file freetype.c.

4521{
4522 PDC dc;
4523 PDC_ATTR pdcattr;
4524 PTEXTOBJ TextObj;
4525 PFONTGDI FontGDI;
4526 FT_Face Face;
4527 TT_OS2 *pOS2;
4528 TT_HoriHeader *pHori;
4530 ULONG Error;
4532 LOGFONTW *plf;
4533
4534 if (!ptmwi)
4535 {
4537 return FALSE;
4538 }
4539 RtlZeroMemory(ptmwi, sizeof(TMW_INTERNAL));
4540
4541 if (!(dc = DC_LockDc(hDC)))
4542 {
4544 return FALSE;
4545 }
4546 pdcattr = dc->pdcattr;
4547 TextObj = RealizeFontInit(pdcattr->hlfntNew);
4548 if (NULL != TextObj)
4549 {
4550 plf = &TextObj->logfont.elfEnumLogfontEx.elfLogFont;
4551 FontGDI = ObjToGDI(TextObj->Font, FONT);
4552
4553 Face = FontGDI->SharedFace->Face;
4554
4555 // NOTE: GetTextMetrics simply ignores lfEscapement and XFORM.
4557 Error = IntRequestFontSize(dc, FontGDI, plf->lfWidth, plf->lfHeight);
4558 FT_Set_Transform(Face, NULL, NULL);
4559
4561
4562 if (0 != Error)
4563 {
4564 DPRINT1("Error in setting pixel sizes: %u\n", Error);
4566 }
4567 else
4568 {
4570
4572 pOS2 = FT_Get_Sfnt_Table(Face, ft_sfnt_os2);
4573 if (NULL == pOS2)
4574 {
4575 DPRINT1("Can't find OS/2 table - not TT font?\n");
4577 }
4578
4579 pHori = FT_Get_Sfnt_Table(Face, ft_sfnt_hhea);
4580 if (NULL == pHori)
4581 {
4582 DPRINT1("Can't find HHEA table - not TT font?\n");
4584 }
4585
4586 Error = FT_Get_WinFNT_Header(Face, &Win);
4587
4588 if (NT_SUCCESS(Status) || !Error)
4589 {
4590 FillTM(&ptmwi->TextMetric, FontGDI, pOS2, pHori, !Error ? &Win : 0);
4591
4592 /* FIXME: Fill Diff member */
4593 }
4594
4596 }
4597 TEXTOBJ_UnlockText(TextObj);
4598 }
4599 else
4600 {
4602 }
4603 DC_UnlockDc(dc);
4604
4605 if (!NT_SUCCESS(Status))
4606 {
4608 return FALSE;
4609 }
4610 return TRUE;
4611}
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:2111
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(_In_ NTSTATUS Status)
Definition: error.c:31

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

◆ ftGdiRealizationInfo()

BOOL FASTCALL ftGdiRealizationInfo ( PFONTGDI  Font,
PREALIZATION_INFO  Info 
)

Definition at line 5611 of file freetype.c.

5612{
5613 if (FT_HAS_FIXED_SIZES(Font->SharedFace->Face))
5614 Info->iTechnology = RI_TECH_BITMAP;
5615 else
5616 {
5617 if (FT_IS_SCALABLE(Font->SharedFace->Face))
5618 Info->iTechnology = RI_TECH_SCALABLE;
5619 else
5620 Info->iTechnology = RI_TECH_FIXED;
5621 }
5622 Info->iUniq = Font->FontObj.iUniq;
5623 Info->dwUnknown = -1;
5624 return TRUE;
5625}
#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 4444 of file freetype.c.

4445{
4446 DWORD size = 0;
4447 DWORD num_ranges = 0;
4448 FT_Face face = Font->SharedFace->Face;
4449
4450 if (face->charmap == NULL)
4451 {
4452 DPRINT1("FIXME: No charmap selected! This is a BUG!\n");
4453 return 0;
4454 }
4455
4456 if (face->charmap->encoding == FT_ENCODING_UNICODE)
4457 {
4458 FT_UInt glyph_code = 0;
4459 FT_ULong char_code, char_code_prev;
4460
4461 char_code_prev = char_code = FT_Get_First_Char(face, &glyph_code);
4462
4463 DPRINT("Face encoding FT_ENCODING_UNICODE, number of glyphs %ld, first glyph %u, first char %04lx\n",
4464 face->num_glyphs, glyph_code, char_code);
4465
4466 if (!glyph_code) return 0;
4467
4468 if (glyphset)
4469 {
4470 glyphset->ranges[0].wcLow = (USHORT)char_code;
4471 glyphset->ranges[0].cGlyphs = 0;
4472 glyphset->cGlyphsSupported = 0;
4473 }
4474
4475 num_ranges = 1;
4476 while (glyph_code)
4477 {
4478 if (char_code < char_code_prev)
4479 {
4480 DPRINT1("Expected increasing char code from FT_Get_Next_Char\n");
4481 return 0;
4482 }
4483 if (char_code - char_code_prev > 1)
4484 {
4485 num_ranges++;
4486 if (glyphset)
4487 {
4488 glyphset->ranges[num_ranges - 1].wcLow = (USHORT)char_code;
4489 glyphset->ranges[num_ranges - 1].cGlyphs = 1;
4490 glyphset->cGlyphsSupported++;
4491 }
4492 }
4493 else if (glyphset)
4494 {
4495 glyphset->ranges[num_ranges - 1].cGlyphs++;
4496 glyphset->cGlyphsSupported++;
4497 }
4498 char_code_prev = char_code;
4499 char_code = FT_Get_Next_Char(face, char_code, &glyph_code);
4500 }
4501 }
4502 else
4503 DPRINT1("Encoding %i not supported\n", face->charmap->encoding);
4504
4505 size = sizeof(GLYPHSET) + sizeof(WCRANGE) * (num_ranges - 1);
4506 if (glyphset)
4507 {
4508 glyphset->cbThis = size;
4509 glyphset->cRanges = num_ranges;
4510 glyphset->flAccel = 0;
4511 }
4512 return size;
4513}
GLsizeiptr size
Definition: glext.h:5919

Referenced by NtGdiGetFontUnicodeRanges().

◆ FTVectorToPOINTFX()

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

Definition at line 383 of file freetype.c.

384{
385 pt->x.value = vec->x >> 6;
386 pt->x.fract = (vec->x & 0x3f) << 10;
387 pt->x.fract |= ((pt->x.fract >> 6) | (pt->x.fract >> 12));
388 pt->y.value = vec->y >> 6;
389 pt->y.fract = (vec->y & 0x3f) << 10;
390 pt->y.fract |= ((pt->y.fract >> 6) | (pt->y.fract >> 12));
391}
#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 3291 of file freetype.c.

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

3660{
3661 FT_UInt ret;
3662
3663 if (face_has_symbol_charmap(ft_face))
3664 {
3665 ret = get_glyph_index_symbol(ft_face, glyph);
3666 if (ret != 0)
3667 return ret;
3668 }
3669
3670 return FT_Get_Char_Index(ft_face, glyph);
3671}
static FT_UInt FASTCALL get_glyph_index_symbol(FT_Face ft_face, UINT glyph)
Definition: freetype.c:3645
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 3674 of file freetype.c.

3675{
3676 FT_UInt glyph_index;
3677 if (flags & indexed_flag)
3678 {
3679 glyph_index = code;
3680 }
3681 else
3682 {
3683 glyph_index = get_glyph_index(face, code);
3684 }
3685 return glyph_index;
3686}
static FT_UInt FASTCALL get_glyph_index(FT_Face ft_face, UINT glyph)
Definition: freetype.c:3659
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 3645 of file freetype.c.

3646{
3647 FT_UInt ret;
3648
3649 if (glyph < 0x100) glyph += 0xf000;
3650 /* there are a number of old pre-Unicode "broken" TTFs, which
3651 do have symbols at U+00XX instead of U+f0XX */
3652 if (!(ret = FT_Get_Char_Index(ft_face, glyph)))
3653 ret = FT_Get_Char_Index(ft_face, glyph - 0xf000);
3654
3655 return ret;
3656}

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

3219{
3220 TTPOLYGONHEADER *pph;
3221 TTPOLYCURVE *ppc;
3222 int needed = 0, point = 0, contour, first_pt;
3223 unsigned int pph_start, cpfx;
3224 DWORD type;
3225
3226 for (contour = 0; contour < outline->n_contours; contour++)
3227 {
3228 /* Ignore contours containing one point */
3229 if (point == outline->contours[contour])
3230 {
3231 point++;
3232 continue;
3233 }
3234
3235 pph_start = needed;
3236 pph = (TTPOLYGONHEADER *)(buf + needed);
3237 first_pt = point;
3238 if (buf)
3239 {
3240 pph->dwType = TT_POLYGON_TYPE;
3241 FTVectorToPOINTFX(&outline->points[point], &pph->pfxStart);
3242 }
3243 needed += sizeof(*pph);
3244 point++;
3245 while (point <= outline->contours[contour])
3246 {
3247 ppc = (TTPOLYCURVE *)(buf + needed);
3248 type = (outline->tags[point] & FT_Curve_Tag_On) ?
3250 cpfx = 0;
3251 do
3252 {
3253 if (buf)
3254 FTVectorToPOINTFX(&outline->points[point], &ppc->apfx[cpfx]);
3255 cpfx++;
3256 point++;
3257 } while (point <= outline->contours[contour] &&
3258 (outline->tags[point] & FT_Curve_Tag_On) ==
3259 (outline->tags[point-1] & FT_Curve_Tag_On));
3260 /* At the end of a contour Windows adds the start point, but
3261 only for Beziers */
3262 if (point > outline->contours[contour] &&
3263 !(outline->tags[point-1] & FT_Curve_Tag_On))
3264 {
3265 if (buf)
3266 FTVectorToPOINTFX(&outline->points[first_pt], &ppc->apfx[cpfx]);
3267 cpfx++;
3268 }
3269 else if (point <= outline->contours[contour] &&
3270 outline->tags[point] & FT_Curve_Tag_On)
3271 {
3272 /* add closing pt for bezier */
3273 if (buf)
3274 FTVectorToPOINTFX(&outline->points[point], &ppc->apfx[cpfx]);
3275 cpfx++;
3276 point++;
3277 }
3278 if (buf)
3279 {
3280 ppc->wType = type;
3281 ppc->cpfx = cpfx;
3282 }
3283 needed += sizeof(*ppc) + (cpfx - 1) * sizeof(POINTFX);
3284 }
3285 if (buf)
3286 pph->cb = needed - pph_start;
3287 }
3288 return needed;
3289}
#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 2962 of file freetype.c.

2968{
2970 PFONT_ENTRY CurrentEntry;
2971 FONTGDI *FontGDI;
2972 FONTFAMILYINFO InfoEntry;
2973 LONG Count = *pCount;
2974
2975 for (Entry = Head->Flink; Entry != Head; Entry = Entry->Flink)
2976 {
2977 CurrentEntry = CONTAINING_RECORD(Entry, FONT_ENTRY, ListEntry);
2978 FontGDI = CurrentEntry->Font;
2979 ASSERT(FontGDI);
2980
2981 if (LogFont->lfCharSet != DEFAULT_CHARSET &&
2982 LogFont->lfCharSet != FontGDI->CharSet)
2983 {
2984 continue; /* charset mismatch */
2985 }
2986
2987 /* get one info entry */
2988 FontFamilyFillInfo(&InfoEntry, NULL, NULL, FontGDI);
2989
2990 if (LogFont->lfFaceName[0] != UNICODE_NULL)
2991 {
2992 /* check name */
2993 if (_wcsnicmp(LogFont->lfFaceName,
2995 RTL_NUMBER_OF(LogFont->lfFaceName) - 1) != 0 &&
2996 _wcsnicmp(LogFont->lfFaceName,
2997 InfoEntry.EnumLogFontEx.elfFullName,
2998 RTL_NUMBER_OF(LogFont->lfFaceName) - 1) != 0)
2999 {
3000 continue;
3001 }
3002 }
3003
3004 if (NominalName)
3005 {
3006 /* store the nominal name */
3008 sizeof(InfoEntry.EnumLogFontEx.elfLogFont.lfFaceName),
3009 NominalName);
3010 }
3011
3012 /* store one entry to Info */
3013 if (0 <= Count && Count < MaxCount)
3014 {
3015 RtlCopyMemory(&Info[Count], &InfoEntry, sizeof(InfoEntry));
3016 }
3017 Count++;
3018 }
3019
3020 *pCount = Count;
3021
3022 return TRUE;
3023}
#define RTL_NUMBER_OF(x)
Definition: RtlRegistry.c:12
static void FASTCALL FontFamilyFillInfo(PFONTFAMILYINFO Info, LPCWSTR FaceName, LPCWSTR FullName, PFONTGDI FontGDI)
Definition: freetype.c:2778
_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 3026 of file freetype.c.

3030{
3031 PLIST_ENTRY pEntry, pHead = &g_FontSubstListHead;
3032 PFONTSUBST_ENTRY pCurrentEntry;
3033 PUNICODE_STRING pFromW, pToW;
3034 LOGFONTW lf = *LogFont;
3036
3037 for (pEntry = pHead->Flink; pEntry != pHead; pEntry = pEntry->Flink)
3038 {
3039 pCurrentEntry = CONTAINING_RECORD(pEntry, FONTSUBST_ENTRY, ListEntry);
3040
3041 pFromW = &pCurrentEntry->FontNames[FONTSUBST_FROM];
3042 if (LogFont->lfFaceName[0] != UNICODE_NULL)
3043 {
3044 /* check name */
3045 if (_wcsicmp(LogFont->lfFaceName, pFromW->Buffer) != 0)
3046 continue; /* mismatch */
3047 }
3048
3049 pToW = &pCurrentEntry->FontNames[FONTSUBST_TO];
3050 if (RtlEqualUnicodeString(pFromW, pToW, TRUE) &&
3051 pCurrentEntry->CharSets[FONTSUBST_FROM] ==
3052 pCurrentEntry->CharSets[FONTSUBST_TO])
3053 {
3054 /* identical mapping */
3055 continue;
3056 }
3057
3058 /* substitute and get the real name */
3059 IntUnicodeStringToBuffer(lf.lfFaceName, sizeof(lf.lfFaceName), pFromW);
3061 if (LogFont->lfCharSet != DEFAULT_CHARSET && LogFont->lfCharSet != lf.lfCharSet)
3062 continue;
3063
3064 /* search in global fonts */
3066 GetFontFamilyInfoForList(&lf, Info, pFromW->Buffer, pCount, MaxCount, &g_FontListHead);
3068
3069 /* search in private fonts */
3070 IntLockProcessPrivateFonts(Win32Process);
3071 GetFontFamilyInfoForList(&lf, Info, pFromW->Buffer, pCount, MaxCount,
3072 &Win32Process->PrivateFontListHead);
3073 IntUnLockProcessPrivateFonts(Win32Process);
3074
3075 if (LogFont->lfFaceName[0] != UNICODE_NULL)
3076 {
3077 /* it's already matched to the exact name and charset if the name
3078 was specified at here, then so don't scan more for another name */
3079 break;
3080 }
3081 }
3082
3083 return TRUE;
3084}
static BOOLEAN FASTCALL GetFontFamilyInfoForList(const LOGFONTW *LogFont, PFONTFAMILYINFO Info, LPCWSTR NominalName, LONG *pCount, LONG MaxCount, PLIST_ENTRY Head)
Definition: freetype.c:2962
static LIST_ENTRY g_FontListHead
Definition: freetype.c:81
static BOOL SubstituteFontRecurse(LOGFONTW *pLogFont)
Definition: freetype.c:868
static VOID IntUnicodeStringToBuffer(LPWSTR pszBuffer, SIZE_T cbBuffer, const UNICODE_STRING *pString)
Definition: freetype.c:830
#define IntUnLockGlobalFonts()
Definition: freetype.c:88
#define IntLockGlobalFonts()
Definition: freetype.c:85
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 4657 of file freetype.c.

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

6533{
6534 BOOL bResult;
6535 DC *dc;
6536
6537 // TODO: Write test-cases to exactly match real Windows in different
6538 // bad parameters (e.g. does Windows check the DC or the RECT first?).
6539 dc = DC_LockDc(hDC);
6540 if (!dc)
6541 {
6543 return FALSE;
6544 }
6545
6546 bResult = IntExtTextOutW( dc,
6547 XStart,
6548 YStart,
6549 fuOptions,
6550 lprc,
6551 String,
6552 Count,
6553 Dx,
6554 dwCodePage );
6555
6556 DC_UnlockDc(dc);
6557
6558 return bResult;
6559}
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:6003
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFSTRING String
Definition: wdfdevice.h:2433
_In_ int _Inout_ LPRECT lprc
Definition: winuser.h:4466

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

◆ InitFontSupport()

BOOL FASTCALL InitFontSupport ( VOID  )

Definition at line 672 of file freetype.c.

673{
674 ULONG ulError;
675
679 /* Fast Mutexes must be allocated from non paged pool */
681 if (g_FontListLock == NULL)
682 {
683 return FALSE;
684 }
685
688 if (g_FreeTypeLock == NULL)
689 {
690 return FALSE;
691 }
693
695 if (ulError)
696 {
697 DPRINT1("FT_Init_FreeType failed with error code 0x%x\n", ulError);
698 return FALSE;
699 }
700
702 {
703 DPRINT1("Fonts registry is empty.\n");
704
705 /* Load font(s) with writing registry */
707 }
708
709 IntLoadFontSubstList(&g_FontSubstListHead);
710
711#if DBG
712 DumpFontInfo(TRUE);
713#endif
714
715 return TRUE;
716}
#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:79
BOOL FASTCALL IntLoadFontSubstList(PLIST_ENTRY pHead)
Definition: freetype.c:525
static UINT g_FontCacheNumEntries
Definition: freetype.c:109
VOID FASTCALL IntLoadSystemFonts(VOID)
Definition: freetype.c:907
static LIST_ENTRY g_FontCacheListHead
Definition: freetype.c:108
static PFAST_MUTEX g_FontListLock
Definition: freetype.c:82
BOOL FASTCALL IntLoadFontsInRegistry(VOID)
Definition: freetype.c:1652
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 5330 of file freetype.c.

5331{
5333 if (FamInfo->EnumLogFontEx.elfStyle[0] &&
5334 _wcsicmp(FamInfo->EnumLogFontEx.elfStyle, L"Regular") != 0)
5335 {
5336 wcscat(psz, L" ");
5337 wcscat(psz, FamInfo->EnumLogFontEx.elfStyle);
5338 }
5339}
#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 187 of file freetype.c.

188{
189 UINT i;
190
191 if (uCodePage == CP_OEMCP)
192 return OEM_CHARSET;
193
194 if (uCodePage == CP_MACCP)
195 return MAC_CHARSET;
196
197 for (i = 0; i < MAXTCIINDEX; ++i)
198 {
199 if (g_FontTci[i].ciACP == 0)
200 continue;
201
202 if (g_FontTci[i].ciACP == uCodePage)
203 return g_FontTci[i].ciCharset;
204 }
205
206 return DEFAULT_CHARSET;
207}
#define CP_OEMCP
Definition: freetype.c:181
static const CHARSETINFO g_FontTci[MAXTCIINDEX]
Definition: freetype.c:139
#define CP_MACCP
Definition: freetype.c:182
#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 1978 of file freetype.c.

1979{
1981}
static BOOL g_RenderingEnabled
Definition: freetype.c:83
_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 5956 of file freetype.c.

5963{
5964 RECTL DestRect;
5965 SURFACE *psurf = dc->dclevel.pSurface;
5966
5968 ASSERT(psurf != NULL);
5969
5970 if (Width < 0)
5971 {
5972 X += Width;
5973 Width = -Width;
5974 }
5975
5976 if (Height < 0)
5977 {
5978 Y += Height;
5979 Height = -Height;
5980 }
5981
5982 DestRect.left = X;
5983 DestRect.right = X + Width;
5984 DestRect.top = Y;
5985 DestRect.bottom = Y + Height;
5986
5987 IntEngBitBlt(&psurf->SurfObj,
5988 NULL,
5989 NULL,
5990 (CLIPOBJ *)&dc->co,
5991 NULL,
5992 &DestRect,
5993 NULL,
5994 NULL,
5995 BrushObj,
5996 &PointZero,
5998}
#define ASSERT_DC_PREPARED(pdc)
Definition: dc.h:300
#define Y(I)
static POINTL PointZero
Definition: freetype.c:65
#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 5920 of file freetype.c.

5925{
5926 SURFACE *psurf = dc->dclevel.pSurface;
5927 RECT Rect;
5928 UINT i;
5929 INT x, y;
5930
5932 ASSERT(psurf != NULL);
5933
5934 Rect.left = Rect.right = pPoints[0].x;
5935 Rect.top = Rect.bottom = pPoints[0].y;
5936 for (i = 1; i < cPoints; ++i)
5937 {
5938 x = pPoints[i].x;
5939 if (x < Rect.left)
5940 Rect.left = x;
5941 else if (Rect.right < x)
5942 Rect.right = x;
5943
5944 y = pPoints[i].y;
5945 if (y < Rect.top)
5946 Rect.top = y;
5947 else if (Rect.bottom < y)
5948 Rect.bottom = y;
5949 }
5950
5951 IntFillPolygon(dc, dc->dclevel.pSurface, BrushObj, pPoints, cPoints, Rect, &PointZero);
5952}
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 726 of file freetype.c.

727{
728 FT_Vector vecAngle;
729 /* Convert the angle in tenths of degrees into degrees as a 16.16 fixed-point value */
730 FT_Angle angle = INT_TO_FIXED(lfEscapement) / 10;
731 FT_Vector_Unit(&vecAngle, angle);
732 pmat->xx = vecAngle.x;
733 pmat->xy = -vecAngle.y;
734 pmat->yx = -pmat->xy;
735 pmat->yy = pmat->xx;
736}
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 6003 of file freetype.c.

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