ReactOS 0.4.16-dev-197-g92996da
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 IntGdiAddFontResource (PUNICODE_STRING FileName, DWORD Characteristics)
 
INT FASTCALL IntGdiAddFontResourceEx (PUNICODE_STRING FileName, DWORD Characteristics, 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, LPMAT2, 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, LPCWSTR, INT, ULONG, LPINT, LPINT, LPSIZE, 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 NTAPI GreExtTextOutW (IN HDC, IN INT, IN INT, IN UINT, IN OPTIONAL RECTL *, IN LPCWSTR, IN INT, IN OPTIONAL LPINT, IN DWORD)
 
DWORD FASTCALL IntGetCharDimensions (HDC, PTEXTMETRICW, PDWORD)
 
BOOL FASTCALL GreGetTextExtentW (HDC, LPCWSTR, INT, LPSIZE, UINT)
 
BOOL FASTCALL GreGetTextExtentExW (HDC, LPCWSTR, ULONG, ULONG, PULONG, PULONG, LPSIZE, FLONG)
 
BOOL FASTCALL GreTextOutW (HDC, int, int, LPCWSTR, int)
 
HFONT FASTCALL GreCreateFontIndirectW (LOGFONTW *)
 
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 148 of file text.h.

◆ IntUnLockProcessPrivateFonts

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

Definition at line 151 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 
)

Definition at line 293 of file font.c.

294{
295 ULONG cjMaxSize;
296 ENUMLOGFONTEXDVW *plf;
297
298 ASSERT(plfont);
299 plf = &plfont->logfont;
300
301 if (!(plfont->fl & TEXTOBJECT_INIT))
302 {
304 DPRINT("FontGetObject font not initialized!\n");
305
306 Status = TextIntRealizeFont(plfont->BaseObject.hHmgr, plfont);
307 if (!NT_SUCCESS(Status))
308 {
309 DPRINT1("FontGetObject(TextIntRealizeFont) Status = 0x%lx\n", Status);
310 }
311 }
312
313 /* If buffer is NULL, only the size is requested */
314 if (pvBuffer == NULL) return sizeof(LOGFONTW);
315
316 /* Calculate the maximum size according to number of axes */
317 cjMaxSize = FIELD_OFFSET(ENUMLOGFONTEXDVW,
318 elfDesignVector.dvValues[plf->elfDesignVector.dvNumAxes]);
319
320 if (cjBuffer > cjMaxSize) cjBuffer = cjMaxSize;
321
322 RtlCopyMemory(pvBuffer, plf, cjBuffer);
323
324 return cjBuffer;
325}
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
#define NULL
Definition: types.h:112
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
NTSTATUS FASTCALL TextIntRealizeFont(HFONT FontHandle, PTEXTOBJ pTextObj)
Definition: freetype.c:5906
Status
Definition: gdiplustypes.h:25
#define ASSERT(a)
Definition: mode.c:44
_In_ ULONG cjBuffer
Definition: ntgdi.h:2860
#define DPRINT
Definition: sndvol32.h:73
DWORD dvNumAxes
Definition: wingdi.h:2769
DESIGNVECTOR elfDesignVector
Definition: wingdi.h:2780
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
uint32_t ULONG
Definition: typedefs.h:59
#define TEXTOBJECT_INIT
Definition: text.h:56

Referenced by GreGetObject().

◆ FreeFontSupport()

VOID FASTCALL FreeFontSupport ( VOID  )

Definition at line 1062 of file freetype.c.

1063{
1064 PLIST_ENTRY pHead, pEntry;
1065 PFONT_CACHE_ENTRY pFontCache;
1066 PFONTSUBST_ENTRY pSubstEntry;
1067 PFONT_ENTRY pFontEntry;
1068
1069 // Cleanup the FontLink cache
1071
1072 // Free font cache list
1073 pHead = &g_FontCacheListHead;
1074 while (!IsListEmpty(pHead))
1075 {
1076 pEntry = RemoveHeadList(pHead);
1077 pFontCache = CONTAINING_RECORD(pEntry, FONT_CACHE_ENTRY, ListEntry);
1078 RemoveCachedEntry(pFontCache);
1079 }
1080
1081 // Free font subst list
1082 pHead = &g_FontSubstListHead;
1083 while (!IsListEmpty(pHead))
1084 {
1085 pEntry = RemoveHeadList(pHead);
1086 pSubstEntry = CONTAINING_RECORD(pEntry, FONTSUBST_ENTRY, ListEntry);
1087 ExFreePoolWithTag(pSubstEntry, TAG_FONT);
1088 }
1089
1090 // Free font list
1091 pHead = &g_FontListHead;
1092 while (!IsListEmpty(pHead))
1093 {
1094 pEntry = RemoveHeadList(pHead);
1095 pFontEntry = CONTAINING_RECORD(pEntry, FONT_ENTRY, ListEntry);
1096 CleanupFontEntry(pFontEntry);
1097 }
1098
1100 {
1103 }
1104
1107}
#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:368
FT_Library g_FreeTypeLibrary
Definition: freetype.c:359
static VOID FontLink_CleanupCache(VOID)
Definition: freetype.c:311
static __inline VOID FASTCALL CleanupFontEntry(PFONT_ENTRY FontEntry)
Definition: freetype.c:721
static void RemoveCachedEntry(PFONT_CACHE_ENTRY Entry)
Definition: freetype.c:616
FT_Done_Library(FT_Library library)
Definition: ftobjs.c:5220
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 5364 of file freetype.c.

5370{
5372 FT_Face Face = FontGdi->SharedFace->Face;
5373
5375
5376 if (FT_IS_SFNT(Face))
5377 {
5378 if (Table)
5379 Table = Table >> 24 | Table << 24 | (Table >> 8 & 0xFF00) |
5380 (Table << 8 & 0xFF0000);
5381
5382 if (!Buffer) Size = 0;
5383
5384 if (Buffer && Size)
5385 {
5387 FT_ULong Needed = 0;
5388
5389 Error = FT_Load_Sfnt_Table(Face, Table, Offset, NULL, &Needed);
5390
5391 if ( !Error && Needed < Size) Size = Needed;
5392 }
5393 if (!FT_Load_Sfnt_Table(Face, Table, Offset, Buffer, &Size))
5394 Result = Size;
5395 }
5396
5398
5399 return Result;
5400}
BOOL Error
Definition: chkdsk.c:66
Definition: bufpool.h:45
unsigned long DWORD
Definition: ntddk_ex.h:95
#define IntUnLockFreeType()
Definition: freetype.c:385
#define IntLockFreeType()
Definition: freetype.c:379
#define FT_IS_SFNT(face)
Definition: freetype.h:1331
unsigned long FT_ULong
Definition: fttypes.h:253
int FT_Error
Definition: fttypes.h:300
ASMGENDATA Table[]
Definition: genincdata.c:61
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
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:4134
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533
#define GDI_ERROR
Definition: wingdi.h:1309
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:409

Referenced by NtGdiGetFontData().

◆ ftGdiGetGlyphOutline()

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

Definition at line 4436 of file freetype.c.

