ReactOS 0.4.16-dev-2293-g4d8327b
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)
 

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

1044{
1045 PLIST_ENTRY pHead, pEntry;
1046 PFONT_CACHE_ENTRY pFontCache;
1047 PFONTSUBST_ENTRY pSubstEntry;
1048 PFONT_ENTRY pFontEntry;
1049
1050 // Cleanup the FontLink cache
1052
1053 // Cleanup FONT_LOOKUP_CACHE
1055
1056 // Free font cache list
1057 pHead = &g_FontCacheListHead;
1058 while (!IsListEmpty(pHead))
1059 {
1060 pEntry = RemoveHeadList(pHead);
1061 pFontCache = CONTAINING_RECORD(pEntry, FONT_CACHE_ENTRY, ListEntry);
1062 RemoveCachedEntry(pFontCache);
1063 }
1064
1065 // Free font subst list
1066 pHead = &g_FontSubstListHead;
1067 while (!IsListEmpty(pHead))
1068 {
1069 pEntry = RemoveHeadList(pHead);
1070 pSubstEntry = CONTAINING_RECORD(pEntry, FONTSUBST_ENTRY, ListEntry);
1071 ExFreePoolWithTag(pSubstEntry, TAG_FONT);
1072 }
1073
1074 // Free font list
1075 pHead = &g_FontListHead;
1076 while (!IsListEmpty(pHead))
1077 {
1078 pEntry = RemoveHeadList(pHead);
1079 pFontEntry = CONTAINING_RECORD(pEntry, FONT_ENTRY, ListEntry);
1080 CleanupFontEntry(pFontEntry);
1081 }
1082
1084 {
1087 }
1088
1091}
#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:330
FT_Library g_FreeTypeLibrary
Definition: freetype.c:322
static VOID FontLink_CleanupCache(VOID)
Definition: freetype.c:278
static void FontLookUp_Cleanup(_In_ BOOL bDoLock, _Inout_opt_ PSHARED_FACE SharedFace)
Definition: freetype.c:962
static __inline VOID FASTCALL CleanupFontEntry(PFONT_ENTRY FontEntry)
Definition: freetype.c:657
static void RemoveCachedEntry(PFONT_CACHE_ENTRY Entry)
Definition: freetype.c:548
FT_Done_Library(FT_Library library)
Definition: ftobjs.c:5333
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 5367 of file freetype.c.

5373{
5375 FT_Face Face = FontGdi->SharedFace->Face;
5376
5378
5379 if (FT_IS_SFNT(Face))
5380 {
5381 if (Table)
5382 Table = Table >> 24 | Table << 24 | (Table >> 8 & 0xFF00) |
5383 (Table << 8 & 0xFF0000);
5384
5385 if (!Buffer) Size = 0;
5386
5387 if (Buffer && Size)
5388 {
5390 FT_ULong Needed = 0;
5391
5392 Error = FT_Load_Sfnt_Table(Face, Table, Offset, NULL, &Needed);
5393
5394 if ( !Error && Needed < Size) Size = Needed;
5395 }
5396 if (!FT_Load_Sfnt_Table(Face, Table, Offset, Buffer, &Size))
5397 Result = Size;
5398 }
5399
5401
5402 return Result;
5403}
BOOL Error
Definition: chkdsk.c:66
Definition: bufpool.h:45
unsigned long DWORD
Definition: ntddk_ex.h:95
#define IntUnLockFreeType()
Definition: freetype.c:347
#define IntLockFreeType()
Definition: freetype.c:341
#define FT_IS_SFNT(face)
Definition: freetype.h:1303
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:4177
_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 4432 of file freetype.c.

