ReactOS 0.4.15-dev-5875-g7c755d9
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:5199
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 4658 of file freetype.c.

4664{
4666 FT_Face Face = FontGdi->SharedFace->Face;
4667
4669
4670 if (FT_IS_SFNT(Face))
4671 {
4672 if (Table)
4673 Table = Table >> 24 | Table << 24 | (Table >> 8 & 0xFF00) |
4674 (Table << 8 & 0xFF0000);
4675
4676 if (!Buffer) Size = 0;
4677
4678 if (Buffer && Size)
4679 {
4681 FT_ULong Needed = 0;
4682
4683 Error = FT_Load_Sfnt_Table(Face, Table, Offset, NULL, &Needed);
4684
4685 if ( !Error && Needed < Size) Size = Needed;
4686 }
4687 if (!FT_Load_Sfnt_Table(Face, Table, Offset, Buffer, &Size))
4688 Result = Size;
4689 }
4690
4692
4693 return Result;
4694}
BOOL Error
Definition: chkdsk.c:66
Definition: bufpool.h:45
unsigned long DWORD
Definition: ntddk_ex.h:95
#define IntUnLockFreeType()
Definition: freetype.c:83
#define IntLockFreeType()
Definition: freetype.c:80
#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:426

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

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

5676{
5677 DWORD Count = 0;
5678 INT i = 0;
5679 FT_Face face = Font->SharedFace->Face;
5680
5681 if (FT_HAS_KERNING(face) && face->charmap->encoding == FT_ENCODING_UNICODE)
5682 {
5683 FT_UInt previous_index = 0, glyph_index = 0;
5684 FT_ULong char_code, char_previous;
5685 FT_Vector delta;
5686
5687 char_previous = char_code = FT_Get_First_Char(face, &glyph_index);
5688
5690
5691 while (glyph_index)
5692 {
5693 if (previous_index && glyph_index)
5694 {
5695 FT_Get_Kerning(face, previous_index, glyph_index, FT_KERNING_DEFAULT, &delta);
5696
5697 if (pKerningPair && cPairs)
5698 {
5699 pKerningPair[i].wFirst = char_previous;
5700 pKerningPair[i].wSecond = char_code;
5701 pKerningPair[i].iKernAmount = delta.x;
5702 i++;
5703 if (i == cPairs) break;
5704 }
5705 Count++;
5706 }
5707 previous_index = glyph_index;
5708 char_previous = char_code;
5709 char_code = FT_Get_Next_Char(face, char_code, &glyph_index);
5710 }
5712 }
5713 return Count;
5714}
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 3079 of file freetype.c.

3080{
3081 if ( lprs )
3082 {
3083 lprs->nSize = sizeof(RASTERIZER_STATUS);
3084 lprs->wFlags = TT_AVAILABLE | TT_ENABLED;
3085 lprs->nLanguageID = gusLanguageID;
3086 return TRUE;
3087 }
3089 return FALSE;
3090}
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
USHORT gusLanguageID
Definition: main.c:29
#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 4374 of file freetype.c.

4378{
4379 PDC_ATTR pdcattr;
4380 UINT Ret = DEFAULT_CHARSET;
4381 INT i;
4382 HFONT hFont;
4383 PTEXTOBJ TextObj;
4384 PFONTGDI FontGdi;
4386 TT_OS2 *pOS2;
4387 FT_Face Face;
4388 CHARSETINFO csi;
4389 DWORD cp, fs0;
4390 USHORT usACP, usOEM;
4391
4392 pdcattr = Dc->pdcattr;
4393 hFont = pdcattr->hlfntNew;
4394 TextObj = RealizeFontInit(hFont);
4395
4396 if (!TextObj)
4397 {
4399 return Ret;
4400 }
4401 FontGdi = ObjToGDI(TextObj->Font, FONT);
4402 Face = FontGdi->SharedFace->Face;
4403 TEXTOBJ_UnlockText(TextObj);
4404
4405 memset(&fs, 0, sizeof(FONTSIGNATURE));
4407 pOS2 = FT_Get_Sfnt_Table(Face, ft_sfnt_os2);
4408 if (NULL != pOS2)
4409 {
4410 fs.fsCsb[0] = pOS2->ulCodePageRange1;
4411 fs.fsCsb[1] = pOS2->ulCodePageRange2;
4412 fs.fsUsb[0] = pOS2->ulUnicodeRange1;
4413 fs.fsUsb[1] = pOS2->ulUnicodeRange2;
4414 fs.fsUsb[2] = pOS2->ulUnicodeRange3;
4415 fs.fsUsb[3] = pOS2->ulUnicodeRange4;
4416 if (pOS2->version == 0)
4417 {
4418 FT_UInt dummy;
4419
4420 if (FT_Get_First_Char( Face, &dummy ) < 0x100)
4421 fs.fsCsb[0] |= FS_LATIN1;
4422 else
4423 fs.fsCsb[0] |= FS_SYMBOL;
4424 }
4425 }
4426 pOS2 = NULL;
4428 DPRINT("Csb 1=%x 0=%x\n", fs.fsCsb[1],fs.fsCsb[0]);
4429 if (fs.fsCsb[0] == 0)
4430 { /* Let's see if we can find any interesting cmaps */
4431 for (i = 0; i < Face->num_charmaps; i++)
4432 {
4433 switch (Face->charmaps[i]->encoding)
4434 {
4435 case FT_ENCODING_UNICODE:
4436 case FT_ENCODING_APPLE_ROMAN:
4437 fs.fsCsb[0] |= FS_LATIN1;
4438 break;
4439 case FT_ENCODING_MS_SYMBOL:
4440 fs.fsCsb[0] |= FS_SYMBOL;
4441 break;
4442 default:
4443 break;
4444 }
4445 }
4446 }
4447 if (lpSig)
4448 {
4449 RtlCopyMemory(lpSig, &fs, sizeof(FONTSIGNATURE));
4450 }
4451
4452 RtlGetDefaultCodePage(&usACP, &usOEM);
4453 cp = usACP;
4454
4456 if (csi.fs.fsCsb[0] & fs.fsCsb[0])
4457 {
4458 DPRINT("Hit 1\n");
4459 Ret = csi.ciCharset;
4460 goto Exit;
4461 }
4462
4463 for (i = 0; i < MAXTCIINDEX; i++)
4464 {
4465 fs0 = 1L << i;
4466 if (fs.fsCsb[0] & fs0)
4467 {
4468 if (IntTranslateCharsetInfo(&fs0, &csi, TCI_SRCFONTSIG))
4469 {
4470 // *cp = csi.ciACP;
4471 DPRINT("Hit 2\n");
4472 Ret = csi.ciCharset;
4473 goto Exit;
4474 }
4475 else
4476 DPRINT1("TCI failing on %x\n", fs0);
4477 }
4478 }
4479Exit:
4480 DPRINT("CharSet %u CodePage %u\n", csi.ciCharset, csi.ciACP);
4481 return (MAKELONG(csi.ciACP, csi.ciCharset));
4482}
#define MAXTCIINDEX
Definition: freetype.c:124
static BOOLEAN IntTranslateCharsetInfo(PDWORD Src, LPCHARSETINFO Cs, DWORD Flags)
Definition: freetype.c:2039
#define fs
Definition: i386-dis.c:445
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 4561 of file freetype.c.

