ReactOS 0.4.15-dev-8076-g06e89b2
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)
 
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 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 147 of file text.h.

◆ IntUnLockProcessPrivateFonts

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

Definition at line 150 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:32
NTSTATUS FASTCALL TextIntRealizeFont(HFONT FontHandle, PTEXTOBJ pTextObj)
Definition: freetype.c:5156
Status
Definition: gdiplustypes.h:25
#define ASSERT(a)
Definition: mode.c:44
_In_ ULONG cjBuffer
Definition: ntgdi.h:2860
#define DPRINT
Definition: sndvol32.h:71
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().

◆ ftGdiGetFontData()

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

Definition at line 4615 of file freetype.c.

4621{
4623 FT_Face Face = FontGdi->SharedFace->Face;
4624
4626
4627 if (FT_IS_SFNT(Face))
4628 {
4629 if (Table)
4630 Table = Table >> 24 | Table << 24 | (Table >> 8 & 0xFF00) |
4631 (Table << 8 & 0xFF0000);
4632
4633 if (!Buffer) Size = 0;
4634
4635 if (Buffer && Size)
4636 {
4638 FT_ULong Needed = 0;
4639
4640 Error = FT_Load_Sfnt_Table(Face, Table, Offset, NULL, &Needed);
4641
4642 if ( !Error && Needed < Size) Size = Needed;
4643 }
4644 if (!FT_Load_Sfnt_Table(Face, Table, Offset, Buffer, &Size))
4645 Result = Size;
4646 }
4647
4649
4650 return Result;
4651}
BOOL Error
Definition: chkdsk.c:66
Definition: bufpool.h:45
unsigned long DWORD
Definition: ntddk_ex.h:95
#define IntUnLockFreeType()
Definition: freetype.c:97
#define IntLockFreeType()
Definition: freetype.c:94
#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 3694 of file freetype.c.

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

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

3089{
3090 if ( lprs )
3091 {
3092 lprs->nSize = sizeof(RASTERIZER_STATUS);
3093 lprs->wFlags = TT_AVAILABLE | TT_ENABLED;
3094 lprs->nLanguageID = gusLanguageID;
3095 return TRUE;
3096 }
3098 return FALSE;
3099}
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
USHORT gusLanguageID
Definition: init.c:12
#define TT_ENABLED
Definition: wingdi.h:889
struct _RASTERIZER_STATUS RASTERIZER_STATUS
#define TT_AVAILABLE
Definition: wingdi.h:888

Referenced by NtGdiGetRasterizerCaps().

◆ ftGdiGetTextCharsetInfo()

INT FASTCALL ftGdiGetTextCharsetInfo ( PDC  Dc,
PFONTSIGNATURE  lpSig,
DWORD  dwFlags 
)

Definition at line 4331 of file freetype.c.

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

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

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

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

Referenced by NtGdiGetFontUnicodeRanges().

◆ 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:4215
_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:4518
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:6523

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

◆ InitFontSupport()

BOOL FASTCALL InitFontSupport ( VOID  )

Definition at line 672 of file freetype.c.

673{
674 ULONG ulError;
675
679 /* Fast Mutexes must be allocated from non paged pool */
681 if (g_FontListLock == NULL)
682 {
683 return FALSE;
684 }
685
688 if (g_FreeTypeLock == NULL)
689 {
690 return FALSE;
691 }
693
695 if (ulError)
696 {
697 DPRINT1("FT_Init_FreeType failed with error code 0x%x\n", ulError);
698 return FALSE;
699 }
700
702 {
703 DPRINT1("Fonts registry is empty.\n");
704
705 /* Load font(s) with writing registry */
707 }
708
709 IntLoadFontSubstList(&g_FontSubstListHead);
710
711#if DBG
712 DumpFontInfo(TRUE);
713#endif
714
715 return TRUE;
716}
#define NonPagedPool
Definition: env_spec_w32.h:307
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
static PFAST_MUTEX g_FreeTypeLock
Definition: freetype.c:79
static LIST_ENTRY g_FontListHead
Definition: freetype.c:81
BOOL FASTCALL IntLoadFontSubstList(PLIST_ENTRY pHead)
Definition: freetype.c:525
static UINT g_FontCacheNumEntries
Definition: freetype.c:109
VOID FASTCALL IntLoadSystemFonts(VOID)
Definition: freetype.c:907
static LIST_ENTRY g_FontCacheListHead
Definition: freetype.c:108
static PFAST_MUTEX g_FontListLock
Definition: freetype.c:82
BOOL FASTCALL IntLoadFontsInRegistry(VOID)
Definition: freetype.c:1652
FT_Init_FreeType(FT_Library *alibrary)
Definition: ftinit.c:320
#define TAG_INTERNAL_SYNC
Definition: tags.h:18
FORCEINLINE VOID ExInitializeFastMutex(_Out_ PFAST_MUTEX FastMutex)
Definition: exfuncs.h:274
FAST_MUTEX
Definition: extypes.h:17

Referenced by InitializeGreCSRSS().

◆ IntCharSetFromCodePage()

BYTE FASTCALL IntCharSetFromCodePage ( UINT  uCodePage)

Definition at line 187 of file freetype.c.

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

Referenced by CreateStockFonts().

◆ IntEnableFontRendering()

VOID FASTCALL IntEnableFontRendering ( BOOL  Enable)

Definition at line 1978 of file freetype.c.

1979{
1981}
static BOOL g_RenderingEnabled
Definition: freetype.c:83
_In_ ULONGLONG _In_ ULONGLONG _In_ BOOLEAN Enable
Definition: ntddpcm.h:142

◆ IntGdiAddFontMemResource()

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

Definition at line 1804 of file freetype.c.

1805{
1806 HANDLE Ret = NULL;
1808 PFONT_ENTRY_COLL_MEM EntryCollection;
1809 INT FaceCount;
1810
1812 if (!BufferCopy)
1813 {
1814 *pNumAdded = 0;
1815 return NULL;
1816 }
1817 RtlCopyMemory(BufferCopy, Buffer, dwSize);
1818
1819 LoadFont.pFileName = NULL;
1820 LoadFont.Memory = SharedMem_Create(BufferCopy, dwSize, FALSE);
1821 LoadFont.Characteristics = FR_PRIVATE | FR_NOT_ENUM;
1822 RtlInitUnicodeString(&LoadFont.RegValueName, NULL);
1823 LoadFont.IsTrueType = FALSE;
1824 LoadFont.PrivateEntry = NULL;
1826
1827 RtlFreeUnicodeString(&LoadFont.RegValueName);
1828
1829 /* Release our copy */
1833
1834 if (FaceCount > 0)
1835 {
1836 EntryCollection = ExAllocatePoolWithTag(PagedPool, sizeof(FONT_ENTRY_COLL_MEM), TAG_FONT);
1837 if (EntryCollection)
1838 {
1840 EntryCollection->Entry = LoadFont.PrivateEntry;
1841 IntLockProcessPrivateFonts(Win32Process);
1842 EntryCollection->Handle = ULongToHandle(++Win32Process->PrivateMemFontHandleCount);
1843 InsertTailList(&Win32Process->PrivateMemFontListHead, &EntryCollection->ListEntry);
1844 IntUnLockProcessPrivateFonts(Win32Process);
1845 Ret = EntryCollection->Handle;
1846 }
1847 }
1848 *pNumAdded = FaceCount;
1849
1850 return Ret;
1851}
#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:248
static INT FASTCALL IntGdiLoadFontsFromMemory(PGDI_LOAD_FONT pLoadFont, PSHARED_FACE SharedFace, FT_Long FontIndex, INT CharSetIndex)
Definition: freetype.c:1065
static void SharedMem_Release(PSHARED_MEM Ptr)
Definition: freetype.c:305
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:285
UINT PrivateMemFontHandleCount
Definition: win32.h:286
#define IntLockProcessPrivateFonts(W32Process)
Definition: text.h:147
#define IntUnLockProcessPrivateFonts(W32Process)
Definition: text.h:150
#define TAG_FONT
Definition: tags.h:12