4441{
4442 PDC_ATTR pdcattr;
4443 PTEXTOBJ TextObj;
4444 PFONTGDI FontGDI;
4445 HFONT hFont = 0;
4446 GLYPHMETRICS gm;
4447 ULONG Size;
4448 FT_Face ft_face;
4449 FT_UInt glyph_index;
4450 DWORD width, height, pitch, needed = 0;
4451 FT_Bitmap ft_bitmap;
4453 INT left, right, top = 0, bottom = 0;
4455 FLOATOBJ eM11, widthRatio, eTemp;
4456 FT_Matrix mat, transMat = identityMat;
4457 BOOL needsTransform = FALSE;
4458 INT orientation;
4459 LONG aveWidth;
4460 INT adv, lsb, bbx; /* These three hold to widths of the unrotated chars */
4461 OUTLINETEXTMETRICW *potm;
4462 XFORMOBJ xo;
4463 XFORML xform;
4464 LOGFONTW *plf;
4465
4466 DPRINT("%u, %08x, %p, %08lx, %p, %p\n", wch, iFormat, pgm,
4467 cjBuf, pvBuf, pmat2);
4468
4469 pdcattr = dc->pdcattr;
4470
4471 XFORMOBJ_vInit(&xo, &dc->pdcattr->mxWorldToDevice);
4472 XFORMOBJ_iGetXform(&xo, &xform);
4473 FLOATOBJ_SetFloat(&eM11, xform.eM11);
4474
4475 hFont = pdcattr->hlfntNew;
4476 TextObj = RealizeFontInit(hFont);
4477
4478 if (!TextObj)
4479 {
4481 return GDI_ERROR;
4482 }
4483 FontGDI = ObjToGDI(TextObj->Font, FONT);
4484 ft_face = FontGDI->SharedFace->Face;
4485
4486 plf = &TextObj->logfont.elfEnumLogfontEx.elfLogFont;
4487 aveWidth = FT_IS_SCALABLE(ft_face) ? abs(plf->lfWidth) : 0;
4488 orientation = FT_IS_SCALABLE(ft_face) ? plf->lfOrientation : 0;
4489
4491 Size = IntGetOutlineTextMetrics(FontGDI, 0, NULL, FALSE);
4492 if (!Size)
4493 {
4494 TEXTOBJ_UnlockText(TextObj);
4496 return GDI_ERROR;
4497 }
4499 if (!potm)
4500 {
4501 TEXTOBJ_UnlockText(TextObj);
4503 return GDI_ERROR;
4504 }
4506 Size = IntGetOutlineTextMetrics(FontGDI, Size, potm, FALSE);
4507 if (!Size)
4508 {
4510 TEXTOBJ_UnlockText(TextObj);
4512 return GDI_ERROR;
4513 }
4514
4516 TextIntUpdateSize(dc, TextObj, FontGDI, FALSE);
4518 FT_Set_Transform(ft_face, &mat, NULL);
4519
4520 TEXTOBJ_UnlockText(TextObj);
4521
4522 glyph_index = get_glyph_index_flagged(ft_face, wch, (iFormat & GGO_GLYPH_INDEX));
4523 iFormat &= ~GGO_GLYPH_INDEX;
4524
4525 if (orientation || (iFormat != GGO_METRICS && iFormat != GGO_BITMAP) || aveWidth || pmat2)
4526 load_flags |= FT_LOAD_NO_BITMAP;
4527
4528 if (iFormat & GGO_UNHINTED)
4529 {
4530 load_flags |= FT_LOAD_NO_HINTING;
4531 iFormat &= ~GGO_UNHINTED;
4532 }
4533
4534 error = FT_Load_Glyph(ft_face, glyph_index, load_flags);
4535 if (error)
4536 {
4537 DPRINT1("WARNING: Failed to load and render glyph! [index: %u]\n", glyph_index);
4539 if (potm) ExFreePoolWithTag(potm, GDITAG_TEXT);
4540 return GDI_ERROR;
4541 }
4543
4544 FLOATOBJ_Set1(&widthRatio);
4545 if (aveWidth && potm)
4546 {
4547 // widthRatio = aveWidth * eM11 / potm->otmTextMetrics.tmAveCharWidth
4548 FLOATOBJ_SetLong(&widthRatio, aveWidth);
4549 FLOATOBJ_Mul(&widthRatio, &eM11);
4551 }
4552
4553 //left = (INT)(ft_face->glyph->metrics.horiBearingX * widthRatio) & -64;
4554 FLOATOBJ_SetLong(&eTemp, ft_face->glyph->metrics.horiBearingX);
4555 FLOATOBJ_Mul(&eTemp, &widthRatio);
4556 left = FLOATOBJ_GetLong(&eTemp) & -64;
4557
4558 //right = (INT)((ft_face->glyph->metrics.horiBearingX +
4559 // ft_face->glyph->metrics.width) * widthRatio + 63) & -64;
4560 FLOATOBJ_SetLong(&eTemp, ft_face->glyph->metrics.horiBearingX * ft_face->glyph->metrics.width);
4561 FLOATOBJ_Mul(&eTemp, &widthRatio);
4562 FLOATOBJ_AddLong(&eTemp, 63);
4563 right = FLOATOBJ_GetLong(&eTemp) & -64;
4564
4565 //adv = (INT)((ft_face->glyph->metrics.horiAdvance * widthRatio) + 63) >> 6;
4566 FLOATOBJ_SetLong(&eTemp, ft_face->glyph->metrics.horiAdvance);
4567 FLOATOBJ_Mul(&eTemp, &widthRatio);
4568 FLOATOBJ_AddLong(&eTemp, 63);
4569 adv = FLOATOBJ_GetLong(&eTemp) >> 6;
4570
4571 lsb = left >> 6;
4572 bbx = (right - left) >> 6;
4573
4574 DPRINT("Advance = %d, lsb = %d, bbx = %d\n",adv, lsb, bbx);
4575
4577
4578 /* Width scaling transform */
4579 if (!FLOATOBJ_Equal1(&widthRatio))
4580 {
4581 FT_Matrix scaleMat;
4582
4583 eTemp = widthRatio;
4584 FLOATOBJ_MulLong(&eTemp, 1 << 16);
4585
4586 scaleMat.xx = FLOATOBJ_GetLong(&eTemp);
4587 scaleMat.xy = 0;
4588 scaleMat.yx = 0;
4589 scaleMat.yy = INT_TO_FIXED(1);
4590 FT_Matrix_Multiply(&scaleMat, &transMat);
4591 needsTransform = TRUE;
4592 }
4593
4594 /* World transform */
4595 {
4596 FT_Matrix ftmatrix;
4598
4599 /* Create a freetype matrix, by converting to 16.16 fixpoint format */
4600 IntMatrixFromMx(&ftmatrix, pmx);
4601
4602 if (memcmp(&ftmatrix, &identityMat, sizeof(identityMat)) != 0)
4603 {
4604 FT_Matrix_Multiply(&ftmatrix, &transMat);
4605 needsTransform = TRUE;
4606 }
4607 }
4608
4609 /* Rotation transform */
4610 if (orientation)
4611 {
4612 FT_Matrix rotationMat;
4613 DPRINT("Rotation Trans!\n");
4614 IntEscapeMatrix(&rotationMat, orientation);
4615 FT_Matrix_Multiply(&rotationMat, &transMat);
4616 needsTransform = TRUE;
4617 }
4618
4619 /* Extra transformation specified by caller */
4620 if (pmat2)
4621 {
4622 FT_Matrix extraMat;
4623 DPRINT("MAT2 Matrix Trans!\n");
4624 extraMat.xx = FT_FixedFromFIXED(pmat2->eM11);
4625 extraMat.xy = FT_FixedFromFIXED(pmat2->eM21);
4626 extraMat.yx = FT_FixedFromFIXED(pmat2->eM12);
4627 extraMat.yy = FT_FixedFromFIXED(pmat2->eM22);
4628 FT_Matrix_Multiply(&extraMat, &transMat);
4629 needsTransform = TRUE;
4630 }
4631
4632 if (potm) ExFreePoolWithTag(potm, GDITAG_TEXT); /* It looks like we are finished with potm ATM. */
4633
4634 if (!needsTransform)
4635 {
4636 DPRINT("No Need to be Transformed!\n");
4637 top = (ft_face->glyph->metrics.horiBearingY + 63) & -64;
4638 bottom = (ft_face->glyph->metrics.horiBearingY -
4639 ft_face->glyph->metrics.height) & -64;
4640 gm.gmCellIncX = adv;
4641 gm.gmCellIncY = 0;
4642 }
4643 else
4644 {
4645 INT xc, yc;
4646 FT_Vector vec;
4647 for (xc = 0; xc < 2; xc++)
4648 {
4649 for (yc = 0; yc < 2; yc++)
4650 {
4651 vec.x = (ft_face->glyph->metrics.horiBearingX +
4652 xc * ft_face->glyph->metrics.width);
4653 vec.y = ft_face->glyph->metrics.horiBearingY -
4654 yc * ft_face->glyph->metrics.height;
4655 DPRINT("Vec %ld,%ld\n", vec.x, vec.y);
4656 FT_Vector_Transform(&vec, &transMat);
4657 if (xc == 0 && yc == 0)
4658 {
4659 left = right = vec.x;
4660 top = bottom = vec.y;
4661 }
4662 else
4663 {
4664 if (vec.x < left) left = vec.x;
4665 else if (vec.x > right) right = vec.x;
4666 if (vec.y < bottom) bottom = vec.y;
4667 else if (vec.y > top) top = vec.y;
4668 }
4669 }
4670 }
4671 left = left & -64;
4672 right = (right + 63) & -64;
4673 bottom = bottom & -64;
4674 top = (top + 63) & -64;
4675
4676 DPRINT("Transformed box: (%d,%d - %d,%d)\n", left, top, right, bottom);
4677 vec.x = ft_face->glyph->metrics.horiAdvance;
4678 vec.y = 0;
4679 FT_Vector_Transform(&vec, &transMat);
4680 gm.gmCellIncX = (vec.x+63) >> 6;
4681 gm.gmCellIncY = -((vec.y+63) >> 6);
4682 }
4683 gm.gmBlackBoxX = (right - left) >> 6;
4684 gm.gmBlackBoxY = (top - bottom) >> 6;
4685 gm.gmptGlyphOrigin.x = left >> 6;
4686 gm.gmptGlyphOrigin.y = top >> 6;
4687
4688 DPRINT("CX %d CY %d BBX %u BBY %u GOX %d GOY %d\n",
4689 gm.gmCellIncX, gm.gmCellIncY,
4690 gm.gmBlackBoxX, gm.gmBlackBoxY,
4692
4694
4695 if (iFormat == GGO_METRICS)
4696 {
4697 DPRINT("GGO_METRICS Exit!\n");
4698 *pgm = gm;
4699 return 1; /* FIXME */
4700 }
4701
4702 if (ft_face->glyph->format != ft_glyph_format_outline && iFormat != GGO_BITMAP)
4703 {
4704 DPRINT1("Loaded a bitmap\n");
4705 return GDI_ERROR;
4706 }
4707
4708 switch (iFormat)
4709 {
4710 case GGO_BITMAP:
4711 {
4712 width = gm.gmBlackBoxX;
4713 height = gm.gmBlackBoxY;
4714 pitch = ((width + 31) >> 5) << 2;
4715 needed = pitch * height;
4716
4717 if (!pvBuf || !cjBuf) break;
4718 if (!needed) return GDI_ERROR; /* empty glyph */
4719 if (needed > cjBuf)
4720 return GDI_ERROR;
4721
4722 switch (ft_face->glyph->format)
4723 {
4725 {
4726 BYTE *src = ft_face->glyph->bitmap.buffer, *dst = pvBuf;
4727 INT w = min( pitch, (ft_face->glyph->bitmap.width + 7) >> 3 );
4728 INT h = min( height, ft_face->glyph->bitmap.rows );
4729 while (h--)
4730 {
4732 src += ft_face->glyph->bitmap.pitch;
4733 dst += pitch;
4734 }
4735 break;
4736 }
4737
4739 {
4740 ft_bitmap.width = width;
4741 ft_bitmap.rows = height;
4742 ft_bitmap.pitch = pitch;
4743 ft_bitmap.pixel_mode = FT_PIXEL_MODE_MONO;
4744 ft_bitmap.buffer = pvBuf;
4745
4747 if (needsTransform)
4748 {
4749 FT_Outline_Transform(&ft_face->glyph->outline, &transMat);
4750 }
4751 FT_Outline_Translate(&ft_face->glyph->outline, -left, -bottom );
4752 /* Note: FreeType will only set 'black' bits for us. */
4753 RtlZeroMemory(pvBuf, needed);
4754 FT_Outline_Get_Bitmap(g_FreeTypeLibrary, &ft_face->glyph->outline, &ft_bitmap);
4756 break;
4757 }
4758
4759 default:
4760 DPRINT1("Loaded glyph format %x\n", ft_face->glyph->format);
4761 return GDI_ERROR;
4762 }
4763
4764 break;
4765 }
4766
4767 case GGO_GRAY2_BITMAP:
4768 case GGO_GRAY4_BITMAP:
4769 case GGO_GRAY8_BITMAP:
4770 {
4771 unsigned int mult, row, col;
4772 BYTE *start, *ptr;
4773
4774 width = gm.gmBlackBoxX;
4775 height = gm.gmBlackBoxY;
4776 pitch = (width + 3) / 4 * 4;
4777 needed = pitch * height;
4778
4779 if (!pvBuf || !cjBuf) break;
4780 if (!needed) return GDI_ERROR; /* empty glyph */
4781 if (needed > cjBuf)
4782 return GDI_ERROR;
4783
4784 switch (ft_face->glyph->format)
4785 {
4787 {
4788 BYTE *src = ft_face->glyph->bitmap.buffer, *dst = pvBuf;
4789 INT h = min( height, ft_face->glyph->bitmap.rows );
4790 INT x;
4791 while (h--)
4792 {
4793 for (x = 0; (UINT)x < pitch; x++)
4794 {
4795 if (x < ft_face->glyph->bitmap.width)
4796 dst[x] = (src[x / 8] & (1 << ( (7 - (x % 8))))) ? 0xff : 0;
4797 else
4798 dst[x] = 0;
4799 }
4800 src += ft_face->glyph->bitmap.pitch;
4801 dst += pitch;
4802 }
4803 break;
4804 }
4806 {
4807 ft_bitmap.width = width;
4808 ft_bitmap.rows = height;
4809 ft_bitmap.pitch = pitch;
4810 ft_bitmap.pixel_mode = FT_PIXEL_MODE_GRAY;
4811 ft_bitmap.buffer = pvBuf;
4812
4814 if (needsTransform)
4815 {
4816 FT_Outline_Transform(&ft_face->glyph->outline, &transMat);
4817 }
4818 FT_Outline_Translate(&ft_face->glyph->outline, -left, -bottom );
4819 RtlZeroMemory(ft_bitmap.buffer, cjBuf);
4820 FT_Outline_Get_Bitmap(g_FreeTypeLibrary, &ft_face->glyph->outline, &ft_bitmap);
4822
4824 mult = 4;
4825 else if (iFormat == GGO_GRAY4_BITMAP)
4826 mult = 16;
4827 else if (iFormat == GGO_GRAY8_BITMAP)
4828 mult = 64;
4829 else
4830 {
4831 return GDI_ERROR;
4832 }
4833
4834 start = pvBuf;
4835 for (row = 0; row < height; row++)
4836 {
4837 ptr = start;
4838 for (col = 0; col < width; col++, ptr++)
4839 {
4840 *ptr = (((int)*ptr) * mult + 128) / 256;
4841 }
4842 start += pitch;
4843 }
4844
4845 break;
4846 }
4847 default:
4848 DPRINT1("Loaded glyph format %x\n", ft_face->glyph->format);
4849 return GDI_ERROR;
4850 }
4851
4852 break;
4853 }
4854
4855 case GGO_NATIVE:
4856 {
4857 FT_Outline *outline = &ft_face->glyph->outline;
4858
4859 if (cjBuf == 0) pvBuf = NULL; /* This is okay, need cjBuf to allocate. */
4860
4862 if (needsTransform && pvBuf) FT_Outline_Transform(outline, &transMat);
4863
4865
4866 if (!pvBuf || !cjBuf)
4867 {
4869 break;
4870 }
4871 if (needed > cjBuf)
4872 {
4874 return GDI_ERROR;
4875 }
4878 break;
4879 }
4880
4881 case GGO_BEZIER:
4882 {
4883 FT_Outline *outline = &ft_face->glyph->outline;
4884 if (cjBuf == 0) pvBuf = NULL;
4885
4886 if (needsTransform && pvBuf)
4887 {
4889 FT_Outline_Transform(outline, &transMat);
4891 }
4893
4894 if (!pvBuf || !cjBuf)
4895 break;
4896 if (needed > cjBuf)
4897 return GDI_ERROR;
4898
4900 break;
4901 }
4902
4903 default:
4904 DPRINT1("Unsupported format %u\n", iFormat);
4905 return GDI_ERROR;
4906 }
4907
4908 DPRINT("ftGdiGetGlyphOutline END and needed %lu\n", needed);
4909
4910 if (gm.gmBlackBoxX == 0)
4911 gm.gmBlackBoxX = 1;
4912 if (gm.gmBlackBoxY == 0)
4913 gm.gmBlackBoxY = 1;
4914
4915 *pgm = gm;
4916 return needed;
4917}
#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:4223
static FT_UInt FASTCALL get_glyph_index_flagged(FT_Face face, FT_ULong code, BOOL fCodeAsIndex)
Definition: freetype.c:4341
#define ASSERT_FREETYPE_LOCK_NOT_HELD()
Definition: freetype.c:338
static unsigned int get_bezier_glyph_outline(FT_Outline *outline, unsigned int buflen, char *buf)
Definition: freetype.c:3959
static unsigned int get_native_glyph_outline(FT_Outline *outline, unsigned int buflen, char *buf)
Definition: freetype.c:3886
static VOID FASTCALL IntMatrixFromMx(FT_Matrix *pmat, const MATRIX *pmx)
Definition: freetype.c:1106
static VOID FASTCALL IntEscapeMatrix(FT_Matrix *pmat, LONG lfEscapement)
Definition: freetype.c:1093
static const FT_Matrix identityMat
Definition: freetype.c:317
static __inline FT_Fixed FT_FixedFromFIXED(FIXED f)
Definition: freetype.c:676
INT FASTCALL IntGetOutlineTextMetrics(PFONTGDI FontGDI, UINT Size, OUTLINETEXTMETRICW *Otm, BOOL bLocked)
Definition: freetype.c:3143
FT_Load_Glyph(FT_Face face, FT_UInt glyph_index, FT_Int32 load_flags)
Definition: ftobjs.c:797
#define FT_LOAD_NO_BITMAP
Definition: freetype.h:3030
FT_Set_Transform(FT_Face face, FT_Matrix *matrix, FT_Vector *delta)
Definition: ftobjs.c:690
#define FT_LOAD_NO_HINTING
Definition: freetype.h:3028
#define FT_IS_SCALABLE(face)
Definition: freetype.h:1284
#define FT_LOAD_DEFAULT
Definition: freetype.h:3026
#define FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH
Definition: freetype.h:3035
FT_Vector_Transform(FT_Vector *vector, const FT_Matrix *matrix)
Definition: ftoutln.c:675
FT_Vector * vec
Definition: ftbbox.c:470
#define INT_TO_FIXED(x)
Definition: ftcalc.h:448
FT_Matrix_Multiply(const FT_Matrix *a, FT_Matrix *b)
Definition: ftcalc.c:661
#define ft_glyph_format_bitmap
Definition: ftimage.h:752
@ FT_PIXEL_MODE_MONO
Definition: ftimage.h:184
@ FT_PIXEL_MODE_GRAY
Definition: ftimage.h:185
#define ft_glyph_format_outline
Definition: ftimage.h:753
FT_Outline_Translate(const FT_Outline *outline, FT_Pos xOffset, FT_Pos yOffset)
Definition: ftoutln.c:509
FT_Outline_Get_Bitmap(FT_Library library, FT_Outline *outline, const FT_Bitmap *abitmap)
Definition: ftoutln.c:648
FT_Outline_Transform(const FT_Outline *outline, const FT_Matrix *matrix)
Definition: ftoutln.c:698
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: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:1078
FT_Bitmap bitmap
Definition: freetype.h:1892
FT_Outline outline
Definition: freetype.h:1896
FT_Glyph_Metrics metrics
Definition: freetype.h:1885
FT_Glyph_Format format
Definition: freetype.h:1890
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:78
FT_Pos y
Definition: ftimage.h:79
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:431
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 6468 of file freetype.c.

6471{
6472 DWORD Count = 0;
6473 INT i = 0;
6474 FT_Face face = Font->SharedFace->Face;
6475
6476 if (FT_HAS_KERNING(face) && face->charmap->encoding == FT_ENCODING_UNICODE)
6477 {
6478 FT_UInt previous_index = 0, glyph_index = 0;
6479 FT_ULong char_code, char_previous;
6480 FT_Vector delta;
6481
6482 char_previous = char_code = FT_Get_First_Char(face, &glyph_index);
6483
6485
6486 while (glyph_index)
6487 {
6488 if (previous_index && glyph_index)
6489 {
6490 FT_Get_Kerning(face, previous_index, glyph_index, FT_KERNING_DEFAULT, &delta);
6491
6492 if (pKerningPair && cPairs)
6493 {
6494 pKerningPair[i].wFirst = char_previous;
6495 pKerningPair[i].wSecond = char_code;
6496 pKerningPair[i].iKernAmount = delta.x;
6497 i++;
6498 if (i == cPairs) break;
6499 }
6500 Count++;
6501 }
6502 previous_index = glyph_index;
6503 char_previous = char_code;
6504 char_code = FT_Get_Next_Char(face, char_code, &glyph_index);
6505 }
6507 }
6508 return Count;
6509}
FT_Get_First_Char(FT_Face face, FT_UInt *agindex)
Definition: ftobjs.c:3740
FT_Get_Next_Char(FT_Face face, FT_ULong char_code, FT_UInt *agindex)
Definition: ftobjs.c:3765
FT_Get_Kerning(FT_Face face, FT_UInt left_glyph, FT_UInt right_glyph, FT_UInt kern_mode, FT_Vector *akerning)
Definition: ftobjs.c:3391
@ FT_KERNING_DEFAULT
Definition: freetype.h:3413
#define FT_HAS_KERNING(face)
Definition: freetype.h:1269
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 3755 of file freetype.c.

3756{
3757 if ( lprs )
3758 {
3759 lprs->nSize = sizeof(RASTERIZER_STATUS);
3760 lprs->wFlags = TT_AVAILABLE | TT_ENABLED;
3761 lprs->nLanguageID = gusLanguageID;
3762 return TRUE;
3763 }
3765 return FALSE;
3766}
#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 5082 of file freetype.c.

5086{
5087 PDC_ATTR pdcattr;
5088 UINT Ret = DEFAULT_CHARSET;
5089 INT i;
5090 HFONT hFont;
5091 PTEXTOBJ TextObj;
5092 PFONTGDI FontGdi;
5094 TT_OS2 *pOS2;
5095 FT_Face Face;
5096 CHARSETINFO csi;
5097 DWORD cp, fs0;
5098 USHORT usACP, usOEM;
5099
5100 pdcattr = Dc->pdcattr;
5101 hFont = pdcattr->hlfntNew;
5102 TextObj = RealizeFontInit(hFont);
5103
5104 if (!TextObj)
5105 {
5107 return Ret;
5108 }
5109 FontGdi = ObjToGDI(TextObj->Font, FONT);
5110 Face = FontGdi->SharedFace->Face;
5111 TEXTOBJ_UnlockText(TextObj);
5112
5113 memset(&fs, 0, sizeof(FONTSIGNATURE));
5115 pOS2 = FT_Get_Sfnt_Table(Face, ft_sfnt_os2);
5116 if (NULL != pOS2)
5117 {
5118 fs.fsCsb[0] = pOS2->ulCodePageRange1;
5119 fs.fsCsb[1] = pOS2->ulCodePageRange2;
5120 fs.fsUsb[0] = pOS2->ulUnicodeRange1;
5121 fs.fsUsb[1] = pOS2->ulUnicodeRange2;
5122 fs.fsUsb[2] = pOS2->ulUnicodeRange3;
5123 fs.fsUsb[3] = pOS2->ulUnicodeRange4;
5124 if (pOS2->version == 0)
5125 {
5126 FT_UInt dummy;
5127
5128 if (FT_Get_First_Char( Face, &dummy ) < 0x100)
5129 fs.fsCsb[0] |= FS_LATIN1;
5130 else
5131 fs.fsCsb[0] |= FS_SYMBOL;
5132 }
5133 }
5134 pOS2 = NULL;
5136 DPRINT("Csb 1=%x 0=%x\n", fs.fsCsb[1],fs.fsCsb[0]);
5137 if (fs.fsCsb[0] == 0)
5138 { /* Let's see if we can find any interesting cmaps */
5139 for (i = 0; i < Face->num_charmaps; i++)
5140 {
5141 switch (Face->charmaps[i]->encoding)
5142 {
5143 case FT_ENCODING_UNICODE:
5144 case FT_ENCODING_APPLE_ROMAN:
5145 fs.fsCsb[0] |= FS_LATIN1;
5146 break;
5147 case FT_ENCODING_MS_SYMBOL:
5148 fs.fsCsb[0] |= FS_SYMBOL;
5149 break;
5150 default:
5151 break;
5152 }
5153 }
5154 }
5155 if (lpSig)
5156 {
5157 RtlCopyMemory(lpSig, &fs, sizeof(FONTSIGNATURE));
5158 }
5159
5160 RtlGetDefaultCodePage(&usACP, &usOEM);
5161 cp = usACP;
5162
5164 if (csi.fs.fsCsb[0] & fs.fsCsb[0])
5165 {
5166 DPRINT("Hit 1\n");
5167 Ret = csi.ciCharset;
5168 goto Exit;
5169 }
5170
5171 for (i = 0; i < MAXTCIINDEX; i++)
5172 {
5173 fs0 = 1L << i;
5174 if (fs.fsCsb[0] & fs0)
5175 {
5176 if (IntTranslateCharsetInfo(&fs0, &csi, TCI_SRCFONTSIG))
5177 {
5178 // *cp = csi.ciACP;
5179 DPRINT("Hit 2\n");
5180 Ret = csi.ciCharset;
5181 goto Exit;
5182 }
5183 else
5184 DPRINT1("TCI failing on %x\n", fs0);
5185 }
5186 }
5187Exit:
5188 DPRINT("CharSet %u CodePage %u\n", csi.ciCharset, csi.ciACP);
5189 return (MAKELONG(csi.ciACP, csi.ciCharset));
5190}
#define MAXTCIINDEX
Definition: freetype.c:385
static BOOLEAN IntTranslateCharsetInfo(PDWORD Src, LPCHARSETINFO Cs, DWORD Flags)
Definition: freetype.c:2779
#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:836
FT_Int num_charmaps
Definition: freetype.h:1057
FT_CharMap * charmaps
Definition: freetype.h:1058
FT_UShort version
Definition: tttables.h:378
FT_ULong ulUnicodeRange1
Definition: tttables.h:397
FT_ULong ulCodePageRange1
Definition: tttables.h:415
FT_ULong ulUnicodeRange3
Definition: tttables.h:399
FT_ULong ulUnicodeRange2
Definition: tttables.h:398
FT_ULong ulCodePageRange2
Definition: tttables.h:416
FT_ULong ulUnicodeRange4
Definition: tttables.h:400
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:4156
#define ft_sfnt_os2
Definition: tttables.h:639
#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 5269 of file freetype.c.

5272{
5273 PDC dc;
5274 PDC_ATTR pdcattr;
5275 PTEXTOBJ TextObj;
5276 PFONTGDI FontGDI;
5277 FT_Face Face;
5278 TT_OS2 *pOS2;
5279 TT_HoriHeader *pHori;
5281 ULONG Error;
5283 LOGFONTW *plf;
5284
5285 if (!ptmwi)
5286 {
5288 return FALSE;
5289 }
5290 RtlZeroMemory(ptmwi, sizeof(TMW_INTERNAL));
5291
5292 if (!(dc = DC_LockDc(hDC)))
5293 {
5295 return FALSE;
5296 }
5297 pdcattr = dc->pdcattr;
5298 TextObj = RealizeFontInit(pdcattr->hlfntNew);
5299 if (NULL != TextObj)
5300 {
5301 plf = &TextObj->logfont.elfEnumLogfontEx.elfLogFont;
5302 FontGDI = ObjToGDI(TextObj->Font, FONT);
5303
5304 Face = FontGDI->SharedFace->Face;
5305
5306 // NOTE: GetTextMetrics simply ignores lfEscapement and XFORM.
5308 Error = IntRequestFontSize(dc, FontGDI, plf->lfWidth, plf->lfHeight);
5309 FT_Set_Transform(Face, NULL, NULL);
5310
5312
5313 if (0 != Error)
5314 {
5315 DPRINT1("Error in setting pixel sizes: %u\n", Error);
5317 }
5318 else
5319 {
5321
5323
5324 Error = FT_Get_WinFNT_Header(Face, &Win);
5325 pOS2 = FT_Get_Sfnt_Table(Face, ft_sfnt_os2);
5326 pHori = FT_Get_Sfnt_Table(Face, ft_sfnt_hhea);
5327
5328 if (!pOS2 && Error)
5329 {
5330 DPRINT1("Can't find OS/2 table - not TT font?\n");
5332 }
5333
5334 if (!pHori && Error)
5335 {
5336 DPRINT1("Can't find HHEA table - not TT font?\n");
5338 }
5339
5340 if (NT_SUCCESS(Status))
5341 {
5342 FillTM(&ptmwi->TextMetric, FontGDI, pOS2, pHori, (Error ? NULL : &Win));
5343
5344 /* FIXME: Fill Diff member */
5345 }
5346
5348 }
5349 TEXTOBJ_UnlockText(TextObj);
5350 }
5351 else
5352 {
5354 }
5355 DC_UnlockDc(dc);
5356
5357 if (!NT_SUCCESS(Status))
5358 {
5360 return FALSE;
5361 }
5362 return TRUE;
5363}
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:4084
static void FASTCALL FillTM(TEXTMETRICW *TM, PFONTGDI FontGDI, TT_OS2 *pOS2, TT_HoriHeader *pHori, FT_WinFNT_HeaderRec *pFNT)
Definition: freetype.c:2841
FT_Get_WinFNT_Header(FT_Face face, FT_WinFNT_HeaderRec *aheader)
Definition: ftwinfnt.c:29
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:640
#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 6449 of file freetype.c.

6450{
6451 if (FT_HAS_FIXED_SIZES(Font->SharedFace->Face))
6452 Info->iTechnology = RI_TECH_BITMAP;
6453 else
6454 {
6455 if (FT_IS_SCALABLE(Font->SharedFace->Face))
6456 Info->iTechnology = RI_TECH_SCALABLE;
6457 else
6458 Info->iTechnology = RI_TECH_FIXED;
6459 }
6460 Info->iUniq = Font->FontObj.iUniq;
6461 Info->dwUnknown = -1;
6462 return TRUE;
6463}
#define FT_HAS_FIXED_SIZES(face)
Definition: freetype.h:1333
#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 5195 of file freetype.c.

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

Referenced by NtGdiGetFontUnicodeRanges().

◆ GreCreateFontIndirectW()

HFONT FASTCALL GreCreateFontIndirectW ( _In_ const LOGFONTW lplf)

Internal

Definition at line 28 of file font.c.

29{
30 if (lplf)
31 {
32 ENUMLOGFONTEXDVW Logfont;
33
34 RtlCopyMemory( &Logfont.elfEnumLogfontEx.elfLogFont, lplf, sizeof(LOGFONTW));
36 sizeof(Logfont.elfEnumLogfontEx.elfFullName));
38 sizeof(Logfont.elfEnumLogfontEx.elfStyle));
40 sizeof(Logfont.elfEnumLogfontEx.elfScript));
41
42 Logfont.elfDesignVector.dvNumAxes = 0;
43
44 RtlZeroMemory( &Logfont.elfDesignVector, sizeof(DESIGNVECTOR));
45
46 return HfontCreate(&Logfont, 0, 0, 0, NULL);
47 }
48 else return NULL;
49}
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 7295 of file freetype.c.