4564{
4565 PDC dc;
4566 PDC_ATTR pdcattr;
4567 PTEXTOBJ TextObj;
4568 PFONTGDI FontGDI;
4569 FT_Face Face;
4570 TT_OS2 *pOS2;
4571 TT_HoriHeader *pHori;
4573 ULONG Error;
4575 LOGFONTW *plf;
4576
4577 if (!ptmwi)
4578 {
4580 return FALSE;
4581 }
4582 RtlZeroMemory(ptmwi, sizeof(TMW_INTERNAL));
4583
4584 if (!(dc = DC_LockDc(hDC)))
4585 {
4587 return FALSE;
4588 }
4589 pdcattr = dc->pdcattr;
4590 TextObj = RealizeFontInit(pdcattr->hlfntNew);
4591 if (NULL != TextObj)
4592 {
4593 plf = &TextObj->logfont.elfEnumLogfontEx.elfLogFont;
4594 FontGDI = ObjToGDI(TextObj->Font, FONT);
4595
4596 Face = FontGDI->SharedFace->Face;
4597
4598 // NOTE: GetTextMetrics simply ignores lfEscapement and XFORM.
4600 Error = IntRequestFontSize(dc, FontGDI, plf->lfWidth, plf->lfHeight);
4601 FT_Set_Transform(Face, NULL, NULL);
4602
4604
4605 if (0 != Error)
4606 {
4607 DPRINT1("Error in setting pixel sizes: %u\n", Error);
4609 }
4610 else
4611 {
4613
4615 pOS2 = FT_Get_Sfnt_Table(Face, ft_sfnt_os2);
4616 if (NULL == pOS2)
4617 {
4618 DPRINT1("Can't find OS/2 table - not TT font?\n");
4620 }
4621
4622 pHori = FT_Get_Sfnt_Table(Face, ft_sfnt_hhea);
4623 if (NULL == pHori)
4624 {
4625 DPRINT1("Can't find HHEA table - not TT font?\n");
4627 }
4628
4629 Error = FT_Get_WinFNT_Header(Face, &Win);
4630
4631 if (NT_SUCCESS(Status) || !Error)
4632 {
4633 FillTM(&ptmwi->TextMetric, FontGDI, pOS2, pHori, !Error ? &Win : 0);
4634
4635 /* FIXME: Fill Diff member */
4636 }
4637
4639 }
4640 TEXTOBJ_UnlockText(TextObj);
4641 }
4642 else
4643 {
4645 }
4646 DC_UnlockDc(dc);
4647
4648 if (!NT_SUCCESS(Status))
4649 {
4651 return FALSE;
4652 }
4653 return TRUE;
4654}
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:3451
static void FASTCALL FillTM(TEXTMETRICW *TM, PFONTGDI FontGDI, TT_OS2 *pOS2, TT_HoriHeader *pHori, FT_WinFNT_HeaderRec *pFNT)
Definition: freetype.c:2102
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(NTSTATUS Status)
Definition: error.c:37

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

◆ ftGdiRealizationInfo()

BOOL FASTCALL ftGdiRealizationInfo ( PFONTGDI  Font,
PREALIZATION_INFO  Info 
)

Definition at line 5654 of file freetype.c.

5655{
5656 if (FT_HAS_FIXED_SIZES(Font->SharedFace->Face))
5657 Info->iTechnology = RI_TECH_BITMAP;
5658 else
5659 {
5660 if (FT_IS_SCALABLE(Font->SharedFace->Face))
5661 Info->iTechnology = RI_TECH_SCALABLE;
5662 else
5663 Info->iTechnology = RI_TECH_FIXED;
5664 }
5665 Info->iUniq = Font->FontObj.iUniq;
5666 Info->dwUnknown = -1;
5667 return TRUE;
5668}
#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 4487 of file freetype.c.

4488{
4489 DWORD size = 0;
4490 DWORD num_ranges = 0;
4491 FT_Face face = Font->SharedFace->Face;
4492
4493 if (face->charmap == NULL)
4494 {
4495 DPRINT1("FIXME: No charmap selected! This is a BUG!\n");
4496 return 0;
4497 }
4498
4499 if (face->charmap->encoding == FT_ENCODING_UNICODE)
4500 {
4501 FT_UInt glyph_code = 0;
4502 FT_ULong char_code, char_code_prev;
4503
4504 char_code_prev = char_code = FT_Get_First_Char(face, &glyph_code);
4505
4506 DPRINT("Face encoding FT_ENCODING_UNICODE, number of glyphs %ld, first glyph %u, first char %04lx\n",
4507 face->num_glyphs, glyph_code, char_code);
4508
4509 if (!glyph_code) return 0;
4510
4511 if (glyphset)
4512 {
4513 glyphset->ranges[0].wcLow = (USHORT)char_code;
4514 glyphset->ranges[0].cGlyphs = 0;
4515 glyphset->cGlyphsSupported = 0;
4516 }
4517
4518 num_ranges = 1;
4519 while (glyph_code)
4520 {
4521 if (char_code < char_code_prev)
4522 {
4523 DPRINT1("Expected increasing char code from FT_Get_Next_Char\n");
4524 return 0;
4525 }
4526 if (char_code - char_code_prev > 1)
4527 {
4528 num_ranges++;
4529 if (glyphset)
4530 {
4531 glyphset->ranges[num_ranges - 1].wcLow = (USHORT)char_code;
4532 glyphset->ranges[num_ranges - 1].cGlyphs = 1;
4533 glyphset->cGlyphsSupported++;
4534 }
4535 }
4536 else if (glyphset)
4537 {
4538 glyphset->ranges[num_ranges - 1].cGlyphs++;
4539 glyphset->cGlyphsSupported++;
4540 }
4541 char_code_prev = char_code;
4542 char_code = FT_Get_Next_Char(face, char_code, &glyph_code);
4543 }
4544 }
4545 else
4546 DPRINT1("Encoding %i not supported\n", face->charmap->encoding);
4547
4548 size = sizeof(GLYPHSET) + sizeof(WCRANGE) * (num_ranges - 1);
4549 if (glyphset)
4550 {
4551 glyphset->cbThis = size;
4552 glyphset->cRanges = num_ranges;
4553 glyphset->flAccel = 0;
4554 }
4555 return size;
4556}
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:4264
_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:4561
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:6543

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

◆ InitFontSupport()

BOOL FASTCALL InitFontSupport ( VOID  )

Definition at line 661 of file freetype.c.

