ReactOS 0.4.16-dev-2354-g16de117
text.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _STRGDI
 
struct  _LFONT
 

Macros

#define TAG_FINF   'FNIF'
 
#define TO_MEM_ALLOCATED   0x0001
 
#define TO_ALL_PTRS_VALID   0x0002
 
#define TO_VALID   0x0004
 
#define TO_ESC_NOT_ORIENT   0x0008
 
#define TO_PWSZ_ALLOCATED   0x0010
 
#define TSIM_UNDERLINE1   0x0020
 
#define TSIM_UNDERLINE2   0x0040
 
#define TSIM_STRIKEOUT   0x0080
 
#define TO_HIGHRESTEXT   0x0100
 
#define TO_BITMAPS   0x0200
 
#define TO_PARTITION_INIT   0x0400
 
#define TO_ALLOC_FACENAME   0x0800
 
#define TO_SYS_PARTITION   0x1000
 
#define TEXTOBJECT_INIT   0x00010000
 
#define LFONT_AllocFontWithHandle()   ((PLFONT)GDIOBJ_AllocObjWithHandle(GDI_OBJECT_TYPE_FONT, sizeof(TEXTOBJ)))
 
#define LFONT_ShareLockFont(hfont)   (PLFONT)GDIOBJ_ReferenceObjectByHandle(hfont, GDIObjType_LFONT_TYPE)
 
#define LFONT_ShareUnlockFont(plfnt)   GDIOBJ_vDereferenceObject((POBJ)plfnt)
 
#define LFONT_UnlockFont(plfnt)   GDIOBJ_vUnlockObject((POBJ)plfnt)
 
#define AFRX_WRITE_REGISTRY   0x1
 
#define AFRX_ALTERNATIVE_PATH   0x2
 
#define AFRX_DOS_DEVICE_PATH   0x4
 
#define IntLockProcessPrivateFonts(W32Process)    ExEnterCriticalRegionAndAcquireFastMutexUnsafe(&W32Process->PrivateFontListLock)
 
#define IntUnLockProcessPrivateFonts(W32Process)    ExReleaseFastMutexUnsafeAndLeaveCriticalRegion(&W32Process->PrivateFontListLock)
 

Typedefs

typedef struct _STRGDI STRGDI
 
typedef struct _STRGDIPSTRGDI
 
typedef struct _LFONT TEXTOBJ
 
typedef struct _LFONTPTEXTOBJ
 
typedef struct _LFONT LFONT
 
typedef struct _LFONTPLFONT
 

Functions

FORCEINLINE PTEXTOBJ TEXTOBJ_LockText (HFONT hfont)
 
FORCEINLINE VOID TEXTOBJ_UnlockText (PLFONT plfnt)
 
PTEXTOBJ FASTCALL RealizeFontInit (HFONT)
 
NTSTATUS FASTCALL TextIntRealizeFont (HFONT, PTEXTOBJ)
 
NTSTATUS FASTCALL TextIntCreateFontIndirect (CONST LPLOGFONTW lf, HFONT *NewFont)
 
BYTE FASTCALL IntCharSetFromCodePage (UINT uCodePage)
 
BOOL FASTCALL InitFontSupport (VOID)
 
VOID FASTCALL FreeFontSupport (VOID)
 
BOOL FASTCALL IntIsFontRenderingEnabled (VOID)
 
VOID FASTCALL IntEnableFontRendering (BOOL Enable)
 
ULONG FASTCALL FontGetObject (PTEXTOBJ TextObj, ULONG Count, PVOID Buffer)
 
VOID FASTCALL IntLoadSystemFonts (VOID)
 
BOOL FASTCALL IntLoadFontsInRegistry (VOID)
 
VOID FASTCALL IntGdiCleanupPrivateFontsForProcess (VOID)
 
INT FASTCALL IntGdiAddFontResourceEx (_In_ PCUNICODE_STRING FileName, _In_ DWORD cFiles, _In_ DWORD Characteristics, _In_ DWORD dwFlags)
 
BOOL FASTCALL IntGdiRemoveFontResource (_In_ PCUNICODE_STRING FileName, _In_ DWORD cFiles, _In_ DWORD dwFlags)
 
HANDLE FASTCALL IntGdiAddFontMemResource (PVOID Buffer, DWORD dwSize, PDWORD pNumAdded)
 
BOOL FASTCALL IntGdiRemoveFontMemResource (HANDLE hMMFont)
 
ULONG FASTCALL ftGdiGetGlyphOutline (PDC, WCHAR, UINT, LPGLYPHMETRICS, ULONG, PVOID, const MAT2 *, BOOL)
 
INT FASTCALL IntGetOutlineTextMetrics (PFONTGDI, UINT, OUTLINETEXTMETRICW *, BOOL)
 
BOOL FASTCALL TextIntUpdateSize (PDC, PTEXTOBJ, PFONTGDI, BOOL)
 
BOOL FASTCALL ftGdiGetRasterizerCaps (LPRASTERIZER_STATUS)
 
BOOL FASTCALL TextIntGetTextExtentPoint (PDC, PTEXTOBJ, PCWCH, INT, ULONG, PINT, PINT, PSIZE, FLONG)
 
BOOL FASTCALL ftGdiGetTextMetricsW (HDC, PTMW_INTERNAL)
 
DWORD FASTCALL IntGetFontLanguageInfo (PDC)
 
INT FASTCALL ftGdiGetTextCharsetInfo (PDC, PFONTSIGNATURE, DWORD)
 
DWORD FASTCALL ftGetFontUnicodeRanges (PFONTGDI, PGLYPHSET)
 
DWORD FASTCALL ftGdiGetFontData (PFONTGDI, DWORD, DWORD, PVOID, DWORD)
 
BOOL FASTCALL IntGdiGetFontResourceInfo (PUNICODE_STRING, PVOID, DWORD *, DWORD)
 
BOOL FASTCALL ftGdiRealizationInfo (PFONTGDI, PREALIZATION_INFO)
 
DWORD FASTCALL ftGdiGetKerningPairs (PFONTGDI, DWORD, LPKERNINGPAIR)
 
BOOL APIENTRY GreExtTextOutW (_In_ HDC hDC, _In_ INT XStart, _In_ INT YStart, _In_ UINT fuOptions, _In_opt_ PRECTL lprc, _In_reads_opt_(Count) PCWCH String, _In_ INT Count, _In_opt_ const INT *Dx, _In_ DWORD dwCodePage)
 
DWORD FASTCALL IntGetCharDimensions (HDC, PTEXTMETRICW, PDWORD)
 
BOOL FASTCALL GreGetTextExtentW (HDC, PCWCH, INT, PSIZE, UINT)
 
BOOL FASTCALL GreGetTextExtentExW (HDC, PCWCH, ULONG, ULONG, PULONG, PULONG, PSIZE, FLONG)
 
BOOL FASTCALL GreTextOutW (HDC, INT, INT, PCWCH, INT)
 
HFONT FASTCALL GreCreateFontIndirectW (_In_ const LOGFONTW *lplf)
 
BOOL WINAPI GreGetTextMetricsW (_In_ HDC hdc, _Out_ LPTEXTMETRICW lptm)
 
BOOL APIENTRY GreGetCharWidthW (_In_ HDC hDC, _In_ UINT FirstChar, _In_ UINT Count, _In_reads_opt_(Count) PCWCH Safepwc, _In_ ULONG fl, _Out_writes_bytes_(Count *sizeof(INT)) PVOID pTmpBuffer)
 

Macro Definition Documentation

◆ AFRX_ALTERNATIVE_PATH

#define AFRX_ALTERNATIVE_PATH   0x2

Definition at line 105 of file text.h.

◆ AFRX_DOS_DEVICE_PATH

#define AFRX_DOS_DEVICE_PATH   0x4

Definition at line 106 of file text.h.

◆ AFRX_WRITE_REGISTRY

#define AFRX_WRITE_REGISTRY   0x1

Definition at line 104 of file text.h.

◆ IntLockProcessPrivateFonts

#define IntLockProcessPrivateFonts (   W32Process)     ExEnterCriticalRegionAndAcquireFastMutexUnsafe(&W32Process->PrivateFontListLock)

Definition at line 164 of file text.h.

◆ IntUnLockProcessPrivateFonts

#define IntUnLockProcessPrivateFonts (   W32Process)     ExReleaseFastMutexUnsafeAndLeaveCriticalRegion(&W32Process->PrivateFontListLock)

Definition at line 167 of file text.h.

◆ LFONT_AllocFontWithHandle

#define LFONT_AllocFontWithHandle ( )    ((PLFONT)GDIOBJ_AllocObjWithHandle(GDI_OBJECT_TYPE_FONT, sizeof(TEXTOBJ)))

Definition at line 76 of file text.h.

◆ LFONT_ShareLockFont

Definition at line 77 of file text.h.

◆ LFONT_ShareUnlockFont

#define LFONT_ShareUnlockFont (   plfnt)    GDIOBJ_vDereferenceObject((POBJ)plfnt)

Definition at line 78 of file text.h.

◆ LFONT_UnlockFont

#define LFONT_UnlockFont (   plfnt)    GDIOBJ_vUnlockObject((POBJ)plfnt)

Definition at line 79 of file text.h.

◆ TAG_FINF

#define TAG_FINF   'FNIF'

Definition at line 3 of file text.h.

◆ TEXTOBJECT_INIT

#define TEXTOBJECT_INIT   0x00010000

Definition at line 56 of file text.h.

◆ TO_ALL_PTRS_VALID

#define TO_ALL_PTRS_VALID   0x0002

Definition at line 8 of file text.h.

◆ TO_ALLOC_FACENAME

#define TO_ALLOC_FACENAME   0x0800

Definition at line 18 of file text.h.

◆ TO_BITMAPS

#define TO_BITMAPS   0x0200

Definition at line 16 of file text.h.

◆ TO_ESC_NOT_ORIENT

#define TO_ESC_NOT_ORIENT   0x0008

Definition at line 10 of file text.h.

◆ TO_HIGHRESTEXT

#define TO_HIGHRESTEXT   0x0100

Definition at line 15 of file text.h.

◆ TO_MEM_ALLOCATED

#define TO_MEM_ALLOCATED   0x0001

Definition at line 7 of file text.h.

◆ TO_PARTITION_INIT

#define TO_PARTITION_INIT   0x0400

Definition at line 17 of file text.h.

◆ TO_PWSZ_ALLOCATED

#define TO_PWSZ_ALLOCATED   0x0010

Definition at line 11 of file text.h.

◆ TO_SYS_PARTITION

#define TO_SYS_PARTITION   0x1000

Definition at line 19 of file text.h.

◆ TO_VALID

#define TO_VALID   0x0004

Definition at line 9 of file text.h.

◆ TSIM_STRIKEOUT

#define TSIM_STRIKEOUT   0x0080

Definition at line 14 of file text.h.

◆ TSIM_UNDERLINE1

#define TSIM_UNDERLINE1   0x0020

Definition at line 12 of file text.h.

◆ TSIM_UNDERLINE2

#define TSIM_UNDERLINE2   0x0040

Definition at line 13 of file text.h.

Typedef Documentation

◆ LFONT

typedef struct _LFONT LFONT

◆ PLFONT

typedef struct _LFONT * PLFONT

◆ PSTRGDI

typedef struct _STRGDI * PSTRGDI

◆ PTEXTOBJ

typedef struct _LFONT * PTEXTOBJ

◆ STRGDI

◆ TEXTOBJ

Function Documentation

◆ FontGetObject()

ULONG FASTCALL FontGetObject ( PTEXTOBJ  TextObj,
ULONG  Count,
PVOID  Buffer 
)

◆ FreeFontSupport()

VOID FASTCALL FreeFontSupport ( VOID  )

Definition at line 1039 of file freetype.c.

1040{
1041 PLIST_ENTRY pHead, pEntry;
1042 PFONT_CACHE_ENTRY pFontCache;
1043 PFONTSUBST_ENTRY pSubstEntry;
1044 PFONT_ENTRY pFontEntry;
1045
1046 // Cleanup the FontLink cache
1048
1049 // Cleanup FONT_LOOKUP_CACHE
1051
1052 // Free font cache list
1053 pHead = &g_FontCacheListHead;
1054 while (!IsListEmpty(pHead))
1055 {
1056 pEntry = RemoveHeadList(pHead);
1057 pFontCache = CONTAINING_RECORD(pEntry, FONT_CACHE_ENTRY, ListEntry);
1058 RemoveCachedEntry(pFontCache);
1059 }
1060
1061 // Free font subst list
1062 pHead = &g_FontSubstListHead;
1063 while (!IsListEmpty(pHead))
1064 {
1065 pEntry = RemoveHeadList(pHead);
1066 pSubstEntry = CONTAINING_RECORD(pEntry, FONTSUBST_ENTRY, ListEntry);
1067 ExFreePoolWithTag(pSubstEntry, TAG_FONT);
1068 }
1069
1070 // Free font list
1071 pHead = &g_FontListHead;
1072 while (!IsListEmpty(pHead))
1073 {
1074 pEntry = RemoveHeadList(pHead);
1075 pFontEntry = CONTAINING_RECORD(pEntry, FONT_ENTRY, ListEntry);
1076 CleanupFontEntry(pFontEntry);
1077 }
1078
1080 {
1083 }
1084
1087}
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
#define IsListEmpty(ListHead)
Definition: env_spec_w32.h:954
#define RemoveHeadList(ListHead)
Definition: env_spec_w32.h:964
static PFAST_MUTEX g_FreeTypeLock
Definition: freetype.c:326
FT_Library g_FreeTypeLibrary
Definition: freetype.c:318
static VOID FontLink_CleanupCache(VOID)
Definition: freetype.c:274
static void FontLookUp_Cleanup(_In_ BOOL bDoLock, _Inout_opt_ PSHARED_FACE SharedFace)
Definition: freetype.c:958
static __inline VOID FASTCALL CleanupFontEntry(PFONT_ENTRY FontEntry)
Definition: freetype.c:653
static void RemoveCachedEntry(PFONT_CACHE_ENTRY Entry)
Definition: freetype.c:544
FT_Done_Library(FT_Library library)
Definition: ftobjs.c:5353
PLIST_ENTRY pEntry
Definition: fxioqueue.cpp:4484
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
Definition: font.h:77
Definition: font.h:56
Definition: font.h:5
Definition: typedefs.h:120
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
#define TAG_INTERNAL_SYNC
Definition: tags.h:18
#define TAG_FONT
Definition: tags.h:12

Referenced by _Function_class_().

◆ ftGdiGetFontData()

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

Definition at line 5363 of file freetype.c.