7305{
7306 BOOL bResult;
7307 DC *dc;
7308
7309 // TODO: Write test-cases to exactly match real Windows in different
7310 // bad parameters (e.g. does Windows check the DC or the RECT first?).
7311 dc = DC_LockDc(hDC);
7312 if (!dc)
7313 {
7315 return FALSE;
7316 }
7317
7318 bResult = IntExtTextOutW( dc,
7319 XStart,
7320 YStart,
7321 fuOptions,
7322 lprc,
7323 String,
7324 Count,
7325 Dx,
7326 dwCodePage );
7327
7328 DC_UnlockDc(dc);
7329
7330 return bResult;
7331}
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:6746
_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().

◆ 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:5269
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 1001 of file freetype.c.

1002{
1003 ULONG ulError;
1004
1006
1008 if (g_FreeTypeLock == NULL)
1009 {
1010 return FALSE;
1011 }
1013
1015 if (ulError)
1016 {
1017 DPRINT1("FT_Init_FreeType failed with error code 0x%x\n", ulError);
1018 return FALSE;
1019 }
1020
1022 {
1023 DPRINT1("Fonts registry is empty.\n");
1024
1025 /* Load font(s) with writing registry */
1027 }
1028
1029 IntLoadFontSubstList(&g_FontSubstListHead);
1030
1031#if 0
1032 DumpFontInfo(TRUE);
1033#endif
1034
1038
1039 return TRUE;
1040}
#define NonPagedPool
Definition: env_spec_w32.h:307
BOOL FASTCALL IntLoadFontSubstList(PLIST_ENTRY pHead)
Definition: freetype.c:807
static UINT g_FontCacheNumEntries
Definition: freetype.c:356
VOID FASTCALL IntLoadSystemFonts(VOID)
Definition: freetype.c:1499
static NTSTATUS FontLink_LoadDefaultCharset(VOID)
Definition: freetype.c:140
static NTSTATUS FontLink_LoadSettings(VOID)
Definition: freetype.c:76
static NTSTATUS FontLink_LoadDefaultFonts(VOID)
Definition: freetype.c:102
BOOL FASTCALL IntLoadFontsInRegistry(VOID)
Definition: freetype.c:2380
FT_Init_FreeType(FT_Library *alibrary)
Definition: ftinit.c:196
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 434 of file freetype.c.