Referenced by NtGdiAddFontMemResourceEx().

◆ IntGdiAddFontResource()

INT FASTCALL IntGdiAddFontResource ( PUNICODE_STRING  FileName,
DWORD  Characteristics 
)

Definition at line 1636 of file freetype.c.

1637{
1638 return IntGdiAddFontResourceEx(FileName, Characteristics, 0);
1639}
INT FASTCALL IntGdiAddFontResourceEx(PUNICODE_STRING FileName, DWORD Characteristics, DWORD dwFlags)
Definition: freetype.c:1437

Referenced by NtGdiAddFontResourceW().

◆ IntGdiAddFontResourceEx()

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

Definition at line 1437 of file freetype.c.

1439{
1442 PVOID Buffer = NULL;
1445 SIZE_T ViewSize = 0, Length;
1446 LARGE_INTEGER SectionSize;
1449 INT FontCount;
1451 UNICODE_STRING PathName;
1452 LPWSTR pszBuffer;
1454 static const UNICODE_STRING TrueTypePostfix = RTL_CONSTANT_STRING(L" (TrueType)");
1455 static const UNICODE_STRING DosPathPrefix = RTL_CONSTANT_STRING(L"\\??\\");
1456
1457 /* Build PathName */
1459 {
1460 Length = DosPathPrefix.Length + FileName->Length + sizeof(UNICODE_NULL);
1462 if (!pszBuffer)
1463 return 0; /* failure */
1464
1465 RtlInitEmptyUnicodeString(&PathName, pszBuffer, Length);
1466 RtlAppendUnicodeStringToString(&PathName, &DosPathPrefix);
1468 }
1469 else
1470 {
1472 if (!NT_SUCCESS(Status))
1473 return 0; /* failure */
1474 }
1475
1476 /* Open the font file */
1480 &FileHandle,
1483 &Iosb,
1486 if (!NT_SUCCESS(Status))
1487 {
1488 DPRINT1("Could not load font file: %wZ\n", &PathName);
1489 RtlFreeUnicodeString(&PathName);
1490 return 0;
1491 }
1492
1495 if (!NT_SUCCESS(Status))
1496 {
1497 DPRINT1("ObReferenceObjectByHandle failed.\n");
1499 RtlFreeUnicodeString(&PathName);
1500 return 0;
1501 }
1502
1503 SectionSize.QuadPart = 0LL;
1506 NULL, &SectionSize, PAGE_READONLY,
1508 if (!NT_SUCCESS(Status))
1509 {
1510 DPRINT1("Could not map file: %wZ\n", &PathName);
1513 RtlFreeUnicodeString(&PathName);
1514 return 0;
1515 }
1517
1519 if (!NT_SUCCESS(Status))
1520 {
1521 DPRINT1("Could not map file: %wZ\n", &PathName);
1524 RtlFreeUnicodeString(&PathName);
1525 return 0;
1526 }
1527
1528 LoadFont.pFileName = &PathName;
1530 LoadFont.Characteristics = Characteristics;
1531 RtlInitUnicodeString(&LoadFont.RegValueName, NULL);
1532 LoadFont.IsTrueType = FALSE;
1533 LoadFont.CharSet = DEFAULT_CHARSET;
1534 LoadFont.PrivateEntry = NULL;
1535 FontCount = IntGdiLoadFontsFromMemory(&LoadFont, NULL, -1, -1);
1536
1537 /* Release our copy */
1541
1543
1545
1546 /* Save the loaded font name into the registry */
1547 if (FontCount > 0 && (dwFlags & AFRX_WRITE_REGISTRY))
1548 {
1549 UNICODE_STRING NewString;
1550 SIZE_T Length;
1551 PWCHAR pszBuffer;
1552 LPCWSTR CharSetName;
1553 if (LoadFont.IsTrueType)
1554 {
1555 /* Append " (TrueType)" */
1556 Length = LoadFont.RegValueName.Length + TrueTypePostfix.Length + sizeof(UNICODE_NULL);
1558 if (pszBuffer)
1559 {
1560 RtlInitEmptyUnicodeString(&NewString, pszBuffer, Length);
1561 NewString.Buffer[0] = UNICODE_NULL;
1562 RtlAppendUnicodeStringToString(&NewString, &LoadFont.RegValueName);
1563 RtlAppendUnicodeStringToString(&NewString, &TrueTypePostfix);
1564 RtlFreeUnicodeString(&LoadFont.RegValueName);
1565 LoadFont.RegValueName = NewString;
1566 }
1567 else
1568 {
1569 // FIXME!
1570 }
1571 }
1572 else if (LoadFont.CharSet != DEFAULT_CHARSET)
1573 {
1574 /* Append " (CharSetName)" */
1575 CharSetName = NameFromCharSet(LoadFont.CharSet);
1576 Length = LoadFont.RegValueName.Length +
1577 (wcslen(CharSetName) + 3) * sizeof(WCHAR) +
1578 sizeof(UNICODE_NULL);
1579
1581 if (pszBuffer)
1582 {
1583 RtlInitEmptyUnicodeString(&NewString, pszBuffer, Length);
1584 NewString.Buffer[0] = UNICODE_NULL;
1585 RtlAppendUnicodeStringToString(&NewString, &LoadFont.RegValueName);
1586 RtlAppendUnicodeToString(&NewString, L" (");
1587 RtlAppendUnicodeToString(&NewString, CharSetName);
1588 RtlAppendUnicodeToString(&NewString, L")");
1589 RtlFreeUnicodeString(&LoadFont.RegValueName);
1590 LoadFont.RegValueName = NewString;
1591 }
1592 else
1593 {
1594 // FIXME!
1595 }
1596 }
1597
1600 NULL, NULL);
1601 Status = ZwOpenKey(&KeyHandle, KEY_WRITE, &ObjectAttributes);
1602 if (NT_SUCCESS(Status))
1603 {
1605 LPWSTR pFileName;
1606
1608 {
1609 pFileName = PathName.Buffer;
1610 }
1611 else
1612 {
1613 pFileName = wcsrchr(PathName.Buffer, L'\\');
1614 }
1615
1616 if (pFileName)
1617 {
1619 {
1620 pFileName++;
1621 }
1622 DataSize = (wcslen(pFileName) + 1) * sizeof(WCHAR);
1623 ZwSetValueKey(KeyHandle, &LoadFont.RegValueName, 0, REG_SZ,
1624 pFileName, DataSize);
1625 }
1627 }
1628 }
1629 RtlFreeUnicodeString(&LoadFont.RegValueName);
1630
1631 RtlFreeUnicodeString(&PathName);
1632 return FontCount;
1633}
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:845
static UNICODE_STRING g_FontRegPath
Definition: freetype.c:73
static LPCWSTR FASTCALL NameFromCharSet(BYTE CharSet)
Definition: freetype.c:1403
#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:4447
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:4620
#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 1926 of file freetype.c.