5369{
5371 FT_Face Face = FontGdi->SharedFace->Face;
5372
5374
5375 if (FT_IS_SFNT(Face))
5376 {
5377 if (Table)
5378 Table = Table >> 24 | Table << 24 | (Table >> 8 & 0xFF00) |
5379 (Table << 8 & 0xFF0000);
5380
5381 if (!Buffer) Size = 0;
5382
5383 if (Buffer && Size)
5384 {
5386 FT_ULong Needed = 0;
5387
5388 Error = FT_Load_Sfnt_Table(Face, Table, Offset, NULL, &Needed);
5389
5390 if ( !Error && Needed < Size) Size = Needed;
5391 }
5392 if (!FT_Load_Sfnt_Table(Face, Table, Offset, Buffer, &Size))
5393 Result = Size;
5394 }
5395
5397
5398 return Result;
5399}
BOOL Error
Definition: chkdsk.c:66
Definition: bufpool.h:45
unsigned long DWORD
Definition: ntddk_ex.h:95
#define IntUnLockFreeType()
Definition: freetype.c:343
#define IntLockFreeType()
Definition: freetype.c:337
#define FT_IS_SFNT(face)
Definition: freetype.h:1290
unsigned long FT_ULong
Definition: fttypes.h:253
int FT_Error
Definition: fttypes.h:299
ASMGENDATA Table[]
Definition: genincdata.c:61
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
PSHARED_FACE SharedFace
Definition: engobjects.h:145
FT_Face Face
Definition: engobjects.h:132
FT_Load_Sfnt_Table(FT_Face face, FT_ULong tag, FT_Long offset, FT_Byte *buffer, FT_ULong *length)
Definition: ftobjs.c:4197
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4539
#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,
const MAT2 pmat2,
BOOL  bIgnoreRotation 
)

Definition at line 4428 of file freetype.c.