435{
436 UINT i;
437
438 if (uCodePage == CP_OEMCP)
439 return OEM_CHARSET;
440
441 if (uCodePage == CP_MACCP)
442 return MAC_CHARSET;
443
444 for (i = 0; i < MAXTCIINDEX; ++i)
445 {
446 if (g_FontTci[i].ciACP == 0)
447 continue;
448
449 if (g_FontTci[i].ciACP == uCodePage)
450 return g_FontTci[i].ciCharset;
451 }
452
453 return DEFAULT_CHARSET;
454}
#define CP_OEMCP
Definition: freetype.c:428
static const CHARSETINFO g_FontTci[MAXTCIINDEX]
Definition: freetype.c:386
#define CP_MACCP
Definition: freetype.c:429
#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 2710 of file freetype.c.

2711{
2713}
static BOOL g_RenderingEnabled
Definition: freetype.c:333
_In_ ULONGLONG _In_ ULONGLONG _In_ BOOLEAN Enable
Definition: ntddpcm.h:142

◆ IntGdiAddFontMemResource()

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

Definition at line 2532 of file freetype.c.

2533{
2534 HANDLE Ret = NULL;
2536 PFONT_ENTRY_COLL_MEM EntryCollection;
2537 INT FaceCount;
2538
2540 if (!BufferCopy)
2541 {
2542 *pNumAdded = 0;
2543 return NULL;
2544 }
2545 RtlCopyMemory(BufferCopy, Buffer, dwSize);
2546
2547 RtlZeroMemory(&LoadFont, sizeof(LoadFont));
2548 LoadFont.Memory = SharedMem_Create(BufferCopy, dwSize, FALSE);
2549 LoadFont.Characteristics = FR_PRIVATE | FR_NOT_ENUM;
2550 RtlInitUnicodeString(&LoadFont.RegValueName, NULL);
2552
2553 RtlFreeUnicodeString(&LoadFont.RegValueName);
2554
2555 /* Release our copy */
2559
2560 if (FaceCount > 0)
2561 {
2562 EntryCollection = ExAllocatePoolWithTag(PagedPool, sizeof(FONT_ENTRY_COLL_MEM), TAG_FONT);
2563 if (EntryCollection)
2564 {
2566 EntryCollection->Entry = LoadFont.PrivateEntry;
2568 IntLockProcessPrivateFonts(Win32Process);
2569 EntryCollection->Handle = ULongToHandle(++Win32Process->PrivateMemFontHandleCount);
2570 InsertTailList(&Win32Process->PrivateMemFontListHead, &EntryCollection->ListEntry);
2571 IntUnLockProcessPrivateFonts(Win32Process);
2573 Ret = EntryCollection->Handle;
2574 }
2575 }
2576 *pNumAdded = FaceCount;
2577
2578 return Ret;
2579}
#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:1944
static PSHARED_MEM SharedMem_Create(PBYTE Buffer, ULONG BufferSize, BOOL IsMapping)
Definition: freetype.c:524
static void SharedMem_Release(PSHARED_MEM Ptr)
Definition: freetype.c:581
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 2197 of file freetype.c.