4445{
4446 PDC_ATTR pdcattr;
4447 PTEXTOBJ TextObj;
4448 PFONTGDI FontGDI;
4449 HFONT hFont = 0;
4450 GLYPHMETRICS gm;
4451 ULONG Size;
4452 FT_Face ft_face;
4453 FT_UInt glyph_index;
4454 DWORD width, height, pitch, needed = 0;
4455 FT_Bitmap ft_bitmap;
4457 INT left, right, top = 0, bottom = 0;
4459 FLOATOBJ eM11, widthRatio, eTemp;
4460 FT_Matrix mat, transMat = identityMat;
4461 BOOL needsTransform = FALSE;
4462 INT orientation;
4463 LONG aveWidth;
4464 INT adv, lsb, bbx; /* These three hold to widths of the unrotated chars */
4465 OUTLINETEXTMETRICW *potm;
4466 XFORMOBJ xo;
4467 XFORML xform;
4468 LOGFONTW *plf;
4469
4470 DPRINT("%u, %08x, %p, %08lx, %p, %p\n", wch, iFormat, pgm,
4471 cjBuf, pvBuf, pmat2);
4472
4473 pdcattr = dc->pdcattr;
4474
4475 XFORMOBJ_vInit(&xo, &dc->pdcattr->mxWorldToDevice);
4476 XFORMOBJ_iGetXform(&xo, &xform);
4477 FLOATOBJ_SetFloat(&eM11, xform.eM11);
4478
4479 hFont = pdcattr->hlfntNew;
4480 TextObj = RealizeFontInit(hFont);
4481
4482 if (!TextObj)
4483 {
4485 return GDI_ERROR;
4486 }
4487 FontGDI = ObjToGDI(TextObj->Font, FONT);
4488 ft_face = FontGDI->SharedFace->Face;
4489
4490 plf = &TextObj->logfont.elfEnumLogfontEx.elfLogFont;
4491 aveWidth = FT_IS_SCALABLE(ft_face) ? abs(plf->lfWidth) : 0;
4492 orientation = FT_IS_SCALABLE(ft_face) ? plf->lfOrientation : 0;
4493
4495 Size = IntGetOutlineTextMetrics(FontGDI, 0, NULL, FALSE);
4497 if (!potm)
4498 {
4500 TEXTOBJ_UnlockText(TextObj);
4501 return GDI_ERROR;
4502 }
4504 Size = IntGetOutlineTextMetrics(FontGDI, Size, potm, FALSE);
4505 if (!Size)
4506 {
4507 /* FIXME: last error? */
4509 TEXTOBJ_UnlockText(TextObj);
4510 return GDI_ERROR;
4511 }
4512
4514 TextIntUpdateSize(dc, TextObj, FontGDI, FALSE);
4516 FT_Set_Transform(ft_face, &mat, NULL);
4517
4518 TEXTOBJ_UnlockText(TextObj);
4519
4520 glyph_index = get_glyph_index_flagged(ft_face, wch, (iFormat & GGO_GLYPH_INDEX));
4521 iFormat &= ~GGO_GLYPH_INDEX;
4522
4523 if (orientation || (iFormat != GGO_METRICS && iFormat != GGO_BITMAP) || aveWidth || pmat2)
4524 load_flags |= FT_LOAD_NO_BITMAP;
4525
4526 if (iFormat & GGO_UNHINTED)
4527 {
4528 load_flags |= FT_LOAD_NO_HINTING;
4529 iFormat &= ~GGO_UNHINTED;
4530 }
4531
4532 error = FT_Load_Glyph(ft_face, glyph_index, load_flags);
4533 if (error)
4534 {
4535 DPRINT1("WARNING: Failed to load and render glyph! [index: %u]\n", glyph_index);
4537 if (potm) ExFreePoolWithTag(potm, GDITAG_TEXT);
4538 return GDI_ERROR;
4539 }
4541
4542 FLOATOBJ_Set1(&widthRatio);
4543 if (aveWidth && potm)
4544 {
4545 // widthRatio = aveWidth * eM11 / potm->otmTextMetrics.tmAveCharWidth
4546 FLOATOBJ_SetLong(&widthRatio, aveWidth);
4547 FLOATOBJ_Mul(&widthRatio, &eM11);
4549 }
4550
4551 //left = (INT)(ft_face->glyph->metrics.horiBearingX * widthRatio) & -64;
4552 FLOATOBJ_SetLong(&eTemp, ft_face->glyph->metrics.horiBearingX);
4553 FLOATOBJ_Mul(&eTemp, &widthRatio);
4554 left = FLOATOBJ_GetLong(&eTemp) & -64;
4555
4556 //right = (INT)((ft_face->glyph->metrics.horiBearingX +
4557 // ft_face->glyph->metrics.width) * widthRatio + 63) & -64;
4558 FLOATOBJ_SetLong(&eTemp, ft_face->glyph->metrics.horiBearingX * ft_face->glyph->metrics.width);
4559 FLOATOBJ_Mul(&eTemp, &widthRatio);
4560 FLOATOBJ_AddLong(&eTemp, 63);
4561 right = FLOATOBJ_GetLong(&eTemp) & -64;
4562
4563 //adv = (INT)((ft_face->glyph->metrics.horiAdvance * widthRatio) + 63) >> 6;
4564 FLOATOBJ_SetLong(&eTemp, ft_face->glyph->metrics.horiAdvance);
4565 FLOATOBJ_Mul(&eTemp, &widthRatio);
4566 FLOATOBJ_AddLong(&eTemp, 63);
4567 adv = FLOATOBJ_GetLong(&eTemp) >> 6;
4568
4569 lsb = left >> 6;
4570 bbx = (right - left) >> 6;
4571
4572 DPRINT("Advance = %d, lsb = %d, bbx = %d\n",adv, lsb, bbx);
4573
4575
4576 /* Width scaling transform */
4577 if (!FLOATOBJ_Equal1(&widthRatio))
4578 {
4579 FT_Matrix scaleMat;
4580
4581 eTemp = widthRatio;
4582 FLOATOBJ_MulLong(&eTemp, 1 << 16);
4583
4584 scaleMat.xx = FLOATOBJ_GetLong(&eTemp);
4585 scaleMat.xy = 0;
4586 scaleMat.yx = 0;
4587 scaleMat.yy = INT_TO_FIXED(1);
4588 FT_Matrix_Multiply(&scaleMat, &transMat);
4589 needsTransform = TRUE;
4590 }
4591
4592 /* World transform */
4593 {
4594 FT_Matrix ftmatrix;
4596
4597 /* Create a freetype matrix, by converting to 16.16 fixpoint format */
4598 IntMatrixFromMx(&ftmatrix, pmx);
4599
4600 if (memcmp(&ftmatrix, &identityMat, sizeof(identityMat)) != 0)
4601 {
4602 FT_Matrix_Multiply(&ftmatrix, &transMat);
4603 needsTransform = TRUE;
4604 }
4605 }
4606
4607 /* Rotation transform */
4608 if (orientation)
4609 {
4610 FT_Matrix rotationMat;
4611 DPRINT("Rotation Trans!\n");
4612 IntEscapeMatrix(&rotationMat, orientation);
4613 FT_Matrix_Multiply(&rotationMat, &transMat);
4614 needsTransform = TRUE;
4615 }
4616
4617 /* Extra transformation specified by caller */
4618 if (pmat2)
4619 {
4620 FT_Matrix extraMat;
4621 DPRINT("MAT2 Matrix Trans!\n");
4622 extraMat.xx = FT_FixedFromFIXED(pmat2->eM11);
4623 extraMat.xy = FT_FixedFromFIXED(pmat2->eM21);
4624 extraMat.yx = FT_FixedFromFIXED(pmat2->eM12);
4625 extraMat.yy = FT_FixedFromFIXED(pmat2->eM22);
4626 FT_Matrix_Multiply(&extraMat, &transMat);
4627 needsTransform = TRUE;
4628 }
4629
4630 if (potm) ExFreePoolWithTag(potm, GDITAG_TEXT); /* It looks like we are finished with potm ATM. */
4631
4632 if (!needsTransform)
4633 {
4634 DPRINT("No Need to be Transformed!\n");
4635 top = (ft_face->glyph->metrics.horiBearingY + 63) & -64;
4636 bottom = (ft_face->glyph->metrics.horiBearingY -
4637 ft_face->glyph->metrics.height) & -64;
4638 gm.gmCellIncX = adv;
4639 gm.gmCellIncY = 0;
4640 }
4641 else
4642 {
4643 INT xc, yc;
4644 FT_Vector vec;
4645 for (xc = 0; xc < 2; xc++)
4646 {
4647 for (yc = 0; yc < 2; yc++)
4648 {
4649 vec.x = (ft_face->glyph->metrics.horiBearingX +
4650 xc * ft_face->glyph->metrics.width);
4651 vec.y = ft_face->glyph->metrics.horiBearingY -
4652 yc * ft_face->glyph->metrics.height;
4653 DPRINT("Vec %ld,%ld\n", vec.x, vec.y);
4654 FT_Vector_Transform(&vec, &transMat);
4655 if (xc == 0 && yc == 0)
4656 {
4657 left = right = vec.x;
4658 top = bottom = vec.y;
4659 }
4660 else
4661 {
4662 if (vec.x < left) left = vec.x;
4663 else if (vec.x > right) right = vec.x;
4664 if (vec.y < bottom) bottom = vec.y;
4665 else if (vec.y > top) top = vec.y;
4666 }
4667 }
4668 }
4669 left = left & -64;
4670 right = (right + 63) & -64;
4671 bottom = bottom & -64;
4672 top = (top + 63) & -64;
4673
4674 DPRINT("Transformed box: (%d,%d - %d,%d)\n", left, top, right, bottom);
4675 vec.x = ft_face->glyph->metrics.horiAdvance;
4676 vec.y = 0;
4677 FT_Vector_Transform(&vec, &transMat);
4678 gm.gmCellIncX = (vec.x+63) >> 6;
4679 gm.gmCellIncY = -((vec.y+63) >> 6);
4680 }
4681 gm.gmBlackBoxX = (right - left) >> 6;
4682 gm.gmBlackBoxY = (top - bottom) >> 6;
4683 gm.gmptGlyphOrigin.x = left >> 6;
4684 gm.gmptGlyphOrigin.y = top >> 6;
4685
4686 DPRINT("CX %d CY %d BBX %u BBY %u GOX %d GOY %d\n",
4687 gm.gmCellIncX, gm.gmCellIncY,
4688 gm.gmBlackBoxX, gm.gmBlackBoxY,
4690
4692
4693 if (iFormat == GGO_METRICS)
4694 {
4695 DPRINT("GGO_METRICS Exit!\n");
4696 *pgm = gm;
4697 return 1; /* FIXME */
4698 }
4699
4700 if (ft_face->glyph->format != ft_glyph_format_outline && iFormat != GGO_BITMAP)
4701 {
4702 DPRINT1("Loaded a bitmap\n");
4703 return GDI_ERROR;
4704 }
4705
4706 switch (iFormat)
4707 {
4708 case GGO_BITMAP:
4709 {
4710 width = gm.gmBlackBoxX;
4711 height = gm.gmBlackBoxY;
4712 pitch = ((width + 31) >> 5) << 2;
4713 needed = pitch * height;
4714
4715 if (!pvBuf || !cjBuf) break;
4716 if (!needed) return GDI_ERROR; /* empty glyph */
4717 if (needed > cjBuf)
4718 return GDI_ERROR;
4719
4720 switch (ft_face->glyph->format)
4721 {
4723 {
4724 BYTE *src = ft_face->glyph->bitmap.buffer, *dst = pvBuf;
4725 INT w = min( pitch, (ft_face->glyph->bitmap.width + 7) >> 3 );
4726 INT h = min( height, ft_face->glyph->bitmap.rows );
4727 while (h--)
4728 {
4730 src += ft_face->glyph->bitmap.pitch;
4731 dst += pitch;
4732 }
4733 break;
4734 }
4735
4737 {
4738 ft_bitmap.width = width;
4739 ft_bitmap.rows = height;
4740 ft_bitmap.pitch = pitch;
4741 ft_bitmap.pixel_mode = FT_PIXEL_MODE_MONO;
4742 ft_bitmap.buffer = pvBuf;
4743
4745 if (needsTransform)
4746 {
4747 FT_Outline_Transform(&ft_face->glyph->outline, &transMat);
4748 }
4749 FT_Outline_Translate(&ft_face->glyph->outline, -left, -bottom );
4750 /* Note: FreeType will only set 'black' bits for us. */
4751 RtlZeroMemory(pvBuf, needed);
4752 FT_Outline_Get_Bitmap(g_FreeTypeLibrary, &ft_face->glyph->outline, &ft_bitmap);
4754 break;
4755 }
4756
4757 default:
4758 DPRINT1("Loaded glyph format %x\n", ft_face->glyph->format);
4759 return GDI_ERROR;
4760 }
4761
4762 break;
4763 }
4764
4765 case GGO_GRAY2_BITMAP:
4766 case GGO_GRAY4_BITMAP:
4767 case GGO_GRAY8_BITMAP:
4768 {
4769 unsigned int mult, row, col;
4770 BYTE *start, *ptr;
4771
4772 width = gm.gmBlackBoxX;
4773 height = gm.gmBlackBoxY;
4774 pitch = (width + 3) / 4 * 4;
4775 needed = pitch * height;
4776
4777 if (!pvBuf || !cjBuf) break;
4778 if (!needed) return GDI_ERROR; /* empty glyph */
4779 if (needed > cjBuf)
4780 return GDI_ERROR;
4781
4782 switch (ft_face->glyph->format)
4783 {
4785 {
4786 BYTE *src = ft_face->glyph->bitmap.buffer, *dst = pvBuf;
4787 INT h = min( height, ft_face->glyph->bitmap.rows );
4788 INT x;
4789 while (h--)
4790 {
4791 for (x = 0; (UINT)x < pitch; x++)
4792 {
4793 if (x < ft_face->glyph->bitmap.width)
4794 dst[x] = (src[x / 8] & (1 << ( (7 - (x % 8))))) ? 0xff : 0;
4795 else
4796 dst[x] = 0;
4797 }
4798 src += ft_face->glyph->bitmap.pitch;
4799 dst += pitch;
4800 }
4801 break;
4802 }
4804 {
4805 ft_bitmap.width = width;
4806 ft_bitmap.rows = height;
4807 ft_bitmap.pitch = pitch;
4808 ft_bitmap.pixel_mode = FT_PIXEL_MODE_GRAY;
4809 ft_bitmap.buffer = pvBuf;
4810
4812 if (needsTransform)
4813 {
4814 FT_Outline_Transform(&ft_face->glyph->outline, &transMat);
4815 }
4816 FT_Outline_Translate(&ft_face->glyph->outline, -left, -bottom );
4817 RtlZeroMemory(ft_bitmap.buffer, cjBuf);
4818 FT_Outline_Get_Bitmap(g_FreeTypeLibrary, &ft_face->glyph->outline, &ft_bitmap);
4820
4822 mult = 4;
4823 else if (iFormat == GGO_GRAY4_BITMAP)
4824 mult = 16;
4825 else if (iFormat == GGO_GRAY8_BITMAP)
4826 mult = 64;
4827 else
4828 {
4829 return GDI_ERROR;
4830 }
4831
4832 start = pvBuf;
4833 for (row = 0; row < height; row++)
4834 {
4835 ptr = start;
4836 for (col = 0; col < width; col++, ptr++)
4837 {
4838 *ptr = (((int)*ptr) * mult + 128) / 256;
4839 }
4840 start += pitch;
4841 }
4842
4843 break;
4844 }
4845 default:
4846 DPRINT1("Loaded glyph format %x\n", ft_face->glyph->format);
4847 return GDI_ERROR;
4848 }
4849
4850 break;
4851 }
4852
4853 case GGO_NATIVE:
4854 {
4855 FT_Outline *outline = &ft_face->glyph->outline;
4856
4857 if (cjBuf == 0) pvBuf = NULL; /* This is okay, need cjBuf to allocate. */
4858
4860 if (needsTransform && pvBuf) FT_Outline_Transform(outline, &transMat);
4861
4863
4864 if (!pvBuf || !cjBuf)
4865 {
4867 break;
4868 }
4869 if (needed > cjBuf)
4870 {
4872 return GDI_ERROR;
4873 }
4876 break;
4877 }
4878
4879 case GGO_BEZIER:
4880 {
4881 FT_Outline *outline = &ft_face->glyph->outline;
4882 if (cjBuf == 0) pvBuf = NULL;
4883
4884 if (needsTransform && pvBuf)
4885 {
4887 FT_Outline_Transform(outline, &transMat);
4889 }
4891
4892 if (!pvBuf || !cjBuf)
4893 break;
4894 if (needed > cjBuf)
4895 return GDI_ERROR;
4896
4898 break;
4899 }
4900
4901 default:
4902 DPRINT1("Unsupported format %u\n", iFormat);
4903 return GDI_ERROR;
4904 }
4905
4906 DPRINT("ftGdiGetGlyphOutline END and needed %lu\n", needed);
4907
4908 if (gm.gmBlackBoxX == 0)
4909 gm.gmBlackBoxX = 1;
4910 if (gm.gmBlackBoxY == 0)
4911 gm.gmBlackBoxY = 1;
4912
4913 *pgm = gm;
4914 return needed;
4915}
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
HFONT hFont
Definition: main.c:53
FORCEINLINE PMATRIX DC_pmxWorldToDevice(PDC pdc)
Definition: coord.h:135
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
struct png_info_def *typedef unsigned char **typedef struct png_info_def *typedef struct png_info_def *typedef struct png_info_def *typedef unsigned char ** row
Definition: typeof.h:78
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
#define ObjToGDI(ClipObj, Type)
Definition: engobjects.h:184
#define 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:4227
static FT_UInt FASTCALL get_glyph_index_flagged(FT_Face face, FT_ULong code, BOOL fCodeAsIndex)
Definition: freetype.c:4345
#define ASSERT_FREETYPE_LOCK_NOT_HELD()
Definition: freetype.c:376
static unsigned int get_bezier_glyph_outline(FT_Outline *outline, unsigned int buflen, char *buf)
Definition: freetype.c:3962
static unsigned int get_native_glyph_outline(FT_Outline *outline, unsigned int buflen, char *buf)
Definition: freetype.c:3889
static VOID FASTCALL IntMatrixFromMx(FT_Matrix *pmat, const MATRIX *pmx)
Definition: freetype.c:1130
static VOID FASTCALL IntEscapeMatrix(FT_Matrix *pmat, LONG lfEscapement)
Definition: freetype.c:1117
static const FT_Matrix identityMat
Definition: freetype.c:353
static __inline FT_Fixed FT_FixedFromFIXED(FIXED f)
Definition: freetype.c:741
INT FASTCALL IntGetOutlineTextMetrics(PFONTGDI FontGDI, UINT Size, OUTLINETEXTMETRICW *Otm, BOOL bLocked)
Definition: freetype.c:3075
FT_Load_Glyph(FT_Face face, FT_UInt glyph_index, FT_Int32 load_flags)
Definition: ftobjs.c:760
#define FT_LOAD_NO_BITMAP
Definition: freetype.h:3012
FT_Set_Transform(FT_Face face, FT_Matrix *matrix, FT_Vector *delta)
Definition: ftobjs.c:653
FT_Vector_Transform(FT_Vector *vec, const FT_Matrix *matrix)
Definition: ftoutln.c:688
#define FT_LOAD_NO_HINTING
Definition: freetype.h:3010
#define FT_IS_SCALABLE(face)
Definition: freetype.h:1312
#define FT_LOAD_DEFAULT
Definition: freetype.h:3008
#define FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH
Definition: freetype.h:3017
FT_Vector * vec
Definition: ftbbox.c:448
#define INT_TO_FIXED(x)
Definition: ftcalc.h:404
FT_Matrix_Multiply(const FT_Matrix *a, FT_Matrix *b)
Definition: ftcalc.c:661
#define ft_glyph_format_bitmap
Definition: ftimage.h:731
@ FT_PIXEL_MODE_MONO
Definition: ftimage.h:183
@ FT_PIXEL_MODE_GRAY
Definition: ftimage.h:184
#define ft_glyph_format_outline
Definition: ftimage.h:732
FT_Outline_Translate(const FT_Outline *outline, FT_Pos xOffset, FT_Pos yOffset)
Definition: ftoutln.c:528
FT_Outline_Get_Bitmap(FT_Library library, FT_Outline *outline, const FT_Bitmap *abitmap)
Definition: ftoutln.c:661
FT_Outline_Transform(const FT_Outline *outline, const FT_Matrix *matrix)
Definition: ftoutln.c:711
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
static const WCHAR dc[]
#define error(str)
Definition: mkdosfs.c:1605
static PVOID ptr
Definition: dispmode.c:27
static const MAT2 mat
Definition: font.c:66
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
#define min(a, b)
Definition: monoChain.cc:55
unsigned int UINT
Definition: ndis.h:50
long LONG
Definition: pedump.c:60
unsigned int width
Definition: ftimage.h:264
unsigned char * buffer
Definition: ftimage.h:266
unsigned char pixel_mode
Definition: ftimage.h:268
unsigned int rows
Definition: ftimage.h:263
int pitch
Definition: ftimage.h:265
FT_GlyphSlot glyph
Definition: freetype.h:1105
FT_Bitmap bitmap
Definition: freetype.h:1923
FT_Outline outline
Definition: freetype.h:1927
FT_Glyph_Metrics metrics
Definition: freetype.h:1916
FT_Glyph_Format format
Definition: freetype.h:1921
FT_Fixed xx
Definition: fttypes.h:387
FT_Fixed yx
Definition: fttypes.h:388
FT_Fixed yy
Definition: fttypes.h:388
FT_Fixed xy
Definition: fttypes.h:387
FT_Pos x
Definition: ftimage.h:76
FT_Pos y
Definition: ftimage.h:77
LONG lfOrientation
Definition: dimm.idl:62
LONG lfWidth
Definition: dimm.idl:60
HANDLE hlfntNew
Definition: ntgdihdl.h:330
short gmCellIncX
Definition: wingdi.h:2445
UINT gmBlackBoxY
Definition: wingdi.h:2443
UINT gmBlackBoxX
Definition: wingdi.h:2442
short gmCellIncY
Definition: wingdi.h:2446
POINT gmptGlyphOrigin
Definition: wingdi.h:2444
Definition: text.h:60
ENUMLOGFONTEXDVW logfont
Definition: text.h:70
FONTOBJ * Font
Definition: text.h:66
FIXED eM22
Definition: wingdi.h:2476
FIXED eM21
Definition: wingdi.h:2475
FIXED eM11
Definition: wingdi.h:2473
FIXED eM12
Definition: wingdi.h:2474
TEXTMETRICW otmTextMetrics
Definition: wingdi.h:2514
FLOATL eM11
Definition: winddi.h:1234
Definition: mesh.c:5330
ENUMLOGFONTEXW elfEnumLogfontEx
Definition: wingdi.h:2779
LOGFONTW elfLogFont
Definition: wingdi.h:2702
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
LONG tmAveCharWidth
Definition: wingdi.h:2388
int32_t INT
Definition: typedefs.h:58
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
PTEXTOBJ FASTCALL RealizeFontInit(HFONT hFont)
Definition: font.c:422
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 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 6382 of file freetype.c.

6385{
6386 DWORD Count = 0;
6387 INT i = 0;
6388 FT_Face face = Font->SharedFace->Face;
6389
6390 if (FT_HAS_KERNING(face) && face->charmap->encoding == FT_ENCODING_UNICODE)
6391 {
6392 FT_UInt previous_index = 0, glyph_index = 0;
6393 FT_ULong char_code, char_previous;
6394 FT_Vector delta;
6395
6396 char_previous = char_code = FT_Get_First_Char(face, &glyph_index);
6397
6399
6400 while (glyph_index)
6401 {
6402 if (previous_index && glyph_index)
6403 {
6404 FT_Get_Kerning(face, previous_index, glyph_index, FT_KERNING_DEFAULT, &delta);
6405
6406 if (pKerningPair && cPairs)
6407 {
6408 pKerningPair[i].wFirst = char_previous;
6409 pKerningPair[i].wSecond = char_code;
6410 pKerningPair[i].iKernAmount = delta.x;
6411 i++;
6412 if (i == cPairs) break;
6413 }
6414 Count++;
6415 }
6416 previous_index = glyph_index;
6417 char_previous = char_code;
6418 char_code = FT_Get_Next_Char(face, char_code, &glyph_index);
6419 }
6421 }
6422 return Count;
6423}
FT_Get_First_Char(FT_Face face, FT_UInt *agindex)
Definition: ftobjs.c:3697
FT_Get_Next_Char(FT_Face face, FT_ULong char_code, FT_UInt *agindex)
Definition: ftobjs.c:3722
FT_Get_Kerning(FT_Face face, FT_UInt left_glyph, FT_UInt right_glyph, FT_UInt kern_mode, FT_Vector *akerning)
Definition: ftobjs.c:3347
@ FT_KERNING_DEFAULT
Definition: freetype.h:3389
#define FT_HAS_KERNING(face)
Definition: freetype.h:1297
GLenum GLuint GLint GLenum face
Definition: glext.h:7025
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:2465
int iKernAmount
Definition: wingdi.h:2466

Referenced by GreGetKerningPairs(), and NtGdiGetKerningPairs().

◆ ftGdiGetRasterizerCaps()

BOOL FASTCALL ftGdiGetRasterizerCaps ( LPRASTERIZER_STATUS  lprs)

Definition at line 3759 of file freetype.c.

3760{
3761 if ( lprs )
3762 {
3763 lprs->nSize = sizeof(RASTERIZER_STATUS);
3764 lprs->wFlags = TT_AVAILABLE | TT_ENABLED;
3765 lprs->nLanguageID = gusLanguageID;
3766 return TRUE;
3767 }
3769 return FALSE;
3770}
#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 5080 of file freetype.c.

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

5270{
5271 PDC dc;
5272 PDC_ATTR pdcattr;
5273 PTEXTOBJ TextObj;
5274 PFONTGDI FontGDI;
5275 FT_Face Face;
5276 TT_OS2 *pOS2;
5277 TT_HoriHeader *pHori;
5279 ULONG Error;
5281 LOGFONTW *plf;
5282
5283 if (!ptmwi)
5284 {
5286 return FALSE;
5287 }
5288 RtlZeroMemory(ptmwi, sizeof(TMW_INTERNAL));
5289
5290 if (!(dc = DC_LockDc(hDC)))
5291 {
5293 return FALSE;
5294 }
5295 pdcattr = dc->pdcattr;
5296 TextObj = RealizeFontInit(pdcattr->hlfntNew);
5297 if (NULL != TextObj)
5298 {
5299 plf = &TextObj->logfont.elfEnumLogfontEx.elfLogFont;
5300 FontGDI = ObjToGDI(TextObj->Font, FONT);
5301
5302 Face = FontGDI->SharedFace->Face;
5303
5304 // NOTE: GetTextMetrics simply ignores lfEscapement and XFORM.
5306 Error = IntRequestFontSize(dc, FontGDI, plf->lfWidth, plf->lfHeight);
5307 FT_Set_Transform(Face, NULL, NULL);
5308
5310
5311 if (0 != Error)
5312 {
5313 DPRINT1("Error in setting pixel sizes: %u\n", Error);
5315 }
5316 else
5317 {
5319
5321 pOS2 = FT_Get_Sfnt_Table(Face, ft_sfnt_os2);
5322 if (NULL == pOS2)
5323 {
5324 DPRINT1("Can't find OS/2 table - not TT font?\n");
5326 }
5327
5328 pHori = FT_Get_Sfnt_Table(Face, ft_sfnt_hhea);
5329 if (NULL == pHori)
5330 {
5331 DPRINT1("Can't find HHEA table - not TT font?\n");
5333 }
5334
5335 Error = FT_Get_WinFNT_Header(Face, &Win);
5336
5337 if (NT_SUCCESS(Status) || !Error)
5338 {
5339 FillTM(&ptmwi->TextMetric, FontGDI, pOS2, pHori, !Error ? &Win : 0);
5340
5341 /* FIXME: Fill Diff member */
5342 }
5343
5345 }
5346 TEXTOBJ_UnlockText(TextObj);
5347 }
5348 else
5349 {
5351 }
5352 DC_UnlockDc(dc);
5353
5354 if (!NT_SUCCESS(Status))
5355 {
5357 return FALSE;
5358 }
5359 return TRUE;
5360}
static HDC hDC
Definition: 3dtext.c:33
#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
static FT_Error IntRequestFontSize(PDC dc, PFONTGDI FontGDI, LONG lfWidth, LONG lfHeight)
Definition: freetype.c:4087
static void FASTCALL FillTM(TEXTMETRICW *TM, PFONTGDI FontGDI, TT_OS2 *pOS2, TT_HoriHeader *pHori, FT_WinFNT_HeaderRec *pFNT)
Definition: freetype.c:2773
FT_Get_WinFNT_Header(FT_Face face, FT_WinFNT_HeaderRec *aheader)
Definition: ftwinfnt.c:29
#define STATUS_INTERNAL_ERROR
Definition: ntstatus.h:465
#define STATUS_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:632
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
VOID FASTCALL SetLastNtError(_In_ NTSTATUS Status)
Definition: error.c:31

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

◆ ftGdiRealizationInfo()

BOOL FASTCALL ftGdiRealizationInfo ( PFONTGDI  Font,
PREALIZATION_INFO  Info 
)

Definition at line 6363 of file freetype.c.

6364{
6365 if (FT_HAS_FIXED_SIZES(Font->SharedFace->Face))
6366 Info->iTechnology = RI_TECH_BITMAP;
6367 else
6368 {
6369 if (FT_IS_SCALABLE(Font->SharedFace->Face))
6370 Info->iTechnology = RI_TECH_SCALABLE;
6371 else
6372 Info->iTechnology = RI_TECH_FIXED;
6373 }
6374 Info->iUniq = Font->FontObj.iUniq;
6375 Info->dwUnknown = -1;
6376 return TRUE;
6377}
#define FT_HAS_FIXED_SIZES(face)
Definition: freetype.h:1361
#define RI_TECH_SCALABLE
Definition: ntgdityp.h:273
#define RI_TECH_FIXED
Definition: ntgdityp.h:272
#define RI_TECH_BITMAP
Definition: ntgdityp.h:271
_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 5193 of file freetype.c.

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

Referenced by NtGdiGetFontUnicodeRanges().

◆ GreCreateFontIndirectW()

HFONT FASTCALL GreCreateFontIndirectW ( LOGFONTW lplf)

Internal

Definition at line 23 of file font.c.

24{
25 if (lplf)
26 {
27 ENUMLOGFONTEXDVW Logfont;
28
29 RtlCopyMemory( &Logfont.elfEnumLogfontEx.elfLogFont, lplf, sizeof(LOGFONTW));
31 sizeof(Logfont.elfEnumLogfontEx.elfFullName));
33 sizeof(Logfont.elfEnumLogfontEx.elfStyle));
35 sizeof(Logfont.elfEnumLogfontEx.elfScript));
36
37 Logfont.elfDesignVector.dvNumAxes = 0;
38
39 RtlZeroMemory( &Logfont.elfDesignVector, sizeof(DESIGNVECTOR));
40
41 return HfontCreate((PENUMLOGFONTEXDVW)&Logfont, 0, 0, 0, NULL );
42 }
43 else return NULL;
44}
WCHAR elfStyle[LF_FACESIZE]
Definition: wingdi.h:2704
WCHAR elfFullName[LF_FULLFACESIZE]
Definition: wingdi.h:2703
WCHAR elfScript[LF_FACESIZE]
Definition: wingdi.h:2705
HFONT APIENTRY HfontCreate(IN PENUMLOGFONTEXDVW pelfw, IN ULONG cjElfw, IN LFTYPE lft, IN FLONG fl, IN PVOID pvCliData)
Definition: font.c:1140

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