1927{
1930 PFONT_ENTRY_COLL_MEM EntryCollection;
1931
1932 DPRINT("IntGdiCleanupPrivateFontsForProcess()\n");
1933 do {
1934 Entry = NULL;
1935 EntryCollection = NULL;
1936
1937 IntLockProcessPrivateFonts(Win32Process);
1938 if (!IsListEmpty(&Win32Process->PrivateMemFontListHead))
1939 {
1940 Entry = Win32Process->PrivateMemFontListHead.Flink;
1941 EntryCollection = CONTAINING_RECORD(Entry, FONT_ENTRY_COLL_MEM, ListEntry);
1942 UnlinkFontMemCollection(EntryCollection);
1943 }
1944 IntUnLockProcessPrivateFonts(Win32Process);
1945
1946 if (EntryCollection)
1947 {
1948 IntGdiCleanupMemEntry(EntryCollection->Entry);
1949 ExFreePoolWithTag(EntryCollection, TAG_FONT);
1950 }
1951 else
1952 {
1953 /* No Mem fonts anymore, see if we have any other private fonts left */
1954 Entry = NULL;
1955 IntLockProcessPrivateFonts(Win32Process);
1956 if (!IsListEmpty(&Win32Process->PrivateFontListHead))
1957 {
1958 Entry = RemoveHeadList(&Win32Process->PrivateFontListHead);
1959 }
1960 IntUnLockProcessPrivateFonts(Win32Process);
1961
1962 if (Entry)
1963 {
1965 }
1966 }
1967
1968 } while (Entry);
1969}
#define IsListEmpty(ListHead)
Definition: env_spec_w32.h:954
#define RemoveHeadList(ListHead)
Definition: env_spec_w32.h:964
VOID FASTCALL IntGdiCleanupMemEntry(PFONT_ENTRY_MEM Head)
Definition: freetype.c:1856
static VOID FASTCALL UnlinkFontMemCollection(PFONT_ENTRY_COLL_MEM Collection)
Definition: freetype.c:1875
static __inline VOID FASTCALL CleanupFontEntry(PFONT_ENTRY FontEntry)
Definition: freetype.c:377
base of all file and directory entries
Definition: entries.h:83
Definition: typedefs.h:120
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
LIST_ENTRY PrivateFontListHead
Definition: win32.h:284
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

Referenced by GdiProcessDestroy().

◆ IntGdiGetFontResourceInfo()

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

Definition at line 5343 of file freetype.c.