4437{
4438 PDC_ATTR pdcattr;
4439 PTEXTOBJ TextObj;
4440 PFONTGDI FontGDI;
4441 HFONT hFont = 0;
4442 GLYPHMETRICS gm;
4443 ULONG Size;
4444 FT_Face ft_face;
4445 FT_UInt glyph_index;
4446 DWORD width, height, pitch, needed = 0;
4447 FT_Bitmap ft_bitmap;
4449 INT left, right, top = 0, bottom = 0;
4451 FLOATOBJ eM11, widthRatio, eTemp;
4452 FT_Matrix mat, transMat = identityMat;
4453 BOOL needsTransform = FALSE;
4454 INT orientation;
4455 LONG aveWidth;
4456 INT adv, lsb, bbx; /* These three hold to widths of the unrotated chars */
4457 OUTLINETEXTMETRICW *potm;
4458 XFORMOBJ xo;
4459 XFORML xform;
4460 LOGFONTW *plf;
4461
4462 DPRINT("%u, %08x, %p, %08lx, %p, %p\n", wch, iFormat, pgm,
4463 cjBuf, pvBuf, pmat2);
4464
4465 pdcattr = dc->pdcattr;
4466
4467 XFORMOBJ_vInit(&xo, &dc->pdcattr->mxWorldToDevice);
4468 XFORMOBJ_iGetXform(&xo, &xform);
4469 FLOATOBJ_SetFloat(&eM11, xform.eM11);
4470
4471 hFont = pdcattr->hlfntNew;
4472 TextObj = RealizeFontInit(hFont);
4473
4474 if (!TextObj)
4475 {
4477 return GDI_ERROR;
4478 }
4479 FontGDI = ObjToGDI(TextObj->Font, FONT);
4480 ft_face = FontGDI->SharedFace->Face;
4481
4482 plf = &TextObj->logfont.elfEnumLogfontEx.elfLogFont;
4483 aveWidth = FT_IS_SCALABLE(ft_face) ? abs(plf->lfWidth) : 0;
4484 orientation = FT_IS_SCALABLE(ft_face) ? plf->lfOrientation : 0;
4485
4487 Size = IntGetOutlineTextMetrics(FontGDI, 0, NULL, FALSE);
4488 if (!Size)
4489 {
4490 TEXTOBJ_UnlockText(TextObj);
4492 return GDI_ERROR;
4493 }
4495 if (!potm)
4496 {
4497 TEXTOBJ_UnlockText(TextObj);
4499 return GDI_ERROR;
4500 }
4502 Size = IntGetOutlineTextMetrics(FontGDI, Size, potm, FALSE);
4503 if (!Size)
4504 {
4506 TEXTOBJ_UnlockText(TextObj);
4508 return GDI_ERROR;
4509 }
4510
4512 TextIntUpdateSize(dc, TextObj, FontGDI, FALSE);
4514 FT_Set_Transform(ft_face, &mat, NULL);
4515
4516 TEXTOBJ_UnlockText(TextObj);
4517
4518 glyph_index = get_glyph_index_flagged(ft_face, wch, (iFormat & GGO_GLYPH_INDEX));
4519 iFormat &= ~GGO_GLYPH_INDEX;
4520
4521 if (orientation || (iFormat != GGO_METRICS && iFormat != GGO_BITMAP) || aveWidth || pmat2)
4522 load_flags |= FT_LOAD_NO_BITMAP;
4523
4524 if (iFormat & GGO_UNHINTED)
4525 {
4526 load_flags |= FT_LOAD_NO_HINTING;
4527 iFormat &= ~GGO_UNHINTED;
4528 }
4529
4530 error = FT_Load_Glyph(ft_face, glyph_index, load_flags);
4531 if (error)
4532 {
4533 DPRINT1("WARNING: Failed to load and render glyph! [index: %u]\n", glyph_index);
4535 if (potm) ExFreePoolWithTag(potm, GDITAG_TEXT);
4536 return GDI_ERROR;
4537 }
4539
4540 FLOATOBJ_Set1(&widthRatio);
4541 if (aveWidth && potm)
4542 {
4543 // widthRatio = aveWidth * eM11 / potm->otmTextMetrics.tmAveCharWidth
4544 FLOATOBJ_SetLong(&widthRatio, aveWidth);
4545 FLOATOBJ_Mul(&widthRatio, &eM11);
4547 }
4548
4549 //left = (INT)(ft_face->glyph->metrics.horiBearingX * widthRatio) & -64;
4550 FLOATOBJ_SetLong(&eTemp, ft_face->glyph->metrics.horiBearingX);
4551 FLOATOBJ_Mul(&eTemp, &widthRatio);
4552 left = FLOATOBJ_GetLong(&eTemp) & -64;
4553
4554 //right = (INT)((ft_face->glyph->metrics.horiBearingX +
4555 // ft_face->glyph->metrics.width) * widthRatio + 63) & -64;
4556 FLOATOBJ_SetLong(&eTemp, ft_face->glyph->metrics.horiBearingX * ft_face->glyph->metrics.width);
4557 FLOATOBJ_Mul(&eTemp, &widthRatio);
4558 FLOATOBJ_AddLong(&eTemp, 63);
4559 right = FLOATOBJ_GetLong(&eTemp) & -64;
4560
4561 //adv = (INT)((ft_face->glyph->metrics.horiAdvance * widthRatio) + 63) >> 6;
4562 FLOATOBJ_SetLong(&eTemp, ft_face->glyph->metrics.horiAdvance);
4563 FLOATOBJ_Mul(&eTemp, &widthRatio);
4564 FLOATOBJ_AddLong(&eTemp, 63);
4565 adv = FLOATOBJ_GetLong(&eTemp) >> 6;
4566
4567 lsb = left >> 6;
4568 bbx = (right - left) >> 6;
4569
4570 DPRINT("Advance = %d, lsb = %d, bbx = %d\n",adv, lsb, bbx);
4571
4573
4574 /* Width scaling transform */
4575 if (!FLOATOBJ_Equal1(&widthRatio))
4576 {
4577 FT_Matrix scaleMat;
4578
4579 eTemp = widthRatio;
4580 FLOATOBJ_MulLong(&eTemp, 1 << 16);
4581
4582 scaleMat.xx = FLOATOBJ_GetLong(&eTemp);
4583 scaleMat.xy = 0;
4584 scaleMat.yx = 0;
4585 scaleMat.yy = INT_TO_FIXED(1);
4586 FT_Matrix_Multiply(&scaleMat, &transMat);
4587 needsTransform = TRUE;
4588 }
4589
4590 /* World transform */
4591 {
4592 FT_Matrix ftmatrix;
4594
4595 /* Create a freetype matrix, by converting to 16.16 fixpoint format */
4596 IntMatrixFromMx(&ftmatrix, pmx);
4597
4598 if (memcmp(&ftmatrix, &identityMat, sizeof(identityMat)) != 0)
4599 {
4600 FT_Matrix_Multiply(&ftmatrix, &transMat);
4601 needsTransform = TRUE;
4602 }
4603 }
4604
4605 /* Rotation transform */
4606 if (orientation)
4607 {
4608 FT_Matrix rotationMat;
4609 DPRINT("Rotation Trans!\n");
4610 IntEscapeMatrix(&rotationMat, orientation);
4611 FT_Matrix_Multiply(&rotationMat, &transMat);
4612 needsTransform = TRUE;
4613 }
4614
4615 /* Extra transformation specified by caller */
4616 if (pmat2)
4617 {
4618 FT_Matrix extraMat;
4619 DPRINT("MAT2 Matrix Trans!\n");
4620 extraMat.xx = FT_FixedFromFIXED(pmat2->eM11);
4621 extraMat.xy = FT_FixedFromFIXED(pmat2->eM21);
4622 extraMat.yx = FT_FixedFromFIXED(pmat2->eM12);
4623 extraMat.yy = FT_FixedFromFIXED(pmat2->eM22);
4624 FT_Matrix_Multiply(&extraMat, &transMat);
4625 needsTransform = TRUE;
4626 }
4627
4628 if (potm) ExFreePoolWithTag(potm, GDITAG_TEXT); /* It looks like we are finished with potm ATM. */
4629
4630 if (!needsTransform)
4631 {
4632 DPRINT("No Need to be Transformed!\n");
4633 top = (ft_face->glyph->metrics.horiBearingY + 63) & -64;
4634 bottom = (ft_face->glyph->metrics.horiBearingY -
4635 ft_face->glyph->metrics.height) & -64;
4636 gm.gmCellIncX = adv;
4637 gm.gmCellIncY = 0;
4638 }
4639 else
4640 {
4641 INT xc, yc;
4642 FT_Vector vec;
4643 for (xc = 0; xc < 2; xc++)
4644 {
4645 for (yc = 0; yc < 2; yc++)
4646 {
4647 vec.x = (ft_face->glyph->metrics.horiBearingX +
4648 xc * ft_face->glyph->metrics.width);
4649 vec.y = ft_face->glyph->metrics.horiBearingY -
4650 yc * ft_face->glyph->metrics.height;
4651 DPRINT("Vec %ld,%ld\n", vec.x, vec.y);
4652 FT_Vector_Transform(&vec, &transMat);
4653 if (xc == 0 && yc == 0)
4654 {
4655 left = right = vec.x;
4656 top = bottom = vec.y;
4657 }
4658 else
4659 {
4660 if (vec.x < left) left = vec.x;
4661 else if (vec.x > right) right = vec.x;
4662 if (vec.y < bottom) bottom = vec.y;
4663 else if (vec.y > top) top = vec.y;
4664 }
4665 }
4666 }
4667 left = left & -64;
4668 right = (right + 63) & -64;
4669 bottom = bottom & -64;
4670 top = (top + 63) & -64;
4671
4672 DPRINT("Transformed box: (%d,%d - %d,%d)\n", left, top, right, bottom);
4673 vec.x = ft_face->glyph->metrics.horiAdvance;
4674 vec.y = 0;
4675 FT_Vector_Transform(&vec, &transMat);
4676 gm.gmCellIncX = (vec.x+63) >> 6;
4677 gm.gmCellIncY = -((vec.y+63) >> 6);
4678 }
4679 gm.gmBlackBoxX = (right - left) >> 6;
4680 gm.gmBlackBoxY = (top - bottom) >> 6;
4681 gm.gmptGlyphOrigin.x = left >> 6;
4682 gm.gmptGlyphOrigin.y = top >> 6;
4683
4684 DPRINT("CX %d CY %d BBX %u BBY %u GOX %d GOY %d\n",
4685 gm.gmCellIncX, gm.gmCellIncY,
4686 gm.gmBlackBoxX, gm.gmBlackBoxY,
4688
4690
4691 if (iFormat == GGO_METRICS)
4692 {
4693 DPRINT("GGO_METRICS Exit!\n");
4694 *pgm = gm;
4695 return 1; /* FIXME */
4696 }
4697
4698 if (ft_face->glyph->format != ft_glyph_format_outline && iFormat != GGO_BITMAP)
4699 {
4700 DPRINT1("Loaded a bitmap\n");
4701 return GDI_ERROR;
4702 }
4703
4704 switch (iFormat)
4705 {
4706 case GGO_BITMAP:
4707 {
4708 width = gm.gmBlackBoxX;
4709 height = gm.gmBlackBoxY;
4710 pitch = ((width + 31) >> 5) << 2;
4711 needed = pitch * height;
4712
4713 if (!pvBuf || !cjBuf) break;
4714 if (!needed) return GDI_ERROR; /* empty glyph */
4715 if (needed > cjBuf)
4716 return GDI_ERROR;
4717
4718 switch (ft_face->glyph->format)
4719 {
4721 {
4722 BYTE *src = ft_face->glyph->bitmap.buffer, *dst = pvBuf;
4723 INT w = min( pitch, (ft_face->glyph->bitmap.width + 7) >> 3 );
4724 INT h = min( height, ft_face->glyph->bitmap.rows );
4725 while (h--)
4726 {
4728 src += ft_face->glyph->bitmap.pitch;
4729 dst += pitch;
4730 }
4731 break;
4732 }
4733
4735 {
4736 ft_bitmap.width = width;
4737 ft_bitmap.rows = height;
4738 ft_bitmap.pitch = pitch;
4739 ft_bitmap.pixel_mode = FT_PIXEL_MODE_MONO;
4740 ft_bitmap.buffer = pvBuf;
4741
4743 if (needsTransform)
4744 {
4745 FT_Outline_Transform(&ft_face->glyph->outline, &transMat);
4746 }
4747 FT_Outline_Translate(&ft_face->glyph->outline, -left, -bottom );
4748 /* Note: FreeType will only set 'black' bits for us. */
4749 RtlZeroMemory(pvBuf, needed);
4750 FT_Outline_Get_Bitmap(g_FreeTypeLibrary, &ft_face->glyph->outline, &ft_bitmap);
4752 break;
4753 }
4754
4755 default:
4756 DPRINT1("Loaded glyph format %x\n", ft_face->glyph->format);
4757 return GDI_ERROR;
4758 }
4759
4760 break;
4761 }
4762
4763 case GGO_GRAY2_BITMAP:
4764 case GGO_GRAY4_BITMAP:
4765 case GGO_GRAY8_BITMAP:
4766 {
4767 unsigned int mult, row, col;
4768 BYTE *start, *ptr;
4769
4770 width = gm.gmBlackBoxX;
4771 height = gm.gmBlackBoxY;
4772 pitch = (width + 3) / 4 * 4;
4773 needed = pitch * height;
4774
4775 if (!pvBuf || !cjBuf) break;
4776 if (!needed) return GDI_ERROR; /* empty glyph */
4777 if (needed > cjBuf)
4778 return GDI_ERROR;
4779
4780 switch (ft_face->glyph->format)
4781 {
4783 {
4784 BYTE *src = ft_face->glyph->bitmap.buffer, *dst = pvBuf;
4785 INT h = min( height, ft_face->glyph->bitmap.rows );
4786 INT x;
4787 while (h--)
4788 {
4789 for (x = 0; (UINT)x < pitch; x++)
4790 {
4791 if (x < ft_face->glyph->bitmap.width)
4792 dst[x] = (src[x / 8] & (1 << ( (7 - (x % 8))))) ? 0xff : 0;
4793 else
4794 dst[x] = 0;
4795 }
4796 src += ft_face->glyph->bitmap.pitch;
4797 dst += pitch;
4798 }
4799 break;
4800 }
4802 {
4803 ft_bitmap.width = width;
4804 ft_bitmap.rows = height;
4805 ft_bitmap.pitch = pitch;
4806 ft_bitmap.pixel_mode = FT_PIXEL_MODE_GRAY;
4807 ft_bitmap.buffer = pvBuf;
4808
4810 if (needsTransform)
4811 {
4812 FT_Outline_Transform(&ft_face->glyph->outline, &transMat);
4813 }
4814 FT_Outline_Translate(&ft_face->glyph->outline, -left, -bottom );
4815 RtlZeroMemory(ft_bitmap.buffer, cjBuf);
4816 FT_Outline_Get_Bitmap(g_FreeTypeLibrary, &ft_face->glyph->outline, &ft_bitmap);
4818
4820 mult = 4;
4821 else if (iFormat == GGO_GRAY4_BITMAP)
4822 mult = 16;
4823 else if (iFormat == GGO_GRAY8_BITMAP)
4824 mult = 64;
4825 else
4826 {
4827 return GDI_ERROR;
4828 }
4829
4830 start = pvBuf;
4831 for (row = 0; row < height; row++)
4832 {
4833 ptr = start;
4834 for (col = 0; col < width; col++, ptr++)
4835 {
4836 *ptr = (((int)*ptr) * mult + 128) / 256;
4837 }
4838 start += pitch;
4839 }
4840
4841 break;
4842 }
4843 default:
4844 DPRINT1("Loaded glyph format %x\n", ft_face->glyph->format);
4845 return GDI_ERROR;
4846 }
4847
4848 break;
4849 }
4850
4851 case GGO_NATIVE:
4852 {
4853 FT_Outline *outline = &ft_face->glyph->outline;
4854
4855 if (cjBuf == 0) pvBuf = NULL; /* This is okay, need cjBuf to allocate. */
4856
4858 if (needsTransform && pvBuf) FT_Outline_Transform(outline, &transMat);
4859
4861
4862 if (!pvBuf || !cjBuf)
4863 {
4865 break;
4866 }
4867 if (needed > cjBuf)
4868 {
4870 return GDI_ERROR;
4871 }
4874 break;
4875 }
4876
4877 case GGO_BEZIER:
4878 {
4879 FT_Outline *outline = &ft_face->glyph->outline;
4880 if (cjBuf == 0) pvBuf = NULL;
4881
4882 if (needsTransform && pvBuf)
4883 {
4885 FT_Outline_Transform(outline, &transMat);
4887 }
4889
4890 if (!pvBuf || !cjBuf)
4891 break;
4892 if (needed > cjBuf)
4893 return GDI_ERROR;
4894
4896 break;
4897 }
4898
4899 default:
4900 DPRINT1("Unsupported format %u\n", iFormat);
4901 return GDI_ERROR;
4902 }
4903
4904 DPRINT("ftGdiGetGlyphOutline END and needed %lu\n", needed);
4905
4906 if (gm.gmBlackBoxX == 0)
4907 gm.gmBlackBoxX = 1;
4908 if (gm.gmBlackBoxY == 0)
4909 gm.gmBlackBoxY = 1;
4910
4911 *pgm = gm;
4912 return needed;
4913}
#define DPRINT1
Definition: precomp.h:8
HFONT hFont
Definition: main.c:53
FORCEINLINE PMATRIX DC_pmxWorldToDevice(PDC pdc)
Definition: coord.h:135
HDC dc
Definition: cylfrac.c:34
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define TRUE
Definition: types.h:120
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
_ACRTIMP int __cdecl memcmp(const void *, const void *, size_t)
Definition: string.c:2802
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 ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define PagedPool
Definition: env_spec_w32.h:308
#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:4219
static FT_UInt FASTCALL get_glyph_index_flagged(FT_Face face, FT_ULong code, BOOL fCodeAsIndex)
Definition: freetype.c:4337
#define ASSERT_FREETYPE_LOCK_NOT_HELD()
Definition: freetype.c:334
static unsigned int get_bezier_glyph_outline(FT_Outline *outline, unsigned int buflen, char *buf)
Definition: freetype.c:3955
static unsigned int get_native_glyph_outline(FT_Outline *outline, unsigned int buflen, char *buf)
Definition: freetype.c:3882
static VOID FASTCALL IntMatrixFromMx(FT_Matrix *pmat, const MATRIX *pmx)
Definition: freetype.c:1102
static VOID FASTCALL IntEscapeMatrix(FT_Matrix *pmat, LONG lfEscapement)
Definition: freetype.c:1089
static const FT_Matrix identityMat
Definition: freetype.c:313
static __inline FT_Fixed FT_FixedFromFIXED(FIXED f)
Definition: freetype.c:672
INT FASTCALL IntGetOutlineTextMetrics(PFONTGDI FontGDI, UINT Size, OUTLINETEXTMETRICW *Otm, BOOL bLocked)
Definition: freetype.c:3139
FT_Load_Glyph(FT_Face face, FT_UInt glyph_index, FT_Int32 load_flags)
Definition: ftobjs.c:796
#define FT_LOAD_NO_BITMAP
Definition: freetype.h:3025
FT_Set_Transform(FT_Face face, FT_Matrix *matrix, FT_Vector *delta)
Definition: ftobjs.c:689
#define FT_LOAD_NO_HINTING
Definition: freetype.h:3023
#define FT_IS_SCALABLE(face)
Definition: freetype.h:1271
#define FT_LOAD_DEFAULT
Definition: freetype.h:3021
#define FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH
Definition: freetype.h:3030
FT_Vector_Transform(FT_Vector *vector, const FT_Matrix *matrix)
Definition: ftoutln.c:683
FT_Vector * vec
Definition: ftbbox.c:469
#define INT_TO_FIXED(x)
Definition: ftcalc.h:448
FT_Matrix_Multiply(const FT_Matrix *a, FT_Matrix *b)
Definition: ftcalc.c:660
#define ft_glyph_format_bitmap
Definition: ftimage.h:759
@ FT_PIXEL_MODE_MONO
Definition: ftimage.h:183
@ FT_PIXEL_MODE_GRAY
Definition: ftimage.h:184
#define ft_glyph_format_outline
Definition: ftimage.h:760
FT_Outline_Translate(const FT_Outline *outline, FT_Pos xOffset, FT_Pos yOffset)
Definition: ftoutln.c:507
FT_Outline_Get_Bitmap(FT_Library library, FT_Outline *outline, const FT_Bitmap *abitmap)
Definition: ftoutln.c:656
FT_Outline_Transform(const FT_Outline *outline, const FT_Matrix *matrix)
Definition: ftoutln.c:706
unsigned int FT_UInt
Definition: fttypes.h:231
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
#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
unsigned int UINT
Definition: ndis.h:50
long LONG
Definition: pedump.c:60
#define DPRINT
Definition: sndvol32.h:73
unsigned int width
Definition: ftimage.h:263
unsigned char * buffer
Definition: ftimage.h:265
unsigned char pixel_mode
Definition: ftimage.h:267
unsigned int rows
Definition: ftimage.h:262
int pitch
Definition: ftimage.h:264
FT_GlyphSlot glyph
Definition: freetype.h:1065
FT_Bitmap bitmap
Definition: freetype.h:1886
FT_Outline outline
Definition: freetype.h:1890
FT_Glyph_Metrics metrics
Definition: freetype.h:1879
FT_Glyph_Format format
Definition: freetype.h:1884
FT_Fixed xx
Definition: fttypes.h:392
FT_Fixed yx
Definition: fttypes.h:393
FT_Fixed yy
Definition: fttypes.h:393
FT_Fixed xy
Definition: fttypes.h:392
FT_Pos x
Definition: ftimage.h:77
FT_Pos y
Definition: ftimage.h:78
LONG lfOrientation
Definition: dimm.idl:62
LONG lfWidth
Definition: dimm.idl:60
HANDLE hlfntNew
Definition: ntgdihdl.h:330
short gmCellIncX
Definition: wingdi.h:2891
UINT gmBlackBoxY
Definition: wingdi.h:2889
UINT gmBlackBoxX
Definition: wingdi.h:2888
short gmCellIncY
Definition: wingdi.h:2892
POINT gmptGlyphOrigin
Definition: wingdi.h:2890
Definition: text.h:60
ENUMLOGFONTEXDVW logfont
Definition: text.h:70
FONTOBJ * Font
Definition: text.h:66
FIXED eM22
Definition: wingdi.h:2922
FIXED eM21
Definition: wingdi.h:2921
FIXED eM11
Definition: wingdi.h:2919
FIXED eM12
Definition: wingdi.h:2920
TEXTMETRICW otmTextMetrics
Definition: wingdi.h:2960
FLOATL eM11
Definition: winddi.h:1234
Definition: mesh.c:5330
ENUMLOGFONTEXW elfEnumLogfontEx
Definition: wingdi.h:3225
LOGFONTW elfLogFont
Definition: wingdi.h:3148
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
LONG tmAveCharWidth
Definition: wingdi.h:2834
int32_t INT
Definition: typedefs.h:58
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
uint32_t ULONG
Definition: typedefs.h:59
PTEXTOBJ FASTCALL RealizeFontInit(_In_ HFONT hFont)
Definition: font.c:433
FORCEINLINE VOID TEXTOBJ_UnlockText(PLFONT plfnt)
Definition: text.h:96
#define GDITAG_TEXT
Definition: tags.h:172
#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 ERROR_GEN_FAILURE
Definition: winerror.h:256
#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 6464 of file freetype.c.

6467{
6468 DWORD Count = 0;
6469 INT i = 0;
6470 FT_Face face = Font->SharedFace->Face;
6471
6472 if (FT_HAS_KERNING(face) && face->charmap->encoding == FT_ENCODING_UNICODE)
6473 {
6474 FT_UInt previous_index = 0, glyph_index = 0;
6475 FT_ULong char_code, char_previous;
6476 FT_Vector delta;
6477
6478 char_previous = char_code = FT_Get_First_Char(face, &glyph_index);
6479
6481
6482 while (glyph_index)
6483 {
6484 if (previous_index && glyph_index)
6485 {
6486 FT_Get_Kerning(face, previous_index, glyph_index, FT_KERNING_DEFAULT, &delta);
6487
6488 if (pKerningPair && cPairs)
6489 {
6490 pKerningPair[i].wFirst = char_previous;
6491 pKerningPair[i].wSecond = char_code;
6492 pKerningPair[i].iKernAmount = delta.x;
6493 i++;
6494 if (i == cPairs) break;
6495 }
6496 Count++;
6497 }
6498 previous_index = glyph_index;
6499 char_previous = char_code;
6500 char_code = FT_Get_Next_Char(face, char_code, &glyph_index);
6501 }
6503 }
6504 return Count;
6505}
FT_Get_First_Char(FT_Face face, FT_UInt *agindex)
Definition: ftobjs.c:3760
FT_Get_Next_Char(FT_Face face, FT_ULong char_code, FT_UInt *agindex)
Definition: ftobjs.c:3785
FT_Get_Kerning(FT_Face face, FT_UInt left_glyph, FT_UInt right_glyph, FT_UInt kern_mode, FT_Vector *akerning)
Definition: ftobjs.c:3411
@ FT_KERNING_DEFAULT
Definition: freetype.h:3406
#define FT_HAS_KERNING(face)
Definition: freetype.h:1256
GLenum GLuint GLint GLenum face
Definition: glext.h:7025
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
int Count
Definition: noreturn.cpp:7
WORD wSecond
Definition: wingdi.h:2911
int iKernAmount
Definition: wingdi.h:2912

Referenced by GreGetKerningPairs(), and NtGdiGetKerningPairs().

◆ ftGdiGetRasterizerCaps()

BOOL FASTCALL ftGdiGetRasterizerCaps ( LPRASTERIZER_STATUS  lprs)

Definition at line 3751 of file freetype.c.

3752{
3753 if ( lprs )
3754 {
3755 lprs->nSize = sizeof(RASTERIZER_STATUS);
3756 lprs->wFlags = TT_AVAILABLE | TT_ENABLED;
3757 lprs->nLanguageID = gusLanguageID;
3758 return TRUE;
3759 }
3761 return FALSE;
3762}
#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,
PFONTSIGNATURE  lpSig,
DWORD  dwFlags 
)

Definition at line 5078 of file freetype.c.