◆ GreExtTextOutW()

BOOL NTAPI GreExtTextOutW ( IN  HDC,
IN  INT,
IN  INT,
IN  UINT,
IN OPTIONAL RECTL ,
IN  LPCWSTR,
IN  INT,
IN OPTIONAL  LPINT,
IN  DWORD 
)

◆ GreGetTextExtentExW()

BOOL FASTCALL GreGetTextExtentExW ( HDC  hDC,
LPCWSTR  String,
ULONG  Count,
ULONG  MaxExtent,
PULONG  Fit,
PULONG  Dx,
LPSIZE  pSize,
FLONG  fl 
)

Definition at line 135 of file text.c.

144{
145 PDC pdc;
146 PDC_ATTR pdcattr;
147 BOOL Result;
148 PTEXTOBJ TextObj;
149
150 if ( (!String && Count ) || !pSize )
151 {
153 return FALSE;
154 }
155
156 if ( !Count )
157 {
158 if ( Fit ) Fit = 0;
159 return TRUE;
160 }
161
162 pdc = DC_LockDc(hDC);
163 if (NULL == pdc)
164 {
166 return FALSE;
167 }
168 pdcattr = pdc->pdcattr;
169
170 TextObj = RealizeFontInit(pdcattr->hlfntNew);
171 if ( TextObj )
172 {
174 TextObj,
175 String,
176 Count,
177 MaxExtent,
178 (LPINT)Fit,
179 (LPINT)Dx,
180 pSize,
181 fl);
182 TEXTOBJ_UnlockText(TextObj);
183 }
184 else
185 Result = FALSE;
186
187 DC_UnlockDc(pdc);
188 return Result;
189}
BOOL FASTCALL TextIntGetTextExtentPoint(PDC dc, PTEXTOBJ TextObj, LPCWSTR String, INT Count, ULONG MaxExtent, LPINT Fit, LPINT Dx, LPSIZE Size, FLONG fl)
Definition: freetype.c:4958
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFSTRING String
Definition: wdfdevice.h:2433
_In_ FLONG fl
Definition: winddi.h:1279
int * LPINT
Definition: windef.h:178

Referenced by TEXT_Ellipsify(), TEXT_NextLineW(), TEXT_PathEllipsify(), TEXT_WordBreak(), and UserDrawCaptionText().

◆ GreGetTextExtentW()

BOOL FASTCALL GreGetTextExtentW ( HDC  hDC,
LPCWSTR  lpwsz,
INT  cwc,
LPSIZE  psize,
UINT  flOpts 
)

Definition at line 78 of file text.c.

84{
85 PDC pdc;
86 PDC_ATTR pdcattr;
88 PTEXTOBJ TextObj;
89
90 if (!cwc)
91 {
92 psize->cx = 0;
93 psize->cy = 0;
94 return TRUE;
95 }
96
97 pdc = DC_LockDc(hDC);
98 if (!pdc)
99 {
101 return FALSE;
102 }
103
104 pdcattr = pdc->pdcattr;
105
106 TextObj = RealizeFontInit(pdcattr->hlfntNew);
107 if ( TextObj )
108 {
110 TextObj,
111 lpwsz,
112 cwc,
113 0,
114 NULL,
115 0,
116 psize,
117 flOpts);
118 TEXTOBJ_UnlockText(TextObj);
119 }
120 else
121 Result = FALSE;
122
123 DC_UnlockDc(pdc);
124 return Result;
125}
_Must_inspect_result_ _Out_ LPSIZE psize
Definition: ntgdi.h:1569
LONG cx
Definition: windef.h:334
LONG cy
Definition: windef.h:335

Referenced by DrawTextExWorker(), IntPaintDesktop(), and TEXT_DrawUnderscore().

◆ GreGetTextMetricsW()

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

Definition at line 193 of file text.c.

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