662{
663 ULONG ulError;
664
668 /* Fast Mutexes must be allocated from non paged pool */
670 if (g_FontListLock == NULL)
671 {
672 return FALSE;
673 }
674
677 if (g_FreeTypeLock == NULL)
678 {
679 return FALSE;
680 }
682
684 if (ulError)
685 {
686 DPRINT1("FT_Init_FreeType failed with error code 0x%x\n", ulError);
687 return FALSE;
688 }
689
691 {
692 DPRINT1("Fonts registry is empty.\n");
693
694 /* Load font(s) with writing registry */
696 }
697
698 IntLoadFontSubstList(&g_FontSubstListHead);
699
700#if DBG
701 DumpFontInfo(TRUE);
702#endif
703
704 return TRUE;
705}
#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:65
static LIST_ENTRY g_FontListHead
Definition: freetype.c:67
BOOL FASTCALL IntLoadFontSubstList(PLIST_ENTRY pHead)
Definition: freetype.c:511
static UINT g_FontCacheNumEntries
Definition: freetype.c:95
VOID FASTCALL IntLoadSystemFonts(VOID)
Definition: freetype.c:896
static LIST_ENTRY g_FontCacheListHead
Definition: freetype.c:94
static PFAST_MUTEX g_FontListLock
Definition: freetype.c:68
BOOL FASTCALL IntLoadFontsInRegistry(VOID)
Definition: freetype.c:1641
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 DriverEntry().

◆ IntCharSetFromCodePage()

BYTE FASTCALL IntCharSetFromCodePage ( UINT  uCodePage)

Definition at line 173 of file freetype.c.

174{
175 UINT i;
176
177 if (uCodePage == CP_OEMCP)
178 return OEM_CHARSET;
179
180 if (uCodePage == CP_MACCP)
181 return MAC_CHARSET;
182
183 for (i = 0; i < MAXTCIINDEX; ++i)
184 {
185 if (g_FontTci[i].ciACP == 0)
186 continue;
187
188 if (g_FontTci[i].ciACP == uCodePage)
189 return g_FontTci[i].ciCharset;
190 }
191
192 return DEFAULT_CHARSET;
193}
#define CP_OEMCP
Definition: freetype.c:167
static const CHARSETINFO g_FontTci[MAXTCIINDEX]
Definition: freetype.c:125
#define CP_MACCP
Definition: freetype.c:168
#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 1969 of file freetype.c.

1970{
1972}
static BOOL g_RenderingEnabled
Definition: freetype.c:69
_In_ ULONGLONG _In_ ULONGLONG _In_ BOOLEAN Enable
Definition: ntddpcm.h:142

◆ IntGdiAddFontMemResource()

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

Definition at line 1795 of file freetype.c.

1796{
1797 HANDLE Ret = NULL;
1799 PFONT_ENTRY_COLL_MEM EntryCollection;
1800 INT FaceCount;
1801
1803 if (!BufferCopy)
1804 {
1805 *pNumAdded = 0;
1806 return NULL;
1807 }
1808 RtlCopyMemory(BufferCopy, Buffer, dwSize);
1809
1810 LoadFont.pFileName = NULL;
1811 LoadFont.Memory = SharedMem_Create(BufferCopy, dwSize, FALSE);
1812 LoadFont.Characteristics = FR_PRIVATE | FR_NOT_ENUM;
1813 RtlInitUnicodeString(&LoadFont.RegValueName, NULL);
1814 LoadFont.IsTrueType = FALSE;
1815 LoadFont.PrivateEntry = NULL;
1817
1818 RtlFreeUnicodeString(&LoadFont.RegValueName);
1819
1820 /* Release our copy */
1824
1825 if (FaceCount > 0)
1826 {
1827 EntryCollection = ExAllocatePoolWithTag(PagedPool, sizeof(FONT_ENTRY_COLL_MEM), TAG_FONT);
1828 if (EntryCollection)
1829 {
1831 EntryCollection->Entry = LoadFont.PrivateEntry;
1832 IntLockProcessPrivateFonts(Win32Process);
1833 EntryCollection->Handle = ULongToHandle(++Win32Process->PrivateMemFontHandleCount);
1834 InsertTailList(&Win32Process->PrivateMemFontListHead, &EntryCollection->ListEntry);
1835 IntUnLockProcessPrivateFonts(Win32Process);
1836 Ret = EntryCollection->Handle;
1837 }
1838 }
1839 *pNumAdded = FaceCount;
1840
1841 return Ret;
1842}
#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:234
static INT FASTCALL IntGdiLoadFontsFromMemory(PGDI_LOAD_FONT pLoadFont, PSHARED_FACE SharedFace, FT_Long FontIndex, INT CharSetIndex)
Definition: freetype.c:1054
static void SharedMem_Release(PSHARED_MEM Ptr)
Definition: freetype.c:291
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 1625 of file freetype.c.

1626{
1627 return IntGdiAddFontResourceEx(FileName, Characteristics, 0);
1628}
INT FASTCALL IntGdiAddFontResourceEx(PUNICODE_STRING FileName, DWORD Characteristics, DWORD dwFlags)
Definition: freetype.c:1426

Referenced by NtGdiAddFontResourceW().

◆ IntGdiAddFontResourceEx()

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

Definition at line 1426 of file freetype.c.