2202{
2203 PWSTR pchFile = FileName->Buffer;
2204 SIZE_T cchFile;
2205 INT ret = 0;
2206
2207 while (cFiles--)
2208 {
2209 _SEH2_TRY
2210 {
2211 cchFile = wcslen(pchFile);
2212 }
2214 {
2215 _SEH2_YIELD(return FALSE);
2216 }
2217 _SEH2_END;
2218
2219 UNICODE_STRING ustrPathName;
2220 ustrPathName.Length = (USHORT)(cchFile * sizeof(WCHAR));
2221 ustrPathName.MaximumLength = ustrPathName.Length + sizeof(WCHAR);
2222 ustrPathName.Buffer = pchFile;
2223
2224 INT count = IntGdiAddFontResourceSingle(&ustrPathName, Characteristics, dwFlags);
2225 if (!count)
2226 return 0;
2227 ret += count;
2228
2229 pchFile += cchFile + 1;
2230 }
2231
2232 /* Prepare for better LOGFONT-to-face matching */
2234
2235 return ret;
2236}
_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:1998
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 2654 of file freetype.c.

2655{
2658 PFONT_ENTRY_COLL_MEM EntryCollection;
2659
2660 DPRINT("IntGdiCleanupPrivateFontsForProcess()\n");
2661 do {
2662 Entry = NULL;
2663 EntryCollection = NULL;
2664
2666 IntLockProcessPrivateFonts(Win32Process);
2667 if (!IsListEmpty(&Win32Process->PrivateMemFontListHead))
2668 {
2669 Entry = Win32Process->PrivateMemFontListHead.Flink;
2670 EntryCollection = CONTAINING_RECORD(Entry, FONT_ENTRY_COLL_MEM, ListEntry);
2671 UnlinkFontMemCollection(EntryCollection);
2672 }
2673 IntUnLockProcessPrivateFonts(Win32Process);
2675
2676 if (EntryCollection)
2677 {
2678 IntGdiCleanupMemEntry(EntryCollection->Entry);
2679 ExFreePoolWithTag(EntryCollection, TAG_FONT);
2680 }
2681 else
2682 {
2683 /* No Mem fonts anymore, see if we have any other private fonts left */
2684 Entry = NULL;
2686 IntLockProcessPrivateFonts(Win32Process);
2687 if (!IsListEmpty(&Win32Process->PrivateFontListHead))
2688 {
2689 Entry = RemoveHeadList(&Win32Process->PrivateFontListHead);
2690 }
2691 IntUnLockProcessPrivateFonts(Win32Process);
2693
2694 if (Entry)
2695 {
2697 }
2698 }
2699
2700 } while (Entry);
2701}
VOID FASTCALL IntGdiCleanupMemEntry(PFONT_ENTRY_MEM Head)
Definition: freetype.c:2582
static VOID FASTCALL UnlinkFontMemCollection(PFONT_ENTRY_COLL_MEM Collection)
Definition: freetype.c:2601
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 6181 of file freetype.c.

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

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