Referenced by DrawTextExWorker().

◆ GreTextOutW()

BOOL FASTCALL GreTextOutW ( HDC  hdc,
int  nXStart,
int  nYStart,
LPCWSTR  lpString,
int  cchString 
)

Functions

Definition at line 61 of file text.c.

67{
68 return GreExtTextOutW(hdc, nXStart, nYStart, 0, NULL, lpString, cchString, NULL, 0);
69}
BOOL APIENTRY GreExtTextOutW(IN HDC hDC, IN INT XStart, IN INT YStart, IN UINT fuOptions, IN OPTIONAL PRECTL lprc, IN LPCWSTR String, IN INT Count, IN OPTIONAL LPINT Dx, IN DWORD dwCodePage)
Definition: freetype.c:7304

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

◆ InitFontSupport()

BOOL FASTCALL InitFontSupport ( VOID  )

Definition at line 1020 of file freetype.c.

1021{
1022 ULONG ulError;
1023
1025
1027 if (g_FreeTypeLock == NULL)
1028 {
1029 return FALSE;
1030 }
1032
1034 if (ulError)
1035 {
1036 DPRINT1("FT_Init_FreeType failed with error code 0x%x\n", ulError);
1037 return FALSE;
1038 }
1039
1041 {
1042 DPRINT1("Fonts registry is empty.\n");
1043
1044 /* Load font(s) with writing registry */
1046 }
1047
1048 IntLoadFontSubstList(&g_FontSubstListHead);
1049
1050#if 0
1051 DumpFontInfo(TRUE);
1052#endif
1053
1057
1058 return TRUE;
1059}
#define NonPagedPool
Definition: env_spec_w32.h:307
BOOL FASTCALL IntLoadFontSubstList(PLIST_ENTRY pHead)
Definition: freetype.c:873
static UINT g_FontCacheNumEntries
Definition: freetype.c:394
VOID FASTCALL IntLoadSystemFonts(VOID)
Definition: freetype.c:1561
static NTSTATUS FontLink_LoadDefaultCharset(VOID)
Definition: freetype.c:155
static NTSTATUS FontLink_LoadSettings(VOID)
Definition: freetype.c:91
static NTSTATUS FontLink_LoadDefaultFonts(VOID)
Definition: freetype.c:117
BOOL FASTCALL IntLoadFontsInRegistry(VOID)
Definition: freetype.c:2306
FT_Init_FreeType(FT_Library *alibrary)
Definition: ftinit.c:320
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 472 of file freetype.c.

473{
474 UINT i;
475
476 if (uCodePage == CP_OEMCP)
477 return OEM_CHARSET;
478
479 if (uCodePage == CP_MACCP)
480 return MAC_CHARSET;
481
482 for (i = 0; i < MAXTCIINDEX; ++i)
483 {
484 if (g_FontTci[i].ciACP == 0)
485 continue;
486
487 if (g_FontTci[i].ciACP == uCodePage)
488 return g_FontTci[i].ciCharset;
489 }
490
491 return DEFAULT_CHARSET;
492}
#define CP_OEMCP
Definition: freetype.c:466
static const CHARSETINFO g_FontTci[MAXTCIINDEX]
Definition: freetype.c:424
#define CP_MACCP
Definition: freetype.c:467
#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 2640 of file freetype.c.

2641{
2643}
static BOOL g_RenderingEnabled
Definition: freetype.c:371
_In_ ULONGLONG _In_ ULONGLONG _In_ BOOLEAN Enable
Definition: ntddpcm.h:142

◆ IntGdiAddFontMemResource()

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

Definition at line 2458 of file freetype.c.

2459{
2460 HANDLE Ret = NULL;
2462 PFONT_ENTRY_COLL_MEM EntryCollection;
2463 INT FaceCount;
2464
2466 if (!BufferCopy)
2467 {
2468 *pNumAdded = 0;
2469 return NULL;
2470 }
2471 RtlCopyMemory(BufferCopy, Buffer, dwSize);
2472
2473 LoadFont.pFileName = NULL;
2474 LoadFont.Memory = SharedMem_Create(BufferCopy, dwSize, FALSE);
2475 LoadFont.Characteristics = FR_PRIVATE | FR_NOT_ENUM;
2476 RtlInitUnicodeString(&LoadFont.RegValueName, NULL);
2477 LoadFont.IsTrueType = FALSE;
2478 LoadFont.PrivateEntry = NULL;
2480
2481 RtlFreeUnicodeString(&LoadFont.RegValueName);
2482
2483 /* Release our copy */
2487
2488 if (FaceCount > 0)
2489 {
2490 EntryCollection = ExAllocatePoolWithTag(PagedPool, sizeof(FONT_ENTRY_COLL_MEM), TAG_FONT);
2491 if (EntryCollection)
2492 {
2494 EntryCollection->Entry = LoadFont.PrivateEntry;
2496 IntLockProcessPrivateFonts(Win32Process);
2497 EntryCollection->Handle = ULongToHandle(++Win32Process->PrivateMemFontHandleCount);
2498 InsertTailList(&Win32Process->PrivateMemFontListHead, &EntryCollection->ListEntry);
2499 IntUnLockProcessPrivateFonts(Win32Process);
2501 Ret = EntryCollection->Handle;
2502 }
2503 }
2504 *pNumAdded = FaceCount;
2505
2506 return Ret;
2507}
#define ULongToHandle(h)
Definition: basetsd.h:81
#define InsertTailList(ListHead, Entry)
BOOL LoadFont(LPWSTR lpCmdLine)
static PSHARED_MEM SharedMem_Create(PBYTE Buffer, ULONG BufferSize, BOOL IsMapping)
Definition: freetype.c:592
static INT FASTCALL IntGdiLoadFontsFromMemory(PGDI_LOAD_FONT pLoadFont, PSHARED_FACE SharedFace, FT_Long FontIndex, INT CharSetIndex)
Definition: freetype.c:1719
static void SharedMem_Release(PSHARED_MEM Ptr)
Definition: freetype.c:649
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:148
#define IntUnLockProcessPrivateFonts(W32Process)
Definition: text.h:151

Referenced by NtGdiAddFontMemResourceEx().

◆ IntGdiAddFontResource()

INT FASTCALL IntGdiAddFontResource ( PUNICODE_STRING  FileName,
DWORD  Characteristics 
)

Definition at line 2290 of file freetype.c.

2291{
2292 return IntGdiAddFontResourceEx(FileName, Characteristics, 0);
2293}
INT FASTCALL IntGdiAddFontResourceEx(PUNICODE_STRING FileName, DWORD Characteristics, DWORD dwFlags)
Definition: freetype.c:2091

Referenced by NtGdiAddFontResourceW().

◆ IntGdiAddFontResourceEx()

INT FASTCALL IntGdiAddFontResourceEx ( PUNICODE_STRING  FileName,
DWORD  Characteristics,
DWORD  dwFlags 
)

Definition at line 2091 of file freetype.c.

2093{
2096 PVOID Buffer = NULL;
2099 SIZE_T ViewSize = 0, Length;
2100 LARGE_INTEGER SectionSize;
2103 INT FontCount;
2105 UNICODE_STRING PathName;
2106 LPWSTR pszBuffer;
2108 static const UNICODE_STRING TrueTypePostfix = RTL_CONSTANT_STRING(L" (TrueType)");
2109 static const UNICODE_STRING DosPathPrefix = RTL_CONSTANT_STRING(L"\\??\\");
2110
2111 /* Build PathName */
2113 {
2114 Length = DosPathPrefix.Length + FileName->Length + sizeof(UNICODE_NULL);
2116 if (!pszBuffer)
2117 return 0; /* failure */
2118
2119 RtlInitEmptyUnicodeString(&PathName, pszBuffer, Length);
2120 RtlAppendUnicodeStringToString(&PathName, &DosPathPrefix);
2122 }
2123 else
2124 {
2126 if (!NT_SUCCESS(Status))
2127 return 0; /* failure */
2128 }
2129
2130 /* Open the font file */
2134 &FileHandle,
2137 &Iosb,
2140 if (!NT_SUCCESS(Status))
2141 {
2142 DPRINT1("Could not load font file: %wZ\n", &PathName);
2143 RtlFreeUnicodeString(&PathName);
2144 return 0;
2145 }
2146
2149 if (!NT_SUCCESS(Status))
2150 {
2151 DPRINT1("ObReferenceObjectByHandle failed.\n");
2153 RtlFreeUnicodeString(&PathName);
2154 return 0;
2155 }
2156
2157 SectionSize.QuadPart = 0LL;
2160 NULL, &SectionSize, PAGE_READONLY,
2162 if (!NT_SUCCESS(Status))
2163 {
2164 DPRINT1("Could not map file: %wZ\n", &PathName);
2167 RtlFreeUnicodeString(&PathName);
2168 return 0;
2169 }
2171
2173 if (!NT_SUCCESS(Status))
2174 {
2175 DPRINT1("Could not map file: %wZ\n", &PathName);
2178 RtlFreeUnicodeString(&PathName);
2179 return 0;
2180 }
2181
2182 LoadFont.pFileName = &PathName;
2184 LoadFont.Characteristics = Characteristics;
2185 RtlInitUnicodeString(&LoadFont.RegValueName, NULL);
2186 LoadFont.IsTrueType = FALSE;
2187 LoadFont.CharSet = DEFAULT_CHARSET;
2188 LoadFont.PrivateEntry = NULL;
2189 FontCount = IntGdiLoadFontsFromMemory(&LoadFont, NULL, -1, -1);
2190
2191 /* Release our copy */
2195
2197
2199
2200 /* Save the loaded font name into the registry */
2201 if (FontCount > 0 && (dwFlags & AFRX_WRITE_REGISTRY))
2202 {
2203 UNICODE_STRING NewString;
2204 SIZE_T Length;
2205 PWCHAR pszBuffer;
2206 LPCWSTR CharSetName;
2207 if (LoadFont.IsTrueType)
2208 {
2209 /* Append " (TrueType)" */
2210 Length = LoadFont.RegValueName.Length + TrueTypePostfix.Length + sizeof(UNICODE_NULL);
2212 if (pszBuffer)
2213 {
2214 RtlInitEmptyUnicodeString(&NewString, pszBuffer, Length);
2215 NewString.Buffer[0] = UNICODE_NULL;
2216 RtlAppendUnicodeStringToString(&NewString, &LoadFont.RegValueName);
2217 RtlAppendUnicodeStringToString(&NewString, &TrueTypePostfix);
2218 RtlFreeUnicodeString(&LoadFont.RegValueName);
2219 LoadFont.RegValueName = NewString;
2220 }
2221 else
2222 {
2223 // FIXME!
2224 }
2225 }
2226 else if (LoadFont.CharSet != DEFAULT_CHARSET)
2227 {
2228 /* Append " (CharSetName)" */
2229 CharSetName = NameFromCharSet(LoadFont.CharSet);
2230 Length = LoadFont.RegValueName.Length +
2231 (wcslen(CharSetName) + 3) * sizeof(WCHAR) +
2232 sizeof(UNICODE_NULL);
2233
2235 if (pszBuffer)
2236 {
2237 RtlInitEmptyUnicodeString(&NewString, pszBuffer, Length);
2238 NewString.Buffer[0] = UNICODE_NULL;
2239 RtlAppendUnicodeStringToString(&NewString, &LoadFont.RegValueName);
2240 RtlAppendUnicodeToString(&NewString, L" (");
2241 RtlAppendUnicodeToString(&NewString, CharSetName);
2242 RtlAppendUnicodeToString(&NewString, L")");
2243 RtlFreeUnicodeString(&LoadFont.RegValueName);
2244 LoadFont.RegValueName = NewString;
2245 }
2246 else
2247 {
2248 // FIXME!
2249 }
2250 }
2251
2254 NULL, NULL);
2255 Status = ZwOpenKey(&KeyHandle, KEY_WRITE, &ObjectAttributes);
2256 if (NT_SUCCESS(Status))
2257 {
2259 LPWSTR pFileName;
2260
2262 {
2263 pFileName = PathName.Buffer;
2264 }
2265 else
2266 {
2267 pFileName = wcsrchr(PathName.Buffer, L'\\');
2268 }
2269
2270 if (pFileName)
2271 {
2273 {
2274 pFileName++;
2275 }
2276 DataSize = (wcslen(pFileName) + 1) * sizeof(WCHAR);
2277 ZwSetValueKey(KeyHandle, &LoadFont.RegValueName, 0, REG_SZ,
2278 pFileName, DataSize);
2279 }
2281 }
2282 }
2283 RtlFreeUnicodeString(&LoadFont.RegValueName);
2284
2285 RtlFreeUnicodeString(&PathName);
2286 return FontCount;
2287}
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:36
#define TAG_USTR
Definition: libsupp.c:997
#define PAGE_READONLY
Definition: compat.h:138
#define SECTION_MAP_READ
Definition: compat.h:139
#define wcsrchr
Definition: compat.h:16
#define FILE_SHARE_READ
Definition: compat.h:136
return Iosb
Definition: create.c:4402
NTSTATUS RtlAppendUnicodeToString(IN PUNICODE_STRING Str1, IN PWSTR Str2)
Definition: string_lib.cpp:62
_Must_inspect_result_ _In_opt_ PFLT_INSTANCE _Out_ PHANDLE FileHandle
Definition: fltkernel.h:1231
static NTSTATUS DuplicateUnicodeString(PUNICODE_STRING Source, PUNICODE_STRING Destination)
Definition: freetype.c:1235
static UNICODE_STRING g_FontRegPath
Definition: freetype.c:362
static LPCWSTR FASTCALL NameFromCharSet(BYTE CharSet)
Definition: freetype.c:2057
#define FILE_SYNCHRONOUS_IO_NONALERT
Definition: from_kernel.h:31
_Must_inspect_result_ _Outptr_ PVOID * SectionObject
Definition: fsrtlfuncs.h:860
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define OBJ_KERNEL_HANDLE
Definition: winternl.h:231
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
#define REG_SZ
Definition: layer.c:22
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
_In_ NDIS_STATUS _In_ ULONG _In_ USHORT _In_opt_ PVOID _In_ ULONG DataSize
Definition: ndis.h:4755
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
Definition: ndis.h:4715
#define KernelMode
Definition: asm.h:34
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)
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID _In_ ULONG_PTR _In_ SIZE_T _Inout_opt_ PLARGE_INTEGER _Inout_ PSIZE_T ViewSize
Definition: mmfuncs.h:408
#define SEC_COMMIT
Definition: mmtypes.h:100
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
#define SYNCHRONIZE
Definition: nt_native.h:61
#define FILE_READ_DATA
Definition: nt_native.h:628
NTSYSAPI NTSTATUS NTAPI RtlAppendUnicodeStringToString(PUNICODE_STRING Destination, PUNICODE_STRING Source)
#define SECTION_QUERY
Definition: nt_native.h:1287
#define KEY_WRITE
Definition: nt_native.h:1031
#define FILE_GENERIC_READ
Definition: nt_native.h:653
#define STANDARD_RIGHTS_REQUIRED
Definition: nt_native.h:63
#define UNICODE_NULL
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
#define L(x)
Definition: ntvdm.h:50
NTSTATUS NTAPI ObReferenceObjectByHandle(IN HANDLE Handle, IN ACCESS_MASK DesiredAccess, IN POBJECT_TYPE ObjectType, IN KPROCESSOR_MODE AccessMode, OUT PVOID *Object, OUT POBJECT_HANDLE_INFORMATION HandleInformation OPTIONAL)
Definition: obref.c:494
NTSTATUS NTAPI MmMapViewInSystemSpace(IN PVOID SectionObject, OUT PVOID *MappedBase, IN OUT PSIZE_T ViewSize)
Definition: section.c:4452
NTSTATUS NTAPI MmCreateSection(OUT PVOID *Section, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, IN PLARGE_INTEGER MaximumSize, IN ULONG SectionPageProtection, IN ULONG AllocationAttributes, IN HANDLE FileHandle OPTIONAL, IN PFILE_OBJECT FileObject OPTIONAL)
Definition: section.c:4625
#define LL
Definition: tui.h:167
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14
ULONG_PTR SIZE_T
Definition: typedefs.h:80
uint16_t * PWCHAR
Definition: typedefs.h:56
LONGLONG QuadPart
Definition: typedefs.h:114
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
Definition: wdfdevice.h:550
#define AFRX_WRITE_REGISTRY
Definition: text.h:104
#define AFRX_DOS_DEVICE_PATH
Definition: text.h:106
#define AFRX_ALTERNATIVE_PATH
Definition: text.h:105
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176
* PFILE_OBJECT
Definition: iotypes.h:1998
#define ObDereferenceObject
Definition: obfuncs.h:203
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

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