5348{
5349 UNICODE_STRING EntryFileName;
5350 POBJECT_NAME_INFORMATION NameInfo1 = NULL, NameInfo2 = NULL;
5351 PLIST_ENTRY ListEntry;
5352 PFONT_ENTRY FontEntry;
5353 ULONG Size, i, Count;
5354 LPBYTE pbBuffer;
5355 BOOL IsEqual;
5356 FONTFAMILYINFO *FamInfo;
5357 const ULONG MaxFamInfo = 64;
5358 const ULONG MAX_FAM_INFO_BYTES = sizeof(FONTFAMILYINFO) * MaxFamInfo;
5359 BOOL bSuccess;
5360 const ULONG NAMEINFO_SIZE = sizeof(OBJECT_NAME_INFORMATION) + MAX_PATH * sizeof(WCHAR);
5361
5362 DPRINT("IntGdiGetFontResourceInfo: dwType == %lu\n", dwType);
5363
5364 do
5365 {
5366 /* Create buffer for full path name */
5367 NameInfo1 = ExAllocatePoolWithTag(PagedPool, NAMEINFO_SIZE, TAG_FINF);
5368 if (!NameInfo1)
5369 break;
5370
5371 /* Get the full path name */
5372 if (!IntGetFullFileName(NameInfo1, NAMEINFO_SIZE, FileName))
5373 break;
5374
5375 /* Create a buffer for the entries' names */
5376 NameInfo2 = ExAllocatePoolWithTag(PagedPool, NAMEINFO_SIZE, TAG_FINF);
5377 if (!NameInfo2)
5378 break;
5379
5380 FamInfo = ExAllocatePoolWithTag(PagedPool, MAX_FAM_INFO_BYTES, TAG_FINF);
5381 } while (0);
5382
5383 if (!NameInfo1 || !NameInfo2 || !FamInfo)
5384 {
5385 if (NameInfo2)
5386 ExFreePoolWithTag(NameInfo2, TAG_FINF);
5387
5388 if (NameInfo1)
5389 ExFreePoolWithTag(NameInfo1, TAG_FINF);
5390
5392 return FALSE;
5393 }
5394
5395 Count = 0;
5396
5397 /* Try to find the pathname in the global font list */
5399 for (ListEntry = g_FontListHead.Flink; ListEntry != &g_FontListHead;
5400 ListEntry = ListEntry->Flink)
5401 {
5402 FontEntry = CONTAINING_RECORD(ListEntry, FONT_ENTRY, ListEntry);
5403 if (FontEntry->Font->Filename == NULL)
5404 continue;
5405
5406 RtlInitUnicodeString(&EntryFileName , FontEntry->Font->Filename);
5407 if (!IntGetFullFileName(NameInfo2, NAMEINFO_SIZE, &EntryFileName))
5408 continue;
5409
5410 if (!RtlEqualUnicodeString(&NameInfo1->Name, &NameInfo2->Name, FALSE))
5411 continue;
5412
5413 IsEqual = FALSE;
5414 FontFamilyFillInfo(&FamInfo[Count], FontEntry->FaceName.Buffer,
5415 NULL, FontEntry->Font);
5416 for (i = 0; i < Count; ++i)
5417 {
5418 if (EqualFamilyInfo(&FamInfo[i], &FamInfo[Count]))
5419 {
5420 IsEqual = TRUE;
5421 break;
5422 }
5423 }
5424 if (!IsEqual)
5425 {
5426 /* Found */
5427 ++Count;
5428 if (Count >= MaxFamInfo)
5429 break;
5430 }
5431 }
5433
5434 /* Free the buffers */
5435 ExFreePoolWithTag(NameInfo1, TAG_FINF);
5436 ExFreePoolWithTag(NameInfo2, TAG_FINF);
5437
5438 if (Count == 0 && dwType != 5)
5439 {
5440 /* Font could not be found in system table
5441 dwType == 5 will still handle this */
5442 ExFreePoolWithTag(FamInfo, TAG_FINF);
5443 return FALSE;
5444 }
5445
5446 bSuccess = FALSE;
5447 switch (dwType)
5448 {
5449 case 0: /* FIXME: Returns 1 or 2, don't know what this is atm */
5450 Size = sizeof(DWORD);
5451 if (*pdwBytes == 0)
5452 {
5453 *pdwBytes = Size;
5454 bSuccess = TRUE;
5455 }
5456 else if (pBuffer)
5457 {
5458 if (*pdwBytes >= Size)
5459 {
5460 *(DWORD*)pBuffer = Count;
5461 }
5462 *pdwBytes = Size;
5463 bSuccess = TRUE;
5464 }
5465 break;
5466
5467 case 1: /* copy the font title */
5468 /* calculate the required size */
5469 Size = 0;
5470 for (i = 0; i < Count; ++i)
5471 {
5472 if (i > 0)
5473 Size += 3; /* " & " */
5474 Size += wcslen(FamInfo[i].EnumLogFontEx.elfLogFont.lfFaceName);
5475 if (FamInfo[i].EnumLogFontEx.elfStyle[0] &&
5476 _wcsicmp(FamInfo[i].EnumLogFontEx.elfStyle, L"Regular") != 0)
5477 {
5478 Size += 1 + wcslen(FamInfo[i].EnumLogFontEx.elfStyle);
5479 }
5480 }
5481 Size += 2; /* "\0\0" */
5482 Size *= sizeof(WCHAR);
5483
5484 if (*pdwBytes == 0)
5485 {
5486 *pdwBytes = Size;
5487 bSuccess = TRUE;
5488 }
5489 else if (pBuffer)
5490 {
5491 if (*pdwBytes >= Size)
5492 {
5493 /* store font title to buffer */
5494 WCHAR *psz = pBuffer;
5495 *psz = 0;
5496 for (i = 0; i < Count; ++i)
5497 {
5498 if (i > 0)
5499 wcscat(psz, L" & ");
5500 IntAddNameFromFamInfo(psz, &FamInfo[i]);
5501 }
5502 psz[wcslen(psz) + 1] = UNICODE_NULL;
5503 *pdwBytes = Size;
5504 bSuccess = TRUE;
5505 }
5506 else
5507 {
5508 *pdwBytes = 1024; /* this is confirmed value */
5509 }
5510 }
5511 break;
5512
5513 case 2: /* Copy an array of LOGFONTW */
5514 Size = Count * sizeof(LOGFONTW);
5515 if (*pdwBytes == 0)
5516 {
5517 *pdwBytes = Size;
5518 bSuccess = TRUE;
5519 }
5520 else if (pBuffer)
5521 {
5522 if (*pdwBytes >= Size)
5523 {
5524 pbBuffer = (LPBYTE)pBuffer;
5525 for (i = 0; i < Count; ++i)
5526 {
5527 FamInfo[i].EnumLogFontEx.elfLogFont.lfWidth = 0;
5528 RtlCopyMemory(pbBuffer, &FamInfo[i].EnumLogFontEx.elfLogFont, sizeof(LOGFONTW));
5529 pbBuffer += sizeof(LOGFONTW);
5530 }
5531 }
5532 *pdwBytes = Size;
5533 bSuccess = TRUE;
5534 }
5535 else
5536 {
5537 *pdwBytes = 1024; /* this is confirmed value */
5538 }
5539 break;
5540
5541 case 3:
5542 Size = sizeof(DWORD);
5543 if (*pdwBytes == 0)
5544 {
5545 *pdwBytes = Size;
5546 bSuccess = TRUE;
5547 }
5548 else if (pBuffer)
5549 {
5550 if (*pdwBytes >= Size)
5551 {
5552 /* FIXME: What exactly is copied here? */
5553 *(DWORD*)pBuffer = 1;
5554 }
5555 *pdwBytes = Size;
5556 bSuccess = TRUE;
5557 }
5558 break;
5559
5560 case 4: /* full file path */
5561 if (FileName->Length >= 4 * sizeof(WCHAR))
5562 {
5563 /* The beginning of FileName is \??\ */
5564 LPWSTR pch = FileName->Buffer + 4;
5565 DWORD Length = FileName->Length - 4 * sizeof(WCHAR);
5566
5567 Size = Length + sizeof(WCHAR);
5568 if (*pdwBytes == 0)
5569 {
5570 *pdwBytes = Size;
5571 bSuccess = TRUE;
5572 }
5573 else if (pBuffer)
5574 {
5575 if (*pdwBytes >= Size)
5576 {
5578 }
5579 *pdwBytes = Size;
5580 bSuccess = TRUE;
5581 }
5582 }
5583 break;
5584
5585 case 5: /* Looks like a BOOL that is copied, TRUE, if the font was not found */
5586 Size = sizeof(BOOL);
5587 if (*pdwBytes == 0)
5588 {
5589 *pdwBytes = Size;
5590 bSuccess = TRUE;
5591 }
5592 else if (pBuffer)
5593 {
5594 if (*pdwBytes >= Size)
5595 {
5596 *(BOOL*)pBuffer = Count == 0;
5597 }
5598 *pdwBytes = Size;
5599 bSuccess = TRUE;
5600 }
5601 break;
5602 }
5603 ExFreePoolWithTag(FamInfo, TAG_FINF);
5604
5605 return bSuccess;
5606}
#define MAX_PATH
Definition: compat.h:34
static BOOLEAN bSuccess
Definition: drive.cpp:433
@ IsEqual
Definition: fatprocs.h:1886
static BOOL FASTCALL IntGetFullFileName(POBJECT_NAME_INFORMATION NameInfo, ULONG Size, PUNICODE_STRING FileName)
Definition: freetype.c:5266
static BOOL EqualFamilyInfo(const FONTFAMILYINFO *pInfo1, const FONTFAMILYINFO *pInfo2)
Definition: freetype.c:5309
static void FASTCALL FontFamilyFillInfo(PFONTFAMILYINFO Info, LPCWSTR FaceName, LPCWSTR FullName, PFONTGDI FontGDI)
Definition: freetype.c:2778
#define IntUnLockGlobalFonts()
Definition: freetype.c:88
static VOID IntAddNameFromFamInfo(LPWSTR psz, FONTFAMILYINFO *FamInfo)
Definition: freetype.c:5330
#define IntLockGlobalFonts()
Definition: freetype.c:85
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
Definition: font.h:5
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 1892 of file freetype.c.

1893{
1895 PFONT_ENTRY_COLL_MEM CurrentEntry;
1896 PFONT_ENTRY_COLL_MEM EntryCollection = NULL;
1898
1899 IntLockProcessPrivateFonts(Win32Process);
1900 for (Entry = Win32Process->PrivateMemFontListHead.Flink;
1901 Entry != &Win32Process->PrivateMemFontListHead;
1902 Entry = Entry->Flink)
1903 {
1904 CurrentEntry = CONTAINING_RECORD(Entry, FONT_ENTRY_COLL_MEM, ListEntry);
1905
1906 if (CurrentEntry->Handle == hMMFont)
1907 {
1908 EntryCollection = CurrentEntry;
1909 UnlinkFontMemCollection(CurrentEntry);
1910 break;
1911 }
1912 }
1913 IntUnLockProcessPrivateFonts(Win32Process);
1914
1915 if (EntryCollection)
1916 {
1917 IntGdiCleanupMemEntry(EntryCollection->Entry);
1918 ExFreePoolWithTag(EntryCollection, TAG_FONT);
1919 return TRUE;
1920 }
1921 return FALSE;
1922}

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:4331
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 
)

Definition at line 2413 of file freetype.c.