5082{
5083 PDC_ATTR pdcattr;
5084 UINT Ret = DEFAULT_CHARSET;
5085 INT i;
5086 HFONT hFont;
5087 PTEXTOBJ TextObj;
5088 PFONTGDI FontGdi;
5090 TT_OS2 *pOS2;
5091 FT_Face Face;
5092 CHARSETINFO csi;
5093 DWORD cp, fs0;
5094 USHORT usACP, usOEM;
5095
5096 pdcattr = Dc->pdcattr;
5097 hFont = pdcattr->hlfntNew;
5098 TextObj = RealizeFontInit(hFont);
5099
5100 if (!TextObj)
5101 {
5103 return Ret;
5104 }
5105 FontGdi = ObjToGDI(TextObj->Font, FONT);
5106 Face = FontGdi->SharedFace->Face;
5107 TEXTOBJ_UnlockText(TextObj);
5108
5109 memset(&fs, 0, sizeof(FONTSIGNATURE));
5111 pOS2 = FT_Get_Sfnt_Table(Face, ft_sfnt_os2);
5112 if (NULL != pOS2)
5113 {
5114 fs.fsCsb[0] = pOS2->ulCodePageRange1;
5115 fs.fsCsb[1] = pOS2->ulCodePageRange2;
5116 fs.fsUsb[0] = pOS2->ulUnicodeRange1;
5117 fs.fsUsb[1] = pOS2->ulUnicodeRange2;
5118 fs.fsUsb[2] = pOS2->ulUnicodeRange3;
5119 fs.fsUsb[3] = pOS2->ulUnicodeRange4;
5120 if (pOS2->version == 0)
5121 {
5122 FT_UInt dummy;
5123
5124 if (FT_Get_First_Char( Face, &dummy ) < 0x100)
5125 fs.fsCsb[0] |= FS_LATIN1;
5126 else
5127 fs.fsCsb[0] |= FS_SYMBOL;
5128 }
5129 }
5130 pOS2 = NULL;
5132 DPRINT("Csb 1=%x 0=%x\n", fs.fsCsb[1],fs.fsCsb[0]);
5133 if (fs.fsCsb[0] == 0)
5134 { /* Let's see if we can find any interesting cmaps */
5135 for (i = 0; i < Face->num_charmaps; i++)
5136 {
5137 switch (Face->charmaps[i]->encoding)
5138 {
5139 case FT_ENCODING_UNICODE:
5140 case FT_ENCODING_APPLE_ROMAN:
5141 fs.fsCsb[0] |= FS_LATIN1;
5142 break;
5143 case FT_ENCODING_MS_SYMBOL:
5144 fs.fsCsb[0] |= FS_SYMBOL;
5145 break;
5146 default:
5147 break;
5148 }
5149 }
5150 }
5151 if (lpSig)
5152 {
5153 RtlCopyMemory(lpSig, &fs, sizeof(FONTSIGNATURE));
5154 }
5155
5156 RtlGetDefaultCodePage(&usACP, &usOEM);
5157 cp = usACP;
5158
5160 if (csi.fs.fsCsb[0] & fs.fsCsb[0])
5161 {
5162 DPRINT("Hit 1\n");
5163 Ret = csi.ciCharset;
5164 goto Exit;
5165 }
5166
5167 for (i = 0; i < MAXTCIINDEX; i++)
5168 {
5169 fs0 = 1L << i;
5170 if (fs.fsCsb[0] & fs0)
5171 {
5172 if (IntTranslateCharsetInfo(&fs0, &csi, TCI_SRCFONTSIG))
5173 {
5174 // *cp = csi.ciACP;
5175 DPRINT("Hit 2\n");
5176 Ret = csi.ciCharset;
5177 goto Exit;
5178 }
5179 else
5180 DPRINT1("TCI failing on %x\n", fs0);
5181 }
5182 }
5183Exit:
5184 DPRINT("CharSet %u CodePage %u\n", csi.ciCharset, csi.ciACP);
5185 return (MAKELONG(csi.ciACP, csi.ciCharset));
5186}
#define MAXTCIINDEX
Definition: freetype.c:381
static BOOLEAN IntTranslateCharsetInfo(PDWORD Src, LPCHARSETINFO Cs, DWORD Flags)
Definition: freetype.c:2775
#define fs
Definition: i386-dis.c:444
POINT cp
Definition: magnifier.c:59
NTSYSAPI VOID NTAPI RtlGetDefaultCodePage(_Out_ PUSHORT AnsiCodePage, _Out_ PUSHORT OemCodePage)
unsigned short USHORT
Definition: pedump.c:61
#define memset(x, y, z)
Definition: compat.h:39
static void Exit(void)
Definition: sock.c:1330
FT_Encoding encoding
Definition: freetype.h:820
FT_Int num_charmaps
Definition: freetype.h:1044
FT_CharMap * charmaps
Definition: freetype.h:1045
FT_UShort version
Definition: tttables.h:377
FT_ULong ulUnicodeRange1
Definition: tttables.h:396
FT_ULong ulCodePageRange1
Definition: tttables.h:414
FT_ULong ulUnicodeRange3
Definition: tttables.h:398
FT_ULong ulUnicodeRange2
Definition: tttables.h:397
FT_ULong ulCodePageRange2
Definition: tttables.h:415
FT_ULong ulUnicodeRange4
Definition: tttables.h:399
Definition: ffs.h:70
FONTSIGNATURE fs
Definition: wingdi.h:1994
UINT ciCharset
Definition: wingdi.h:1992
DWORD fsCsb[2]
Definition: wingdi.h:1989
FT_Get_Sfnt_Table(FT_Face face, FT_Sfnt_Tag tag)
Definition: ftobjs.c:4176
#define ft_sfnt_os2
Definition: tttables.h:638
#define MAKELONG(a, b)
Definition: typedefs.h:249
#define DEFAULT_CHARSET
Definition: wingdi.h:384
#define FS_SYMBOL
Definition: wingdi.h:575
#define FS_LATIN1
Definition: wingdi.h:560
#define TCI_SRCFONTSIG
Definition: wingdi.h:963
#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 5265 of file freetype.c.

5268{
5269 PDC dc;
5270 PDC_ATTR pdcattr;
5271 PTEXTOBJ TextObj;
5272 PFONTGDI FontGDI;
5273 FT_Face Face;
5274 TT_OS2 *pOS2;
5275 TT_HoriHeader *pHori;
5277 ULONG Error;
5279 LOGFONTW *plf;
5280
5281 if (!ptmwi)
5282 {
5284 return FALSE;
5285 }
5286 RtlZeroMemory(ptmwi, sizeof(TMW_INTERNAL));
5287
5288 if (!(dc = DC_LockDc(hDC)))
5289 {
5291 return FALSE;
5292 }
5293 pdcattr = dc->pdcattr;
5294 TextObj = RealizeFontInit(pdcattr->hlfntNew);
5295 if (NULL != TextObj)
5296 {
5297 plf = &TextObj->logfont.elfEnumLogfontEx.elfLogFont;
5298 FontGDI = ObjToGDI(TextObj->Font, FONT);
5299
5300 Face = FontGDI->SharedFace->Face;
5301
5302 // NOTE: GetTextMetrics simply ignores lfEscapement and XFORM.
5304 Error = IntRequestFontSize(dc, FontGDI, plf->lfWidth, plf->lfHeight);
5305 FT_Set_Transform(Face, NULL, NULL);
5306
5308
5309 if (0 != Error)
5310 {
5311 DPRINT1("Error in setting pixel sizes: %u\n", Error);
5313 }
5314 else
5315 {
5317
5319
5320 Error = FT_Get_WinFNT_Header(Face, &Win);
5321 pOS2 = FT_Get_Sfnt_Table(Face, ft_sfnt_os2);
5322 pHori = FT_Get_Sfnt_Table(Face, ft_sfnt_hhea);
5323
5324 if (!pOS2 && Error)
5325 {
5326 DPRINT1("Can't find OS/2 table - not TT font?\n");
5328 }
5329
5330 if (!pHori && Error)
5331 {
5332 DPRINT1("Can't find HHEA table - not TT font?\n");
5334 }
5335
5336 if (NT_SUCCESS(Status))
5337 {
5338 FillTM(&ptmwi->TextMetric, FontGDI, pOS2, pHori, (Error ? NULL : &Win));
5339
5340 /* FIXME: Fill Diff member */
5341 }
5342
5344 }
5345 TEXTOBJ_UnlockText(TextObj);
5346 }
5347 else
5348 {
5350 }
5351 DC_UnlockDc(dc);
5352
5353 if (!NT_SUCCESS(Status))
5354 {
5356 return FALSE;
5357 }
5358 return TRUE;
5359}
static HDC hDC
Definition: 3dtext.c:33
LONG NTSTATUS
Definition: precomp.h:26
#define STATUS_INVALID_HANDLE
Definition: d3dkmdt.h:40
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:238
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:220
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
static FT_Error IntRequestFontSize(PDC dc, PFONTGDI FontGDI, LONG lfWidth, LONG lfHeight)
Definition: freetype.c:4080
static void FASTCALL FillTM(TEXTMETRICW *TM, PFONTGDI FontGDI, TT_OS2 *pOS2, TT_HoriHeader *pHori, FT_WinFNT_HeaderRec *pFNT)
Definition: freetype.c:2837
FT_Get_WinFNT_Header(FT_Face face, FT_WinFNT_HeaderRec *aheader)
Definition: ftwinfnt.c:28
Status
Definition: gdiplustypes.h:25
#define STATUS_INTERNAL_ERROR
Definition: ntstatus.h:559
#define STATUS_SUCCESS
Definition: shellext.h:65
Definition: polytest.cpp:41
LONG lfHeight
Definition: dimm.idl:59
TEXTMETRICW TextMetric
Definition: ntgdityp.h:370
#define ft_sfnt_hhea
Definition: tttables.h:639
#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 6445 of file freetype.c.

6446{
6447 if (FT_HAS_FIXED_SIZES(Font->SharedFace->Face))
6448 Info->iTechnology = RI_TECH_BITMAP;
6449 else
6450 {
6451 if (FT_IS_SCALABLE(Font->SharedFace->Face))
6452 Info->iTechnology = RI_TECH_SCALABLE;
6453 else
6454 Info->iTechnology = RI_TECH_FIXED;
6455 }
6456 Info->iUniq = Font->FontObj.iUniq;
6457 Info->dwUnknown = -1;
6458 return TRUE;
6459}
#define FT_HAS_FIXED_SIZES(face)
Definition: freetype.h:1320
#define RI_TECH_SCALABLE
Definition: ntgdityp.h:273
#define RI_TECH_FIXED
Definition: ntgdityp.h:272
#define RI_TECH_BITMAP
Definition: ntgdityp.h:271
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:690

Referenced by NtGdiGetRealizationInfo().

◆ ftGetFontUnicodeRanges()

DWORD FASTCALL ftGetFontUnicodeRanges ( PFONTGDI  Font,
PGLYPHSET  glyphset 
)

Definition at line 5191 of file freetype.c.

5192{
5193 DWORD size = 0;
5194 DWORD num_ranges = 0;
5195 FT_Face face = Font->SharedFace->Face;
5196
5197 if (face->charmap == NULL)
5198 {
5199 DPRINT1("FIXME: No charmap selected! This is a BUG!\n");
5200 return 0;
5201 }
5202
5203 if (face->charmap->encoding == FT_ENCODING_UNICODE)
5204 {
5205 FT_UInt glyph_code = 0;
5206 FT_ULong char_code, char_code_prev;
5207
5208 char_code_prev = char_code = FT_Get_First_Char(face, &glyph_code);
5209
5210 DPRINT("Face encoding FT_ENCODING_UNICODE, number of glyphs %ld, first glyph %u, first char %04lx\n",
5211 face->num_glyphs, glyph_code, char_code);
5212
5213 if (!glyph_code) return 0;
5214
5215 if (glyphset)
5216 {
5217 glyphset->ranges[0].wcLow = (USHORT)char_code;
5218 glyphset->ranges[0].cGlyphs = 0;
5219 glyphset->cGlyphsSupported = 0;
5220 }
5221
5222 num_ranges = 1;
5223 while (glyph_code)
5224 {
5225 if (char_code < char_code_prev)
5226 {
5227 DPRINT1("Expected increasing char code from FT_Get_Next_Char\n");
5228 return 0;
5229 }
5230 if (char_code - char_code_prev > 1)
5231 {
5232 num_ranges++;
5233 if (glyphset)
5234 {
5235 glyphset->ranges[num_ranges - 1].wcLow = (USHORT)char_code;
5236 glyphset->ranges[num_ranges - 1].cGlyphs = 1;
5237 glyphset->cGlyphsSupported++;
5238 }
5239 }
5240 else if (glyphset)
5241 {
5242 glyphset->ranges[num_ranges - 1].cGlyphs++;
5243 glyphset->cGlyphsSupported++;
5244 }
5245 char_code_prev = char_code;
5246 char_code = FT_Get_Next_Char(face, char_code, &glyph_code);
5247 }
5248 }
5249 else
5250 DPRINT1("Encoding %i not supported\n", face->charmap->encoding);
5251
5252 size = sizeof(GLYPHSET) + sizeof(WCRANGE) * (num_ranges - 1);
5253 if (glyphset)
5254 {
5255 glyphset->cbThis = size;
5256 glyphset->cRanges = num_ranges;
5257 glyphset->flAccel = 0;
5258 }
5259 return size;
5260}
GLsizeiptr size
Definition: glext.h:5919

Referenced by NtGdiGetFontUnicodeRanges().

◆ GreCreateFontIndirectW()

HFONT FASTCALL GreCreateFontIndirectW ( _In_ const LOGFONTW lplf)

Internal

Definition at line 30 of file font.c.

31{
32 if (lplf)
33 {
34 ENUMLOGFONTEXDVW Logfont;
35
36 RtlCopyMemory( &Logfont.elfEnumLogfontEx.elfLogFont, lplf, sizeof(LOGFONTW));
38 sizeof(Logfont.elfEnumLogfontEx.elfFullName));
40 sizeof(Logfont.elfEnumLogfontEx.elfStyle));
42 sizeof(Logfont.elfEnumLogfontEx.elfScript));
43
44 Logfont.elfDesignVector.dvNumAxes = 0;
45
46 RtlZeroMemory( &Logfont.elfDesignVector, sizeof(DESIGNVECTOR));
47
48 return HfontCreate(&Logfont, 0, 0, 0, NULL);
49 }
50 else return NULL;
51}
DWORD dvNumAxes
Definition: wingdi.h:3215
DESIGNVECTOR elfDesignVector
Definition: wingdi.h:3226
WCHAR elfStyle[LF_FACESIZE]
Definition: wingdi.h:3150
WCHAR elfFullName[LF_FULLFACESIZE]
Definition: wingdi.h:3149
WCHAR elfScript[LF_FACESIZE]
Definition: wingdi.h:3151
HFONT APIENTRY HfontCreate(_In_ const ENUMLOGFONTEXDVW *pelfw, _In_ ULONG cjElfw, _In_ LFTYPE lft, _In_ FLONG fl, _In_opt_ PVOID pvCliData)

Referenced by IntPaintDesktop(), MENU_DrawPopupGlyph(), MenuInit(), UITOOLS95_DFC_ButtonCheckRadio(), UITOOLS95_DrawFrameCaption(), UITOOLS95_DrawFrameMenu(), and UITOOLS95_DrawFrameScroll().

◆ GreExtTextOutW()

BOOL APIENTRY GreExtTextOutW ( _In_ HDC  hDC,
_In_ INT  XStart,
_In_ INT  YStart,
_In_ UINT  fuOptions,
_In_opt_ PRECTL  lprc,
_In_reads_opt_(Count) PCWCH  String,
_In_ INT  Count,
_In_opt_ const INT Dx,
_In_ DWORD  dwCodePage 
)

Definition at line 7291 of file freetype.c.