1428{
1431 PVOID Buffer = NULL;
1434 SIZE_T ViewSize = 0, Length;
1435 LARGE_INTEGER SectionSize;
1438 INT FontCount;
1440 UNICODE_STRING PathName;
1441 LPWSTR pszBuffer;
1443 static const UNICODE_STRING TrueTypePostfix = RTL_CONSTANT_STRING(L" (TrueType)");
1444 static const UNICODE_STRING DosPathPrefix = RTL_CONSTANT_STRING(L"\\??\\");
1445
1446 /* Build PathName */
1448 {
1449 Length = DosPathPrefix.Length + FileName->Length + sizeof(UNICODE_NULL);
1451 if (!pszBuffer)
1452 return 0; /* failure */
1453
1454 RtlInitEmptyUnicodeString(&PathName, pszBuffer, Length);
1455 RtlAppendUnicodeStringToString(&PathName, &DosPathPrefix);
1457 }
1458 else
1459 {
1461 if (!NT_SUCCESS(Status))
1462 return 0; /* failure */
1463 }
1464
1465 /* Open the font file */
1469 &FileHandle,
1472 &Iosb,
1475 if (!NT_SUCCESS(Status))
1476 {
1477 DPRINT1("Could not load font file: %wZ\n", &PathName);
1478 RtlFreeUnicodeString(&PathName);
1479 return 0;
1480 }
1481
1484 if (!NT_SUCCESS(Status))
1485 {
1486 DPRINT1("ObReferenceObjectByHandle failed.\n");
1488 RtlFreeUnicodeString(&PathName);
1489 return 0;
1490 }
1491
1492 SectionSize.QuadPart = 0LL;
1495 NULL, &SectionSize, PAGE_READONLY,
1497 if (!NT_SUCCESS(Status))
1498 {
1499 DPRINT1("Could not map file: %wZ\n", &PathName);
1502 RtlFreeUnicodeString(&PathName);
1503 return 0;
1504 }
1506
1508 if (!NT_SUCCESS(Status))
1509 {
1510 DPRINT1("Could not map file: %wZ\n", &PathName);
1513 RtlFreeUnicodeString(&PathName);
1514 return 0;
1515 }
1516
1517 LoadFont.pFileName = &PathName;
1519 LoadFont.Characteristics = Characteristics;
1520 RtlInitUnicodeString(&LoadFont.RegValueName, NULL);
1521 LoadFont.IsTrueType = FALSE;
1522 LoadFont.CharSet = DEFAULT_CHARSET;
1523 LoadFont.PrivateEntry = NULL;
1524 FontCount = IntGdiLoadFontsFromMemory(&LoadFont, NULL, -1, -1);
1525
1526 /* Release our copy */
1530
1532
1534
1535 /* Save the loaded font name into the registry */
1536 if (FontCount > 0 && (dwFlags & AFRX_WRITE_REGISTRY))
1537 {
1538 UNICODE_STRING NewString;
1539 SIZE_T Length;
1540 PWCHAR pszBuffer;
1541 LPCWSTR CharSetName;
1542 if (LoadFont.IsTrueType)
1543 {
1544 /* Append " (TrueType)" */
1545 Length = LoadFont.RegValueName.Length + TrueTypePostfix.Length + sizeof(UNICODE_NULL);
1547 if (pszBuffer)
1548 {
1549 RtlInitEmptyUnicodeString(&NewString, pszBuffer, Length);
1550 NewString.Buffer[0] = UNICODE_NULL;
1551 RtlAppendUnicodeStringToString(&NewString, &LoadFont.RegValueName);
1552 RtlAppendUnicodeStringToString(&NewString, &TrueTypePostfix);
1553 RtlFreeUnicodeString(&LoadFont.RegValueName);
1554 LoadFont.RegValueName = NewString;
1555 }
1556 else
1557 {
1558 // FIXME!
1559 }
1560 }
1561 else if (LoadFont.CharSet != DEFAULT_CHARSET)
1562 {
1563 /* Append " (CharSetName)" */
1564 CharSetName = NameFromCharSet(LoadFont.CharSet);
1565 Length = LoadFont.RegValueName.Length +
1566 (wcslen(CharSetName) + 3) * sizeof(WCHAR) +
1567 sizeof(UNICODE_NULL);
1568
1570 if (pszBuffer)
1571 {
1572 RtlInitEmptyUnicodeString(&NewString, pszBuffer, Length);
1573 NewString.Buffer[0] = UNICODE_NULL;
1574 RtlAppendUnicodeStringToString(&NewString, &LoadFont.RegValueName);
1575 RtlAppendUnicodeToString(&NewString, L" (");
1576 RtlAppendUnicodeToString(&NewString, CharSetName);
1577 RtlAppendUnicodeToString(&NewString, L")");
1578 RtlFreeUnicodeString(&LoadFont.RegValueName);
1579 LoadFont.RegValueName = NewString;
1580 }
1581 else
1582 {
1583 // FIXME!
1584 }
1585 }
1586
1589 NULL, NULL);
1590 Status = ZwOpenKey(&KeyHandle, KEY_WRITE, &ObjectAttributes);
1591 if (NT_SUCCESS(Status))
1592 {
1594 LPWSTR pFileName;
1595
1597 {
1598 pFileName = PathName.Buffer;
1599 }
1600 else
1601 {
1602 pFileName = wcsrchr(PathName.Buffer, L'\\');
1603 }
1604
1605 if (pFileName)
1606 {
1608 {
1609 pFileName++;
1610 }
1611 DataSize = (wcslen(pFileName) + 1) * sizeof(WCHAR);
1612 ZwSetValueKey(KeyHandle, &LoadFont.RegValueName, 0, REG_SZ,
1613 pFileName, DataSize);
1614 }
1616 }
1617 }
1618 RtlFreeUnicodeString(&LoadFont.RegValueName);
1619
1620 RtlFreeUnicodeString(&PathName);
1621 return FontCount;
1622}
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:36
#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:834
static UNICODE_STRING g_FontRegPath
Definition: freetype.c:59
static LPCWSTR FASTCALL NameFromCharSet(BYTE CharSet)
Definition: freetype.c:1392
#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:99
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:4348
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:4521
#define TAG_USTR
Definition: tag.h:145
#define LL
Definition: tui.h:150
#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 1917 of file freetype.c.

1918{
1921 PFONT_ENTRY_COLL_MEM EntryCollection;
1922
1923 DPRINT("IntGdiCleanupPrivateFontsForProcess()\n");
1924 do {
1925 Entry = NULL;
1926 EntryCollection = NULL;
1927
1928 IntLockProcessPrivateFonts(Win32Process);
1929 if (!IsListEmpty(&Win32Process->PrivateMemFontListHead))
1930 {
1931 Entry = Win32Process->PrivateMemFontListHead.Flink;
1932 EntryCollection = CONTAINING_RECORD(Entry, FONT_ENTRY_COLL_MEM, ListEntry);
1933 UnlinkFontMemCollection(EntryCollection);
1934 }
1935 IntUnLockProcessPrivateFonts(Win32Process);
1936
1937 if (EntryCollection)
1938 {
1939 IntGdiCleanupMemEntry(EntryCollection->Entry);
1940 ExFreePoolWithTag(EntryCollection, TAG_FONT);
1941 }
1942 else
1943 {
1944 /* No Mem fonts anymore, see if we have any other private fonts left */
1945 Entry = NULL;
1946 IntLockProcessPrivateFonts(Win32Process);
1947 if (!IsListEmpty(&Win32Process->PrivateFontListHead))
1948 {
1949 Entry = RemoveHeadList(&Win32Process->PrivateFontListHead);
1950 }
1951 IntUnLockProcessPrivateFonts(Win32Process);
1952
1953 if (Entry)
1954 {
1956 }
1957 }
1958
1959 } while (Entry);
1960}
#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:1847
static VOID FASTCALL UnlinkFontMemCollection(PFONT_ENTRY_COLL_MEM Collection)
Definition: freetype.c:1866
static __inline VOID FASTCALL CleanupFontEntry(PFONT_ENTRY FontEntry)
Definition: freetype.c:363
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 5386 of file freetype.c.