2416{
2417 TT_OS2 *pOS2;
2418 TT_HoriHeader *pHori;
2419 TT_Postscript *pPost;
2420 FT_Fixed XScale, YScale;
2421 FT_WinFNT_HeaderRec WinFNT;
2423 BYTE *pb;
2424 FONT_NAMES FontNames;
2425 PSHARED_FACE SharedFace = FontGDI->SharedFace;
2427 FT_Face Face = SharedFace->Face;
2428
2430 {
2431 Cache = &SharedFace->EnglishUS;
2432 }
2433 else
2434 {
2435 Cache = &SharedFace->UserLanguage;
2436 }
2437
2438 if (Size == 0 && Cache->OutlineRequiredSize > 0)
2439 {
2440 ASSERT(Otm == NULL);
2441 return Cache->OutlineRequiredSize;
2442 }
2443
2444 IntInitFontNames(&FontNames, SharedFace);
2445 Cache->OutlineRequiredSize = FontNames.OtmSize;
2446
2447 if (Size == 0)
2448 {
2449 ASSERT(Otm == NULL);
2450 IntFreeFontNames(&FontNames);
2451 return Cache->OutlineRequiredSize;
2452 }
2453
2454 ASSERT(Otm != NULL);
2455
2456 if (Size < Cache->OutlineRequiredSize)
2457 {
2458 DPRINT1("Size %u < OutlineRequiredSize %u\n", Size,
2459 Cache->OutlineRequiredSize);
2460 IntFreeFontNames(&FontNames);
2461 return 0; /* failure */
2462 }
2463
2464 XScale = Face->size->metrics.x_scale;
2465 YScale = Face->size->metrics.y_scale;
2466
2468
2469 pOS2 = FT_Get_Sfnt_Table(Face, FT_SFNT_OS2);
2470 pHori = FT_Get_Sfnt_Table(Face, FT_SFNT_HHEA);
2471 pPost = FT_Get_Sfnt_Table(Face, FT_SFNT_POST); /* We can live with this failing */
2472 Error = FT_Get_WinFNT_Header(Face, &WinFNT);
2473
2474 if (pOS2 == NULL && Error)
2475 {
2477 DPRINT1("Can't find OS/2 table - not TT font?\n");
2478 IntFreeFontNames(&FontNames);
2479 return 0;
2480 }
2481
2482 if (pHori == NULL && Error)
2483 {
2485 DPRINT1("Can't find HHEA table - not TT font?\n");
2486 IntFreeFontNames(&FontNames);
2487 return 0;
2488 }
2489
2490 Otm->otmSize = Cache->OutlineRequiredSize;
2491
2492 FillTM(&Otm->otmTextMetrics, FontGDI, pOS2, pHori, !Error ? &WinFNT : 0);
2493
2494 if (!pOS2)
2495 goto skip_os2;
2496
2497 Otm->otmFiller = 0;
2499 Otm->otmfsSelection = pOS2->fsSelection;
2500 Otm->otmfsType = pOS2->fsType;
2501 Otm->otmsCharSlopeRise = pHori->caret_Slope_Rise;
2502 Otm->otmsCharSlopeRun = pHori->caret_Slope_Run;
2503 Otm->otmItalicAngle = 0; /* POST table */
2504 Otm->otmEMSquare = Face->units_per_EM;
2505
2506#define SCALE_X(value) ((FT_MulFix((value), XScale) + 32) >> 6)
2507#define SCALE_Y(value) ((FT_MulFix((value), YScale) + 32) >> 6)
2508
2509 Otm->otmAscent = SCALE_Y(pOS2->sTypoAscender);
2510 Otm->otmDescent = SCALE_Y(pOS2->sTypoDescender);
2511 Otm->otmLineGap = SCALE_Y(pOS2->sTypoLineGap);
2512 Otm->otmsCapEmHeight = SCALE_Y(pOS2->sCapHeight);
2513 Otm->otmsXHeight = SCALE_Y(pOS2->sxHeight);
2514 Otm->otmrcFontBox.left = SCALE_X(Face->bbox.xMin);
2515 Otm->otmrcFontBox.right = SCALE_X(Face->bbox.xMax);
2516 Otm->otmrcFontBox.top = SCALE_Y(Face->bbox.yMax);
2517 Otm->otmrcFontBox.bottom = SCALE_Y(Face->bbox.yMin);
2520 Otm->otmMacLineGap = Otm->otmLineGap;
2521 Otm->otmusMinimumPPEM = 0; /* TT Header */
2532
2533 if (!pPost)
2534 {
2535 Otm->otmsUnderscoreSize = 0;
2536 Otm->otmsUnderscorePosition = 0;
2537 }
2538 else
2539 {
2542 }
2543
2544#undef SCALE_X
2545#undef SCALE_Y
2546
2547skip_os2:
2549
2550 pb = IntStoreFontNames(&FontNames, Otm);
2551 ASSERT(pb - (BYTE*)Otm == Cache->OutlineRequiredSize);
2552
2553 IntFreeFontNames(&FontNames);
2554
2555 return Cache->OutlineRequiredSize;
2556}
#define SCALE_Y(value)
static __inline void FASTCALL IntInitFontNames(FONT_NAMES *Names, PSHARED_FACE SharedFace)
Definition: freetype.c:2340
static __inline BYTE *FASTCALL IntStoreFontNames(const FONT_NAMES *Names, OUTLINETEXTMETRICW *Otm)
Definition: freetype.c:2376
#define SCALE_X(value)
static __inline void FASTCALL IntFreeFontNames(FONT_NAMES *Names)
Definition: freetype.c:2400
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:2336
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 1972 of file freetype.c.

1973{
1974 return (gpsi->BitsPixel > 8) && g_RenderingEnabled;
1975}
PSERVERINFO gpsi
Definition: imm.c:18

Referenced by IntExtTextOutW(), and TextIntGetTextExtentPoint().

◆ IntLoadFontsInRegistry()

BOOL FASTCALL IntLoadFontsInRegistry ( VOID  )

Definition at line 1652 of file freetype.c.