7301{
7302 BOOL bResult;
7303 DC *dc;
7304
7305 // TODO: Write test-cases to exactly match real Windows in different
7306 // bad parameters (e.g. does Windows check the DC or the RECT first?).
7307 dc = DC_LockDc(hDC);
7308 if (!dc)
7309 {
7311 return FALSE;
7312 }
7313
7314 bResult = IntExtTextOutW( dc,
7315 XStart,
7316 YStart,
7317 fuOptions,
7318 lprc,
7319 String,
7320 Count,
7321 Dx,
7322 dwCodePage );
7323
7324 DC_UnlockDc(dc);
7325
7326 return bResult;
7327}
BOOL APIENTRY IntExtTextOutW(_In_ PDC dc, _In_ INT XStart, _In_ INT YStart, _In_ UINT fuOptions, _In_opt_ PRECTL lprc, _In_reads_opt_(Count) PCWCH String, _In_ INT Count, _In_opt_ const INT *Dx, _In_ DWORD dwCodePage)
Definition: freetype.c:6742
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFSTRING String
Definition: wdfdevice.h:2439
_In_ int _Inout_ LPRECT lprc
Definition: winuser.h:4568

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

◆ GreGetCharWidthW()

BOOL APIENTRY GreGetCharWidthW ( _In_ HDC  hDC,
_In_ UINT  FirstChar,
_In_ UINT  Count,
_In_reads_opt_(Count) PCWCH  Safepwc,
_In_ ULONG  fl,
_Out_writes_bytes_(Count *sizeof(INT)) PVOID  pTmpBuffer 
)

◆ GreGetTextExtentExW()

BOOL FASTCALL GreGetTextExtentExW ( HDC  ,
PCWCH  ,
ULONG  ,
ULONG  ,
PULONG  ,
PULONG  ,
PSIZE  ,
FLONG   
)

◆ GreGetTextExtentW()

BOOL FASTCALL GreGetTextExtentW ( HDC  ,
PCWCH  ,
INT  ,
PSIZE  ,
UINT   
)

◆ GreGetTextMetricsW()

BOOL WINAPI GreGetTextMetricsW ( _In_ HDC  hdc,
_Out_ LPTEXTMETRICW  lptm 
)

Definition at line 191 of file text.c.

194{
195 TMW_INTERNAL tmwi;
196 if (!ftGdiGetTextMetricsW(hdc, &tmwi)) return FALSE;
197 IntTMWFixUp(hdc, &tmwi);
198 *lptm = tmwi.TextMetric;
199 return TRUE;
200}
BOOL FASTCALL ftGdiGetTextMetricsW(HDC hDC, PTMW_INTERNAL ptmwi)
Definition: freetype.c:5265
HDC hdc
Definition: main.c:9
static LPTEXTMETRICW lptm
Definition: font.c:42
VOID FASTCALL IntTMWFixUp(_In_ HDC hDC, _Inout_ PTMW_INTERNAL ptm)
Definition: text.c:29

Referenced by DrawTextExWorker().

◆ GreTextOutW()

BOOL FASTCALL GreTextOutW ( HDC  ,
INT  ,
INT  ,
PCWCH  ,
INT   
)

◆ InitFontSupport()

BOOL FASTCALL InitFontSupport ( VOID  )

Definition at line 997 of file freetype.c.

998{
999 ULONG ulError;
1000
1002
1004 if (g_FreeTypeLock == NULL)
1005 {
1006 return FALSE;
1007 }
1009
1011 if (ulError)
1012 {
1013 DPRINT1("FT_Init_FreeType failed with error code 0x%x\n", ulError);
1014 return FALSE;
1015 }
1016
1018 {
1019 DPRINT1("Fonts registry is empty.\n");
1020
1021 /* Load font(s) with writing registry */
1023 }
1024
1025 IntLoadFontSubstList(&g_FontSubstListHead);
1026
1027#if 0
1028 DumpFontInfo(TRUE);
1029#endif
1030
1034
1035 return TRUE;
1036}
#define NonPagedPool
Definition: env_spec_w32.h:307
BOOL FASTCALL IntLoadFontSubstList(PLIST_ENTRY pHead)
Definition: freetype.c:803
static UINT g_FontCacheNumEntries
Definition: freetype.c:352
VOID FASTCALL IntLoadSystemFonts(VOID)
Definition: freetype.c:1495
static NTSTATUS FontLink_LoadDefaultCharset(VOID)
Definition: freetype.c:136
static NTSTATUS FontLink_LoadSettings(VOID)
Definition: freetype.c:72
static NTSTATUS FontLink_LoadDefaultFonts(VOID)
Definition: freetype.c:98
BOOL FASTCALL IntLoadFontsInRegistry(VOID)
Definition: freetype.c:2376
FT_Init_FreeType(FT_Library *alibrary)
Definition: ftinit.c:199
FORCEINLINE VOID ExInitializeFastMutex(_Out_ PFAST_MUTEX FastMutex)
Definition: exfuncs.h:274
FAST_MUTEX
Definition: extypes.h:17

Referenced by InitializeGreCSRSS().

◆ IntCharSetFromCodePage()

BYTE FASTCALL IntCharSetFromCodePage ( UINT  uCodePage)

Definition at line 430 of file freetype.c.

431{
432 UINT i;
433
434 if (uCodePage == CP_OEMCP)
435 return OEM_CHARSET;
436
437 if (uCodePage == CP_MACCP)
438 return MAC_CHARSET;
439
440 for (i = 0; i < MAXTCIINDEX; ++i)
441 {
442 if (g_FontTci[i].ciACP == 0)
443 continue;
444
445 if (g_FontTci[i].ciACP == uCodePage)
446 return g_FontTci[i].ciCharset;
447 }
448
449 return DEFAULT_CHARSET;
450}
#define CP_OEMCP
Definition: freetype.c:424
static const CHARSETINFO g_FontTci[MAXTCIINDEX]
Definition: freetype.c:382
#define CP_MACCP
Definition: freetype.c:425
#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 2706 of file freetype.c.

2707{
2709}
static BOOL g_RenderingEnabled
Definition: freetype.c:329
_In_ ULONGLONG _In_ ULONGLONG _In_ BOOLEAN Enable
Definition: ntddpcm.h:142

◆ IntGdiAddFontMemResource()

HANDLE FASTCALL IntGdiAddFontMemResource ( PVOID  Buffer,
DWORD  dwSize,
PDWORD  pNumAdded 
)

Definition at line 2528 of file freetype.c.

2529{
2530 HANDLE Ret = NULL;
2532 PFONT_ENTRY_COLL_MEM EntryCollection;
2533 INT FaceCount;
2534
2536 if (!BufferCopy)
2537 {
2538 *pNumAdded = 0;
2539 return NULL;
2540 }
2541 RtlCopyMemory(BufferCopy, Buffer, dwSize);
2542
2543 RtlZeroMemory(&LoadFont, sizeof(LoadFont));
2544 LoadFont.Memory = SharedMem_Create(BufferCopy, dwSize, FALSE);
2545 LoadFont.Characteristics = FR_PRIVATE | FR_NOT_ENUM;
2546 RtlInitUnicodeString(&LoadFont.RegValueName, NULL);
2548
2549 RtlFreeUnicodeString(&LoadFont.RegValueName);
2550
2551 /* Release our copy */
2555
2556 if (FaceCount > 0)
2557 {
2558 EntryCollection = ExAllocatePoolWithTag(PagedPool, sizeof(FONT_ENTRY_COLL_MEM), TAG_FONT);
2559 if (EntryCollection)
2560 {
2562 EntryCollection->Entry = LoadFont.PrivateEntry;
2564 IntLockProcessPrivateFonts(Win32Process);
2565 EntryCollection->Handle = ULongToHandle(++Win32Process->PrivateMemFontHandleCount);
2566 InsertTailList(&Win32Process->PrivateMemFontListHead, &EntryCollection->ListEntry);
2567 IntUnLockProcessPrivateFonts(Win32Process);
2569 Ret = EntryCollection->Handle;
2570 }
2571 }
2572 *pNumAdded = FaceCount;
2573
2574 return Ret;
2575}
#define ULongToHandle(h)
Definition: basetsd.h:75
#define InsertTailList(ListHead, Entry)
BOOL LoadFont(LPWSTR lpCmdLine)
static INT FASTCALL IntGdiLoadFontByIndexFromMemory(PGDI_LOAD_FONT pLoadFont, FT_Long FontIndex)
Definition: freetype.c:1940
static PSHARED_MEM SharedMem_Create(PBYTE Buffer, ULONG BufferSize, BOOL IsMapping)
Definition: freetype.c:520
static void SharedMem_Release(PSHARED_MEM Ptr)
Definition: freetype.c:577
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
PVOID NTAPI PsGetCurrentProcessWin32Process(VOID)
Definition: process.c:1183
Definition: font.h:20
FONT_ENTRY_MEM * Entry
Definition: font.h:23
LIST_ENTRY ListEntry
Definition: font.h:21
HANDLE Handle
Definition: font.h:22
LIST_ENTRY PrivateMemFontListHead
Definition: win32.h:286
UINT PrivateMemFontHandleCount
Definition: win32.h:287
#define IntLockProcessPrivateFonts(W32Process)
Definition: text.h:164
#define IntUnLockProcessPrivateFonts(W32Process)
Definition: text.h:167

Referenced by NtGdiAddFontMemResourceEx().

◆ IntGdiAddFontResourceEx()

INT FASTCALL IntGdiAddFontResourceEx ( _In_ PCUNICODE_STRING  FileName,
_In_ DWORD  cFiles,
_In_ DWORD  Characteristics,
_In_ DWORD  dwFlags 
)

Definition at line 2193 of file freetype.c.

2198{
2199 PWSTR pchFile = FileName->Buffer;
2200 SIZE_T cchFile;
2201 INT ret = 0;
2202
2203 while (cFiles--)
2204 {
2205 _SEH2_TRY
2206 {
2207 cchFile = wcslen(pchFile);
2208 }
2210 {
2211 _SEH2_YIELD(return FALSE);
2212 }
2213 _SEH2_END;
2214
2215 UNICODE_STRING ustrPathName;
2216 ustrPathName.Length = (USHORT)(cchFile * sizeof(WCHAR));
2217 ustrPathName.MaximumLength = ustrPathName.Length + sizeof(WCHAR);
2218 ustrPathName.Buffer = pchFile;
2219
2220 INT count = IntGdiAddFontResourceSingle(&ustrPathName, Characteristics, dwFlags);
2221 if (!count)
2222 return 0;
2223 ret += count;
2224
2225 pchFile += cchFile + 1;
2226 }
2227
2228 /* Prepare for better LOGFONT-to-face matching */
2230
2231 return ret;
2232}
_ACRTIMP size_t __cdecl wcslen(const wchar_t *)
Definition: wcs.c:2983
return ret
Definition: mutex.c:146
static INT FASTCALL IntGdiAddFontResourceSingle(_In_ PCUNICODE_STRING FileName, _In_ DWORD Characteristics, _In_ DWORD dwFlags)
Definition: freetype.c:1994
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:90
_In_ LPWSTR _In_ DWORD _In_ DWORD _In_ DWORD dwFlags
Definition: netsh.h:141
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:82
#define _SEH2_END
Definition: pseh2_64.h:171
#define _SEH2_TRY
Definition: pseh2_64.h:71
#define _SEH2_YIELD(__stmt)
Definition: pseh2_64.h:184
USHORT MaximumLength
Definition: env_spec_w32.h:370
uint16_t * PWSTR
Definition: typedefs.h:56
ULONG_PTR SIZE_T
Definition: typedefs.h:80
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by IntLoadFontsInRegistry(), IntLoadSystemFonts(), and NtGdiAddFontResourceW().

◆ IntGdiCleanupPrivateFontsForProcess()

VOID FASTCALL IntGdiCleanupPrivateFontsForProcess ( VOID  )

Definition at line 2650 of file freetype.c.

2651{
2654 PFONT_ENTRY_COLL_MEM EntryCollection;
2655
2656 DPRINT("IntGdiCleanupPrivateFontsForProcess()\n");
2657 do {
2658 Entry = NULL;
2659 EntryCollection = NULL;
2660
2662 IntLockProcessPrivateFonts(Win32Process);
2663 if (!IsListEmpty(&Win32Process->PrivateMemFontListHead))
2664 {
2665 Entry = Win32Process->PrivateMemFontListHead.Flink;
2666 EntryCollection = CONTAINING_RECORD(Entry, FONT_ENTRY_COLL_MEM, ListEntry);
2667 UnlinkFontMemCollection(EntryCollection);
2668 }
2669 IntUnLockProcessPrivateFonts(Win32Process);
2671
2672 if (EntryCollection)
2673 {
2674 IntGdiCleanupMemEntry(EntryCollection->Entry);
2675 ExFreePoolWithTag(EntryCollection, TAG_FONT);
2676 }
2677 else
2678 {
2679 /* No Mem fonts anymore, see if we have any other private fonts left */
2680 Entry = NULL;
2682 IntLockProcessPrivateFonts(Win32Process);
2683 if (!IsListEmpty(&Win32Process->PrivateFontListHead))
2684 {
2685 Entry = RemoveHeadList(&Win32Process->PrivateFontListHead);
2686 }
2687 IntUnLockProcessPrivateFonts(Win32Process);
2689
2690 if (Entry)
2691 {
2693 }
2694 }
2695
2696 } while (Entry);
2697}
VOID FASTCALL IntGdiCleanupMemEntry(PFONT_ENTRY_MEM Head)
Definition: freetype.c:2578
static VOID FASTCALL UnlinkFontMemCollection(PFONT_ENTRY_COLL_MEM Collection)
Definition: freetype.c:2597
base of all file and directory entries
Definition: entries.h:83
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
LIST_ENTRY PrivateFontListHead
Definition: win32.h:285

Referenced by GdiProcessDestroy().

◆ IntGdiGetFontResourceInfo()

BOOL FASTCALL IntGdiGetFontResourceInfo ( PUNICODE_STRING  FileName,
PVOID  pBuffer,
DWORD pdwBytes,
DWORD  dwType 
)

Definition at line 6177 of file freetype.c.