Referenced by NtGdiRemoveFontMemResourceEx().

◆ IntGdiRemoveFontResource()

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

Definition at line 2344 of file freetype.c.

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

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

3147{
3148 TT_OS2 *pOS2;
3149 TT_HoriHeader *pHori;
3150 TT_Postscript *pPost;
3151 FT_Fixed XScale, YScale;
3152 FT_WinFNT_HeaderRec WinFNT;
3154 BYTE *pb;
3155 FONT_NAMES FontNames;
3156 PSHARED_FACE SharedFace = FontGDI->SharedFace;
3158 FT_Face Face = SharedFace->Face;
3159
3160 if (bLocked)
3162 else
3164
3166 {
3167 Cache = &SharedFace->EnglishUS;
3168 }
3169 else
3170 {
3171 Cache = &SharedFace->UserLanguage;
3172 }
3173
3174 if (Size == 0 && Cache->OutlineRequiredSize > 0)
3175 {
3176 ASSERT(Otm == NULL);
3177 return Cache->OutlineRequiredSize;
3178 }
3179
3180 if (!bLocked)
3182
3183 IntInitFontNames(&FontNames, SharedFace);
3184 Cache->OutlineRequiredSize = FontNames.OtmSize;
3185
3186 if (Size == 0)
3187 {
3188 ASSERT(Otm == NULL);
3189 IntFreeFontNames(&FontNames);
3190 if (!bLocked)
3192 return Cache->OutlineRequiredSize;
3193 }
3194
3195 ASSERT(Otm != NULL);
3196
3197 if (Size < Cache->OutlineRequiredSize)
3198 {
3199 DPRINT1("Size %u < OutlineRequiredSize %u\n", Size,
3200 Cache->OutlineRequiredSize);
3201 IntFreeFontNames(&FontNames);
3202 if (!bLocked)
3204 return 0; /* failure */
3205 }
3206
3207 XScale = Face->size->metrics.x_scale;
3208 YScale = Face->size->metrics.y_scale;
3209
3210 pOS2 = FT_Get_Sfnt_Table(Face, FT_SFNT_OS2);
3211 pHori = FT_Get_Sfnt_Table(Face, FT_SFNT_HHEA);
3212 pPost = FT_Get_Sfnt_Table(Face, FT_SFNT_POST); /* We can live with this failing */
3213 Error = FT_Get_WinFNT_Header(Face, &WinFNT);
3214
3215 if (pOS2 == NULL && Error)
3216 {
3217 if (!bLocked)
3219 DPRINT1("Can't find OS/2 table - not TT font?\n");
3220 IntFreeFontNames(&FontNames);
3221 return 0;
3222 }
3223
3224 if (pHori == NULL && Error)
3225 {
3226 if (!bLocked)
3228 DPRINT1("Can't find HHEA table - not TT font?\n");
3229 IntFreeFontNames(&FontNames);
3230 return 0;
3231 }
3232
3233 Otm->otmSize = Cache->OutlineRequiredSize;
3234
3235 FillTM(&Otm->otmTextMetrics, FontGDI, pOS2, pHori, (Error ? NULL : &WinFNT));
3236
3237 if (!pOS2)
3238 goto skip_os2;
3239
3240 Otm->otmFiller = 0;
3242 Otm->otmfsSelection = pOS2->fsSelection;
3243 Otm->otmfsType = pOS2->fsType;
3244 Otm->otmsCharSlopeRise = pHori->caret_Slope_Rise;
3245 Otm->otmsCharSlopeRun = pHori->caret_Slope_Run;
3246 Otm->otmItalicAngle = 0; /* POST table */
3247 Otm->otmEMSquare = Face->units_per_EM;
3248
3249#define SCALE_X(value) ((FT_MulFix((value), XScale) + 32) >> 6)
3250#define SCALE_Y(value) ((FT_MulFix((value), YScale) + 32) >> 6)
3251
3252 Otm->otmAscent = SCALE_Y(pOS2->sTypoAscender);
3253 Otm->otmDescent = SCALE_Y(pOS2->sTypoDescender);
3254 Otm->otmLineGap = SCALE_Y(pOS2->sTypoLineGap);
3255 Otm->otmsCapEmHeight = SCALE_Y(pOS2->sCapHeight);
3256 Otm->otmsXHeight = SCALE_Y(pOS2->sxHeight);
3257 Otm->otmrcFontBox.left = SCALE_X(Face->bbox.xMin);
3258 Otm->otmrcFontBox.right = SCALE_X(Face->bbox.xMax);
3259 Otm->otmrcFontBox.top = SCALE_Y(Face->bbox.yMax);
3260 Otm->otmrcFontBox.bottom = SCALE_Y(Face->bbox.yMin);
3263 Otm->otmMacLineGap = Otm->otmLineGap;
3264 Otm->otmusMinimumPPEM = 0; /* TT Header */
3275
3276 if (!pPost)
3277 {
3278 Otm->otmsUnderscoreSize = 0;
3279 Otm->otmsUnderscorePosition = 0;
3280 }
3281 else
3282 {
3285 }
3286
3287#undef SCALE_X
3288#undef SCALE_Y
3289
3290skip_os2:
3291 if (!bLocked)
3293
3294 pb = IntStoreFontNames(&FontNames, Otm);
3295 ASSERT(pb - (BYTE*)Otm == Cache->OutlineRequiredSize);
3296
3297 IntFreeFontNames(&FontNames);
3298
3299 return Cache->OutlineRequiredSize;
3300}
BOOLEAN bLocked
Definition: Mke2fs.c:19
#define SCALE_Y(value)
static __inline void FASTCALL IntInitFontNames(FONT_NAMES *Names, PSHARED_FACE SharedFace)
Definition: freetype.c:3070
PBYTE FASTCALL IntStoreFontNames(_In_ const FONT_NAMES *Names, _Out_ OUTLINETEXTMETRICW *Otm)
Definition: freetype.c:3106
#define SCALE_X(value)
#define ASSERT_FREETYPE_LOCK_HELD()
Definition: freetype.c:335
static __inline void FASTCALL IntFreeFontNames(FONT_NAMES *Names)
Definition: freetype.c:3130
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:3066
FT_Pos xMin
Definition: ftimage.h:121
FT_Pos yMax
Definition: ftimage.h:122
FT_Pos yMin
Definition: ftimage.h:121
FT_Pos xMax
Definition: ftimage.h:122
FT_Size size
Definition: freetype.h:1079
FT_BBox bbox
Definition: freetype.h:1065
FT_UShort units_per_EM
Definition: freetype.h:1067
FT_Size_Metrics metrics
Definition: freetype.h:1649
FT_Fixed y_scale
Definition: freetype.h:1614
FT_Fixed x_scale
Definition: freetype.h:1613
FT_Short caret_Slope_Run
Definition: tttables.h:214
FT_Short caret_Slope_Rise
Definition: tttables.h:213
FT_Short sTypoDescender
Definition: tttables.h:408
FT_UShort fsSelection
Definition: tttables.h:404
FT_Short ySuperscriptYSize
Definition: tttables.h:388
FT_Short sxHeight
Definition: tttables.h:420
FT_Short yStrikeoutSize
Definition: tttables.h:391
FT_Byte panose[10]
Definition: tttables.h:395
FT_Short ySubscriptXSize
Definition: tttables.h:383
FT_Short sTypoLineGap
Definition: tttables.h:409
FT_Short sTypoAscender
Definition: tttables.h:407
FT_Short ySuperscriptXSize
Definition: tttables.h:387
FT_Short ySubscriptYOffset
Definition: tttables.h:386
FT_Short ySuperscriptYOffset
Definition: tttables.h:390
FT_Short ySubscriptXOffset
Definition: tttables.h:385
FT_Short yStrikeoutPosition
Definition: tttables.h:392
FT_Short sCapHeight
Definition: tttables.h:421
FT_UShort fsType
Definition: tttables.h:382
FT_Short ySuperscriptXOffset
Definition: tttables.h:389
FT_Short ySubscriptYSize
Definition: tttables.h:384
FT_Short underlineThickness
Definition: tttables.h:456
FT_Short underlinePosition
Definition: tttables.h:455
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:626
@ FT_SFNT_POST
Definition: tttables.h:628
@ FT_SFNT_OS2
Definition: tttables.h:625
#define PANOSE_COUNT
Definition: wingdi.h:453

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