1653{
1657 KEY_FULL_INFORMATION KeyFullInfo;
1658 ULONG i, Length;
1659 UNICODE_STRING FontTitleW, FileNameW;
1660 SIZE_T InfoSize;
1661 LPBYTE InfoBuffer;
1663 LPWSTR pchPath;
1665 INT nFontCount = 0;
1666 DWORD dwFlags;
1667
1668 /* open registry key */
1671 NULL, NULL);
1672 Status = ZwOpenKey(&KeyHandle, KEY_READ, &ObjectAttributes);
1673 if (!NT_SUCCESS(Status))
1674 {
1675 DPRINT1("ZwOpenKey failed: 0x%08X\n", Status);
1676 return FALSE; /* failure */
1677 }
1678
1679 /* query count of values */
1680 Status = ZwQueryKey(KeyHandle, KeyFullInformation,
1681 &KeyFullInfo, sizeof(KeyFullInfo), &Length);
1682 if (!NT_SUCCESS(Status))
1683 {
1684 DPRINT1("ZwQueryKey failed: 0x%08X\n", Status);
1686 return FALSE; /* failure */
1687 }
1688
1689 /* allocate buffer */
1690 InfoSize = (MAX_PATH + 256) * sizeof(WCHAR);
1691 InfoBuffer = ExAllocatePoolWithTag(PagedPool, InfoSize, TAG_FONT);
1692 if (!InfoBuffer)
1693 {
1694 DPRINT1("ExAllocatePoolWithTag failed\n");
1696 return FALSE;
1697 }
1698
1699 /* for each value */
1700 for (i = 0; i < KeyFullInfo.Values; ++i)
1701 {
1702 /* get value name */
1703 Status = ZwEnumerateValueKey(KeyHandle, i, KeyValueFullInformation,
1704 InfoBuffer, InfoSize, &Length);
1706 {
1707 /* too short buffer */
1708 ExFreePoolWithTag(InfoBuffer, TAG_FONT);
1709 InfoSize *= 2;
1710 InfoBuffer = ExAllocatePoolWithTag(PagedPool, InfoSize, TAG_FONT);
1711 if (!InfoBuffer)
1712 {
1713 DPRINT1("ExAllocatePoolWithTag failed\n");
1714 break;
1715 }
1716 /* try again */
1717 Status = ZwEnumerateValueKey(KeyHandle, i, KeyValueFullInformation,
1718 InfoBuffer, InfoSize, &Length);
1719 }
1720 if (!NT_SUCCESS(Status))
1721 {
1722 DPRINT1("ZwEnumerateValueKey failed: 0x%08X\n", Status);
1723 break; /* failure */
1724 }
1725
1726 /* create FontTitleW string */
1727 pInfo = (PKEY_VALUE_FULL_INFORMATION)InfoBuffer;
1728 Length = pInfo->NameLength / sizeof(WCHAR);
1729 pInfo->Name[Length] = UNICODE_NULL; /* truncate */
1730 if (!RtlCreateUnicodeString(&FontTitleW, pInfo->Name))
1731 {
1733 DPRINT1("RtlCreateUnicodeString failed\n");
1734 break; /* failure */
1735 }
1736
1737 /* query value */
1738 Status = ZwQueryValueKey(KeyHandle, &FontTitleW, KeyValueFullInformation,
1739 InfoBuffer, InfoSize, &Length);
1741 {
1742 /* too short buffer */
1743 ExFreePoolWithTag(InfoBuffer, TAG_FONT);
1744 InfoSize *= 2;
1745 InfoBuffer = ExAllocatePoolWithTag(PagedPool, InfoSize, TAG_FONT);
1746 if (!InfoBuffer)
1747 {
1748 DPRINT1("ExAllocatePoolWithTag failed\n");
1749 break;
1750 }
1751 /* try again */
1752 Status = ZwQueryValueKey(KeyHandle, &FontTitleW, KeyValueFullInformation,
1753 InfoBuffer, InfoSize, &Length);
1754 }
1755 pInfo = (PKEY_VALUE_FULL_INFORMATION)InfoBuffer;
1756 if (!NT_SUCCESS(Status) || !pInfo->DataLength)
1757 {
1758 DPRINT1("ZwQueryValueKey failed: 0x%08X\n", Status);
1759 RtlFreeUnicodeString(&FontTitleW);
1760 break; /* failure */
1761 }
1762
1763 /* Build pchPath */
1764 pchPath = (LPWSTR)((PUCHAR)pInfo + pInfo->DataOffset);
1765 Length = pInfo->DataLength / sizeof(WCHAR);
1766 pchPath[Length] = UNICODE_NULL; /* truncate */
1767
1768 /* Load font(s) without writing registry */
1769 if (PathIsRelativeW(pchPath))
1770 {
1771 dwFlags = 0;
1773 L"\\SystemRoot\\Fonts\\%s", pchPath);
1774 }
1775 else
1776 {
1778 Status = RtlStringCbCopyW(szPath, sizeof(szPath), pchPath);
1779 }
1780
1781 if (NT_SUCCESS(Status))
1782 {
1783 RtlCreateUnicodeString(&FileNameW, szPath);
1784 nFontCount += IntGdiAddFontResourceEx(&FileNameW, 0, dwFlags);
1785 RtlFreeUnicodeString(&FileNameW);
1786 }
1787
1788 RtlFreeUnicodeString(&FontTitleW);
1789 }
1790
1791 /* close now */
1793
1794 /* free memory block */
1795 if (InfoBuffer)
1796 {
1797 ExFreePoolWithTag(InfoBuffer, TAG_FONT);
1798 }
1799
1800 return (KeyFullInfo.Values != 0 && nFontCount != 0);
1801}
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
BOOL WINAPI PathIsRelativeW(LPCWSTR lpszPath)
Definition: freetype.c:1642
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 907 of file freetype.c.

908{
910 UNICODE_STRING Directory, FileName, TempString;
912 HANDLE hDirectory;
913 BYTE *DirInfoBuffer;
915 BOOLEAN bRestartScan = TRUE;
917 INT i;
918 static UNICODE_STRING SearchPatterns[] =
919 {
920 RTL_CONSTANT_STRING(L"*.ttf"),
921 RTL_CONSTANT_STRING(L"*.ttc"),
922 RTL_CONSTANT_STRING(L"*.otf"),
923 RTL_CONSTANT_STRING(L"*.otc"),
924 RTL_CONSTANT_STRING(L"*.fon"),
925 RTL_CONSTANT_STRING(L"*.fnt")
926 };
927 static UNICODE_STRING IgnoreFiles[] =
928 {
931 };
932
933 RtlInitUnicodeString(&Directory, L"\\SystemRoot\\Fonts\\");
934
937 &Directory,
939 NULL,
940 NULL);
941
943 &hDirectory,
946 &Iosb,
949
950 if (NT_SUCCESS(Status))
951 {
952 for (i = 0; i < _countof(SearchPatterns); ++i)
953 {
954 DirInfoBuffer = ExAllocatePoolWithTag(PagedPool, 0x4000, TAG_FONT);
955 if (DirInfoBuffer == NULL)
956 {
957 ZwClose(hDirectory);
958 return;
959 }
960
962 if (FileName.Buffer == NULL)
963 {
964 ExFreePoolWithTag(DirInfoBuffer, TAG_FONT);
965 ZwClose(hDirectory);
966 return;
967 }
968 FileName.Length = 0;
969 FileName.MaximumLength = MAX_PATH * sizeof(WCHAR);
970
971 while (1)
972 {
973 Status = ZwQueryDirectoryFile(
974 hDirectory,
975 NULL,
976 NULL,
977 NULL,
978 &Iosb,
979 DirInfoBuffer,
980 0x4000,
982 FALSE,
983 &SearchPatterns[i],
984 bRestartScan);
985
987 {
988 break;
989 }
990
991 DirInfo = (PFILE_DIRECTORY_INFORMATION)DirInfoBuffer;
992 while (1)
993 {
994 SIZE_T ign;
995
996 TempString.Buffer = DirInfo->FileName;
997 TempString.Length = TempString.MaximumLength = DirInfo->FileNameLength;
998
999 /* Should we ignore this file? */
1000 for (ign = 0; ign < _countof(IgnoreFiles); ++ign)
1001 {
1002 /* Yes.. */
1003 if (RtlEqualUnicodeString(IgnoreFiles + ign, &TempString, FALSE))
1004 break;
1005 }
1006
1007 /* If we tried all Ignore patterns and there was no match, try to create a font */
1008 if (ign == _countof(IgnoreFiles))
1009 {
1013 {
1014 DPRINT1("ERR: Failed to load %wZ\n", &FileName);
1015 }
1016 }
1017
1018 if (DirInfo->NextEntryOffset == 0)
1019 break;
1020
1021 DirInfo = (PFILE_DIRECTORY_INFORMATION)((ULONG_PTR)DirInfo + DirInfo->NextEntryOffset);
1022 }
1023
1024 bRestartScan = FALSE;
1025 }
1026
1028 ExFreePoolWithTag(DirInfoBuffer, TAG_FONT);
1029 }
1030 ZwClose(hDirectory);
1031 }
1032}
@ IgnoreFiles
Definition: ACListISF.cpp:75
unsigned char BOOLEAN
#define FILE_DIRECTORY_FILE
Definition: constants.h:491
struct _FileName FileName
Definition: fatprocs.h:896
@ 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:68
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 2006 of file freetype.c.