5391{
5392 UNICODE_STRING EntryFileName;
5393 POBJECT_NAME_INFORMATION NameInfo1 = NULL, NameInfo2 = NULL;
5394 PLIST_ENTRY ListEntry;
5395 PFONT_ENTRY FontEntry;
5396 ULONG Size, i, Count;
5397 LPBYTE pbBuffer;
5398 BOOL IsEqual;
5399 FONTFAMILYINFO *FamInfo;
5400 const ULONG MaxFamInfo = 64;
5401 const ULONG MAX_FAM_INFO_BYTES = sizeof(FONTFAMILYINFO) * MaxFamInfo;
5402 BOOL bSuccess;
5403 const ULONG NAMEINFO_SIZE = sizeof(OBJECT_NAME_INFORMATION) + MAX_PATH * sizeof(WCHAR);
5404
5405 DPRINT("IntGdiGetFontResourceInfo: dwType == %lu\n", dwType);
5406
5407 do
5408 {
5409 /* Create buffer for full path name */
5410 NameInfo1 = ExAllocatePoolWithTag(PagedPool, NAMEINFO_SIZE, TAG_FINF);
5411 if (!NameInfo1)
5412 break;
5413
5414 /* Get the full path name */
5415 if (!IntGetFullFileName(NameInfo1, NAMEINFO_SIZE, FileName))
5416 break;
5417
5418 /* Create a buffer for the entries' names */
5419 NameInfo2 = ExAllocatePoolWithTag(PagedPool, NAMEINFO_SIZE, TAG_FINF);
5420 if (!NameInfo2)
5421 break;
5422
5423 FamInfo = ExAllocatePoolWithTag(PagedPool, MAX_FAM_INFO_BYTES, TAG_FINF);
5424 } while (0);
5425
5426 if (!NameInfo1 || !NameInfo2 || !FamInfo)
5427 {
5428 if (NameInfo2)
5429 ExFreePoolWithTag(NameInfo2, TAG_FINF);
5430
5431 if (NameInfo1)
5432 ExFreePoolWithTag(NameInfo1, TAG_FINF);
5433
5435 return FALSE;
5436 }
5437
5438 Count = 0;
5439
5440 /* Try to find the pathname in the global font list */
5442 for (ListEntry = g_FontListHead.Flink; ListEntry != &g_FontListHead;
5443 ListEntry = ListEntry->Flink)
5444 {
5445 FontEntry = CONTAINING_RECORD(ListEntry, FONT_ENTRY, ListEntry);
5446 if (FontEntry->Font->Filename == NULL)
5447 continue;
5448
5449 RtlInitUnicodeString(&EntryFileName , FontEntry->Font->Filename);
5450 if (!IntGetFullFileName(NameInfo2, NAMEINFO_SIZE, &EntryFileName))
5451 continue;
5452
5453 if (!RtlEqualUnicodeString(&NameInfo1->Name, &NameInfo2->Name, FALSE))
5454 continue;
5455
5456 IsEqual = FALSE;
5457 FontFamilyFillInfo(&FamInfo[Count], FontEntry->FaceName.Buffer,
5458 NULL, FontEntry->Font);
5459 for (i = 0; i < Count; ++i)
5460 {
5461 if (EqualFamilyInfo(&FamInfo[i], &FamInfo[Count]))
5462 {
5463 IsEqual = TRUE;
5464 break;
5465 }
5466 }
5467 if (!IsEqual)
5468 {
5469 /* Found */
5470 ++Count;
5471 if (Count >= MaxFamInfo)
5472 break;
5473 }
5474 }
5476
5477 /* Free the buffers */
5478 ExFreePoolWithTag(NameInfo1, TAG_FINF);
5479 ExFreePoolWithTag(NameInfo2, TAG_FINF);
5480
5481 if (Count == 0 && dwType != 5)
5482 {
5483 /* Font could not be found in system table
5484 dwType == 5 will still handle this */
5485 ExFreePoolWithTag(FamInfo, TAG_FINF);
5486 return FALSE;
5487 }
5488
5489 bSuccess = FALSE;
5490 switch (dwType)
5491 {
5492 case 0: /* FIXME: Returns 1 or 2, don't know what this is atm */
5493 Size = sizeof(DWORD);
5494 if (*pdwBytes == 0)
5495 {
5496 *pdwBytes = Size;
5497 bSuccess = TRUE;
5498 }
5499 else if (pBuffer)
5500 {
5501 if (*pdwBytes >= Size)
5502 {
5503 *(DWORD*)pBuffer = Count;
5504 }
5505 *pdwBytes = Size;
5506 bSuccess = TRUE;
5507 }
5508 break;
5509
5510 case 1: /* copy the font title */
5511 /* calculate the required size */
5512 Size = 0;
5513 for (i = 0; i < Count; ++i)
5514 {
5515 if (i > 0)
5516 Size += 3; /* " & " */
5517 Size += wcslen(FamInfo[i].EnumLogFontEx.elfLogFont.lfFaceName);
5518 if (FamInfo[i].EnumLogFontEx.elfStyle[0] &&
5519 _wcsicmp(FamInfo[i].EnumLogFontEx.elfStyle, L"Regular") != 0)
5520 {
5521 Size += 1 + wcslen(FamInfo[i].EnumLogFontEx.elfStyle);
5522 }
5523 }
5524 Size += 2; /* "\0\0" */
5525 Size *= sizeof(WCHAR);
5526
5527 if (*pdwBytes == 0)
5528 {
5529 *pdwBytes = Size;
5530 bSuccess = TRUE;
5531 }
5532 else if (pBuffer)
5533 {
5534 if (*pdwBytes >= Size)
5535 {
5536 /* store font title to buffer */
5537 WCHAR *psz = pBuffer;
5538 *psz = 0;
5539 for (i = 0; i < Count; ++i)
5540 {
5541 if (i > 0)
5542 wcscat(psz, L" & ");
5543 IntAddNameFromFamInfo(psz, &FamInfo[i]);
5544 }
5545 psz[wcslen(psz) + 1] = UNICODE_NULL;
5546 *pdwBytes = Size;
5547 bSuccess = TRUE;
5548 }
5549 else
5550 {
5551 *pdwBytes = 1024; /* this is confirmed value */
5552 }
5553 }
5554 break;
5555
5556 case 2: /* Copy an array of LOGFONTW */
5557 Size = Count * sizeof(LOGFONTW);
5558 if (*pdwBytes == 0)
5559 {
5560 *pdwBytes = Size;
5561 bSuccess = TRUE;
5562 }
5563 else if (pBuffer)
5564 {
5565 if (*pdwBytes >= Size)
5566 {
5567 pbBuffer = (LPBYTE)pBuffer;
5568 for (i = 0; i < Count; ++i)
5569 {
5570 FamInfo[i].EnumLogFontEx.elfLogFont.lfWidth = 0;
5571 RtlCopyMemory(pbBuffer, &FamInfo[i].EnumLogFontEx.elfLogFont, sizeof(LOGFONTW));
5572 pbBuffer += sizeof(LOGFONTW);
5573 }
5574 }
5575 *pdwBytes = Size;
5576 bSuccess = TRUE;
5577 }
5578 else
5579 {
5580 *pdwBytes = 1024; /* this is confirmed value */
5581 }
5582 break;
5583
5584 case 3:
5585 Size = sizeof(DWORD);
5586 if (*pdwBytes == 0)
5587 {
5588 *pdwBytes = Size;
5589 bSuccess = TRUE;
5590 }
5591 else if (pBuffer)
5592 {
5593 if (*pdwBytes >= Size)
5594 {
5595 /* FIXME: What exactly is copied here? */
5596 *(DWORD*)pBuffer = 1;
5597 }
5598 *pdwBytes = Size;
5599 bSuccess = TRUE;
5600 }
5601 break;
5602
5603 case 4: /* full file path */
5604 if (FileName->Length >= 4 * sizeof(WCHAR))
5605 {
5606 /* The beginning of FileName is \??\ */
5607 LPWSTR pch = FileName->Buffer + 4;
5608 DWORD Length = FileName->Length - 4 * sizeof(WCHAR);
5609
5610 Size = Length + sizeof(WCHAR);
5611 if (*pdwBytes == 0)
5612 {
5613 *pdwBytes = Size;
5614 bSuccess = TRUE;
5615 }
5616 else if (pBuffer)
5617 {
5618 if (*pdwBytes >= Size)
5619 {
5621 }
5622 *pdwBytes = Size;
5623 bSuccess = TRUE;
5624 }
5625 }
5626 break;
5627
5628 case 5: /* Looks like a BOOL that is copied, TRUE, if the font was not found */
5629 Size = sizeof(BOOL);
5630 if (*pdwBytes == 0)
5631 {
5632 *pdwBytes = Size;
5633 bSuccess = TRUE;
5634 }
5635 else if (pBuffer)
5636 {
5637 if (*pdwBytes >= Size)
5638 {
5639 *(BOOL*)pBuffer = Count == 0;
5640 }
5641 *pdwBytes = Size;
5642 bSuccess = TRUE;
5643 }
5644 break;
5645 }
5646 ExFreePoolWithTag(FamInfo, TAG_FINF);
5647
5648 return bSuccess;
5649}
#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:5309
static BOOL EqualFamilyInfo(const FONTFAMILYINFO *pInfo1, const FONTFAMILYINFO *pInfo2)
Definition: freetype.c:5352
static void FASTCALL FontFamilyFillInfo(PFONTFAMILYINFO Info, LPCWSTR FaceName, LPCWSTR FullName, PFONTGDI FontGDI)
Definition: freetype.c:2769
#define IntUnLockGlobalFonts()
Definition: freetype.c:74
static VOID IntAddNameFromFamInfo(LPWSTR psz, FONTFAMILYINFO *FamInfo)
Definition: freetype.c:5373
#define IntLockGlobalFonts()
Definition: freetype.c:71
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 1883 of file freetype.c.