◆ IntIsFontRenderingEnabled()

BOOL FASTCALL IntIsFontRenderingEnabled ( VOID  )

Definition at line 2704 of file freetype.c.

2705{
2706 return (gpsi->BitsPixel > 8) && g_RenderingEnabled;
2707}
PSERVERINFO gpsi
Definition: imm.c:18

Referenced by IntExtTextOutW(), and TextIntGetTextExtentPoint().

◆ IntLoadFontsInRegistry()

BOOL FASTCALL IntLoadFontsInRegistry ( VOID  )

Definition at line 2380 of file freetype.c.

2381{
2385 KEY_FULL_INFORMATION KeyFullInfo;
2386 ULONG i, Length;
2387 UNICODE_STRING FontTitleW, FileNameW;
2388 SIZE_T InfoSize;
2389 LPBYTE InfoBuffer;
2391 LPWSTR pchPath;
2393 INT nFontCount = 0;
2394 DWORD dwFlags;
2395
2396 /* open registry key */
2399 NULL, NULL);
2400 Status = ZwOpenKey(&KeyHandle, KEY_READ, &ObjectAttributes);
2401 if (!NT_SUCCESS(Status))
2402 {
2403 DPRINT1("ZwOpenKey failed: 0x%08X\n", Status);
2404 return FALSE; /* failure */
2405 }
2406
2407 /* query count of values */
2408 Status = ZwQueryKey(KeyHandle, KeyFullInformation,
2409 &KeyFullInfo, sizeof(KeyFullInfo), &Length);
2410 if (!NT_SUCCESS(Status))
2411 {
2412 DPRINT1("ZwQueryKey failed: 0x%08X\n", Status);
2414 return FALSE; /* failure */
2415 }
2416
2417 /* allocate buffer */
2418 InfoSize = (MAX_PATH + 256) * sizeof(WCHAR);
2419 InfoBuffer = ExAllocatePoolWithTag(PagedPool, InfoSize, TAG_FONT);
2420 if (!InfoBuffer)
2421 {
2422 DPRINT1("ExAllocatePoolWithTag failed\n");
2424 return FALSE;
2425 }
2426
2427 /* for each value */
2428 for (i = 0; i < KeyFullInfo.Values; ++i)
2429 {
2430 /* get value name */
2431 Status = ZwEnumerateValueKey(KeyHandle, i, KeyValueFullInformation,
2432 InfoBuffer, InfoSize, &Length);
2434 {
2435 /* too short buffer */
2436 ExFreePoolWithTag(InfoBuffer, TAG_FONT);
2437 InfoSize *= 2;
2438 InfoBuffer = ExAllocatePoolWithTag(PagedPool, InfoSize, TAG_FONT);
2439 if (!InfoBuffer)
2440 {
2441 DPRINT1("ExAllocatePoolWithTag failed\n");
2442 break;
2443 }
2444 /* try again */
2445 Status = ZwEnumerateValueKey(KeyHandle, i, KeyValueFullInformation,
2446 InfoBuffer, InfoSize, &Length);
2447 }
2448 if (!NT_SUCCESS(Status))
2449 {
2450 DPRINT1("ZwEnumerateValueKey failed: 0x%08X\n", Status);
2451 break; /* failure */
2452 }
2453
2454 /* create FontTitleW string */
2455 pInfo = (PKEY_VALUE_FULL_INFORMATION)InfoBuffer;
2456 Length = pInfo->NameLength / sizeof(WCHAR);
2457 pInfo->Name[Length] = UNICODE_NULL; /* truncate */
2458 if (!RtlCreateUnicodeString(&FontTitleW, pInfo->Name))
2459 {
2461 DPRINT1("RtlCreateUnicodeString failed\n");
2462 break; /* failure */
2463 }
2464
2465 /* query value */
2466 Status = ZwQueryValueKey(KeyHandle, &FontTitleW, KeyValueFullInformation,
2467 InfoBuffer, InfoSize, &Length);
2469 {
2470 /* too short buffer */
2471 ExFreePoolWithTag(InfoBuffer, TAG_FONT);
2472 InfoSize *= 2;
2473 InfoBuffer = ExAllocatePoolWithTag(PagedPool, InfoSize, TAG_FONT);
2474 if (!InfoBuffer)
2475 {
2476 DPRINT1("ExAllocatePoolWithTag failed\n");
2477 break;
2478 }
2479 /* try again */
2480 Status = ZwQueryValueKey(KeyHandle, &FontTitleW, KeyValueFullInformation,
2481 InfoBuffer, InfoSize, &Length);
2482 }
2483 pInfo = (PKEY_VALUE_FULL_INFORMATION)InfoBuffer;
2484 if (!NT_SUCCESS(Status) || !pInfo->DataLength)
2485 {
2486 DPRINT1("ZwQueryValueKey failed: 0x%08X\n", Status);
2487 RtlFreeUnicodeString(&FontTitleW);
2488 break; /* failure */
2489 }
2490
2491 /* Build pchPath */
2492 pchPath = (LPWSTR)((PUCHAR)pInfo + pInfo->DataOffset);
2493 Length = pInfo->DataLength / sizeof(WCHAR);
2494 pchPath[Length] = UNICODE_NULL; /* truncate */
2495
2496 /* Load font(s) without writing registry */
2497 if (PathIsRelativeW(pchPath))
2498 {
2499 dwFlags = 0;
2501 L"\\SystemRoot\\Fonts\\%s", pchPath);
2502 }
2503 else
2504 {
2506 Status = RtlStringCbCopyW(szPath, sizeof(szPath), pchPath);
2507 }
2508
2509 if (NT_SUCCESS(Status))
2510 {
2511 RtlCreateUnicodeString(&FileNameW, szPath);
2512 nFontCount += IntGdiAddFontResourceEx(&FileNameW, 1, 0, dwFlags);
2513 RtlFreeUnicodeString(&FileNameW);
2514 }
2515
2516 RtlFreeUnicodeString(&FontTitleW);
2517 }
2518
2519 /* close now */
2521
2522 /* free memory block */
2523 if (InfoBuffer)
2524 {
2525 ExFreePoolWithTag(InfoBuffer, TAG_FONT);
2526 }
2527
2528 return (KeyFullInfo.Values != 0 && nFontCount != 0);
2529}
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:325
INT FASTCALL IntGdiAddFontResourceEx(_In_ PCUNICODE_STRING FileName, _In_ DWORD cFiles, _In_ DWORD Characteristics, _In_ DWORD dwFlags)
Definition: freetype.c:2197
#define OBJ_KERNEL_HANDLE
Definition: winternl.h:231
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
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 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 1499 of file freetype.c.