2007{
2008 PLFONT plfont;
2009 LOGFONTW *plf;
2010
2011 ASSERT(lf);
2012 plfont = LFONT_AllocFontWithHandle();
2013 if (!plfont)
2014 {
2015 return STATUS_NO_MEMORY;
2016 }
2017
2018 ExInitializePushLock(&plfont->lock);
2019 *NewFont = plfont->BaseObject.hHmgr;
2020 plf = &plfont->logfont.elfEnumLogfontEx.elfLogFont;
2021 RtlCopyMemory(plf, lf, sizeof(LOGFONTW));
2022 if (lf->lfEscapement != lf->lfOrientation)
2023 {
2024 /* This should really depend on whether GM_ADVANCED is set */
2025 plf->lfOrientation = plf->lfEscapement;
2026 }
2027 LFONT_UnlockFont(plfont);
2028
2029 return STATUS_SUCCESS;
2030}
HGDIOBJ hHmgr(VOID)
Definition: baseobj.hpp:95
#define ExInitializePushLock
Definition: ex.h:1013
#define STATUS_NO_MEMORY
Definition: ntstatus.h:260
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 4215 of file freetype.c.

4224{
4225 PFONTGDI FontGDI;
4226 FT_BitmapGlyph realglyph;
4227 INT glyph_index, i, previous, nTenthsOfDegrees;
4228 ULONGLONG TotalWidth64 = 0;
4229 LOGFONTW *plf;
4230 BOOL use_kerning, bVerticalWriting;
4231 LONG ascender, descender;
4233 DWORD ch0, ch1;
4234
4235 FontGDI = ObjToGDI(TextObj->Font, FONT);
4236
4237 Cache.Hashed.Face = FontGDI->SharedFace->Face;
4238 if (NULL != Fit)
4239 {
4240 *Fit = 0;
4241 }
4242
4243 plf = &TextObj->logfont.elfEnumLogfontEx.elfLogFont;
4244 Cache.Hashed.lfHeight = plf->lfHeight;
4245 Cache.Hashed.lfWidth = plf->lfWidth;
4246 Cache.Hashed.Aspect.Emu.Bold = EMUBOLD_NEEDED(FontGDI->OriginalWeight, plf->lfWeight);
4247 Cache.Hashed.Aspect.Emu.Italic = (plf->lfItalic && !FontGDI->OriginalItalic);
4248
4249 // Check vertical writing (tategaki)
4250 nTenthsOfDegrees = IntNormalizeAngle(plf->lfEscapement - plf->lfOrientation);
4251 bVerticalWriting = ((nTenthsOfDegrees == 90 * 10) || (nTenthsOfDegrees == 270 * 10));
4252
4254 Cache.Hashed.Aspect.RenderMode = (BYTE)IntGetFontRenderMode(plf);
4255 else
4256 Cache.Hashed.Aspect.RenderMode = (BYTE)FT_RENDER_MODE_MONO;
4257
4258 // NOTE: GetTextExtentPoint32 simply ignores lfEscapement and XFORM.
4260 TextIntUpdateSize(dc, TextObj, FontGDI, FALSE);
4261 Cache.Hashed.matTransform = identityMat;
4262 FT_Set_Transform(Cache.Hashed.Face, NULL, NULL);
4263
4264 use_kerning = FT_HAS_KERNING(Cache.Hashed.Face);
4265 previous = 0;
4266
4267 for (i = 0; i < Count; i++)
4268 {
4269 ch0 = *String++;
4270 if (IS_HIGH_SURROGATE(ch0))
4271 {
4272 ++i;
4273 if (i >= Count)
4274 break;
4275
4276 ch1 = *String++;
4277 if (IS_LOW_SURROGATE(ch1))
4278 ch0 = Utf32FromSurrogatePair(ch0, ch1);
4279 }
4280
4281 glyph_index = get_glyph_index_flagged(Cache.Hashed.Face, ch0, GTEF_INDICES, fl);
4282 Cache.Hashed.GlyphIndex = glyph_index;
4283
4284 realglyph = IntGetRealGlyph(&Cache);
4285 if (!realglyph)
4286 break;
4287
4288 /* Retrieve kerning distance */
4289 if (use_kerning && previous && glyph_index)
4290 {
4291 FT_Vector delta;
4292 FT_Get_Kerning(Cache.Hashed.Face, previous, glyph_index, 0, &delta);
4293 TotalWidth64 += delta.x;
4294 }
4295
4296 TotalWidth64 += realglyph->root.advance.x >> 10;
4297
4298 if (((TotalWidth64 + 32) >> 6) <= MaxExtent && NULL != Fit)
4299 {
4300 *Fit = i + 1;
4301 }
4302 if (NULL != Dx)
4303 {
4304 Dx[i] = (TotalWidth64 + 32) >> 6;
4305 }
4306
4307 previous = glyph_index;
4308 }
4309 ASSERT(FontGDI->Magic == FONTGDI_MAGIC);
4310 ascender = FontGDI->tmAscent; /* Units above baseline */
4311 descender = FontGDI->tmDescent; /* Units below baseline */
4313
4314 if (bVerticalWriting)
4315 {
4316 Size->cx = ascender + descender;
4317 Size->cy = (TotalWidth64 + 32) >> 6;
4318 }
4319 else
4320 {
4321 Size->cx = (TotalWidth64 + 32) >> 6;
4322 Size->cy = ascender + descender;
4323 }
4324
4325 return TRUE;
4326}
#define FONTGDI_MAGIC
Definition: engobjects.h:171
#define IS_HIGH_SURROGATE(ch0)
Definition: freetype.c:44
static DWORD Utf32FromSurrogatePair(DWORD ch0, DWORD ch1)
Definition: freetype.c:48
#define IS_LOW_SURROGATE(ch1)
Definition: freetype.c:45
#define EMUBOLD_NEEDED(original, request)
Definition: freetype.c:59
static LONG IntNormalizeAngle(LONG nTenthsOfDegrees)
Definition: freetype.c:718
static FT_BitmapGlyph IntGetRealGlyph(IN OUT PFONT_CACHE_ENTRY Cache)
Definition: freetype.c:4175
BOOL FASTCALL IntIsFontRenderingEnabled(VOID)
Definition: freetype.c:1972
FT_Render_Mode FASTCALL IntGetFontRenderMode(LOGFONTW *logfont)
Definition: freetype.c:1984
@ 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
Definition: font.h:56
uint64_t ULONGLONG
Definition: typedefs.h:67

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

◆ TextIntRealizeFont()

NTSTATUS FASTCALL TextIntRealizeFont ( HFONT  FontHandle,
PTEXTOBJ  pTextObj 
)

Definition at line 5156 of file freetype.c.