6182{
6183 UNICODE_STRING EntryFileName;
6184 POBJECT_NAME_INFORMATION NameInfo1 = NULL, NameInfo2 = NULL;
6185 PLIST_ENTRY ListEntry;
6186 PFONT_ENTRY FontEntry;
6187 ULONG Size, i, Count;
6188 LPBYTE pbBuffer;
6189 BOOL IsEqual;
6190 FONTFAMILYINFO *FamInfo;
6191 const ULONG MaxFamInfo = 64;
6192 const ULONG MAX_FAM_INFO_BYTES = sizeof(FONTFAMILYINFO) * MaxFamInfo;
6193 BOOL bSuccess;
6194 const ULONG NAMEINFO_SIZE = sizeof(OBJECT_NAME_INFORMATION) + MAX_PATH * sizeof(WCHAR);
6195
6196 DPRINT("IntGdiGetFontResourceInfo: dwType == %lu\n", dwType);
6197
6198 do
6199 {
6200 /* Create buffer for full path name */
6201 NameInfo1 = ExAllocatePoolWithTag(PagedPool, NAMEINFO_SIZE, TAG_FINF);
6202 if (!NameInfo1)
6203 break;
6204
6205 /* Get the full path name */
6206 if (!IntGetFullFileName(NameInfo1, NAMEINFO_SIZE, FileName))
6207 break;
6208
6209 /* Create a buffer for the entries' names */
6210 NameInfo2 = ExAllocatePoolWithTag(PagedPool, NAMEINFO_SIZE, TAG_FINF);
6211 if (!NameInfo2)
6212 break;
6213
6214 FamInfo = ExAllocatePoolWithTag(PagedPool, MAX_FAM_INFO_BYTES, TAG_FINF);
6215 } while (0);
6216
6217 if (!NameInfo1 || !NameInfo2 || !FamInfo)
6218 {
6219 if (NameInfo2)
6220 ExFreePoolWithTag(NameInfo2, TAG_FINF);
6221
6222 if (NameInfo1)
6223 ExFreePoolWithTag(NameInfo1, TAG_FINF);
6224
6226 return FALSE;
6227 }
6228
6229 Count = 0;
6230
6231 /* Try to find the pathname in the global font list */
6233 for (ListEntry = g_FontListHead.Flink; ListEntry != &g_FontListHead;
6234 ListEntry = ListEntry->Flink)
6235 {
6236 FontEntry = CONTAINING_RECORD(ListEntry, FONT_ENTRY, ListEntry);
6237 if (FontEntry->Font->Filename == NULL)
6238 continue;
6239
6240 RtlInitUnicodeString(&EntryFileName , FontEntry->Font->Filename);
6241 if (!IntGetFullFileName(NameInfo2, NAMEINFO_SIZE, &EntryFileName))
6242 continue;
6243
6244 if (!RtlEqualUnicodeString(&NameInfo1->Name, &NameInfo2->Name, FALSE))
6245 continue;
6246
6247 IsEqual = FALSE;
6248 FontFamilyFillInfo(&FamInfo[Count], FontEntry->FaceName.Buffer,
6249 NULL, FontEntry->Font);
6250 for (i = 0; i < Count; ++i)
6251 {
6252 if (EqualFamilyInfo(&FamInfo[i], &FamInfo[Count]))
6253 {
6254 IsEqual = TRUE;
6255 break;
6256 }
6257 }
6258 if (!IsEqual)
6259 {
6260 /* Found */
6261 ++Count;
6262 if (Count >= MaxFamInfo)
6263 break;
6264 }
6265 }
6267
6268 /* Free the buffers */
6269 ExFreePoolWithTag(NameInfo1, TAG_FINF);
6270 ExFreePoolWithTag(NameInfo2, TAG_FINF);
6271
6272 if (Count == 0 && dwType != 5)
6273 {
6274 /* Font could not be found in system table
6275 dwType == 5 will still handle this */
6276 ExFreePoolWithTag(FamInfo, TAG_FINF);
6277 return FALSE;
6278 }
6279
6280 bSuccess = FALSE;
6281 switch (dwType)
6282 {
6283 case 0: /* FIXME: Returns 1 or 2, don't know what this is atm */
6284 Size = sizeof(DWORD);
6285 if (*pdwBytes == 0)
6286 {
6287 *pdwBytes = Size;
6288 bSuccess = TRUE;
6289 }
6290 else if (pBuffer)
6291 {
6292 if (*pdwBytes >= Size)
6293 {
6294 *(DWORD*)pBuffer = Count;
6295 }
6296 *pdwBytes = Size;
6297 bSuccess = TRUE;
6298 }
6299 break;
6300
6301 case 1: /* copy the font title */
6302 /* calculate the required size */
6303 Size = 0;
6304 for (i = 0; i < Count; ++i)
6305 {
6306 if (i > 0)
6307 Size += 3; /* " & " */
6308 Size += wcslen(FamInfo[i].EnumLogFontEx.elfLogFont.lfFaceName);
6309 if (FamInfo[i].EnumLogFontEx.elfStyle[0] &&
6310 _wcsicmp(FamInfo[i].EnumLogFontEx.elfStyle, L"Regular") != 0)
6311 {
6312 Size += 1 + wcslen(FamInfo[i].EnumLogFontEx.elfStyle);
6313 }
6314 }
6315 Size += 2; /* "\0\0" */
6316 Size *= sizeof(WCHAR);
6317
6318 if (*pdwBytes == 0)
6319 {
6320 *pdwBytes = Size;
6321 bSuccess = TRUE;
6322 }
6323 else if (pBuffer)
6324 {
6325 if (*pdwBytes >= Size)
6326 {
6327 /* store font title to buffer */
6328 WCHAR *psz = pBuffer;
6329 *psz = 0;
6330 for (i = 0; i < Count; ++i)
6331 {
6332 if (i > 0)
6333 wcscat(psz, L" & ");
6334 IntAddNameFromFamInfo(psz, &FamInfo[i]);
6335 }
6336 psz[wcslen(psz) + 1] = UNICODE_NULL;
6337 *pdwBytes = Size;
6338 bSuccess = TRUE;
6339 }
6340 else
6341 {
6342 *pdwBytes = 1024; /* this is confirmed value */
6343 }
6344 }
6345 break;
6346
6347 case 2: /* Copy an array of LOGFONTW */
6348 Size = Count * sizeof(LOGFONTW);
6349 if (*pdwBytes == 0)
6350 {
6351 *pdwBytes = Size;
6352 bSuccess = TRUE;
6353 }
6354 else if (pBuffer)
6355 {
6356 if (*pdwBytes >= Size)
6357 {
6358 pbBuffer = (LPBYTE)pBuffer;
6359 for (i = 0; i < Count; ++i)
6360 {
6361 FamInfo[i].EnumLogFontEx.elfLogFont.lfWidth = 0;
6362 RtlCopyMemory(pbBuffer, &FamInfo[i].EnumLogFontEx.elfLogFont, sizeof(LOGFONTW));
6363 pbBuffer += sizeof(LOGFONTW);
6364 }
6365 }
6366 *pdwBytes = Size;
6367 bSuccess = TRUE;
6368 }
6369 else
6370 {
6371 *pdwBytes = 1024; /* this is confirmed value */
6372 }
6373 break;
6374
6375 case 3:
6376 Size = sizeof(DWORD);
6377 if (*pdwBytes == 0)
6378 {
6379 *pdwBytes = Size;
6380 bSuccess = TRUE;
6381 }
6382 else if (pBuffer)
6383 {
6384 if (*pdwBytes >= Size)
6385 {
6386 /* FIXME: What exactly is copied here? */
6387 *(DWORD*)pBuffer = 1;
6388 }
6389 *pdwBytes = Size;
6390 bSuccess = TRUE;
6391 }
6392 break;
6393
6394 case 4: /* full file path */
6395 if (FileName->Length >= 4 * sizeof(WCHAR))
6396 {
6397 /* The beginning of FileName is \??\ */
6398 LPWSTR pch = FileName->Buffer + 4;
6399 DWORD Length = FileName->Length - 4 * sizeof(WCHAR);
6400
6401 Size = Length + sizeof(WCHAR);
6402 if (*pdwBytes == 0)
6403 {
6404 *pdwBytes = Size;
6405 bSuccess = TRUE;
6406 }
6407 else if (pBuffer)
6408 {
6409 if (*pdwBytes >= Size)
6410 {
6412 }
6413 *pdwBytes = Size;
6414 bSuccess = TRUE;
6415 }
6416 }
6417 break;
6418
6419 case 5: /* Looks like a BOOL that is copied, TRUE, if the font was not found */
6420 Size = sizeof(BOOL);
6421 if (*pdwBytes == 0)
6422 {
6423 *pdwBytes = Size;
6424 bSuccess = TRUE;
6425 }
6426 else if (pBuffer)
6427 {
6428 if (*pdwBytes >= Size)
6429 {
6430 *(BOOL*)pBuffer = Count == 0;
6431 }
6432 *pdwBytes = Size;
6433 bSuccess = TRUE;
6434 }
6435 break;
6436 }
6437 ExFreePoolWithTag(FamInfo, TAG_FINF);
6438
6439 return bSuccess;
6440}
#define MAX_PATH
Definition: compat.h:34
_ACRTIMP int __cdecl _wcsicmp(const wchar_t *, const wchar_t *)
Definition: wcs.c:159
#define L(x)
Definition: resources.c:13
@ IsEqual
Definition: fatprocs.h:1887
static BOOL FASTCALL IntGetFullFileName(POBJECT_NAME_INFORMATION NameInfo, ULONG Size, PUNICODE_STRING FileName)
Definition: freetype.c:6100
static BOOL EqualFamilyInfo(const FONTFAMILYINFO *pInfo1, const FONTFAMILYINFO *pInfo2)
Definition: freetype.c:6143
static void FASTCALL FontFamilyFillInfo(PFONTFAMILYINFO Info, LPCWSTR FaceName, LPCWSTR FullName, PFONTGDI FontGDI)
Definition: freetype.c:3443
static VOID IntAddNameFromFamInfo(LPWSTR psz, FONTFAMILYINFO *FamInfo)
Definition: freetype.c:6164
static PWSTR PDWORD pdwBytes
Definition: layerapi.c:35
#define pch(ap)
Definition: match.c:418
NTSYSAPI BOOLEAN NTAPI RtlEqualUnicodeString(PUNICODE_STRING String1, PUNICODE_STRING String2, BOOLEAN CaseInSensitive)
struct _OBJECT_NAME_INFORMATION OBJECT_NAME_INFORMATION
#define BOOL
Definition: nt_native.h:43
#define DWORD
Definition: nt_native.h:44
#define UNICODE_NULL
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
struct tagFONTFAMILYINFO FONTFAMILYINFO
PVOID pBuffer
wcscat
LPWSTR Filename
Definition: engobjects.h:151
FONTGDI * Font
Definition: font.h:7
UNICODE_STRING FaceName
Definition: font.h:8
UNICODE_STRING Name
Definition: nt_native.h:1273
ENUMLOGFONTEXW EnumLogFontEx
Definition: ntgdibad.h:47
LONG lfWidth
Definition: wingdi.h:2344
unsigned char * LPBYTE
Definition: typedefs.h:53
#define TAG_FINF
Definition: text.h:3
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by NtGdiGetFontResourceInfoInternalW().

◆ IntGdiRemoveFontMemResource()

BOOL FASTCALL IntGdiRemoveFontMemResource ( HANDLE  hMMFont)

Definition at line 2614 of file freetype.c.

2615{
2617 PFONT_ENTRY_COLL_MEM CurrentEntry;
2618 PFONT_ENTRY_COLL_MEM EntryCollection = NULL;
2620
2622 IntLockProcessPrivateFonts(Win32Process);
2623 for (Entry = Win32Process->PrivateMemFontListHead.Flink;
2624 Entry != &Win32Process->PrivateMemFontListHead;
2625 Entry = Entry->Flink)
2626 {
2627 CurrentEntry = CONTAINING_RECORD(Entry, FONT_ENTRY_COLL_MEM, ListEntry);
2628
2629 if (CurrentEntry->Handle == hMMFont)
2630 {
2631 EntryCollection = CurrentEntry;
2632 UnlinkFontMemCollection(CurrentEntry);
2633 break;
2634 }
2635 }
2636 IntUnLockProcessPrivateFonts(Win32Process);
2638
2639 if (EntryCollection)
2640 {
2641 IntGdiCleanupMemEntry(EntryCollection->Entry);
2642 ExFreePoolWithTag(EntryCollection, TAG_FONT);
2643 return TRUE;
2644 }
2645 return FALSE;
2646}

Referenced by NtGdiRemoveFontMemResourceEx().

◆ IntGdiRemoveFontResource()

BOOL FASTCALL IntGdiRemoveFontResource ( _In_ PCUNICODE_STRING  FileName,
_In_ DWORD  cFiles,
_In_ DWORD  dwFlags 
)

Definition at line 2340 of file freetype.c.

2344{
2345 PWSTR pchFile = FileName->Buffer;
2346 SIZE_T cchFile;
2347
2348 while (cFiles--)
2349 {
2350 _SEH2_TRY
2351 {
2352 cchFile = wcslen(pchFile);
2353 }
2355 {
2356 _SEH2_YIELD(return FALSE);
2357 }
2358 _SEH2_END;
2359
2360 UNICODE_STRING ustrPathName;
2361 ustrPathName.Length = (USHORT)(cchFile * sizeof(WCHAR));
2362 ustrPathName.MaximumLength = ustrPathName.Length + sizeof(WCHAR);
2363 ustrPathName.Buffer = pchFile;
2364
2366 if (!ret)
2367 return FALSE;
2368
2369 pchFile += cchFile + 1;
2370 }
2371
2372 return TRUE;
2373}
static BOOL FASTCALL IntGdiRemoveFontResourceSingle(_In_ PCUNICODE_STRING FileName, _In_ DWORD dwFlags)
Definition: freetype.c:2270

Referenced by NtGdiRemoveFontResourceW().

◆ IntGetCharDimensions()

DWORD FASTCALL IntGetCharDimensions ( HDC  ,
PTEXTMETRICW  ,
PDWORD   
)

◆ IntGetFontLanguageInfo()

DWORD FASTCALL IntGetFontLanguageInfo ( PDC  )

◆ IntGetOutlineTextMetrics()

INT FASTCALL IntGetOutlineTextMetrics ( PFONTGDI  FontGDI,
UINT  Size,
OUTLINETEXTMETRICW Otm,
BOOL  bLocked 
)

Definition at line 3139 of file freetype.c.