1884{
1886 PFONT_ENTRY_COLL_MEM CurrentEntry;
1887 PFONT_ENTRY_COLL_MEM EntryCollection = NULL;
1889
1890 IntLockProcessPrivateFonts(Win32Process);
1891 for (Entry = Win32Process->PrivateMemFontListHead.Flink;
1892 Entry != &Win32Process->PrivateMemFontListHead;
1893 Entry = Entry->Flink)
1894 {
1895 CurrentEntry = CONTAINING_RECORD(Entry, FONT_ENTRY_COLL_MEM, ListEntry);
1896
1897 if (CurrentEntry->Handle == hMMFont)
1898 {
1899 EntryCollection = CurrentEntry;
1900 UnlinkFontMemCollection(CurrentEntry);
1901 break;
1902 }
1903 }
1904 IntUnLockProcessPrivateFonts(Win32Process);
1905
1906 if (EntryCollection)
1907 {
1908 IntGdiCleanupMemEntry(EntryCollection->Entry);
1909 ExFreePoolWithTag(EntryCollection, TAG_FONT);
1910 return TRUE;
1911 }
1912 return FALSE;
1913}

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 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:4374
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 2404 of file freetype.c.

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

1964{
1965 return (gpsi->BitsPixel > 8) && g_RenderingEnabled;
1966}
PSERVERINFO gpsi
Definition: imm.c:18

Referenced by IntExtTextOutW(), and TextIntGetTextExtentPoint().

◆ IntLoadFontsInRegistry()

BOOL FASTCALL IntLoadFontsInRegistry ( VOID  )

Definition at line 1641 of file freetype.c.

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

897{
899 UNICODE_STRING Directory, FileName, TempString;
901 HANDLE hDirectory;
902 BYTE *DirInfoBuffer;
904 BOOLEAN bRestartScan = TRUE;
906 INT i;
907 static UNICODE_STRING SearchPatterns[] =
908 {
909 RTL_CONSTANT_STRING(L"*.ttf"),
910 RTL_CONSTANT_STRING(L"*.ttc"),
911 RTL_CONSTANT_STRING(L"*.otf"),
912 RTL_CONSTANT_STRING(L"*.otc"),
913 RTL_CONSTANT_STRING(L"*.fon"),
914 RTL_CONSTANT_STRING(L"*.fnt")
915 };
916 static UNICODE_STRING IgnoreFiles[] =
917 {
920 };
921
922 RtlInitUnicodeString(&Directory, L"\\SystemRoot\\Fonts\\");
923
926 &Directory,
928 NULL,
929 NULL);
930
932 &hDirectory,
935 &Iosb,
938
939 if (NT_SUCCESS(Status))
940 {
941 for (i = 0; i < _countof(SearchPatterns); ++i)
942 {
943 DirInfoBuffer = ExAllocatePoolWithTag(PagedPool, 0x4000, TAG_FONT);
944 if (DirInfoBuffer == NULL)
945 {
946 ZwClose(hDirectory);
947 return;
948 }
949
951 if (FileName.Buffer == NULL)
952 {
953 ExFreePoolWithTag(DirInfoBuffer, TAG_FONT);
954 ZwClose(hDirectory);
955 return;
956 }
957 FileName.Length = 0;
958 FileName.MaximumLength = MAX_PATH * sizeof(WCHAR);
959
960 while (1)
961 {
962 Status = ZwQueryDirectoryFile(
963 hDirectory,
964 NULL,
965 NULL,
966 NULL,
967 &Iosb,
968 DirInfoBuffer,
969 0x4000,
971 FALSE,
972 &SearchPatterns[i],
973 bRestartScan);
974
976 {
977 break;
978 }
979
980 DirInfo = (PFILE_DIRECTORY_INFORMATION)DirInfoBuffer;
981 while (1)
982 {
983 SIZE_T ign;
984
985 TempString.Buffer = DirInfo->FileName;
986 TempString.Length = TempString.MaximumLength = DirInfo->FileNameLength;
987
988 /* Should we ignore this file? */
989 for (ign = 0; ign < _countof(IgnoreFiles); ++ign)
990 {
991 /* Yes.. */
992 if (RtlEqualUnicodeString(IgnoreFiles + ign, &TempString, FALSE))
993 break;
994 }
995
996 /* If we tried all Ignore patterns and there was no match, try to create a font */
997 if (ign == _countof(IgnoreFiles))
998 {
1002 {
1003 DPRINT1("ERR: Failed to load %wZ\n", &FileName);
1004 }
1005 }
1006
1007 if (DirInfo->NextEntryOffset == 0)
1008 break;
1009
1010 DirInfo = (PFILE_DIRECTORY_INFORMATION)((ULONG_PTR)DirInfo + DirInfo->NextEntryOffset);
1011 }
1012
1013 bRestartScan = FALSE;
1014 }
1015
1017 ExFreePoolWithTag(DirInfoBuffer, TAG_FONT);
1018 }
1019 ZwClose(hDirectory);
1020 }
1021}
@ IgnoreFiles
Definition: ACListISF.cpp:75
#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 1997 of file freetype.c.