1500{
1502 UNICODE_STRING Directory, FileName, TempString;
1504 HANDLE hDirectory;
1505 BYTE *DirInfoBuffer;
1507 BOOLEAN bRestartScan = TRUE;
1509 INT i;
1510 static UNICODE_STRING SearchPatterns[] =
1511 {
1512 RTL_CONSTANT_STRING(L"*.ttf"),
1513 RTL_CONSTANT_STRING(L"*.ttc"),
1514 RTL_CONSTANT_STRING(L"*.otf"),
1515 RTL_CONSTANT_STRING(L"*.otc"),
1516 RTL_CONSTANT_STRING(L"*.fon"),
1517 RTL_CONSTANT_STRING(L"*.fnt")
1518 };
1519 static UNICODE_STRING IgnoreFiles[] =
1520 {
1523 };
1524
1525 RtlInitUnicodeString(&Directory, L"\\SystemRoot\\Fonts\\");
1526
1529 &Directory,
1531 NULL,
1532 NULL);
1533
1535 &hDirectory,
1538 &Iosb,
1541
1542 if (NT_SUCCESS(Status))
1543 {
1544 for (i = 0; i < _countof(SearchPatterns); ++i)
1545 {
1546 DirInfoBuffer = ExAllocatePoolWithTag(PagedPool, 0x4000, TAG_FONT);
1547 if (DirInfoBuffer == NULL)
1548 {
1549 ZwClose(hDirectory);
1550 return;
1551 }
1552
1554 if (FileName.Buffer == NULL)
1555 {
1556 ExFreePoolWithTag(DirInfoBuffer, TAG_FONT);
1557 ZwClose(hDirectory);
1558 return;
1559 }
1560 FileName.Length = 0;
1561 FileName.MaximumLength = MAX_PATH * sizeof(WCHAR);
1562
1563 while (1)
1564 {
1565 Status = ZwQueryDirectoryFile(
1566 hDirectory,
1567 NULL,
1568 NULL,
1569 NULL,
1570 &Iosb,
1571 DirInfoBuffer,
1572 0x4000,
1574 FALSE,
1575 &SearchPatterns[i],
1576 bRestartScan);
1577
1579 {
1580 break;
1581 }
1582
1583 DirInfo = (PFILE_DIRECTORY_INFORMATION)DirInfoBuffer;
1584 while (1)
1585 {
1586 SIZE_T ign;
1587
1588 TempString.Buffer = DirInfo->FileName;
1589 TempString.Length = TempString.MaximumLength = DirInfo->FileNameLength;
1590
1591 /* Should we ignore this file? */
1592 for (ign = 0; ign < _countof(IgnoreFiles); ++ign)
1593 {
1594 /* Yes.. */
1595 if (RtlEqualUnicodeString(IgnoreFiles + ign, &TempString, FALSE))
1596 break;
1597 }
1598
1599 /* If we tried all Ignore patterns and there was no match, try to create a font */
1600 if (ign == _countof(IgnoreFiles))
1601 {
1605 DPRINT1("ERR: Failed to load %wZ\n", &FileName);
1606 }
1607
1608 if (DirInfo->NextEntryOffset == 0)
1609 break;
1610
1611 DirInfo = (PFILE_DIRECTORY_INFORMATION)((ULONG_PTR)DirInfo + DirInfo->NextEntryOffset);
1612 }
1613
1614 bRestartScan = FALSE;
1615 }
1616
1618 ExFreePoolWithTag(DirInfoBuffer, TAG_FONT);
1619 }
1620 ZwClose(hDirectory);
1621 }
1622}
@ IgnoreFiles
Definition: ACListISF.cpp:75
unsigned char BOOLEAN
Definition: actypes.h:127
#define FILE_DIRECTORY_FILE
Definition: constants.h:491
#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
struct _FILE_DIRECTORY_INFORMATION * PFILE_DIRECTORY_INFORMATION
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
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14
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

Referenced by InitFontSupport().

◆ RealizeFontInit()

PTEXTOBJ FASTCALL RealizeFontInit ( HFONT  )

◆ TextIntCreateFontIndirect()

NTSTATUS FASTCALL TextIntCreateFontIndirect ( CONST LPLOGFONTW  lf,
HFONT NewFont 
)

Definition at line 2737 of file freetype.c.

2738{
2739 PLFONT plfont;
2740 LOGFONTW *plf;
2741
2742 ASSERT(lf);
2743 plfont = LFONT_AllocFontWithHandle();
2744 if (!plfont)
2745 {
2746 return STATUS_NO_MEMORY;
2747 }
2748
2749 ExInitializePushLock(&plfont->lock);
2750 *NewFont = plfont->BaseObject.hHmgr;
2751 plf = &plfont->logfont.elfEnumLogfontEx.elfLogFont;
2752 RtlCopyMemory(plf, lf, sizeof(LOGFONTW));
2753 if (lf->lfEscapement != lf->lfOrientation)
2754 {
2755 /* This should really depend on whether GM_ADVANCED is set */
2756 plf->lfOrientation = plf->lfEscapement;
2757 }
2758 LFONT_UnlockFont(plfont);
2759
2760 return STATUS_SUCCESS;
2761}
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 6065 of file freetype.c.

6066{
6067 PTEXTOBJ TextObj;
6068 PSHARED_FACE SharedFace;
6069
6070 if (!pTextObj)
6071 {
6072 TextObj = TEXTOBJ_LockText(FontHandle);
6073 if (NULL == TextObj)
6074 {
6075 return STATUS_INVALID_HANDLE;
6076 }
6077
6078 if (TextObj->fl & TEXTOBJECT_INIT)
6079 {
6080 TEXTOBJ_UnlockText(TextObj);
6081 return STATUS_SUCCESS;
6082 }
6083 }
6084 else
6085 {
6086 TextObj = pTextObj;
6087 }
6088
6090 SharedFace = IntRealizeFont(&TextObj->logfont.elfEnumLogfontEx.elfLogFont, TextObj);
6092
6093 if (!pTextObj)
6094 TEXTOBJ_UnlockText(TextObj);
6095
6096 ASSERT((!!SharedFace ^ (NULL == TextObj->Font)) != 0);
6097
6098 return SharedFace ? STATUS_SUCCESS : STATUS_NOT_FOUND;
6099}
PSHARED_FACE IntRealizeFont(const LOGFONTW *pLogFont, _Inout_opt_ PTEXTOBJ TextObj)
Definition: freetype.c:6007
#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 4223 of file freetype.c.

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

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()