3143{
3144 TT_OS2 *pOS2;
3145 TT_HoriHeader *pHori;
3146 TT_Postscript *pPost;
3147 FT_Fixed XScale, YScale;
3148 FT_WinFNT_HeaderRec WinFNT;
3150 BYTE *pb;
3151 FONT_NAMES FontNames;
3152 PSHARED_FACE SharedFace = FontGDI->SharedFace;
3154 FT_Face Face = SharedFace->Face;
3155
3156 if (bLocked)
3158 else
3160
3162 {
3163 Cache = &SharedFace->EnglishUS;
3164 }
3165 else
3166 {
3167 Cache = &SharedFace->UserLanguage;
3168 }
3169
3170 if (Size == 0 && Cache->OutlineRequiredSize > 0)
3171 {
3172 ASSERT(Otm == NULL);
3173 return Cache->OutlineRequiredSize;
3174 }
3175
3176 if (!bLocked)
3178
3179 IntInitFontNames(&FontNames, SharedFace);
3180 Cache->OutlineRequiredSize = FontNames.OtmSize;
3181
3182 if (Size == 0)
3183 {
3184 ASSERT(Otm == NULL);
3185 IntFreeFontNames(&FontNames);
3186 if (!bLocked)
3188 return Cache->OutlineRequiredSize;
3189 }
3190
3191 ASSERT(Otm != NULL);
3192
3193 if (Size < Cache->OutlineRequiredSize)
3194 {
3195 DPRINT1("Size %u < OutlineRequiredSize %u\n", Size,
3196 Cache->OutlineRequiredSize);
3197 IntFreeFontNames(&FontNames);
3198 if (!bLocked)
3200 return 0; /* failure */
3201 }
3202
3203 XScale = Face->size->metrics.x_scale;
3204 YScale = Face->size->metrics.y_scale;
3205
3206 pOS2 = FT_Get_Sfnt_Table(Face, FT_SFNT_OS2);
3207 pHori = FT_Get_Sfnt_Table(Face, FT_SFNT_HHEA);
3208 pPost = FT_Get_Sfnt_Table(Face, FT_SFNT_POST); /* We can live with this failing */
3209 Error = FT_Get_WinFNT_Header(Face, &WinFNT);
3210
3211 if (pOS2 == NULL && Error)
3212 {
3213 if (!bLocked)
3215 DPRINT1("Can't find OS/2 table - not TT font?\n");
3216 IntFreeFontNames(&FontNames);
3217 return 0;
3218 }
3219
3220 if (pHori == NULL && Error)
3221 {
3222 if (!bLocked)
3224 DPRINT1("Can't find HHEA table - not TT font?\n");
3225 IntFreeFontNames(&FontNames);
3226 return 0;
3227 }
3228
3229 Otm->otmSize = Cache->OutlineRequiredSize;
3230
3231 FillTM(&Otm->otmTextMetrics, FontGDI, pOS2, pHori, (Error ? NULL : &WinFNT));
3232
3233 if (!pOS2)
3234 goto skip_os2;
3235
3236 Otm->otmFiller = 0;
3238 Otm->otmfsSelection = pOS2->fsSelection;
3239 Otm->otmfsType = pOS2->fsType;
3240 Otm->otmsCharSlopeRise = pHori->caret_Slope_Rise;
3241 Otm->otmsCharSlopeRun = pHori->caret_Slope_Run;
3242 Otm->otmItalicAngle = 0; /* POST table */
3243 Otm->otmEMSquare = Face->units_per_EM;
3244
3245#define SCALE_X(value) ((FT_MulFix((value), XScale) + 32) >> 6)
3246#define SCALE_Y(value) ((FT_MulFix((value), YScale) + 32) >> 6)
3247
3248 Otm->otmAscent = SCALE_Y(pOS2->sTypoAscender);
3249 Otm->otmDescent = SCALE_Y(pOS2->sTypoDescender);
3250 Otm->otmLineGap = SCALE_Y(pOS2->sTypoLineGap);
3251 Otm->otmsCapEmHeight = SCALE_Y(pOS2->sCapHeight);
3252 Otm->otmsXHeight = SCALE_Y(pOS2->sxHeight);
3253 Otm->otmrcFontBox.left = SCALE_X(Face->bbox.xMin);
3254 Otm->otmrcFontBox.right = SCALE_X(Face->bbox.xMax);
3255 Otm->otmrcFontBox.top = SCALE_Y(Face->bbox.yMax);
3256 Otm->otmrcFontBox.bottom = SCALE_Y(Face->bbox.yMin);
3259 Otm->otmMacLineGap = Otm->otmLineGap;
3260 Otm->otmusMinimumPPEM = 0; /* TT Header */
3271
3272 if (!pPost)
3273 {
3274 Otm->otmsUnderscoreSize = 0;
3275 Otm->otmsUnderscorePosition = 0;
3276 }
3277 else
3278 {
3281 }
3282
3283#undef SCALE_X
3284#undef SCALE_Y
3285
3286skip_os2:
3287 if (!bLocked)
3289
3290 pb = IntStoreFontNames(&FontNames, Otm);
3291 ASSERT(pb - (BYTE*)Otm == Cache->OutlineRequiredSize);
3292
3293 IntFreeFontNames(&FontNames);
3294
3295 return Cache->OutlineRequiredSize;
3296}
BOOLEAN bLocked
Definition: Mke2fs.c:19
#define SCALE_Y(value)
static __inline void FASTCALL IntInitFontNames(FONT_NAMES *Names, PSHARED_FACE SharedFace)
Definition: freetype.c:3066
PBYTE FASTCALL IntStoreFontNames(_In_ const FONT_NAMES *Names, _Out_ OUTLINETEXTMETRICW *Otm)
Definition: freetype.c:3102
#define SCALE_X(value)
#define ASSERT_FREETYPE_LOCK_HELD()
Definition: freetype.c:331
static __inline void FASTCALL IntFreeFontNames(FONT_NAMES *Names)
Definition: freetype.c:3126
signed long FT_Fixed
Definition: fttypes.h:287
#define ASSERT(a)
Definition: mode.c:44
#define LANG_ENGLISH
Definition: nls.h:52
#define PRIMARYLANGID(l)
Definition: nls.h:16
Definition: fatfs.h:173
ULONG OtmSize
Definition: freetype.c:3062
FT_Pos xMin
Definition: ftimage.h:120
FT_Pos yMax
Definition: ftimage.h:121
FT_Pos yMin
Definition: ftimage.h:120
FT_Pos xMax
Definition: ftimage.h:121
FT_Size size
Definition: freetype.h:1066
FT_BBox bbox
Definition: freetype.h:1052
FT_UShort units_per_EM
Definition: freetype.h:1054
FT_Size_Metrics metrics
Definition: freetype.h:1636
FT_Fixed y_scale
Definition: freetype.h:1601
FT_Fixed x_scale
Definition: freetype.h:1600
FT_Short caret_Slope_Run
Definition: tttables.h:213
FT_Short caret_Slope_Rise
Definition: tttables.h:212
FT_Short sTypoDescender
Definition: tttables.h:407
FT_UShort fsSelection
Definition: tttables.h:403
FT_Short ySuperscriptYSize
Definition: tttables.h:387
FT_Short sxHeight
Definition: tttables.h:419
FT_Short yStrikeoutSize
Definition: tttables.h:390
FT_Byte panose[10]
Definition: tttables.h:394
FT_Short ySubscriptXSize
Definition: tttables.h:382
FT_Short sTypoLineGap
Definition: tttables.h:408
FT_Short sTypoAscender
Definition: tttables.h:406
FT_Short ySuperscriptXSize
Definition: tttables.h:386
FT_Short ySubscriptYOffset
Definition: tttables.h:385
FT_Short ySuperscriptYOffset
Definition: tttables.h:389
FT_Short ySubscriptXOffset
Definition: tttables.h:384
FT_Short yStrikeoutPosition
Definition: tttables.h:391
FT_Short sCapHeight
Definition: tttables.h:420
FT_UShort fsType
Definition: tttables.h:381
FT_Short ySuperscriptXOffset
Definition: tttables.h:388
FT_Short ySubscriptYSize
Definition: tttables.h:383
FT_Short underlineThickness
Definition: tttables.h:455
FT_Short underlinePosition
Definition: tttables.h:454
PANOSE otmPanoseNumber
Definition: wingdi.h:2962
POINT otmptSuperscriptOffset
Definition: wingdi.h:2982
POINT otmptSuperscriptSize
Definition: wingdi.h:2981
POINT otmptSubscriptSize
Definition: wingdi.h:2979
int otmsStrikeoutPosition
Definition: wingdi.h:2984
int otmsUnderscorePosition
Definition: wingdi.h:2986
POINT otmptSubscriptOffset
Definition: wingdi.h:2980
UINT otmsStrikeoutSize
Definition: wingdi.h:2983
SHARED_FACE_CACHE UserLanguage
Definition: engobjects.h:136
SHARED_FACE_CACHE EnglishUS
Definition: engobjects.h:135
LONG right
Definition: windef.h:108
LONG bottom
Definition: windef.h:109
LONG top
Definition: windef.h:107
LONG left
Definition: windef.h:106
LONG tmAscent
Definition: wingdi.h:2830
LONG tmDescent
Definition: wingdi.h:2831
@ FT_SFNT_HHEA
Definition: tttables.h:625
@ FT_SFNT_POST
Definition: tttables.h:627
@ FT_SFNT_OS2
Definition: tttables.h:624
#define PANOSE_COUNT
Definition: wingdi.h:453

Referenced by FindBestFontFromList(), FontFamilyFillInfo(), ftGdiGetGlyphOutline(), and NtGdiGetOutlineTextMetricsInternalW().

◆ IntIsFontRenderingEnabled()

BOOL FASTCALL IntIsFontRenderingEnabled ( VOID  )

Definition at line 2700 of file freetype.c.

2701{
2702 return (gpsi->BitsPixel > 8) && g_RenderingEnabled;
2703}
PSERVERINFO gpsi
Definition: imm.c:18

Referenced by IntExtTextOutW(), and TextIntGetTextExtentPoint().

◆ IntLoadFontsInRegistry()

BOOL FASTCALL IntLoadFontsInRegistry ( VOID  )

Definition at line 2376 of file freetype.c.

2377{
2381 KEY_FULL_INFORMATION KeyFullInfo;
2382 ULONG i, Length;
2383 UNICODE_STRING FontTitleW, FileNameW;
2384 SIZE_T InfoSize;
2385 LPBYTE InfoBuffer;
2387 LPWSTR pchPath;
2389 INT nFontCount = 0;
2390 DWORD dwFlags;
2391
2392 /* open registry key */
2395 NULL, NULL);
2396 Status = ZwOpenKey(&KeyHandle, KEY_READ, &ObjectAttributes);
2397 if (!NT_SUCCESS(Status))
2398 {
2399 DPRINT1("ZwOpenKey failed: 0x%08X\n", Status);
2400 return FALSE; /* failure */
2401 }
2402
2403 /* query count of values */
2404 Status = ZwQueryKey(KeyHandle, KeyFullInformation,
2405 &KeyFullInfo, sizeof(KeyFullInfo), &Length);
2406 if (!NT_SUCCESS(Status))
2407 {
2408 DPRINT1("ZwQueryKey failed: 0x%08X\n", Status);
2410 return FALSE; /* failure */
2411 }
2412
2413 /* allocate buffer */
2414 InfoSize = (MAX_PATH + 256) * sizeof(WCHAR);
2415 InfoBuffer = ExAllocatePoolWithTag(PagedPool, InfoSize, TAG_FONT);
2416 if (!InfoBuffer)
2417 {
2418 DPRINT1("ExAllocatePoolWithTag failed\n");
2420 return FALSE;
2421 }
2422
2423 /* for each value */
2424 for (i = 0; i < KeyFullInfo.Values; ++i)
2425 {
2426 /* get value name */
2427 Status = ZwEnumerateValueKey(KeyHandle, i, KeyValueFullInformation,
2428 InfoBuffer, InfoSize, &Length);
2430 {
2431 /* too short buffer */
2432 ExFreePoolWithTag(InfoBuffer, TAG_FONT);
2433 InfoSize *= 2;
2434 InfoBuffer = ExAllocatePoolWithTag(PagedPool, InfoSize, TAG_FONT);
2435 if (!InfoBuffer)
2436 {
2437 DPRINT1("ExAllocatePoolWithTag failed\n");
2438 break;
2439 }
2440 /* try again */
2441 Status = ZwEnumerateValueKey(KeyHandle, i, KeyValueFullInformation,
2442 InfoBuffer, InfoSize, &Length);
2443 }
2444 if (!NT_SUCCESS(Status))
2445 {
2446 DPRINT1("ZwEnumerateValueKey failed: 0x%08X\n", Status);
2447 break; /* failure */
2448 }
2449
2450 /* create FontTitleW string */
2451 pInfo = (PKEY_VALUE_FULL_INFORMATION)InfoBuffer;
2452 Length = pInfo->NameLength / sizeof(WCHAR);
2453 pInfo->Name[Length] = UNICODE_NULL; /* truncate */
2454 if (!RtlCreateUnicodeString(&FontTitleW, pInfo->Name))
2455 {
2457 DPRINT1("RtlCreateUnicodeString failed\n");
2458 break; /* failure */
2459 }
2460
2461 /* query value */
2462 Status = ZwQueryValueKey(KeyHandle, &FontTitleW, KeyValueFullInformation,
2463 InfoBuffer, InfoSize, &Length);
2465 {
2466 /* too short buffer */
2467 ExFreePoolWithTag(InfoBuffer, TAG_FONT);
2468 InfoSize *= 2;
2469 InfoBuffer = ExAllocatePoolWithTag(PagedPool, InfoSize, TAG_FONT);
2470 if (!InfoBuffer)
2471 {
2472 DPRINT1("ExAllocatePoolWithTag failed\n");
2473 break;
2474 }
2475 /* try again */
2476 Status = ZwQueryValueKey(KeyHandle, &FontTitleW, KeyValueFullInformation,
2477 InfoBuffer, InfoSize, &Length);
2478 }
2479 pInfo = (PKEY_VALUE_FULL_INFORMATION)InfoBuffer;
2480 if (!NT_SUCCESS(Status) || !pInfo->DataLength)
2481 {
2482 DPRINT1("ZwQueryValueKey failed: 0x%08X\n", Status);
2483 RtlFreeUnicodeString(&FontTitleW);
2484 break; /* failure */
2485 }
2486
2487 /* Build pchPath */
2488 pchPath = (LPWSTR)((PUCHAR)pInfo + pInfo->DataOffset);
2489 Length = pInfo->DataLength / sizeof(WCHAR);
2490 pchPath[Length] = UNICODE_NULL; /* truncate */
2491
2492 /* Load font(s) without writing registry */
2493 if (PathIsRelativeW(pchPath))
2494 {
2495 dwFlags = 0;
2497 L"\\SystemRoot\\Fonts\\%s", pchPath);
2498 }
2499 else
2500 {
2502 Status = RtlStringCbCopyW(szPath, sizeof(szPath), pchPath);
2503 }
2504
2505 if (NT_SUCCESS(Status))
2506 {
2507 RtlCreateUnicodeString(&FileNameW, szPath);
2508 nFontCount += IntGdiAddFontResourceEx(&FileNameW, 1, 0, dwFlags);
2509 RtlFreeUnicodeString(&FileNameW);
2510 }
2511
2512 RtlFreeUnicodeString(&FontTitleW);
2513 }
2514
2515 /* close now */
2517
2518 /* free memory block */
2519 if (InfoBuffer)
2520 {
2521 ExFreePoolWithTag(InfoBuffer, TAG_FONT);
2522 }
2523
2524 return (KeyFullInfo.Values != 0 && nFontCount != 0);
2525}
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:36
BOOL WINAPI PathIsRelativeW(const WCHAR *path)
Definition: path.c:1030
UNICODE_STRING g_FontRegPath
Definition: freetype.c:321
INT FASTCALL IntGdiAddFontResourceEx(_In_ PCUNICODE_STRING FileName, _In_ DWORD cFiles, _In_ DWORD Characteristics, _In_ DWORD dwFlags)
Definition: freetype.c:2193
LPCWSTR szPath
Definition: env.c:37
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
Definition: ndis.h:4715
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
@ KeyFullInformation
Definition: nt_native.h:1136
@ KeyValueFullInformation
Definition: nt_native.h:1184
#define KEY_READ
Definition: nt_native.h:1026
struct _KEY_VALUE_FULL_INFORMATION * PKEY_VALUE_FULL_INFORMATION
NTSTRSAFEAPI RtlStringCbCopyW(_Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest, _In_ size_t cbDest, _In_ NTSTRSAFE_PCWSTR pszSrc)
Definition: ntstrsafe.h:174
NTSTRSAFEVAPI RtlStringCbPrintfW(_Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest, _In_ size_t cbDest, _In_ _Printf_format_string_ NTSTRSAFE_PCWSTR pszFormat,...)
Definition: ntstrsafe.h:1173
#define OBJ_KERNEL_HANDLE
Definition: winternl.h:231
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
unsigned char * PUCHAR
Definition: typedefs.h:53
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define AFRX_DOS_DEVICE_PATH
Definition: text.h:106
#define AFRX_ALTERNATIVE_PATH
Definition: text.h:105