◆ IntGdiCleanupPrivateFontsForProcess()

VOID FASTCALL IntGdiCleanupPrivateFontsForProcess ( VOID  )

Definition at line 2584 of file freetype.c.

2585{
2588 PFONT_ENTRY_COLL_MEM EntryCollection;
2589
2590 DPRINT("IntGdiCleanupPrivateFontsForProcess()\n");
2591 do {
2592 Entry = NULL;
2593 EntryCollection = NULL;
2594
2596 IntLockProcessPrivateFonts(Win32Process);
2597 if (!IsListEmpty(&Win32Process->PrivateMemFontListHead))
2598 {
2599 Entry = Win32Process->PrivateMemFontListHead.Flink;
2600 EntryCollection = CONTAINING_RECORD(Entry, FONT_ENTRY_COLL_MEM, ListEntry);
2601 UnlinkFontMemCollection(EntryCollection);
2602 }
2603 IntUnLockProcessPrivateFonts(Win32Process);
2605
2606 if (EntryCollection)
2607 {
2608 IntGdiCleanupMemEntry(EntryCollection->Entry);
2609 ExFreePoolWithTag(EntryCollection, TAG_FONT);
2610 }
2611 else
2612 {
2613 /* No Mem fonts anymore, see if we have any other private fonts left */
2614 Entry = NULL;
2616 IntLockProcessPrivateFonts(Win32Process);
2617 if (!IsListEmpty(&Win32Process->PrivateFontListHead))
2618 {
2619 Entry = RemoveHeadList(&Win32Process->PrivateFontListHead);
2620 }
2621 IntUnLockProcessPrivateFonts(Win32Process);
2623
2624 if (Entry)
2625 {
2627 }
2628 }
2629
2630 } while (Entry);
2631}
VOID FASTCALL IntGdiCleanupMemEntry(PFONT_ENTRY_MEM Head)
Definition: freetype.c:2512
static VOID FASTCALL UnlinkFontMemCollection(PFONT_ENTRY_COLL_MEM Collection)
Definition: freetype.c:2531
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 6095 of file freetype.c.