1998{
1999 PLFONT plfont;
2000 LOGFONTW *plf;
2001
2002 ASSERT(lf);
2003 plfont = LFONT_AllocFontWithHandle();
2004 if (!plfont)
2005 {
2006 return STATUS_NO_MEMORY;
2007 }
2008
2009 ExInitializePushLock(&plfont->lock);
2010 *NewFont = plfont->BaseObject.hHmgr;
2011 plf = &plfont->logfont.elfEnumLogfontEx.elfLogFont;
2012 RtlCopyMemory(plf, lf, sizeof(LOGFONTW));
2013 if (lf->lfEscapement != lf->lfOrientation)
2014 {
2015 /* This should really depend on whether GM_ADVANCED is set */
2016 plf->lfOrientation = plf->lfEscapement;
2017 }
2018 LFONT_UnlockFont(plfont);
2019
2020 return STATUS_SUCCESS;
2021}
HGDIOBJ hHmgr(VOID)
Definition: baseobj.hpp:95
#define ExInitializePushLock
Definition: ex.h:1012
#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 4264 of file freetype.c.

4273{
4274 PFONTGDI FontGDI;
4275 FT_BitmapGlyph realglyph;
4276 INT glyph_index, i, previous, nTenthsOfDegrees;
4277 ULONGLONG TotalWidth64 = 0;
4278 LOGFONTW *plf;
4279 BOOL use_kerning, bVerticalWriting;
4280 LONG ascender, descender;
4282
4283 FontGDI = ObjToGDI(TextObj->Font, FONT);
4284
4285 Cache.Hashed.Face = FontGDI->SharedFace->Face;
4286 if (NULL != Fit)
4287 {
4288 *Fit = 0;
4289 }
4290
4291 plf = &TextObj->logfont.elfEnumLogfontEx.elfLogFont;
4292 Cache.Hashed.lfHeight = plf->lfHeight;
4293 Cache.Hashed.lfWidth = plf->lfWidth;
4294 Cache.Hashed.Aspect.Emu.Bold = EMUBOLD_NEEDED(FontGDI->OriginalWeight, plf->lfWeight);
4295 Cache.Hashed.Aspect.Emu.Italic = (plf->lfItalic && !FontGDI->OriginalItalic);
4296
4297 // Check vertical writing (tategaki)
4298 nTenthsOfDegrees = IntNormalizeAngle(plf->lfEscapement - plf->lfOrientation);
4299 bVerticalWriting = ((nTenthsOfDegrees == 90 * 10) || (nTenthsOfDegrees == 270 * 10));
4300
4302 Cache.Hashed.Aspect.RenderMode = (BYTE)IntGetFontRenderMode(plf);
4303 else
4304 Cache.Hashed.Aspect.RenderMode = (BYTE)FT_RENDER_MODE_MONO;
4305
4306 // NOTE: GetTextExtentPoint32 simply ignores lfEscapement and XFORM.
4308 TextIntUpdateSize(dc, TextObj, FontGDI, FALSE);
4309 Cache.Hashed.matTransform = identityMat;
4310 FT_Set_Transform(Cache.Hashed.Face, NULL, NULL);
4311
4312 use_kerning = FT_HAS_KERNING(Cache.Hashed.Face);
4313 previous = 0;
4314
4315 for (i = 0; i < Count; i++)
4316 {
4317 glyph_index = get_glyph_index_flagged(Cache.Hashed.Face, *String, GTEF_INDICES, fl);
4318 Cache.Hashed.GlyphIndex = glyph_index;
4319
4320 realglyph = IntGetRealGlyph(&Cache);
4321 if (!realglyph)
4322 break;
4323
4324 /* Retrieve kerning distance */
4325 if (use_kerning && previous && glyph_index)
4326 {
4327 FT_Vector delta;
4328 FT_Get_Kerning(Cache.Hashed.Face, previous, glyph_index, 0, &delta);
4329 TotalWidth64 += delta.x;
4330 }
4331
4332 TotalWidth64 += realglyph->root.advance.x >> 10;
4333
4334 if (((TotalWidth64 + 32) >> 6) <= MaxExtent && NULL != Fit)
4335 {
4336 *Fit = i + 1;
4337 }
4338 if (NULL != Dx)
4339 {
4340 Dx[i] = (TotalWidth64 + 32) >> 6;
4341 }
4342
4343 /* Bold and italic do not use the cache */
4344 if (Cache.Hashed.Aspect.EmuBoldItalic)
4345 {
4346 FT_Done_Glyph((FT_Glyph)realglyph);
4347 }
4348
4349 previous = glyph_index;
4350 String++;
4351 }
4352 ASSERT(FontGDI->Magic == FONTGDI_MAGIC);
4353 ascender = FontGDI->tmAscent; /* Units above baseline */
4354 descender = FontGDI->tmDescent; /* Units below baseline */
4356
4357 if (bVerticalWriting)
4358 {
4359 Size->cx = ascender + descender;
4360 Size->cy = (TotalWidth64 + 32) >> 6;
4361 }
4362 else
4363 {
4364 Size->cx = (TotalWidth64 + 32) >> 6;
4365 Size->cy = ascender + descender;
4366 }
4367
4368 return TRUE;
4369}
#define FONTGDI_MAGIC
Definition: engobjects.h:171
#define EMUBOLD_NEEDED(original, request)
Definition: freetype.c:45
static LONG IntNormalizeAngle(LONG nTenthsOfDegrees)
Definition: freetype.c:707
static FT_BitmapGlyph IntGetRealGlyph(IN OUT PFONT_CACHE_ENTRY Cache)
Definition: freetype.c:4210
BOOL FASTCALL IntIsFontRenderingEnabled(VOID)
Definition: freetype.c:1963
FT_Render_Mode FASTCALL IntGetFontRenderMode(LOGFONTW *logfont)
Definition: freetype.c:1975
@ FT_RENDER_MODE_MONO
Definition: freetype.h:3236
FT_Done_Glyph(FT_Glyph glyph)
Definition: ftglyph.c:633
#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 5199 of file freetype.c.