Referenced by InitFontSupport().

◆ IntLoadSystemFonts()

VOID FASTCALL IntLoadSystemFonts ( VOID  )

Definition at line 1495 of file freetype.c.

1496{
1498 UNICODE_STRING Directory, FileName, TempString;
1500 HANDLE hDirectory;
1501 BYTE *DirInfoBuffer;
1503 BOOLEAN bRestartScan = TRUE;
1505 INT i;
1506 static UNICODE_STRING SearchPatterns[] =
1507 {
1508 RTL_CONSTANT_STRING(L"*.ttf"),
1509 RTL_CONSTANT_STRING(L"*.ttc"),
1510 RTL_CONSTANT_STRING(L"*.otf"),
1511 RTL_CONSTANT_STRING(L"*.otc"),
1512 RTL_CONSTANT_STRING(L"*.fon"),
1513 RTL_CONSTANT_STRING(L"*.fnt")
1514 };
1515 static UNICODE_STRING IgnoreFiles[] =
1516 {
1519 };
1520
1521 RtlInitUnicodeString(&Directory, L"\\SystemRoot\\Fonts\\");
1522
1525 &Directory,
1527 NULL,
1528 NULL);
1529
1531 &hDirectory,
1534 &Iosb,
1537
1538 if (NT_SUCCESS(Status))
1539 {
1540 for (i = 0; i < _countof(SearchPatterns); ++i)
1541 {
1542 DirInfoBuffer = ExAllocatePoolWithTag(PagedPool, 0x4000, TAG_FONT);
1543 if (DirInfoBuffer == NULL)
1544 {
1545 ZwClose(hDirectory);
1546 return;
1547 }
1548
1550 if (FileName.Buffer == NULL)
1551 {
1552 ExFreePoolWithTag(DirInfoBuffer, TAG_FONT);
1553 ZwClose(hDirectory);
1554 return;
1555 }
1556 FileName.Length = 0;
1557 FileName.MaximumLength = MAX_PATH * sizeof(WCHAR);
1558
1559 while (1)
1560 {
1561 Status = ZwQueryDirectoryFile(
1562 hDirectory,
1563 NULL,
1564 NULL,
1565 NULL,
1566 &Iosb,
1567 DirInfoBuffer,
1568 0x4000,
1570 FALSE,
1571 &SearchPatterns[i],
1572 bRestartScan);
1573
1575 {
1576 break;
1577 }
1578
1579 DirInfo = (PFILE_DIRECTORY_INFORMATION)DirInfoBuffer;
1580 while (1)
1581 {
1582 SIZE_T ign;
1583
1584 TempString.Buffer = DirInfo->FileName;
1585 TempString.Length = TempString.MaximumLength = DirInfo->FileNameLength;
1586
1587 /* Should we ignore this file? */
1588 for (ign = 0; ign < _countof(IgnoreFiles); ++ign)
1589 {
1590 /* Yes.. */
1591 if (RtlEqualUnicodeString(IgnoreFiles + ign, &TempString, FALSE))
1592 break;
1593 }
1594
1595 /* If we tried all Ignore patterns and there was no match, try to create a font */
1596 if (ign == _countof(IgnoreFiles))
1597 {
1601 DPRINT1("ERR: Failed to load %wZ\n", &FileName);
1602 }
1603
1604 if (DirInfo->NextEntryOffset == 0)
1605 break;
1606
1607 DirInfo = (PFILE_DIRECTORY_INFORMATION)((ULONG_PTR)DirInfo + DirInfo->NextEntryOffset);
1608 }
1609
1610 bRestartScan = FALSE;
1611 }
1612
1614 ExFreePoolWithTag(DirInfoBuffer, TAG_FONT);
1615 }
1616 ZwClose(hDirectory);
1617 }
1618}
@ IgnoreFiles
Definition: ACListISF.cpp:75
unsigned char BOOLEAN
Definition: actypes.h:127
#define FILE_DIRECTORY_FILE
Definition: constants.h:491
#define RTL_CONSTANT_STRING(s)
Definition: combase.c:35
#define FILE_SHARE_READ
Definition: compat.h:136
return Iosb
Definition: create.c:4403
struct _FileName FileName
Definition: fatprocs.h:897
@ FileDirectoryInformation
Definition: from_kernel.h:62
#define FILE_SYNCHRONOUS_IO_NONALERT
Definition: from_kernel.h:31
NTSYSAPI NTSTATUS NTAPI ZwOpenFile(_Out_ PHANDLE FileHandle, _In_ ACCESS_MASK DesiredAccess, _In_ POBJECT_ATTRIBUTES ObjectAttributes, _Out_ PIO_STATUS_BLOCK IoStatusBlock, _In_ ULONG ShareAccess, _In_ ULONG OpenOptions)
NTSYSAPI VOID NTAPI RtlCopyUnicodeString(PUNICODE_STRING DestinationString, PUNICODE_STRING SourceString)
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
#define SYNCHRONIZE
Definition: nt_native.h:61
NTSYSAPI NTSTATUS NTAPI RtlAppendUnicodeStringToString(PUNICODE_STRING Destination, PUNICODE_STRING Source)
#define FILE_LIST_DIRECTORY
Definition: nt_native.h:629
#define FILE_SHARE_DELETE
Definition: nt_native.h:682
#define _countof(array)
Definition: sndvol32.h:70
base for all directory entries
Definition: entries.h:138
WCHAR FileName[ANYSIZE_ARRAY]
Definition: winternl.h:1466
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define STATUS_NO_MORE_FILES
Definition: udferr_usr.h:128
#define AFRX_WRITE_REGISTRY
Definition: text.h:104
struct _FILE_DIRECTORY_INFORMATION * PFILE_DIRECTORY_INFORMATION

Referenced by InitFontSupport().

◆ RealizeFontInit()

PTEXTOBJ FASTCALL RealizeFontInit ( HFONT  )

◆ TextIntCreateFontIndirect()

NTSTATUS FASTCALL TextIntCreateFontIndirect ( CONST LPLOGFONTW  lf,
HFONT NewFont 
)

Definition at line 2733 of file freetype.c.

2734{
2735 PLFONT plfont;
2736 LOGFONTW *plf;
2737
2738 ASSERT(lf);
2739 plfont = LFONT_AllocFontWithHandle();
2740 if (!plfont)
2741 {
2742 return STATUS_NO_MEMORY;
2743 }
2744
2745 ExInitializePushLock(&plfont->lock);
2746 *NewFont = plfont->BaseObject.hHmgr;
2747 plf = &plfont->logfont.elfEnumLogfontEx.elfLogFont;
2748 RtlCopyMemory(plf, lf, sizeof(LOGFONTW));
2749 if (lf->lfEscapement != lf->lfOrientation)
2750 {
2751 /* This should really depend on whether GM_ADVANCED is set */
2752 plf->lfOrientation = plf->lfEscapement;
2753 }
2754 LFONT_UnlockFont(plfont);
2755
2756 return STATUS_SUCCESS;
2757}
HGDIOBJ hHmgr(VOID)
Definition: baseobj.hpp:95
#define STATUS_NO_MEMORY
Definition: d3dkmdt.h:51
#define ExInitializePushLock
Definition: ex.h:1016
LONG lfEscapement
Definition: dimm.idl:61
BASEOBJECT BaseObject
Definition: text.h:63
EX_PUSH_LOCK lock
Definition: text.h:71
#define LFONT_UnlockFont(plfnt)
Definition: text.h:79
#define LFONT_AllocFontWithHandle()
Definition: text.h:76

Referenced by CreateStockFonts(), and UserDrawCaptionText().

◆ TextIntGetTextExtentPoint()

BOOL FASTCALL TextIntGetTextExtentPoint ( PDC  ,
PTEXTOBJ  ,
PCWCH  ,
INT  ,
ULONG  ,
PINT  ,
PINT  ,
PSIZE  ,
FLONG   
)

◆ TextIntRealizeFont()

NTSTATUS FASTCALL TextIntRealizeFont ( HFONT  FontHandle,
PTEXTOBJ  pTextObj 
)

Definition at line 6061 of file freetype.c.

6062{
6063 PTEXTOBJ TextObj;
6064 PSHARED_FACE SharedFace;
6065
6066 if (!pTextObj)
6067 {
6068 TextObj = TEXTOBJ_LockText(FontHandle);
6069 if (NULL == TextObj)
6070 {
6071 return STATUS_INVALID_HANDLE;
6072 }
6073
6074 if (TextObj->fl & TEXTOBJECT_INIT)
6075 {
6076 TEXTOBJ_UnlockText(TextObj);
6077 return STATUS_SUCCESS;
6078 }
6079 }
6080 else
6081 {
6082 TextObj = pTextObj;
6083 }
6084
6086 SharedFace = IntRealizeFont(&TextObj->logfont.elfEnumLogfontEx.elfLogFont, TextObj);
6088
6089 if (!pTextObj)
6090 TEXTOBJ_UnlockText(TextObj);
6091
6092 ASSERT((!!SharedFace ^ (NULL == TextObj->Font)) != 0);
6093
6094 return SharedFace ? STATUS_SUCCESS : STATUS_NOT_FOUND;
6095}
PSHARED_FACE IntRealizeFont(const LOGFONTW *pLogFont, _Inout_opt_ PTEXTOBJ TextObj)
Definition: freetype.c:6003
#define STATUS_NOT_FOUND
Definition: shellext.h:72
FLONG fl
Definition: text.h:65
FORCEINLINE PTEXTOBJ TEXTOBJ_LockText(HFONT hfont)
Definition: text.h:83
#define TEXTOBJECT_INIT
Definition: text.h:56

Referenced by DC_hSelectFont(), DC_InitHack(), FontGetObject(), and RealizeFontInit().

◆ TextIntUpdateSize()

BOOL FASTCALL TextIntUpdateSize ( PDC  dc,
PTEXTOBJ  TextObj,
PFONTGDI  FontGDI,
BOOL  bDoLock 
)

Definition at line 4219 of file freetype.c.

4223{
4224 FT_Face face;
4225 INT error, n;
4226 FT_CharMap charmap, found;
4227 LOGFONTW *plf;
4228
4229 if (bDoLock)
4231
4232 face = FontGDI->SharedFace->Face;
4233 if (face->charmap == NULL)
4234 {
4235 DPRINT("WARNING: No charmap selected!\n");
4236 DPRINT("This font face has %d charmaps\n", face->num_charmaps);
4237
4238 found = NULL;
4239 for (n = 0; n < face->num_charmaps; n++)
4240 {
4241 charmap = face->charmaps[n];
4242 if (charmap->encoding == FT_ENCODING_UNICODE)
4243 {
4244 found = charmap;
4245 break;
4246 }
4247 }
4248 if (!found)
4249 {
4250 for (n = 0; n < face->num_charmaps; n++)
4251 {
4252 charmap = face->charmaps[n];
4253 if (charmap->platform_id == TT_PLATFORM_APPLE_UNICODE)
4254 {
4255 found = charmap;
4256 break;
4257 }
4258 }
4259 }
4260 if (!found)
4261 {
4262 for (n = 0; n < face->num_charmaps; n++)
4263 {
4264 charmap = face->charmaps[n];
4265 if (charmap->encoding == FT_ENCODING_MS_SYMBOL)
4266 {
4267 found = charmap;
4268 break;
4269 }
4270 }
4271 }
4272 if (!found && face->num_charmaps > 0)
4273 {
4274 found = face->charmaps[0];
4275 }
4276 if (!found)
4277 {
4278 DPRINT1("WARNING: Could not find desired charmap!\n");
4279 }
4280 else
4281 {
4282 DPRINT("Found charmap encoding: %i\n", found->encoding);
4283 error = FT_Set_Charmap(face, found);
4284 if (error)
4285 {
4286 DPRINT1("WARNING: Could not set the charmap!\n");
4287 }
4288 }
4289 }
4290
4291 plf = &TextObj->logfont.elfEnumLogfontEx.elfLogFont;
4292
4293 error = IntRequestFontSize(dc, FontGDI, plf->lfWidth, plf->lfHeight);
4294
4295 if (bDoLock)
4297
4298 if (error)
4299 {
4300 DPRINT1("Error in setting pixel sizes: %d\n", error);
4301 return FALSE;
4302 }
4303
4304 return TRUE;
4305}
WORD face[3]
Definition: mesh.c:4747
#define TT_PLATFORM_APPLE_UNICODE
Definition: font.c:1172
FT_Set_Charmap(FT_Face face, FT_CharMap charmap)
Definition: ftobjs.c:3564
GLdouble n
Definition: glext.h:7729
FT_UShort platform_id
Definition: freetype.h:821

Referenced by ftGdiGetGlyphOutline(), IntExtTextOutW(), NtGdiGetOutlineTextMetricsInternalW(), and TextIntGetTextExtentPoint().

◆ TEXTOBJ_LockText()

FORCEINLINE PTEXTOBJ TEXTOBJ_LockText ( HFONT  hfont)

Definition at line 83 of file text.h.

84{
86 if (plfnt != 0)
87 {
90 }
91 return plfnt;
92}
static HFONT hfont
FORCEINLINE VOID ExAcquirePushLockExclusive(PEX_PUSH_LOCK PushLock)
Definition: ex.h:1039
#define KeEnterCriticalRegion()
Definition: ke_x.h:88
#define LFONT_ShareLockFont(hfont)
Definition: text.h:77

Referenced by RealizeFontInit(), and TextIntRealizeFont().

◆ TEXTOBJ_UnlockText()