6100{
6101 UNICODE_STRING EntryFileName;
6102 POBJECT_NAME_INFORMATION NameInfo1 = NULL, NameInfo2 = NULL;
6103 PLIST_ENTRY ListEntry;
6104 PFONT_ENTRY FontEntry;
6105 ULONG Size, i, Count;
6106 LPBYTE pbBuffer;
6107 BOOL IsEqual;
6108 FONTFAMILYINFO *FamInfo;
6109 const ULONG MaxFamInfo = 64;
6110 const ULONG MAX_FAM_INFO_BYTES = sizeof(FONTFAMILYINFO) * MaxFamInfo;
6111 BOOL bSuccess;
6112 const ULONG NAMEINFO_SIZE = sizeof(OBJECT_NAME_INFORMATION) + MAX_PATH * sizeof(WCHAR);
6113
6114 DPRINT("IntGdiGetFontResourceInfo: dwType == %lu\n", dwType);
6115
6116 do
6117 {
6118 /* Create buffer for full path name */
6119 NameInfo1 = ExAllocatePoolWithTag(PagedPool, NAMEINFO_SIZE, TAG_FINF);
6120 if (!NameInfo1)
6121 break;
6122
6123 /* Get the full path name */
6124 if (!IntGetFullFileName(NameInfo1, NAMEINFO_SIZE, FileName))
6125 break;
6126
6127 /* Create a buffer for the entries' names */
6128 NameInfo2 = ExAllocatePoolWithTag(PagedPool, NAMEINFO_SIZE, TAG_FINF);
6129 if (!NameInfo2)
6130 break;
6131
6132 FamInfo = ExAllocatePoolWithTag(PagedPool, MAX_FAM_INFO_BYTES, TAG_FINF);
6133 } while (0);
6134
6135 if (!NameInfo1 || !NameInfo2 || !FamInfo)
6136 {
6137 if (NameInfo2)
6138 ExFreePoolWithTag(NameInfo2, TAG_FINF);
6139
6140 if (NameInfo1)
6141 ExFreePoolWithTag(NameInfo1, TAG_FINF);
6142
6144 return FALSE;
6145 }
6146
6147 Count = 0;
6148
6149 /* Try to find the pathname in the global font list */
6151 for (ListEntry = g_FontListHead.Flink; ListEntry != &g_FontListHead;
6152 ListEntry = ListEntry->Flink)
6153 {
6154 FontEntry = CONTAINING_RECORD(ListEntry, FONT_ENTRY, ListEntry);
6155 if (FontEntry->Font->Filename == NULL)
6156 continue;
6157
6158 RtlInitUnicodeString(&EntryFileName , FontEntry->Font->Filename);
6159 if (!IntGetFullFileName(NameInfo2, NAMEINFO_SIZE, &EntryFileName))
6160 continue;
6161
6162 if (!RtlEqualUnicodeString(&NameInfo1->Name, &NameInfo2->Name, FALSE))
6163 continue;
6164
6165 IsEqual = FALSE;
6166 FontFamilyFillInfo(&FamInfo[Count], FontEntry->FaceName.Buffer,
6167 NULL, FontEntry->Font);
6168 for (i = 0; i < Count; ++i)
6169 {
6170 if (EqualFamilyInfo(&FamInfo[i], &FamInfo[Count]))
6171 {
6172 IsEqual = TRUE;
6173 break;
6174 }
6175 }
6176 if (!IsEqual)
6177 {
6178 /* Found */
6179 ++Count;
6180 if (Count >= MaxFamInfo)
6181 break;
6182 }
6183 }
6185
6186 /* Free the buffers */
6187 ExFreePoolWithTag(NameInfo1, TAG_FINF);
6188 ExFreePoolWithTag(NameInfo2, TAG_FINF);
6189
6190 if (Count == 0 && dwType != 5)
6191 {
6192 /* Font could not be found in system table
6193 dwType == 5 will still handle this */
6194 ExFreePoolWithTag(FamInfo, TAG_FINF);
6195 return FALSE;
6196 }
6197
6198 bSuccess = FALSE;
6199 switch (dwType)
6200 {
6201 case 0: /* FIXME: Returns 1 or 2, don't know what this is atm */
6202 Size = sizeof(DWORD);
6203 if (*pdwBytes == 0)
6204 {
6205 *pdwBytes = Size;
6206 bSuccess = TRUE;
6207 }
6208 else if (pBuffer)
6209 {
6210 if (*pdwBytes >= Size)
6211 {
6212 *(DWORD*)pBuffer = Count;
6213 }
6214 *pdwBytes = Size;
6215 bSuccess = TRUE;
6216 }
6217 break;
6218
6219 case 1: /* copy the font title */
6220 /* calculate the required size */
6221 Size = 0;
6222 for (i = 0; i < Count; ++i)
6223 {
6224 if (i > 0)
6225 Size += 3; /* " & " */
6226 Size += wcslen(FamInfo[i].EnumLogFontEx.elfLogFont.lfFaceName);
6227 if (FamInfo[i].EnumLogFontEx.elfStyle[0] &&
6228 _wcsicmp(FamInfo[i].EnumLogFontEx.elfStyle, L"Regular") != 0)
6229 {
6230 Size += 1 + wcslen(FamInfo[i].EnumLogFontEx.elfStyle);
6231 }
6232 }
6233 Size += 2; /* "\0\0" */
6234 Size *= sizeof(WCHAR);
6235
6236 if (*pdwBytes == 0)
6237 {
6238 *pdwBytes = Size;
6239 bSuccess = TRUE;
6240 }
6241 else if (pBuffer)
6242 {
6243 if (*pdwBytes >= Size)
6244 {
6245 /* store font title to buffer */
6246 WCHAR *psz = pBuffer;
6247 *psz = 0;
6248 for (i = 0; i < Count; ++i)
6249 {
6250 if (i > 0)
6251 wcscat(psz, L" & ");
6252 IntAddNameFromFamInfo(psz, &FamInfo[i]);
6253 }
6254 psz[wcslen(psz) + 1] = UNICODE_NULL;
6255 *pdwBytes = Size;
6256 bSuccess = TRUE;
6257 }
6258 else
6259 {
6260 *pdwBytes = 1024; /* this is confirmed value */
6261 }
6262 }
6263 break;
6264
6265 case 2: /* Copy an array of LOGFONTW */
6266 Size = Count * sizeof(LOGFONTW);
6267 if (*pdwBytes == 0)
6268 {
6269 *pdwBytes = Size;
6270 bSuccess = TRUE;
6271 }
6272 else if (pBuffer)
6273 {
6274 if (*pdwBytes >= Size)
6275 {
6276 pbBuffer = (LPBYTE)pBuffer;
6277 for (i = 0; i < Count; ++i)
6278 {
6279 FamInfo[i].EnumLogFontEx.elfLogFont.lfWidth = 0;
6280 RtlCopyMemory(pbBuffer, &FamInfo[i].EnumLogFontEx.elfLogFont, sizeof(LOGFONTW));
6281 pbBuffer += sizeof(LOGFONTW);
6282 }
6283 }
6284 *pdwBytes = Size;
6285 bSuccess = TRUE;
6286 }
6287 else
6288 {
6289 *pdwBytes = 1024; /* this is confirmed value */
6290 }
6291 break;
6292
6293 case 3:
6294 Size = sizeof(DWORD);
6295 if (*pdwBytes == 0)
6296 {
6297 *pdwBytes = Size;
6298 bSuccess = TRUE;
6299 }
6300 else if (pBuffer)
6301 {
6302 if (*pdwBytes >= Size)
6303 {
6304 /* FIXME: What exactly is copied here? */
6305 *(DWORD*)pBuffer = 1;
6306 }
6307 *pdwBytes = Size;
6308 bSuccess = TRUE;
6309 }
6310 break;
6311
6312 case 4: /* full file path */
6313 if (FileName->Length >= 4 * sizeof(WCHAR))
6314 {
6315 /* The beginning of FileName is \??\ */
6316 LPWSTR pch = FileName->Buffer + 4;
6317 DWORD Length = FileName->Length - 4 * sizeof(WCHAR);
6318
6319 Size = Length + sizeof(WCHAR);
6320 if (*pdwBytes == 0)
6321 {
6322 *pdwBytes = Size;
6323 bSuccess = TRUE;
6324 }
6325 else if (pBuffer)
6326 {
6327 if (*pdwBytes >= Size)
6328 {
6330 }
6331 *pdwBytes = Size;
6332 bSuccess = TRUE;
6333 }
6334 }
6335 break;
6336
6337 case 5: /* Looks like a BOOL that is copied, TRUE, if the font was not found */
6338 Size = sizeof(BOOL);
6339 if (*pdwBytes == 0)
6340 {
6341 *pdwBytes = Size;
6342 bSuccess = TRUE;
6343 }
6344 else if (pBuffer)
6345 {
6346 if (*pdwBytes >= Size)
6347 {
6348 *(BOOL*)pBuffer = Count == 0;
6349 }
6350 *pdwBytes = Size;
6351 bSuccess = TRUE;
6352 }
6353 break;
6354 }
6355 ExFreePoolWithTag(FamInfo, TAG_FINF);
6356
6357 return bSuccess;
6358}
#define MAX_PATH
Definition: compat.h:34
static BOOLEAN bSuccess
Definition: drive.cpp:477
@ IsEqual
Definition: fatprocs.h:1887
static BOOL FASTCALL IntGetFullFileName(POBJECT_NAME_INFORMATION NameInfo, ULONG Size, PUNICODE_STRING FileName)
Definition: freetype.c:6018
static BOOL EqualFamilyInfo(const FONTFAMILYINFO *pInfo1, const FONTFAMILYINFO *pInfo2)
Definition: freetype.c:6061
static void FASTCALL FontFamilyFillInfo(PFONTFAMILYINFO Info, LPCWSTR FaceName, LPCWSTR FullName, PFONTGDI FontGDI)
Definition: freetype.c:3450
static VOID IntAddNameFromFamInfo(LPWSTR psz, FONTFAMILYINFO *FamInfo)
Definition: freetype.c:6082
static PWSTR PDWORD pdwBytes
Definition: layerapi.c:35
#define pch(ap)
Definition: match.c:418
#define BOOL
Definition: nt_native.h:43
NTSYSAPI BOOLEAN NTAPI RtlEqualUnicodeString(PUNICODE_STRING String1, PUNICODE_STRING String2, BOOLEAN CaseInSensitive)
struct _OBJECT_NAME_INFORMATION OBJECT_NAME_INFORMATION
#define DWORD
Definition: nt_native.h:44
struct tagFONTFAMILYINFO FONTFAMILYINFO
PVOID pBuffer
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
_CRTIMP wchar_t *__cdecl wcscat(_Inout_updates_z_(_String_length_(_Dest)+_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
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:1270
ENUMLOGFONTEXW EnumLogFontEx
Definition: ntgdibad.h:47
LONG lfWidth
Definition: wingdi.h:1898
unsigned char * LPBYTE
Definition: typedefs.h:53
#define TAG_FINF
Definition: text.h:3

Referenced by NtGdiGetFontResourceInfoInternalW().

◆ IntGdiRemoveFontMemResource()

BOOL FASTCALL IntGdiRemoveFontMemResource ( HANDLE  hMMFont)

Definition at line 2548 of file freetype.c.

2549{
2551 PFONT_ENTRY_COLL_MEM CurrentEntry;
2552 PFONT_ENTRY_COLL_MEM EntryCollection = NULL;
2554
2556 IntLockProcessPrivateFonts(Win32Process);
2557 for (Entry = Win32Process->PrivateMemFontListHead.Flink;
2558 Entry != &Win32Process->PrivateMemFontListHead;
2559 Entry = Entry->Flink)
2560 {
2561 CurrentEntry = CONTAINING_RECORD(Entry, FONT_ENTRY_COLL_MEM, ListEntry);
2562
2563 if (CurrentEntry->Handle == hMMFont)
2564 {
2565 EntryCollection = CurrentEntry;
2566 UnlinkFontMemCollection(CurrentEntry);
2567 break;
2568 }
2569 }
2570 IntUnLockProcessPrivateFonts(Win32Process);
2572
2573 if (EntryCollection)
2574 {
2575 IntGdiCleanupMemEntry(EntryCollection->Entry);
2576 ExFreePoolWithTag(EntryCollection, TAG_FONT);
2577 return TRUE;
2578 }
2579 return FALSE;
2580}

Referenced by NtGdiRemoveFontMemResourceEx().

◆ IntGetCharDimensions()

DWORD FASTCALL IntGetCharDimensions ( HDC  hdc,
PTEXTMETRICW  ptm,
PDWORD  height 
)

Definition at line 329 of file font.c.

330{
331 PDC pdc;
332 PDC_ATTR pdcattr;
333 PTEXTOBJ TextObj;
334 SIZE sz;
335 TMW_INTERNAL tmwi;
336 BOOL Good;
337
338 static const WCHAR alphabet[] = {
339 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q',
340 'r','s','t','u','v','w','x','y','z','A','B','C','D','E','F','G','H',
341 'I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',0};
342
343 if(!ftGdiGetTextMetricsW(hdc, &tmwi)) return 0;
344
345 pdc = DC_LockDc(hdc);
346
347 if (!pdc) return 0;
348
349 pdcattr = pdc->pdcattr;
350
351 TextObj = RealizeFontInit(pdcattr->hlfntNew);
352 if ( !TextObj )
353 {
354 DC_UnlockDc(pdc);
355 return 0;
356 }
357 Good = TextIntGetTextExtentPoint(pdc, TextObj, alphabet, 52, 0, NULL, 0, &sz, 0);
358 TEXTOBJ_UnlockText(TextObj);
359 DC_UnlockDc(pdc);
360
361 if (!Good) return 0;
362 if (ptm) *ptm = tmwi.TextMetric;
363 if (height) *height = tmwi.TextMetric.tmHeight;
364
365 return (sz.cx / 26 + 1) / 2;
366}
LONG cx
Definition: kdterminal.h:27
LONG tmHeight
Definition: wingdi.h:2383

Referenced by co_IntInitializeDesktopGraphics(), IntGetDialogBaseUnits(), MENU_CalcItemSize(), and UserChangeDisplaySettings().

◆ IntGetFontLanguageInfo()

DWORD FASTCALL IntGetFontLanguageInfo ( PDC  Dc)

Definition at line 371 of file font.c.

372{
373 PDC_ATTR pdcattr;
374 FONTSIGNATURE fontsig;
375 static const DWORD GCP_DBCS_MASK=0x003F0000,
376 GCP_DIACRITIC_MASK=0x00000000,
377 FLI_GLYPHS_MASK=0x00000000,
378 GCP_GLYPHSHAPE_MASK=0x00000040,
379 GCP_KASHIDA_MASK=0x00000000,
380 GCP_LIGATE_MASK=0x00000000,
381 GCP_USEKERNING_MASK=0x00000000,
382 GCP_REORDER_MASK=0x00000060;
383
384 DWORD result=0;
385
386 ftGdiGetTextCharsetInfo( Dc, &fontsig, 0 );
387
388 /* We detect each flag we return using a bitmask on the Codepage Bitfields */
389 if( (fontsig.fsCsb[0]&GCP_DBCS_MASK)!=0 )
391
392 if( (fontsig.fsCsb[0]&GCP_DIACRITIC_MASK)!=0 )
394
395 if( (fontsig.fsCsb[0]&FLI_GLYPHS_MASK)!=0 )
397
398 if( (fontsig.fsCsb[0]&GCP_GLYPHSHAPE_MASK)!=0 )
400
401 if( (fontsig.fsCsb[0]&GCP_KASHIDA_MASK)!=0 )
403
404 if( (fontsig.fsCsb[0]&GCP_LIGATE_MASK)!=0 )
406
407 if( (fontsig.fsCsb[0]&GCP_USEKERNING_MASK)!=0 )
409
410 pdcattr = Dc->pdcattr;
411
412 /* This might need a test for a HEBREW- or ARABIC_CHARSET as well */
413 if ( pdcattr->flTextAlign & TA_RTLREADING )
414 if( (fontsig.fsCsb[0]&GCP_REORDER_MASK)!=0 )
416
417 return result;
418}
INT FASTCALL ftGdiGetTextCharsetInfo(PDC Dc, LPFONTSIGNATURE lpSig, DWORD dwFlags)
Definition: freetype.c:5080
GLuint64EXT * result
Definition: glext.h:11304
FLONG flTextAlign
Definition: ntgdihdl.h:324
#define GCP_GLYPHSHAPE
Definition: wingdi.h:833
#define GCP_DIACRITIC
Definition: wingdi.h:831
#define GCP_LIGATE
Definition: wingdi.h:837
#define GCP_USEKERNING
Definition: wingdi.h:845
#define GCP_KASHIDA
Definition: wingdi.h:836
#define FLI_GLYPHS
Definition: wingdi.h:846
#define TA_RTLREADING
Definition: wingdi.h:934
#define GCP_REORDER
Definition: wingdi.h:843
#define GCP_DBCS
Definition: wingdi.h:828

Referenced by NtGdiGetDCDword().

◆ IntGetOutlineTextMetrics()

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

Definition at line 3075 of file freetype.c.

3079{
3080 TT_OS2 *pOS2;
3081 TT_HoriHeader *pHori;
3082 TT_Postscript *pPost;
3083 FT_Fixed XScale, YScale;
3084 FT_WinFNT_HeaderRec WinFNT;
3086 BYTE *pb;
3087 FONT_NAMES FontNames;
3088 PSHARED_FACE SharedFace = FontGDI->SharedFace;
3090 FT_Face Face = SharedFace->Face;
3091
3092 if (bLocked)
3094 else
3096
3098 {
3099 Cache = &SharedFace->EnglishUS;
3100 }
3101 else
3102 {
3103 Cache = &SharedFace->UserLanguage;
3104 }
3105
3106 if (Size == 0 && Cache->OutlineRequiredSize > 0)
3107 {
3108 ASSERT(Otm == NULL);
3109 return Cache->OutlineRequiredSize;
3110 }
3111
3112 if (!bLocked)
3114
3115 IntInitFontNames(&FontNames, SharedFace);
3116 Cache->OutlineRequiredSize = FontNames.OtmSize;
3117
3118 if (Size == 0)
3119 {
3120 ASSERT(Otm == NULL);
3121 IntFreeFontNames(&FontNames);
3122 if (!bLocked)
3124 return Cache->OutlineRequiredSize;
3125 }
3126
3127 ASSERT(Otm != NULL);
3128
3129 if (Size < Cache->OutlineRequiredSize)
3130 {
3131 DPRINT1("Size %u < OutlineRequiredSize %u\n", Size,
3132 Cache->OutlineRequiredSize);
3133 IntFreeFontNames(&FontNames);
3134 if (!bLocked)
3136 return 0; /* failure */
3137 }
3138
3139 XScale = Face->size->metrics.x_scale;
3140 YScale = Face->size->metrics.y_scale;
3141
3142 pOS2 = FT_Get_Sfnt_Table(Face, FT_SFNT_OS2);
3143 pHori = FT_Get_Sfnt_Table(Face, FT_SFNT_HHEA);
3144 pPost = FT_Get_Sfnt_Table(Face, FT_SFNT_POST); /* We can live with this failing */
3145 Error = FT_Get_WinFNT_Header(Face, &WinFNT);
3146
3147 if (pOS2 == NULL && Error)
3148 {
3149 if (!bLocked)
3151 DPRINT1("Can't find OS/2 table - not TT font?\n");
3152 IntFreeFontNames(&FontNames);
3153 return 0;
3154 }
3155
3156 if (pHori == NULL && Error)
3157 {
3158 if (!bLocked)
3160 DPRINT1("Can't find HHEA table - not TT font?\n");
3161 IntFreeFontNames(&FontNames);
3162 return 0;
3163 }
3164
3165 Otm->otmSize = Cache->OutlineRequiredSize;
3166
3167 FillTM(&Otm->otmTextMetrics, FontGDI, pOS2, pHori, !Error ? &WinFNT : 0);
3168
3169 if (!pOS2)
3170 goto skip_os2;
3171
3172 Otm->otmFiller = 0;
3174 Otm->otmfsSelection = pOS2->fsSelection;
3175 Otm->otmfsType = pOS2->fsType;
3176 Otm->otmsCharSlopeRise = pHori->caret_Slope_Rise;
3177 Otm->otmsCharSlopeRun = pHori->caret_Slope_Run;
3178 Otm->otmItalicAngle = 0; /* POST table */
3179 Otm->otmEMSquare = Face->units_per_EM;
3180
3181#define SCALE_X(value) ((FT_MulFix((value), XScale) + 32) >> 6)
3182#define SCALE_Y(value) ((FT_MulFix((value), YScale) + 32) >> 6)
3183
3184 Otm->otmAscent = SCALE_Y(pOS2->sTypoAscender);
3185 Otm->otmDescent = SCALE_Y(pOS2->sTypoDescender);
3186 Otm->otmLineGap = SCALE_Y(pOS2->sTypoLineGap);
3187 Otm->otmsCapEmHeight = SCALE_Y(pOS2->sCapHeight);
3188 Otm->otmsXHeight = SCALE_Y(pOS2->sxHeight);
3189 Otm->otmrcFontBox.left = SCALE_X(Face->bbox.xMin);
3190 Otm->otmrcFontBox.right = SCALE_X(Face->bbox.xMax);
3191 Otm->otmrcFontBox.top = SCALE_Y(Face->bbox.yMax);
3192 Otm->otmrcFontBox.bottom = SCALE_Y(Face->bbox.yMin);
3195 Otm->otmMacLineGap = Otm->otmLineGap;
3196 Otm->otmusMinimumPPEM = 0; /* TT Header */
3207
3208 if (!pPost)
3209 {
3210 Otm->otmsUnderscoreSize = 0;
3211 Otm->otmsUnderscorePosition = 0;
3212 }
3213 else
3214 {
3217 }
3218
3219#undef SCALE_X
3220#undef SCALE_Y
3221
3222skip_os2:
3223 if (!bLocked)
3225
3226 pb = IntStoreFontNames(&FontNames, Otm);
3227 ASSERT(pb - (BYTE*)Otm == Cache->OutlineRequiredSize);
3228
3229 IntFreeFontNames(&FontNames);
3230
3231 return Cache->OutlineRequiredSize;
3232}
BOOLEAN bLocked
Definition: Mke2fs.c:19
#define SCALE_Y(value)
static __inline void FASTCALL IntInitFontNames(FONT_NAMES *Names, PSHARED_FACE SharedFace)
Definition: freetype.c:3002
static __inline BYTE *FASTCALL IntStoreFontNames(const FONT_NAMES *Names, OUTLINETEXTMETRICW *Otm)
Definition: freetype.c:3038
#define SCALE_X(value)
#define ASSERT_FREETYPE_LOCK_HELD()
Definition: freetype.c:373
static __inline void FASTCALL IntFreeFontNames(FONT_NAMES *Names)
Definition: freetype.c:3062
signed long FT_Fixed
Definition: fttypes.h:288
#define LANG_ENGLISH
Definition: nls.h:52
#define PRIMARYLANGID(l)
Definition: nls.h:16
Definition: fatfs.h:173
ULONG OtmSize
Definition: freetype.c:2998
FT_Pos xMin
Definition: ftimage.h:117
FT_Pos yMax
Definition: ftimage.h:118
FT_Pos yMin
Definition: ftimage.h:117
FT_Pos xMax
Definition: ftimage.h:118
FT_Size size
Definition: freetype.h:1106
FT_BBox bbox
Definition: freetype.h:1092
FT_UShort units_per_EM
Definition: freetype.h:1094
FT_Size_Metrics metrics
Definition: freetype.h:1677
FT_Fixed y_scale
Definition: freetype.h:1644
FT_Fixed x_scale
Definition: freetype.h:1643
FT_Short caret_Slope_Run
Definition: tttables.h:212
FT_Short caret_Slope_Rise
Definition: tttables.h:211
FT_Short sTypoDescender
Definition: tttables.h:412
FT_UShort fsSelection
Definition: tttables.h:408
FT_Short ySuperscriptYSize
Definition: tttables.h:392
FT_Short sxHeight
Definition: tttables.h:424
FT_Short yStrikeoutSize
Definition: tttables.h:395
FT_Byte panose[10]
Definition: tttables.h:399
FT_Short ySubscriptXSize
Definition: tttables.h:387
FT_Short sTypoLineGap
Definition: tttables.h:413
FT_Short sTypoAscender
Definition: tttables.h:411
FT_Short ySuperscriptXSize
Definition: tttables.h:391
FT_Short ySubscriptYOffset
Definition: tttables.h:390
FT_Short ySuperscriptYOffset
Definition: tttables.h:394
FT_Short ySubscriptXOffset
Definition: tttables.h:389
FT_Short yStrikeoutPosition
Definition: tttables.h:396
FT_Short sCapHeight
Definition: tttables.h:425
FT_UShort fsType
Definition: tttables.h:386
FT_Short ySuperscriptXOffset
Definition: tttables.h:393
FT_Short ySubscriptYSize
Definition: tttables.h:388
FT_Short underlineThickness
Definition: tttables.h:460
FT_Short underlinePosition
Definition: tttables.h:459
PANOSE otmPanoseNumber
Definition: wingdi.h:2516
POINT otmptSuperscriptOffset
Definition: wingdi.h:2536
POINT otmptSuperscriptSize
Definition: wingdi.h:2535
POINT otmptSubscriptSize
Definition: wingdi.h:2533
int otmsStrikeoutPosition
Definition: wingdi.h:2538
int otmsUnderscorePosition
Definition: wingdi.h:2540
POINT otmptSubscriptOffset
Definition: wingdi.h:2534
UINT otmsStrikeoutSize
Definition: wingdi.h:2537
SHARED_FACE_CACHE UserLanguage
Definition: engobjects.h:136
SHARED_FACE_CACHE EnglishUS
Definition: engobjects.h:135
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
LONG tmAscent
Definition: wingdi.h:2384
LONG tmDescent
Definition: wingdi.h:2385
@ FT_SFNT_HHEA
Definition: tttables.h:618
@ FT_SFNT_POST
Definition: tttables.h:620
@ FT_SFNT_OS2
Definition: tttables.h:617
#define PANOSE_COUNT
Definition: wingdi.h:453

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

◆ IntIsFontRenderingEnabled()

BOOL FASTCALL IntIsFontRenderingEnabled ( VOID  )

Definition at line 2634 of file freetype.c.

2635{
2636 return (gpsi->BitsPixel > 8) && g_RenderingEnabled;
2637}
PSERVERINFO gpsi
Definition: imm.c:18

Referenced by IntExtTextOutW(), and TextIntGetTextExtentPoint().

◆ IntLoadFontsInRegistry()

BOOL FASTCALL IntLoadFontsInRegistry ( VOID  )

Definition at line 2306 of file freetype.c.

2307{
2311 KEY_FULL_INFORMATION KeyFullInfo;
2312 ULONG i, Length;
2313 UNICODE_STRING FontTitleW, FileNameW;
2314 SIZE_T InfoSize;
2315 LPBYTE InfoBuffer;
2317 LPWSTR pchPath;
2319 INT nFontCount = 0;
2320 DWORD dwFlags;
2321
2322 /* open registry key */
2325 NULL, NULL);
2326 Status = ZwOpenKey(&KeyHandle, KEY_READ, &ObjectAttributes);
2327 if (!NT_SUCCESS(Status))
2328 {
2329 DPRINT1("ZwOpenKey failed: 0x%08X\n", Status);
2330 return FALSE; /* failure */
2331 }
2332
2333 /* query count of values */
2334 Status = ZwQueryKey(KeyHandle, KeyFullInformation,
2335 &KeyFullInfo, sizeof(KeyFullInfo), &Length);
2336 if (!NT_SUCCESS(Status))
2337 {
2338 DPRINT1("ZwQueryKey failed: 0x%08X\n", Status);
2340 return FALSE; /* failure */
2341 }
2342
2343 /* allocate buffer */
2344 InfoSize = (MAX_PATH + 256) * sizeof(WCHAR);
2345 InfoBuffer = ExAllocatePoolWithTag(PagedPool, InfoSize, TAG_FONT);
2346 if (!InfoBuffer)
2347 {
2348 DPRINT1("ExAllocatePoolWithTag failed\n");
2350 return FALSE;
2351 }
2352
2353 /* for each value */
2354 for (i = 0; i < KeyFullInfo.Values; ++i)
2355 {
2356 /* get value name */
2357 Status = ZwEnumerateValueKey(KeyHandle, i, KeyValueFullInformation,
2358 InfoBuffer, InfoSize, &Length);
2360 {
2361 /* too short buffer */
2362 ExFreePoolWithTag(InfoBuffer, TAG_FONT);
2363 InfoSize *= 2;
2364 InfoBuffer = ExAllocatePoolWithTag(PagedPool, InfoSize, TAG_FONT);
2365 if (!InfoBuffer)
2366 {
2367 DPRINT1("ExAllocatePoolWithTag failed\n");
2368 break;
2369 }
2370 /* try again */
2371 Status = ZwEnumerateValueKey(KeyHandle, i, KeyValueFullInformation,
2372 InfoBuffer, InfoSize, &Length);
2373 }
2374 if (!NT_SUCCESS(Status))
2375 {
2376 DPRINT1("ZwEnumerateValueKey failed: 0x%08X\n", Status);
2377 break; /* failure */
2378 }
2379
2380 /* create FontTitleW string */
2381 pInfo = (PKEY_VALUE_FULL_INFORMATION)InfoBuffer;
2382 Length = pInfo->NameLength / sizeof(WCHAR);
2383 pInfo->Name[Length] = UNICODE_NULL; /* truncate */
2384 if (!RtlCreateUnicodeString(&FontTitleW, pInfo->Name))
2385 {
2387 DPRINT1("RtlCreateUnicodeString failed\n");
2388 break; /* failure */
2389 }
2390
2391 /* query value */
2392 Status = ZwQueryValueKey(KeyHandle, &FontTitleW, KeyValueFullInformation,
2393 InfoBuffer, InfoSize, &Length);
2395 {
2396 /* too short buffer */
2397 ExFreePoolWithTag(InfoBuffer, TAG_FONT);
2398 InfoSize *= 2;
2399 InfoBuffer = ExAllocatePoolWithTag(PagedPool, InfoSize, TAG_FONT);
2400 if (!InfoBuffer)
2401 {
2402 DPRINT1("ExAllocatePoolWithTag failed\n");
2403 break;
2404 }
2405 /* try again */
2406 Status = ZwQueryValueKey(KeyHandle, &FontTitleW, KeyValueFullInformation,
2407 InfoBuffer, InfoSize, &Length);
2408 }
2409 pInfo = (PKEY_VALUE_FULL_INFORMATION)InfoBuffer;
2410 if (!NT_SUCCESS(Status) || !pInfo->DataLength)
2411 {
2412 DPRINT1("ZwQueryValueKey failed: 0x%08X\n", Status);
2413 RtlFreeUnicodeString(&FontTitleW);
2414 break; /* failure */
2415 }
2416
2417 /* Build pchPath */
2418 pchPath = (LPWSTR)((PUCHAR)pInfo + pInfo->DataOffset);
2419 Length = pInfo->DataLength / sizeof(WCHAR);
2420 pchPath[Length] = UNICODE_NULL; /* truncate */
2421
2422 /* Load font(s) without writing registry */
2423 if (PathIsRelativeW(pchPath))
2424 {
2425 dwFlags = 0;
2427 L"\\SystemRoot\\Fonts\\%s", pchPath);
2428 }
2429 else
2430 {
2432 Status = RtlStringCbCopyW(szPath, sizeof(szPath), pchPath);
2433 }
2434
2435 if (NT_SUCCESS(Status))
2436 {
2437 RtlCreateUnicodeString(&FileNameW, szPath);
2438 nFontCount += IntGdiAddFontResourceEx(&FileNameW, 0, dwFlags);
2439 RtlFreeUnicodeString(&FileNameW);
2440 }
2441
2442 RtlFreeUnicodeString(&FontTitleW);
2443 }
2444
2445 /* close now */
2447
2448 /* free memory block */
2449 if (InfoBuffer)
2450 {
2451 ExFreePoolWithTag(InfoBuffer, TAG_FONT);
2452 }
2453
2454 return (KeyFullInfo.Values != 0 && nFontCount != 0);
2455}
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
BOOL WINAPI PathIsRelativeW(LPCWSTR lpszPath)
Definition: freetype.c:2296
LPCWSTR szPath
Definition: env.c:37
@ KeyFullInformation
Definition: nt_native.h:1133
@ KeyValueFullInformation
Definition: nt_native.h:1181
#define KEY_READ
Definition: nt_native.h:1023
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