5200{
5202 PTEXTOBJ TextObj;
5203 PPROCESSINFO Win32Process;
5204 ULONG MatchPenalty;
5205 LOGFONTW *pLogFont;
5206 LOGFONTW SubstitutedLogFont;
5207
5208 if (!pTextObj)
5209 {
5210 TextObj = TEXTOBJ_LockText(FontHandle);
5211 if (NULL == TextObj)
5212 {
5213 return STATUS_INVALID_HANDLE;
5214 }
5215
5216 if (TextObj->fl & TEXTOBJECT_INIT)
5217 {
5218 TEXTOBJ_UnlockText(TextObj);
5219 return STATUS_SUCCESS;
5220 }
5221 }
5222 else
5223 {
5224 TextObj = pTextObj;
5225 }
5226
5227 pLogFont = &TextObj->logfont.elfEnumLogfontEx.elfLogFont;
5228
5229 /* substitute */
5230 SubstitutedLogFont = *pLogFont;
5231 DPRINT("Font '%S,%u' is substituted by: ", pLogFont->lfFaceName, pLogFont->lfCharSet);
5232 SubstituteFontRecurse(&SubstitutedLogFont);
5233 DPRINT("'%S,%u'.\n", SubstitutedLogFont.lfFaceName, SubstitutedLogFont.lfCharSet);
5234
5235 MatchPenalty = 0xFFFFFFFF;
5236 TextObj->Font = NULL;
5237
5238 Win32Process = PsGetCurrentProcessWin32Process();
5239
5240 /* Search private fonts */
5241 IntLockProcessPrivateFonts(Win32Process);
5242 FindBestFontFromList(&TextObj->Font, &MatchPenalty, &SubstitutedLogFont,
5243 &Win32Process->PrivateFontListHead);
5244 IntUnLockProcessPrivateFonts(Win32Process);
5245
5246 /* Search system fonts */
5248 FindBestFontFromList(&TextObj->Font, &MatchPenalty, &SubstitutedLogFont,
5251
5252 if (NULL == TextObj->Font)
5253 {
5254 DPRINT1("Request font %S not found, no fonts loaded at all\n",
5255 pLogFont->lfFaceName);
5257 }
5258 else
5259 {
5261 PFONTGDI FontGdi = ObjToGDI(TextObj->Font, FONT);
5262 PSHARED_FACE SharedFace = FontGdi->SharedFace;
5263
5264 TextObj->TextFace[0] = UNICODE_NULL;
5265 if (MatchFontNames(SharedFace, SubstitutedLogFont.lfFaceName))
5266 {
5267 RtlStringCchCopyW(TextObj->TextFace, _countof(TextObj->TextFace), pLogFont->lfFaceName);
5268 }
5269 else
5270 {
5273 if (NT_SUCCESS(Status))
5274 {
5275 /* truncated copy */
5276 IntUnicodeStringToBuffer(TextObj->TextFace, sizeof(TextObj->TextFace), &Name);
5278 }
5279 }
5280
5281 // Need hdev, when freetype is loaded need to create DEVOBJ for
5282 // Consumer and Producer.
5283 TextObj->Font->iUniq = 1; // Now it can be cached.
5284 IntFontType(FontGdi);
5285 FontGdi->flType = TextObj->Font->flFontType;
5286 FontGdi->RequestUnderline = pLogFont->lfUnderline ? 0xFF : 0;
5287 FontGdi->RequestStrikeOut = pLogFont->lfStrikeOut ? 0xFF : 0;
5288 FontGdi->RequestItalic = pLogFont->lfItalic ? 0xFF : 0;
5289 if (pLogFont->lfWeight != FW_DONTCARE)
5290 FontGdi->RequestWeight = pLogFont->lfWeight;
5291 else
5292 FontGdi->RequestWeight = FW_NORMAL;
5293
5294 TextObj->fl |= TEXTOBJECT_INIT;
5296 }
5297
5298 if (!pTextObj) TEXTOBJ_UnlockText(TextObj);
5299
5300 ASSERT((NT_SUCCESS(Status) ^ (NULL == TextObj->Font)) != 0);
5301
5302 return Status;
5303}
struct NameRec_ * Name
Definition: cdprocs.h:460
static VOID FASTCALL IntFontType(PFONTGDI Font)
Definition: freetype.c:5114
static BOOL SubstituteFontRecurse(LOGFONTW *pLogFont)
Definition: freetype.c:857
static __inline VOID FindBestFontFromList(FONTOBJ **FontObj, ULONG *MatchPenalty, const LOGFONTW *LogFont, const PLIST_ENTRY Head)
Definition: freetype.c:5046
static VOID IntUnicodeStringToBuffer(LPWSTR pszBuffer, SIZE_T cbBuffer, const UNICODE_STRING *pString)
Definition: freetype.c:819
static BOOL MatchFontNames(PSHARED_FACE SharedFace, LPCWSTR lfFaceName)
Definition: freetype.c:5172
static NTSTATUS IntGetFontLocalizedName(PUNICODE_STRING pNameW, PSHARED_FACE SharedFace, FT_UShort NameID, FT_UShort LangID)
Definition: freetype.c:2609
#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 3591 of file freetype.c.

3595{
3596 FT_Face face;
3597 INT error, n;
3598 FT_CharMap charmap, found;
3599 LOGFONTW *plf;
3600
3601 if (bDoLock)
3603
3604 face = FontGDI->SharedFace->Face;
3605 if (face->charmap == NULL)
3606 {
3607 DPRINT("WARNING: No charmap selected!\n");
3608 DPRINT("This font face has %d charmaps\n", face->num_charmaps);
3609
3610 found = NULL;
3611 for (n = 0; n < face->num_charmaps; n++)
3612 {
3613 charmap = face->charmaps[n];
3614 if (charmap->encoding == FT_ENCODING_UNICODE)
3615 {
3616 found = charmap;
3617 break;
3618 }
3619 }
3620 if (!found)
3621 {
3622 for (n = 0; n < face->num_charmaps; n++)
3623 {
3624 charmap = face->charmaps[n];
3625 if (charmap->platform_id == TT_PLATFORM_APPLE_UNICODE)
3626 {
3627 found = charmap;
3628 break;
3629 }
3630 }
3631 }
3632 if (!found)
3633 {
3634 for (n = 0; n < face->num_charmaps; n++)
3635 {
3636 charmap = face->charmaps[n];
3637 if (charmap->encoding == FT_ENCODING_MS_SYMBOL)
3638 {
3639 found = charmap;
3640 break;
3641 }
3642 }
3643 }
3644 if (!found && face->num_charmaps > 0)
3645 {
3646 found = face->charmaps[0];
3647 }
3648 if (!found)
3649 {
3650 DPRINT1("WARNING: Could not find desired charmap!\n");
3651 }
3652 else
3653 {
3654 DPRINT("Found charmap encoding: %i\n", found->encoding);
3655 error = FT_Set_Charmap(face, found);
3656 if (error)
3657 {
3658 DPRINT1("WARNING: Could not set the charmap!\n");
3659 }
3660 }
3661 }
3662
3663 plf = &TextObj->logfont.elfEnumLogfontEx.elfLogFont;
3664
3665 error = IntRequestFontSize(dc, FontGDI, plf->lfWidth, plf->lfHeight);
3666
3667 if (bDoLock)
3669
3670 if (error)
3671 {
3672 DPRINT1("Error in setting pixel sizes: %d\n", error);
3673 return FALSE;
3674 }
3675
3676 return TRUE;
3677}
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:1035
#define KeEnterCriticalRegion()
Definition: ke_x.h:88
#define LFONT_ShareLockFont(hfont)
Definition: text.h:77

Referenced by RealizeFontInit(), and TextIntRealizeFont().

◆ TEXTOBJ_UnlockText()