5157{
5159 PTEXTOBJ TextObj;
5160 PPROCESSINFO Win32Process;
5161 ULONG MatchPenalty;
5162 LOGFONTW *pLogFont;
5163 LOGFONTW SubstitutedLogFont;
5164
5165 if (!pTextObj)
5166 {
5167 TextObj = TEXTOBJ_LockText(FontHandle);
5168 if (NULL == TextObj)
5169 {
5170 return STATUS_INVALID_HANDLE;
5171 }
5172
5173 if (TextObj->fl & TEXTOBJECT_INIT)
5174 {
5175 TEXTOBJ_UnlockText(TextObj);
5176 return STATUS_SUCCESS;
5177 }
5178 }
5179 else
5180 {
5181 TextObj = pTextObj;
5182 }
5183
5184 pLogFont = &TextObj->logfont.elfEnumLogfontEx.elfLogFont;
5185
5186 /* substitute */
5187 SubstitutedLogFont = *pLogFont;
5188 DPRINT("Font '%S,%u' is substituted by: ", pLogFont->lfFaceName, pLogFont->lfCharSet);
5189 SubstituteFontRecurse(&SubstitutedLogFont);
5190 DPRINT("'%S,%u'.\n", SubstitutedLogFont.lfFaceName, SubstitutedLogFont.lfCharSet);
5191
5192 MatchPenalty = 0xFFFFFFFF;
5193 TextObj->Font = NULL;
5194
5195 Win32Process = PsGetCurrentProcessWin32Process();
5196
5197 /* Search private fonts */
5198 IntLockProcessPrivateFonts(Win32Process);
5199 FindBestFontFromList(&TextObj->Font, &MatchPenalty, &SubstitutedLogFont,
5200 &Win32Process->PrivateFontListHead);
5201 IntUnLockProcessPrivateFonts(Win32Process);
5202
5203 /* Search system fonts */
5205 FindBestFontFromList(&TextObj->Font, &MatchPenalty, &SubstitutedLogFont,
5208
5209 if (NULL == TextObj->Font)
5210 {
5211 DPRINT1("Request font %S not found, no fonts loaded at all\n",
5212 pLogFont->lfFaceName);
5214 }
5215 else
5216 {
5218 PFONTGDI FontGdi = ObjToGDI(TextObj->Font, FONT);
5219 PSHARED_FACE SharedFace = FontGdi->SharedFace;
5220
5221 TextObj->TextFace[0] = UNICODE_NULL;
5222 if (MatchFontNames(SharedFace, SubstitutedLogFont.lfFaceName))
5223 {
5224 RtlStringCchCopyW(TextObj->TextFace, _countof(TextObj->TextFace), pLogFont->lfFaceName);
5225 }
5226 else
5227 {
5230 if (NT_SUCCESS(Status))
5231 {
5232 /* truncated copy */
5233 IntUnicodeStringToBuffer(TextObj->TextFace, sizeof(TextObj->TextFace), &Name);
5235 }
5236 }
5237
5238 // Need hdev, when freetype is loaded need to create DEVOBJ for
5239 // Consumer and Producer.
5240 TextObj->Font->iUniq = 1; // Now it can be cached.
5241 IntFontType(FontGdi);
5242 FontGdi->flType = TextObj->Font->flFontType;
5243 FontGdi->RequestUnderline = pLogFont->lfUnderline ? 0xFF : 0;
5244 FontGdi->RequestStrikeOut = pLogFont->lfStrikeOut ? 0xFF : 0;
5245 FontGdi->RequestItalic = pLogFont->lfItalic ? 0xFF : 0;
5246 if (pLogFont->lfWeight != FW_DONTCARE)
5247 FontGdi->RequestWeight = pLogFont->lfWeight;
5248 else
5249 FontGdi->RequestWeight = FW_NORMAL;
5250
5251 TextObj->fl |= TEXTOBJECT_INIT;
5253 }
5254
5255 if (!pTextObj) TEXTOBJ_UnlockText(TextObj);
5256
5257 ASSERT((NT_SUCCESS(Status) ^ (NULL == TextObj->Font)) != 0);
5258
5259 return Status;
5260}
struct NameRec_ * Name
Definition: cdprocs.h:460
static VOID FASTCALL IntFontType(PFONTGDI Font)
Definition: freetype.c:5071
static BOOL SubstituteFontRecurse(LOGFONTW *pLogFont)
Definition: freetype.c:868
static __inline VOID FindBestFontFromList(FONTOBJ **FontObj, ULONG *MatchPenalty, const LOGFONTW *LogFont, const PLIST_ENTRY Head)
Definition: freetype.c:5003
static VOID IntUnicodeStringToBuffer(LPWSTR pszBuffer, SIZE_T cbBuffer, const UNICODE_STRING *pString)
Definition: freetype.c:830
static BOOL MatchFontNames(PSHARED_FACE SharedFace, LPCWSTR lfFaceName)
Definition: freetype.c:5129
static NTSTATUS IntGetFontLocalizedName(PUNICODE_STRING pNameW, PSHARED_FACE SharedFace, FT_UShort NameID, FT_UShort LangID)
Definition: freetype.c:2618
#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 3556 of file freetype.c.

3560{
3561 FT_Face face;
3562 INT error, n;
3563 FT_CharMap charmap, found;
3564 LOGFONTW *plf;
3565
3566 if (bDoLock)
3568
3569 face = FontGDI->SharedFace->Face;
3570 if (face->charmap == NULL)
3571 {
3572 DPRINT("WARNING: No charmap selected!\n");
3573 DPRINT("This font face has %d charmaps\n", face->num_charmaps);
3574
3575 found = NULL;
3576 for (n = 0; n < face->num_charmaps; n++)
3577 {
3578 charmap = face->charmaps[n];
3579 if (charmap->encoding == FT_ENCODING_UNICODE)
3580 {
3581 found = charmap;
3582 break;
3583 }
3584 }
3585 if (!found)
3586 {
3587 for (n = 0; n < face->num_charmaps; n++)
3588 {
3589 charmap = face->charmaps[n];
3590 if (charmap->platform_id == TT_PLATFORM_APPLE_UNICODE)
3591 {
3592 found = charmap;
3593 break;
3594 }
3595 }
3596 }
3597 if (!found)
3598 {
3599 for (n = 0; n < face->num_charmaps; n++)
3600 {
3601 charmap = face->charmaps[n];
3602 if (charmap->encoding == FT_ENCODING_MS_SYMBOL)
3603 {
3604 found = charmap;
3605 break;
3606 }
3607 }
3608 }
3609 if (!found && face->num_charmaps > 0)
3610 {
3611 found = face->charmaps[0];
3612 }
3613 if (!found)
3614 {
3615 DPRINT1("WARNING: Could not find desired charmap!\n");
3616 }
3617 else
3618 {
3619 DPRINT("Found charmap encoding: %i\n", found->encoding);
3620 error = FT_Set_Charmap(face, found);
3621 if (error)
3622 {
3623 DPRINT1("WARNING: Could not set the charmap!\n");
3624 }
3625 }
3626 }
3627
3628 plf = &TextObj->logfont.elfEnumLogfontEx.elfLogFont;
3629
3630 error = IntRequestFontSize(dc, FontGDI, plf->lfWidth, plf->lfHeight);
3631
3632 if (bDoLock)
3634
3635 if (error)
3636 {
3637 DPRINT1("Error in setting pixel sizes: %d\n", error);
3638 return FALSE;
3639 }
3640
3641 return TRUE;
3642}
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()