Referenced by InitFontSupport().

◆ IntLoadSystemFonts()

VOID FASTCALL IntLoadSystemFonts ( VOID  )

Definition at line 1561 of file freetype.c.

1562{
1564 UNICODE_STRING Directory, FileName, TempString;
1566 HANDLE hDirectory;
1567 BYTE *DirInfoBuffer;
1569 BOOLEAN bRestartScan = TRUE;
1571 INT i;
1572 static UNICODE_STRING SearchPatterns[] =
1573 {
1574 RTL_CONSTANT_STRING(L"*.ttf"),
1575 RTL_CONSTANT_STRING(L"*.ttc"),
1576 RTL_CONSTANT_STRING(L"*.otf"),
1577 RTL_CONSTANT_STRING(L"*.otc"),
1578 RTL_CONSTANT_STRING(L"*.fon"),
1579 RTL_CONSTANT_STRING(L"*.fnt")
1580 };
1581 static UNICODE_STRING IgnoreFiles[] =
1582 {
1585 };
1586
1587 RtlInitUnicodeString(&Directory, L"\\SystemRoot\\Fonts\\");
1588
1591 &Directory,
1593 NULL,
1594 NULL);
1595
1597 &hDirectory,
1600 &Iosb,
1603
1604 if (NT_SUCCESS(Status))
1605 {
1606 for (i = 0; i < _countof(SearchPatterns); ++i)
1607 {
1608 DirInfoBuffer = ExAllocatePoolWithTag(PagedPool, 0x4000, TAG_FONT);
1609 if (DirInfoBuffer == NULL)
1610 {
1611 ZwClose(hDirectory);
1612 return;
1613 }
1614
1616 if (FileName.Buffer == NULL)
1617 {
1618 ExFreePoolWithTag(DirInfoBuffer, TAG_FONT);
1619 ZwClose(hDirectory);
1620 return;
1621 }
1622 FileName.Length = 0;
1623 FileName.MaximumLength = MAX_PATH * sizeof(WCHAR);
1624
1625 while (1)
1626 {
1627 Status = ZwQueryDirectoryFile(
1628 hDirectory,
1629 NULL,
1630 NULL,
1631 NULL,
1632 &Iosb,
1633 DirInfoBuffer,
1634 0x4000,
1636 FALSE,
1637 &SearchPatterns[i],
1638 bRestartScan);
1639
1641 {
1642 break;
1643 }
1644
1645 DirInfo = (PFILE_DIRECTORY_INFORMATION)DirInfoBuffer;
1646 while (1)
1647 {
1648 SIZE_T ign;
1649
1650 TempString.Buffer = DirInfo->FileName;
1651 TempString.Length = TempString.MaximumLength = DirInfo->FileNameLength;
1652
1653 /* Should we ignore this file? */
1654 for (ign = 0; ign < _countof(IgnoreFiles); ++ign)
1655 {
1656 /* Yes.. */
1657 if (RtlEqualUnicodeString(IgnoreFiles + ign, &TempString, FALSE))
1658 break;
1659 }
1660
1661 /* If we tried all Ignore patterns and there was no match, try to create a font */
1662 if (ign == _countof(IgnoreFiles))
1663 {
1667 {
1668 DPRINT1("ERR: Failed to load %wZ\n", &FileName);
1669 }
1670 }
1671
1672 if (DirInfo->NextEntryOffset == 0)
1673 break;
1674
1675 DirInfo = (PFILE_DIRECTORY_INFORMATION)((ULONG_PTR)DirInfo + DirInfo->NextEntryOffset);
1676 }
1677
1678 bRestartScan = FALSE;
1679 }
1680
1682 ExFreePoolWithTag(DirInfoBuffer, TAG_FONT);
1683 }
1684 ZwClose(hDirectory);
1685 }
1686}
@ IgnoreFiles
Definition: ACListISF.cpp:75
unsigned char BOOLEAN
#define FILE_DIRECTORY_FILE
Definition: constants.h:491
struct _FileName FileName
Definition: fatprocs.h:897
@ FileDirectoryInformation
Definition: from_kernel.h:62
struct _FILE_DIRECTORY_INFORMATION * PFILE_DIRECTORY_INFORMATION
NTSYSAPI VOID NTAPI RtlCopyUnicodeString(PUNICODE_STRING DestinationString, PUNICODE_STRING SourceString)
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
#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:524
USHORT MaximumLength
Definition: env_spec_w32.h:370
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define STATUS_NO_MORE_FILES
Definition: udferr_usr.h:128

Referenced by InitFontSupport().

◆ RealizeFontInit()

◆ TextIntCreateFontIndirect()

NTSTATUS FASTCALL TextIntCreateFontIndirect ( CONST LPLOGFONTW  lf,
HFONT NewFont 
)

Definition at line 2668 of file freetype.c.

2669{
2670 PLFONT plfont;
2671 LOGFONTW *plf;
2672
2673 ASSERT(lf);
2674 plfont = LFONT_AllocFontWithHandle();
2675 if (!plfont)
2676 {
2677 return STATUS_NO_MEMORY;
2678 }
2679
2680 ExInitializePushLock(&plfont->lock);
2681 *NewFont = plfont->BaseObject.hHmgr;
2682 plf = &plfont->logfont.elfEnumLogfontEx.elfLogFont;
2683 RtlCopyMemory(plf, lf, sizeof(LOGFONTW));
2684 if (lf->lfEscapement != lf->lfOrientation)
2685 {
2686 /* This should really depend on whether GM_ADVANCED is set */
2687 plf->lfOrientation = plf->lfEscapement;
2688 }
2689 LFONT_UnlockFont(plfont);
2690
2691 return STATUS_SUCCESS;
2692}
HGDIOBJ hHmgr(VOID)
Definition: baseobj.hpp:95
#define STATUS_NO_MEMORY
Definition: d3dkmdt.h:51
#define ExInitializePushLock
Definition: ex.h:1013
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  dc,
PTEXTOBJ  TextObj,
LPCWSTR  String,
INT  Count,
ULONG  MaxExtent,
LPINT  Fit,
LPINT  Dx,
LPSIZE  Size,
FLONG  fl 
)

Definition at line 4958 of file freetype.c.

4967{
4968 PFONTGDI FontGDI;
4969 FT_BitmapGlyph realglyph;
4970 INT glyph_index, i, previous, nTenthsOfDegrees;
4971 ULONGLONG TotalWidth64 = 0;
4972 LOGFONTW *plf;
4973 BOOL use_kerning, bVerticalWriting;
4974 LONG ascender, descender;
4976 DWORD ch0, ch1;
4977 FONTLINK_CHAIN Chain;
4978
4979 FontGDI = ObjToGDI(TextObj->Font, FONT);
4980
4981 Cache.Hashed.Face = FontGDI->SharedFace->Face;
4982 if (NULL != Fit)
4983 {
4984 *Fit = 0;
4985 }
4986
4987 plf = &TextObj->logfont.elfEnumLogfontEx.elfLogFont;
4988 Cache.Hashed.lfHeight = plf->lfHeight;
4989 Cache.Hashed.lfWidth = plf->lfWidth;
4990 Cache.Hashed.Aspect.Emu.Bold = EMUBOLD_NEEDED(FontGDI->OriginalWeight, plf->lfWeight);
4991 Cache.Hashed.Aspect.Emu.Italic = (plf->lfItalic && !FontGDI->OriginalItalic);
4992
4993 // Check vertical writing (tategaki)
4994 nTenthsOfDegrees = IntNormalizeAngle(plf->lfEscapement - plf->lfOrientation);
4995 bVerticalWriting = ((nTenthsOfDegrees == 90 * 10) || (nTenthsOfDegrees == 270 * 10));
4996
4998 Cache.Hashed.Aspect.RenderMode = (BYTE)IntGetFontRenderMode(plf);
4999 else
5000 Cache.Hashed.Aspect.RenderMode = (BYTE)FT_RENDER_MODE_MONO;
5001
5002 // NOTE: GetTextExtentPoint32 simply ignores lfEscapement and XFORM.
5004 TextIntUpdateSize(dc, TextObj, FontGDI, FALSE);
5005 Cache.Hashed.matTransform = identityMat;
5006 FT_Set_Transform(Cache.Hashed.Face, NULL, NULL);
5007
5008 FontLink_Chain_Init(&Chain, TextObj, Cache.Hashed.Face);
5009
5010 use_kerning = FT_HAS_KERNING(Cache.Hashed.Face);
5011 previous = 0;
5012
5013 for (i = 0; i < Count; i++)
5014 {
5015 ch0 = *String++;
5016 if (IS_HIGH_SURROGATE(ch0))
5017 {
5018 ++i;
5019 if (i >= Count)
5020 break;
5021
5022 ch1 = *String++;
5023 if (IS_LOW_SURROGATE(ch1))
5024 ch0 = Utf32FromSurrogatePair(ch0, ch1);
5025 }
5026
5027 glyph_index = FontLink_Chain_FindGlyph(&Chain, &Cache, &Cache.Hashed.Face, ch0,
5028 (fl & GTEF_INDICES));
5029 Cache.Hashed.GlyphIndex = glyph_index;
5030
5031 realglyph = IntGetRealGlyph(&Cache);
5032 if (!realglyph)
5033 break;
5034
5035 /* Retrieve kerning distance */
5036 if (use_kerning && previous && glyph_index)
5037 {
5038 FT_Vector delta;
5039 FT_Get_Kerning(Cache.Hashed.Face, previous, glyph_index, 0, &delta);
5040 TotalWidth64 += delta.x;
5041 }
5042
5043 TotalWidth64 += realglyph->root.advance.x >> 10;
5044
5045 if (((TotalWidth64 + 32) >> 6) <= MaxExtent && NULL != Fit)
5046 {
5047 *Fit = i + 1;
5048 }
5049 if (NULL != Dx)
5050 {
5051 Dx[i] = (TotalWidth64 + 32) >> 6;
5052 }
5053
5054 previous = glyph_index;
5055 }
5056 ASSERT(FontGDI->Magic == FONTGDI_MAGIC);
5057 ascender = FontGDI->tmAscent; /* Units above baseline */
5058 descender = FontGDI->tmDescent; /* Units below baseline */
5060
5061 if (bVerticalWriting)
5062 {
5063 Size->cx = ascender + descender;
5064 Size->cy = (TotalWidth64 + 32) >> 6;
5065 }
5066 else
5067 {
5068 Size->cx = (TotalWidth64 + 32) >> 6;
5069 Size->cy = ascender + descender;
5070 }
5071
5072 FontLink_Chain_Finish(&Chain);
5073
5074 return TRUE;
5075}
#define FONTGDI_MAGIC
Definition: engobjects.h:171
static UINT FontLink_Chain_FindGlyph(_Inout_ PFONTLINK_CHAIN pChain, _Out_ PFONT_CACHE_ENTRY pCache, _Inout_ FT_Face *pFace, _In_ UINT code, _In_ BOOL fCodeAsIndex)
Definition: freetype.c:4376
#define IS_HIGH_SURROGATE(ch0)
Definition: freetype.c:333
static DWORD Utf32FromSurrogatePair(DWORD ch0, DWORD ch1)
Definition: freetype.c:337
#define IS_LOW_SURROGATE(ch1)
Definition: freetype.c:334
#define EMUBOLD_NEEDED(original, request)
Definition: freetype.c:348
static LONG IntNormalizeAngle(LONG nTenthsOfDegrees)
Definition: freetype.c:1109
static FT_BitmapGlyph IntGetRealGlyph(IN OUT PFONT_CACHE_ENTRY Cache)
Definition: freetype.c:4918
BOOL FASTCALL IntIsFontRenderingEnabled(VOID)
Definition: freetype.c:2634
static VOID FontLink_Chain_Finish(_Inout_ PFONTLINK_CHAIN pChain)
Definition: freetype.c:276
static VOID FontLink_Chain_Init(_Out_ PFONTLINK_CHAIN pChain, _Inout_ PTEXTOBJ pTextObj, _In_ FT_Face face)
Definition: freetype.c:1294
FT_Render_Mode FASTCALL IntGetFontRenderMode(LOGFONTW *logfont)
Definition: freetype.c:2646
@ FT_RENDER_MODE_MONO
Definition: freetype.h:3236
#define GTEF_INDICES
Definition: ntgdityp.h:213
FT_GlyphRec root
Definition: ftglyph.h:162
FT_Vector advance
Definition: ftglyph.h:113
BYTE lfItalic
Definition: dimm.idl:64
LONG lfWeight
Definition: dimm.idl:63
LONG tmAscent
Definition: engobjects.h:162
LONG tmDescent
Definition: engobjects.h:163
BYTE OriginalItalic
Definition: engobjects.h:156
LONG OriginalWeight
Definition: engobjects.h:157
LONG Magic
Definition: engobjects.h:165
uint64_t ULONGLONG
Definition: typedefs.h:67

Referenced by GreGetTextExtentExW(), GreGetTextExtentW(), IntExtTextOutW(), IntGetCharDimensions(), and NtGdiGetTextExtentExW().

◆ TextIntRealizeFont()

NTSTATUS FASTCALL TextIntRealizeFont ( HFONT  FontHandle,
PTEXTOBJ  pTextObj 
)

Definition at line 5906 of file freetype.c.

5907{
5909 PTEXTOBJ TextObj;
5910 PPROCESSINFO Win32Process;
5911 ULONG MatchPenalty;
5912 LOGFONTW *pLogFont;
5913 LOGFONTW SubstitutedLogFont;
5914
5915 if (!pTextObj)
5916 {
5917 TextObj = TEXTOBJ_LockText(FontHandle);
5918 if (NULL == TextObj)
5919 {
5920 return STATUS_INVALID_HANDLE;
5921 }
5922
5923 if (TextObj->fl & TEXTOBJECT_INIT)
5924 {
5925 TEXTOBJ_UnlockText(TextObj);
5926 return STATUS_SUCCESS;
5927 }
5928 }
5929 else
5930 {
5931 TextObj = pTextObj;
5932 }
5933
5934 pLogFont = &TextObj->logfont.elfEnumLogfontEx.elfLogFont;
5935
5936 /* substitute */
5937 SubstitutedLogFont = *pLogFont;
5938 DPRINT("Font '%S,%u' is substituted by: ", pLogFont->lfFaceName, pLogFont->lfCharSet);
5939 SubstituteFontRecurse(&SubstitutedLogFont);
5940 DPRINT("'%S,%u'.\n", SubstitutedLogFont.lfFaceName, SubstitutedLogFont.lfCharSet);
5941
5942 MatchPenalty = 0xFFFFFFFF;
5943 TextObj->Font = NULL;
5944
5945 Win32Process = PsGetCurrentProcessWin32Process();
5946
5947 /* Search private fonts */
5949 IntLockProcessPrivateFonts(Win32Process);
5950 FindBestFontFromList(&TextObj->Font, &MatchPenalty, &SubstitutedLogFont,
5951 &Win32Process->PrivateFontListHead);
5952 IntUnLockProcessPrivateFonts(Win32Process);
5953
5954 /* Search system fonts */
5955 FindBestFontFromList(&TextObj->Font, &MatchPenalty, &SubstitutedLogFont,
5956 &g_FontListHead);
5958
5959 if (NULL == TextObj->Font)
5960 {
5961 DPRINT1("Request font %S not found, no fonts loaded at all\n",
5962 pLogFont->lfFaceName);
5964 }
5965 else
5966 {
5968 PFONTGDI FontGdi = ObjToGDI(TextObj->Font, FONT);
5969 PSHARED_FACE SharedFace = FontGdi->SharedFace;
5970
5971 TextObj->TextFace[0] = UNICODE_NULL;
5973 if (MatchFontNames(SharedFace, SubstitutedLogFont.lfFaceName))
5974 {
5976 RtlStringCchCopyW(TextObj->TextFace, _countof(TextObj->TextFace), pLogFont->lfFaceName);
5977 }
5978 else
5979 {
5983 if (NT_SUCCESS(Status))
5984 {
5985 /* truncated copy */
5986 IntUnicodeStringToBuffer(TextObj->TextFace, sizeof(TextObj->TextFace), &Name);
5988 }
5989 }
5990
5991 // Need hdev, when freetype is loaded need to create DEVOBJ for
5992 // Consumer and Producer.
5993 TextObj->Font->iUniq = 1; // Now it can be cached.
5994 IntFontType(FontGdi);
5995 FontGdi->flType = TextObj->Font->flFontType;
5996 FontGdi->RequestUnderline = pLogFont->lfUnderline ? 0xFF : 0;
5997 FontGdi->RequestStrikeOut = pLogFont->lfStrikeOut ? 0xFF : 0;
5998 FontGdi->RequestItalic = pLogFont->lfItalic ? 0xFF : 0;
5999 if (pLogFont->lfWeight != FW_DONTCARE)
6000 FontGdi->RequestWeight = pLogFont->lfWeight;
6001 else
6002 FontGdi->RequestWeight = FW_NORMAL;
6003
6004 TextObj->fl |= TEXTOBJECT_INIT;
6006 }
6007
6008 if (!pTextObj) TEXTOBJ_UnlockText(TextObj);
6009
6010 ASSERT((NT_SUCCESS(Status) ^ (NULL == TextObj->Font)) != 0);
6011
6012 return Status;
6013}
struct NameRec_ * Name
Definition: cdprocs.h:460
static VOID FASTCALL IntFontType(PFONTGDI Font)
Definition: freetype.c:5821
static __inline VOID FindBestFontFromList(FONTOBJ **FontObj, ULONG *MatchPenalty, const LOGFONTW *LogFont, const PLIST_ENTRY Head)
Definition: freetype.c:5752
static VOID IntUnicodeStringToBuffer(LPWSTR pszBuffer, SIZE_T cbBuffer, const UNICODE_STRING *pString)
Definition: freetype.c:1220
static BOOL MatchFontNames(PSHARED_FACE SharedFace, LPCWSTR lfFaceName)
Definition: freetype.c:5879
static NTSTATUS IntGetFontLocalizedName(PUNICODE_STRING pNameW, PSHARED_FACE SharedFace, FT_UShort NameID, FT_UShort LangID)
Definition: freetype.c:3294
static BOOL SubstituteFontRecurse(PLOGFONTW pLogFont)
Definition: freetype.c:1258
#define TT_NAME_ID_FONT_FAMILY
Definition: font.c:3536
NTSTRSAFEAPI RtlStringCchCopyW(_Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest, _In_ size_t cchDest, _In_ NTSTRSAFE_PCWSTR pszSrc)
Definition: ntstrsafe.h:127
#define STATUS_NOT_FOUND
Definition: shellext.h:72
BYTE lfStrikeOut
Definition: dimm.idl:66
WCHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:72
BYTE lfUnderline
Definition: dimm.idl:65
BYTE lfCharSet
Definition: dimm.idl:67
BYTE RequestItalic
Definition: engobjects.h:154
LONG RequestWeight
Definition: engobjects.h:155
BYTE RequestStrikeOut
Definition: engobjects.h:153
FLONG flType
Definition: engobjects.h:142
BYTE RequestUnderline
Definition: engobjects.h:152
ULONG iUniq
Definition: winddi.h:762
FLONG flFontType
Definition: winddi.h:765
WCHAR TextFace[LF_FACESIZE]
Definition: text.h:67
#define FW_DONTCARE
Definition: wingdi.h:368
#define FW_NORMAL
Definition: wingdi.h:373

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

◆ TextIntUpdateSize()

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

Definition at line 4227 of file freetype.c.

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

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:1036
#define KeEnterCriticalRegion()
Definition: ke_x.h:88
#define LFONT_ShareLockFont(hfont)
Definition: text.h:77

Referenced by RealizeFontInit(), and TextIntRealizeFont().

◆ TEXTOBJ_UnlockText()