ReactOS 0.4.15-dev-7961-gdcf9eb0
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:5193
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 4652 of file freetype.c.

4658{
4660 FT_Face Face = FontGdi->SharedFace->Face;
4661
4663
4664 if (FT_IS_SFNT(Face))
4665 {
4666 if (Table)
4667 Table = Table >> 24 | Table << 24 | (Table >> 8 & 0xFF00) |
4668 (Table << 8 & 0xFF0000);
4669
4670 if (!Buffer) Size = 0;
4671
4672 if (Buffer && Size)
4673 {
4675 FT_ULong Needed = 0;
4676
4677 Error = FT_Load_Sfnt_Table(Face, Table, Offset, NULL, &Needed);
4678
4679 if ( !Error && Needed < Size) Size = Needed;
4680 }
4681 if (!FT_Load_Sfnt_Table(Face, Table, Offset, Buffer, &Size))
4682 Result = Size;
4683 }
4684
4686
4687 return Result;
4688}
BOOL Error
Definition: chkdsk.c:66
Definition: bufpool.h:45
unsigned long DWORD
Definition: ntddk_ex.h:95
#define IntUnLockFreeType()
Definition: freetype.c:82
#define IntLockFreeType()
Definition: freetype.c:79
#define FT_IS_SFNT(face)
Definition: freetype.h:1331
unsigned long FT_ULong
Definition: fttypes.h:253
int FT_Error
Definition: fttypes.h:300
ASMGENDATA Table[]
Definition: genincdata.c:61
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
PSHARED_FACE SharedFace
Definition: engobjects.h:145
FT_Face Face
Definition: engobjects.h:132
FT_Load_Sfnt_Table(FT_Face face, FT_ULong tag, FT_Long offset, FT_Byte *buffer, FT_ULong *length)
Definition: ftobjs.c:4134
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533
#define GDI_ERROR
Definition: wingdi.h:1309
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:409

Referenced by NtGdiGetFontData().

◆ ftGdiGetGlyphOutline()

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

Definition at line 3723 of file freetype.c.

3732{
3733 PDC_ATTR pdcattr;
3734 PTEXTOBJ TextObj;
3735 PFONTGDI FontGDI;
3736 HFONT hFont = 0;
3737 GLYPHMETRICS gm;
3738 ULONG Size;
3739 FT_Face ft_face;
3740 FT_UInt glyph_index;
3741 DWORD width, height, pitch, needed = 0;
3742 FT_Bitmap ft_bitmap;
3744 INT left, right, top = 0, bottom = 0;
3746 FLOATOBJ eM11, widthRatio, eTemp;
3747 FT_Matrix mat, transMat = identityMat;
3748 BOOL needsTransform = FALSE;
3749 INT orientation;
3750 LONG aveWidth;
3751 INT adv, lsb, bbx; /* These three hold to widths of the unrotated chars */
3752 OUTLINETEXTMETRICW *potm;
3753 XFORMOBJ xo;
3754 XFORML xform;
3755 LOGFONTW *plf;
3756
3757 DPRINT("%u, %08x, %p, %08lx, %p, %p\n", wch, iFormat, pgm,
3758 cjBuf, pvBuf, pmat2);
3759
3760 pdcattr = dc->pdcattr;
3761
3762 XFORMOBJ_vInit(&xo, &dc->pdcattr->mxWorldToDevice);
3763 XFORMOBJ_iGetXform(&xo, &xform);
3764 FLOATOBJ_SetFloat(&eM11, xform.eM11);
3765
3766 hFont = pdcattr->hlfntNew;
3767 TextObj = RealizeFontInit(hFont);
3768
3769 if (!TextObj)
3770 {
3772 return GDI_ERROR;
3773 }
3774 FontGDI = ObjToGDI(TextObj->Font, FONT);
3775 ft_face = FontGDI->SharedFace->Face;
3776
3777 plf = &TextObj->logfont.elfEnumLogfontEx.elfLogFont;
3778 aveWidth = FT_IS_SCALABLE(ft_face) ? abs(plf->lfWidth) : 0;
3779 orientation = FT_IS_SCALABLE(ft_face) ? plf->lfOrientation : 0;
3780
3781 Size = IntGetOutlineTextMetrics(FontGDI, 0, NULL);
3783 if (!potm)
3784 {
3786 TEXTOBJ_UnlockText(TextObj);
3787 return GDI_ERROR;
3788 }
3789 Size = IntGetOutlineTextMetrics(FontGDI, Size, potm);
3790 if (!Size)
3791 {
3792 /* FIXME: last error? */
3794 TEXTOBJ_UnlockText(TextObj);
3795 return GDI_ERROR;
3796 }
3797
3799 TextIntUpdateSize(dc, TextObj, FontGDI, FALSE);
3801 FT_Set_Transform(ft_face, &mat, NULL);
3802
3803 TEXTOBJ_UnlockText(TextObj);
3804
3805 glyph_index = get_glyph_index_flagged(ft_face, wch, GGO_GLYPH_INDEX, iFormat);
3806 iFormat &= ~GGO_GLYPH_INDEX;
3807
3808 if (orientation || (iFormat != GGO_METRICS && iFormat != GGO_BITMAP) || aveWidth || pmat2)
3809 load_flags |= FT_LOAD_NO_BITMAP;
3810
3811 if (iFormat & GGO_UNHINTED)
3812 {
3813 load_flags |= FT_LOAD_NO_HINTING;
3814 iFormat &= ~GGO_UNHINTED;
3815 }
3816
3817 error = FT_Load_Glyph(ft_face, glyph_index, load_flags);
3818 if (error)
3819 {
3820 DPRINT1("WARNING: Failed to load and render glyph! [index: %u]\n", glyph_index);
3822 if (potm) ExFreePoolWithTag(potm, GDITAG_TEXT);
3823 return GDI_ERROR;
3824 }
3826
3827 FLOATOBJ_Set1(&widthRatio);
3828 if (aveWidth && potm)
3829 {
3830 // widthRatio = aveWidth * eM11 / potm->otmTextMetrics.tmAveCharWidth
3831 FLOATOBJ_SetLong(&widthRatio, aveWidth);
3832 FLOATOBJ_Mul(&widthRatio, &eM11);
3834 }
3835
3836 //left = (INT)(ft_face->glyph->metrics.horiBearingX * widthRatio) & -64;
3837 FLOATOBJ_SetLong(&eTemp, ft_face->glyph->metrics.horiBearingX);
3838 FLOATOBJ_Mul(&eTemp, &widthRatio);
3839 left = FLOATOBJ_GetLong(&eTemp) & -64;
3840
3841 //right = (INT)((ft_face->glyph->metrics.horiBearingX +
3842 // ft_face->glyph->metrics.width) * widthRatio + 63) & -64;
3843 FLOATOBJ_SetLong(&eTemp, ft_face->glyph->metrics.horiBearingX * ft_face->glyph->metrics.width);
3844 FLOATOBJ_Mul(&eTemp, &widthRatio);
3845 FLOATOBJ_AddLong(&eTemp, 63);
3846 right = FLOATOBJ_GetLong(&eTemp) & -64;
3847
3848 //adv = (INT)((ft_face->glyph->metrics.horiAdvance * widthRatio) + 63) >> 6;
3849 FLOATOBJ_SetLong(&eTemp, ft_face->glyph->metrics.horiAdvance);
3850 FLOATOBJ_Mul(&eTemp, &widthRatio);
3851 FLOATOBJ_AddLong(&eTemp, 63);
3852 adv = FLOATOBJ_GetLong(&eTemp) >> 6;
3853
3854 lsb = left >> 6;
3855 bbx = (right - left) >> 6;
3856
3857 DPRINT("Advance = %d, lsb = %d, bbx = %d\n",adv, lsb, bbx);
3858
3860
3861 /* Width scaling transform */
3862 if (!FLOATOBJ_Equal1(&widthRatio))
3863 {
3864 FT_Matrix scaleMat;
3865
3866 eTemp = widthRatio;
3867 FLOATOBJ_MulLong(&eTemp, 1 << 16);
3868
3869 scaleMat.xx = FLOATOBJ_GetLong(&eTemp);
3870 scaleMat.xy = 0;
3871 scaleMat.yx = 0;
3872 scaleMat.yy = INT_TO_FIXED(1);
3873 FT_Matrix_Multiply(&scaleMat, &transMat);
3874 needsTransform = TRUE;
3875 }
3876
3877 /* World transform */
3878 {
3879 FT_Matrix ftmatrix;
3881
3882 /* Create a freetype matrix, by converting to 16.16 fixpoint format */
3883 IntMatrixFromMx(&ftmatrix, pmx);
3884
3885 if (memcmp(&ftmatrix, &identityMat, sizeof(identityMat)) != 0)
3886 {
3887 FT_Matrix_Multiply(&ftmatrix, &transMat);
3888 needsTransform = TRUE;
3889 }
3890 }
3891
3892 /* Rotation transform */
3893 if (orientation)
3894 {
3895 FT_Matrix rotationMat;
3896 DPRINT("Rotation Trans!\n");
3897 IntEscapeMatrix(&rotationMat, orientation);
3898 FT_Matrix_Multiply(&rotationMat, &transMat);
3899 needsTransform = TRUE;
3900 }
3901
3902 /* Extra transformation specified by caller */
3903 if (pmat2)
3904 {
3905 FT_Matrix extraMat;
3906 DPRINT("MAT2 Matrix Trans!\n");
3907 extraMat.xx = FT_FixedFromFIXED(pmat2->eM11);
3908 extraMat.xy = FT_FixedFromFIXED(pmat2->eM21);
3909 extraMat.yx = FT_FixedFromFIXED(pmat2->eM12);
3910 extraMat.yy = FT_FixedFromFIXED(pmat2->eM22);
3911 FT_Matrix_Multiply(&extraMat, &transMat);
3912 needsTransform = TRUE;
3913 }
3914
3915 if (potm) ExFreePoolWithTag(potm, GDITAG_TEXT); /* It looks like we are finished with potm ATM. */
3916
3917 if (!needsTransform)
3918 {
3919 DPRINT("No Need to be Transformed!\n");
3920 top = (ft_face->glyph->metrics.horiBearingY + 63) & -64;
3921 bottom = (ft_face->glyph->metrics.horiBearingY -
3922 ft_face->glyph->metrics.height) & -64;
3923 gm.gmCellIncX = adv;
3924 gm.gmCellIncY = 0;
3925 }
3926 else
3927 {
3928 INT xc, yc;
3929 FT_Vector vec;
3930 for (xc = 0; xc < 2; xc++)
3931 {
3932 for (yc = 0; yc < 2; yc++)
3933 {
3934 vec.x = (ft_face->glyph->metrics.horiBearingX +
3935 xc * ft_face->glyph->metrics.width);
3936 vec.y = ft_face->glyph->metrics.horiBearingY -
3937 yc * ft_face->glyph->metrics.height;
3938 DPRINT("Vec %ld,%ld\n", vec.x, vec.y);
3939 FT_Vector_Transform(&vec, &transMat);
3940 if (xc == 0 && yc == 0)
3941 {
3942 left = right = vec.x;
3943 top = bottom = vec.y;
3944 }
3945 else
3946 {
3947 if (vec.x < left) left = vec.x;
3948 else if (vec.x > right) right = vec.x;
3949 if (vec.y < bottom) bottom = vec.y;
3950 else if (vec.y > top) top = vec.y;
3951 }
3952 }
3953 }
3954 left = left & -64;
3955 right = (right + 63) & -64;
3956 bottom = bottom & -64;
3957 top = (top + 63) & -64;
3958
3959 DPRINT("Transformed box: (%d,%d - %d,%d)\n", left, top, right, bottom);
3960 vec.x = ft_face->glyph->metrics.horiAdvance;
3961 vec.y = 0;
3962 FT_Vector_Transform(&vec, &transMat);
3963 gm.gmCellIncX = (vec.x+63) >> 6;
3964 gm.gmCellIncY = -((vec.y+63) >> 6);
3965 }
3966 gm.gmBlackBoxX = (right - left) >> 6;
3967 gm.gmBlackBoxY = (top - bottom) >> 6;
3968 gm.gmptGlyphOrigin.x = left >> 6;
3969 gm.gmptGlyphOrigin.y = top >> 6;
3970
3971 DPRINT("CX %d CY %d BBX %u BBY %u GOX %d GOY %d\n",
3972 gm.gmCellIncX, gm.gmCellIncY,
3973 gm.gmBlackBoxX, gm.gmBlackBoxY,
3975
3977
3978
3979 if (iFormat == GGO_METRICS)
3980 {
3981 DPRINT("GGO_METRICS Exit!\n");
3982 *pgm = gm;
3983 return 1; /* FIXME */
3984 }
3985
3986 if (ft_face->glyph->format != ft_glyph_format_outline && iFormat != GGO_BITMAP)
3987 {
3988 DPRINT1("Loaded a bitmap\n");
3989 return GDI_ERROR;
3990 }
3991
3992 switch (iFormat)
3993 {
3994 case GGO_BITMAP:
3995 {
3996 width = gm.gmBlackBoxX;
3997 height = gm.gmBlackBoxY;
3998 pitch = ((width + 31) >> 5) << 2;
3999 needed = pitch * height;
4000
4001 if (!pvBuf || !cjBuf) break;
4002 if (!needed) return GDI_ERROR; /* empty glyph */
4003 if (needed > cjBuf)
4004 return GDI_ERROR;
4005
4006 switch (ft_face->glyph->format)
4007 {
4009 {
4010 BYTE *src = ft_face->glyph->bitmap.buffer, *dst = pvBuf;
4011 INT w = min( pitch, (ft_face->glyph->bitmap.width + 7) >> 3 );
4012 INT h = min( height, ft_face->glyph->bitmap.rows );
4013 while (h--)
4014 {
4016 src += ft_face->glyph->bitmap.pitch;
4017 dst += pitch;
4018 }
4019 break;
4020 }
4021
4023 {
4024 ft_bitmap.width = width;
4025 ft_bitmap.rows = height;
4026 ft_bitmap.pitch = pitch;
4027 ft_bitmap.pixel_mode = FT_PIXEL_MODE_MONO;
4028 ft_bitmap.buffer = pvBuf;
4029
4031 if (needsTransform)
4032 {
4033 FT_Outline_Transform(&ft_face->glyph->outline, &transMat);
4034 }
4035 FT_Outline_Translate(&ft_face->glyph->outline, -left, -bottom );
4036 /* Note: FreeType will only set 'black' bits for us. */
4037 RtlZeroMemory(pvBuf, needed);
4038 FT_Outline_Get_Bitmap(g_FreeTypeLibrary, &ft_face->glyph->outline, &ft_bitmap);
4040 break;
4041 }
4042
4043 default:
4044 DPRINT1("Loaded glyph format %x\n", ft_face->glyph->format);
4045 return GDI_ERROR;
4046 }
4047
4048 break;
4049 }
4050
4051 case GGO_GRAY2_BITMAP:
4052 case GGO_GRAY4_BITMAP:
4053 case GGO_GRAY8_BITMAP:
4054 {
4055 unsigned int mult, row, col;
4056 BYTE *start, *ptr;
4057
4058 width = gm.gmBlackBoxX;
4059 height = gm.gmBlackBoxY;
4060 pitch = (width + 3) / 4 * 4;
4061 needed = pitch * height;
4062
4063 if (!pvBuf || !cjBuf) break;
4064 if (!needed) return GDI_ERROR; /* empty glyph */
4065 if (needed > cjBuf)
4066 return GDI_ERROR;
4067
4068 switch (ft_face->glyph->format)
4069 {
4071 {
4072 BYTE *src = ft_face->glyph->bitmap.buffer, *dst = pvBuf;
4073 INT h = min( height, ft_face->glyph->bitmap.rows );
4074 INT x;
4075 while (h--)
4076 {
4077 for (x = 0; (UINT)x < pitch; x++)
4078 {
4079 if (x < ft_face->glyph->bitmap.width)
4080 dst[x] = (src[x / 8] & (1 << ( (7 - (x % 8))))) ? 0xff : 0;
4081 else
4082 dst[x] = 0;
4083 }
4084 src += ft_face->glyph->bitmap.pitch;
4085 dst += pitch;
4086 }
4087 break;
4088 }
4090 {
4091 ft_bitmap.width = width;
4092 ft_bitmap.rows = height;
4093 ft_bitmap.pitch = pitch;
4094 ft_bitmap.pixel_mode = FT_PIXEL_MODE_GRAY;
4095 ft_bitmap.buffer = pvBuf;
4096
4098 if (needsTransform)
4099 {
4100 FT_Outline_Transform(&ft_face->glyph->outline, &transMat);
4101 }
4102 FT_Outline_Translate(&ft_face->glyph->outline, -left, -bottom );
4103 RtlZeroMemory(ft_bitmap.buffer, cjBuf);
4104 FT_Outline_Get_Bitmap(g_FreeTypeLibrary, &ft_face->glyph->outline, &ft_bitmap);
4106
4108 mult = 4;
4109 else if (iFormat == GGO_GRAY4_BITMAP)
4110 mult = 16;
4111 else if (iFormat == GGO_GRAY8_BITMAP)
4112 mult = 64;
4113 else
4114 {
4115 return GDI_ERROR;
4116 }
4117
4118 start = pvBuf;
4119 for (row = 0; row < height; row++)
4120 {
4121 ptr = start;
4122 for (col = 0; col < width; col++, ptr++)
4123 {
4124 *ptr = (((int)*ptr) * mult + 128) / 256;
4125 }
4126 start += pitch;
4127 }
4128
4129 break;
4130 }
4131 default:
4132 DPRINT1("Loaded glyph format %x\n", ft_face->glyph->format);
4133 return GDI_ERROR;
4134 }
4135
4136 break;
4137 }
4138
4139 case GGO_NATIVE:
4140 {
4141 FT_Outline *outline = &ft_face->glyph->outline;
4142
4143 if (cjBuf == 0) pvBuf = NULL; /* This is okay, need cjBuf to allocate. */
4144
4146 if (needsTransform && pvBuf) FT_Outline_Transform(outline, &transMat);
4147
4149
4150 if (!pvBuf || !cjBuf)
4151 {
4153 break;
4154 }
4155 if (needed > cjBuf)
4156 {
4158 return GDI_ERROR;
4159 }
4162 break;
4163 }
4164
4165 case GGO_BEZIER:
4166 {
4167 FT_Outline *outline = &ft_face->glyph->outline;
4168 if (cjBuf == 0) pvBuf = NULL;
4169
4170 if (needsTransform && pvBuf)
4171 {
4173 FT_Outline_Transform(outline, &transMat);
4175 }
4177
4178 if (!pvBuf || !cjBuf)
4179 break;
4180 if (needed > cjBuf)
4181 return GDI_ERROR;
4182
4184 break;
4185 }
4186
4187 default:
4188 DPRINT1("Unsupported format %u\n", iFormat);
4189 return GDI_ERROR;
4190 }
4191
4192 DPRINT("ftGdiGetGlyphOutline END and needed %lu\n", needed);
4193
4194 if (gm.gmBlackBoxX == 0)
4195 gm.gmBlackBoxX = 1;
4196 if (gm.gmBlackBoxY == 0)
4197 gm.gmBlackBoxY = 1;
4198
4199 *pgm = gm;
4200 return needed;
4201}
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:3585
FT_Library g_FreeTypeLibrary
Definition: freetype.c:55
static unsigned int get_bezier_glyph_outline(FT_Outline *outline, unsigned int buflen, char *buf)
Definition: freetype.c:3320
static unsigned int get_native_glyph_outline(FT_Outline *outline, unsigned int buflen, char *buf)
Definition: freetype.c:3247
static VOID FASTCALL IntMatrixFromMx(FT_Matrix *pmat, const MATRIX *pmx)
Definition: freetype.c:724
static VOID FASTCALL IntEscapeMatrix(FT_Matrix *pmat, LONG lfEscapement)
Definition: freetype.c:711
static FT_UInt FASTCALL get_glyph_index_flagged(FT_Face face, FT_ULong code, DWORD indexed_flag, DWORD flags)
Definition: freetype.c:3703
static const FT_Matrix identityMat
Definition: freetype.c:49
static __inline FT_Fixed FT_FixedFromFIXED(FIXED f)
Definition: freetype.c:382
INT FASTCALL IntGetOutlineTextMetrics(PFONTGDI FontGDI, UINT Size, OUTLINETEXTMETRICW *Otm)
Definition: freetype.c:2398
FT_Load_Glyph(FT_Face face, FT_UInt glyph_index, FT_Int32 load_flags)
Definition: ftobjs.c:760
#define FT_LOAD_NO_BITMAP
Definition: freetype.h:3012
FT_Set_Transform(FT_Face face, FT_Matrix *matrix, FT_Vector *delta)
Definition: ftobjs.c:653
FT_Vector_Transform(FT_Vector *vec, const FT_Matrix *matrix)
Definition: ftoutln.c:688
#define FT_LOAD_NO_HINTING
Definition: freetype.h:3010
#define FT_IS_SCALABLE(face)
Definition: freetype.h:1312
#define FT_LOAD_DEFAULT
Definition: freetype.h:3008
#define FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH
Definition: freetype.h:3017
FT_Vector * vec
Definition: ftbbox.c:448
#define INT_TO_FIXED(x)
Definition: ftcalc.h:404
FT_Matrix_Multiply(const FT_Matrix *a, FT_Matrix *b)
Definition: ftcalc.c:661
#define ft_glyph_format_bitmap
Definition: ftimage.h:731
@ FT_PIXEL_MODE_MONO
Definition: ftimage.h:183
@ FT_PIXEL_MODE_GRAY
Definition: ftimage.h:184
#define ft_glyph_format_outline
Definition: ftimage.h:732
FT_Outline_Translate(const FT_Outline *outline, FT_Pos xOffset, FT_Pos yOffset)
Definition: ftoutln.c:528
FT_Outline_Get_Bitmap(FT_Library library, FT_Outline *outline, const FT_Bitmap *abitmap)
Definition: ftoutln.c:661
FT_Outline_Transform(const FT_Outline *outline, const FT_Matrix *matrix)
Definition: ftoutln.c:711
unsigned int FT_UInt
Definition: fttypes.h:231
signed int FT_Int
Definition: fttypes.h:220
GLuint start
Definition: gl.h:1545
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546
GLenum src
Definition: glext.h:6340
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859
GLdouble GLdouble right
Definition: glext.h:10859
GLint left
Definition: glext.h:7726
GLenum GLenum dst
Definition: glext.h:6340
GLint GLint bottom
Definition: glext.h:7726
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
static const WCHAR dc[]
#define error(str)
Definition: mkdosfs.c:1605
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
static PVOID ptr
Definition: dispmode.c:27
static const MAT2 mat
Definition: font.c:66
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
#define min(a, b)
Definition: monoChain.cc:55
unsigned int UINT
Definition: ndis.h:50
long LONG
Definition: pedump.c:60
unsigned int width
Definition: ftimage.h:264
unsigned char * buffer
Definition: ftimage.h:266
unsigned char pixel_mode
Definition: ftimage.h:268
unsigned int rows
Definition: ftimage.h:263
int pitch
Definition: ftimage.h:265
FT_GlyphSlot glyph
Definition: freetype.h:1105
FT_Bitmap bitmap
Definition: freetype.h:1923
FT_Outline outline
Definition: freetype.h:1927
FT_Glyph_Metrics metrics
Definition: freetype.h:1916
FT_Glyph_Format format
Definition: freetype.h:1921
FT_Fixed xx
Definition: fttypes.h:387
FT_Fixed yx
Definition: fttypes.h:388
FT_Fixed yy
Definition: fttypes.h:388
FT_Fixed xy
Definition: fttypes.h:387
FT_Pos x
Definition: ftimage.h:76
FT_Pos y
Definition: ftimage.h:77
LONG lfOrientation
Definition: dimm.idl:62
LONG lfWidth
Definition: dimm.idl:60
HANDLE hlfntNew
Definition: ntgdihdl.h:330
short gmCellIncX
Definition: wingdi.h:2445
UINT gmBlackBoxY
Definition: wingdi.h:2443
UINT gmBlackBoxX
Definition: wingdi.h:2442
short gmCellIncY
Definition: wingdi.h:2446
POINT gmptGlyphOrigin
Definition: wingdi.h:2444
Definition: text.h:60
ENUMLOGFONTEXDVW logfont
Definition: text.h:70
FONTOBJ * Font
Definition: text.h:66
FIXED eM22
Definition: wingdi.h:2476
FIXED eM21
Definition: wingdi.h:2475
FIXED eM11
Definition: wingdi.h:2473
FIXED eM12
Definition: wingdi.h:2474
TEXTMETRICW otmTextMetrics
Definition: wingdi.h:2514
FLOATL eM11
Definition: winddi.h:1234
Definition: mesh.c:5330
ENUMLOGFONTEXW elfEnumLogfontEx
Definition: wingdi.h:2779
LOGFONTW elfLogFont
Definition: wingdi.h:2702
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
LONG tmAveCharWidth
Definition: wingdi.h:2388
int32_t INT
Definition: typedefs.h:58
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
PTEXTOBJ FASTCALL RealizeFontInit(HFONT hFont)
Definition: font.c:422
FORCEINLINE VOID TEXTOBJ_UnlockText(PLFONT plfnt)
Definition: text.h:96
#define GDITAG_TEXT
Definition: tags.h:172
#define FLOATOBJ_DivLong(pf, l)
Definition: winddi.h:2829
_In_ DWORD cjBuf
Definition: winddi.h:3827
FLOAT FLOATOBJ
Definition: winddi.h:677
#define FLOATOBJ_Mul(pf, pf1)
Definition: winddi.h:2824
#define FLOATOBJ_MulLong(pf, l)
Definition: winddi.h:2826
#define FLOATOBJ_GetLong(pf)
Definition: winddi.h:2817
#define FLOATOBJ_SetFloat(pf, f)
Definition: winddi.h:2814
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:22
#define FLOATOBJ_SetLong(pf, l)
Definition: winddi.h:2815
_In_ SIZEL _In_ ULONG iFormat
Definition: winddi.h:3468
#define FLOATOBJ_AddLong(pf, l)
Definition: winddi.h:2820
#define GGO_GRAY2_BITMAP
Definition: wingdi.h:852
#define GGO_GLYPH_INDEX
Definition: wingdi.h:855
#define GGO_UNHINTED
Definition: wingdi.h:856
#define GGO_GRAY8_BITMAP
Definition: wingdi.h:854
#define GGO_BITMAP
Definition: wingdi.h:849
#define GGO_GRAY4_BITMAP
Definition: wingdi.h:853
#define GGO_NATIVE
Definition: wingdi.h:850
#define GGO_METRICS
Definition: wingdi.h:848
#define GGO_BEZIER
Definition: wingdi.h:851
#define XFORMOBJ_vInit
Definition: xformobj.h:12
#define XFORMOBJ_iGetXform
Definition: xformobj.h:9
unsigned char BYTE
Definition: xxhash.c:193

Referenced by NtGdiGetGlyphOutline(), and PATH_ExtTextOut().

◆ ftGdiGetKerningPairs()

DWORD FASTCALL ftGdiGetKerningPairs ( PFONTGDI  Font,
DWORD  cPairs,
LPKERNINGPAIR  pKerningPair 
)

Definition at line 5667 of file freetype.c.

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

3074{
3075 if ( lprs )
3076 {
3077 lprs->nSize = sizeof(RASTERIZER_STATUS);
3078 lprs->wFlags = TT_AVAILABLE | TT_ENABLED;
3079 lprs->nLanguageID = gusLanguageID;
3080 return TRUE;
3081 }
3083 return FALSE;
3084}
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
USHORT gusLanguageID
Definition: init.c:12
#define TT_ENABLED
Definition: wingdi.h:889
struct _RASTERIZER_STATUS RASTERIZER_STATUS
#define TT_AVAILABLE
Definition: wingdi.h:888

Referenced by NtGdiGetRasterizerCaps().

◆ ftGdiGetTextCharsetInfo()

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

Definition at line 4368 of file freetype.c.

4372{
4373 PDC_ATTR pdcattr;
4374 UINT Ret = DEFAULT_CHARSET;
4375 INT i;
4376 HFONT hFont;
4377 PTEXTOBJ TextObj;
4378 PFONTGDI FontGdi;
4380 TT_OS2 *pOS2;
4381 FT_Face Face;
4382 CHARSETINFO csi;
4383 DWORD cp, fs0;
4384 USHORT usACP, usOEM;
4385
4386 pdcattr = Dc->pdcattr;
4387 hFont = pdcattr->hlfntNew;
4388 TextObj = RealizeFontInit(hFont);
4389
4390 if (!TextObj)
4391 {
4393 return Ret;
4394 }
4395 FontGdi = ObjToGDI(TextObj->Font, FONT);
4396 Face = FontGdi->SharedFace->Face;
4397 TEXTOBJ_UnlockText(TextObj);
4398
4399 memset(&fs, 0, sizeof(FONTSIGNATURE));
4401 pOS2 = FT_Get_Sfnt_Table(Face, ft_sfnt_os2);
4402 if (NULL != pOS2)
4403 {
4404 fs.fsCsb[0] = pOS2->ulCodePageRange1;
4405 fs.fsCsb[1] = pOS2->ulCodePageRange2;
4406 fs.fsUsb[0] = pOS2->ulUnicodeRange1;
4407 fs.fsUsb[1] = pOS2->ulUnicodeRange2;
4408 fs.fsUsb[2] = pOS2->ulUnicodeRange3;
4409 fs.fsUsb[3] = pOS2->ulUnicodeRange4;
4410 if (pOS2->version == 0)
4411 {
4412 FT_UInt dummy;
4413
4414 if (FT_Get_First_Char( Face, &dummy ) < 0x100)
4415 fs.fsCsb[0] |= FS_LATIN1;
4416 else
4417 fs.fsCsb[0] |= FS_SYMBOL;
4418 }
4419 }
4420 pOS2 = NULL;
4422 DPRINT("Csb 1=%x 0=%x\n", fs.fsCsb[1],fs.fsCsb[0]);
4423 if (fs.fsCsb[0] == 0)
4424 { /* Let's see if we can find any interesting cmaps */
4425 for (i = 0; i < Face->num_charmaps; i++)
4426 {
4427 switch (Face->charmaps[i]->encoding)
4428 {
4429 case FT_ENCODING_UNICODE:
4430 case FT_ENCODING_APPLE_ROMAN:
4431 fs.fsCsb[0] |= FS_LATIN1;
4432 break;
4433 case FT_ENCODING_MS_SYMBOL:
4434 fs.fsCsb[0] |= FS_SYMBOL;
4435 break;
4436 default:
4437 break;
4438 }
4439 }
4440 }
4441 if (lpSig)
4442 {
4443 RtlCopyMemory(lpSig, &fs, sizeof(FONTSIGNATURE));
4444 }
4445
4446 RtlGetDefaultCodePage(&usACP, &usOEM);
4447 cp = usACP;
4448
4450 if (csi.fs.fsCsb[0] & fs.fsCsb[0])
4451 {
4452 DPRINT("Hit 1\n");
4453 Ret = csi.ciCharset;
4454 goto Exit;
4455 }
4456
4457 for (i = 0; i < MAXTCIINDEX; i++)
4458 {
4459 fs0 = 1L << i;
4460 if (fs.fsCsb[0] & fs0)
4461 {
4462 if (IntTranslateCharsetInfo(&fs0, &csi, TCI_SRCFONTSIG))
4463 {
4464 // *cp = csi.ciACP;
4465 DPRINT("Hit 2\n");
4466 Ret = csi.ciCharset;
4467 goto Exit;
4468 }
4469 else
4470 DPRINT1("TCI failing on %x\n", fs0);
4471 }
4472 }
4473Exit:
4474 DPRINT("CharSet %u CodePage %u\n", csi.ciCharset, csi.ciACP);
4475 return (MAKELONG(csi.ciACP, csi.ciCharset));
4476}
#define MAXTCIINDEX
Definition: freetype.c:123
static BOOLEAN IntTranslateCharsetInfo(PDWORD Src, LPCHARSETINFO Cs, DWORD Flags)
Definition: freetype.c:2033
#define fs
Definition: i386-dis.c:444
POINT cp
Definition: magnifier.c:59
NTSYSAPI VOID NTAPI RtlGetDefaultCodePage(_Out_ PUSHORT AnsiCodePage, _Out_ PUSHORT OemCodePage)
unsigned short USHORT
Definition: pedump.c:61
#define memset(x, y, z)
Definition: compat.h:39
static void Exit(void)
Definition: sock.c:1330
FT_Encoding encoding
Definition: freetype.h:843
FT_Int num_charmaps
Definition: freetype.h:1084
FT_CharMap * charmaps
Definition: freetype.h:1085
FT_UShort version
Definition: tttables.h:382
FT_ULong ulUnicodeRange1
Definition: tttables.h:401
FT_ULong ulCodePageRange1
Definition: tttables.h:419
FT_ULong ulUnicodeRange3
Definition: tttables.h:403
FT_ULong ulUnicodeRange2
Definition: tttables.h:402
FT_ULong ulCodePageRange2
Definition: tttables.h:420
FT_ULong ulUnicodeRange4
Definition: tttables.h:404
Definition: ffs.h:70
FONTSIGNATURE fs
Definition: wingdi.h:1548
UINT ciCharset
Definition: wingdi.h:1546
DWORD fsCsb[2]
Definition: wingdi.h:1543
FT_Get_Sfnt_Table(FT_Face face, FT_Sfnt_Tag tag)
Definition: ftobjs.c:4113
#define ft_sfnt_os2
Definition: tttables.h:631
#define MAKELONG(a, b)
Definition: typedefs.h:249
#define DEFAULT_CHARSET
Definition: wingdi.h:384
#define FS_SYMBOL
Definition: wingdi.h:575
#define FS_LATIN1
Definition: wingdi.h:560
#define TCI_SRCFONTSIG
Definition: wingdi.h:963
#define TCI_SRCCODEPAGE
Definition: wingdi.h:962

Referenced by DC_InitHack(), IntGetFontLanguageInfo(), NtGdiGetCharSet(), and NtGdiGetTextCharsetInfo().

◆ ftGdiGetTextMetricsW()

BOOL FASTCALL ftGdiGetTextMetricsW ( HDC  hDC,
PTMW_INTERNAL  ptmwi 
)

Definition at line 4555 of file freetype.c.

4558{
4559 PDC dc;
4560 PDC_ATTR pdcattr;
4561 PTEXTOBJ TextObj;
4562 PFONTGDI FontGDI;
4563 FT_Face Face;
4564 TT_OS2 *pOS2;
4565 TT_HoriHeader *pHori;
4567 ULONG Error;
4569 LOGFONTW *plf;
4570
4571 if (!ptmwi)
4572 {
4574 return FALSE;
4575 }
4576 RtlZeroMemory(ptmwi, sizeof(TMW_INTERNAL));
4577
4578 if (!(dc = DC_LockDc(hDC)))
4579 {
4581 return FALSE;
4582 }
4583 pdcattr = dc->pdcattr;
4584 TextObj = RealizeFontInit(pdcattr->hlfntNew);
4585 if (NULL != TextObj)
4586 {
4587 plf = &TextObj->logfont.elfEnumLogfontEx.elfLogFont;
4588 FontGDI = ObjToGDI(TextObj->Font, FONT);
4589
4590 Face = FontGDI->SharedFace->Face;
4591
4592 // NOTE: GetTextMetrics simply ignores lfEscapement and XFORM.
4594 Error = IntRequestFontSize(dc, FontGDI, plf->lfWidth, plf->lfHeight);
4595 FT_Set_Transform(Face, NULL, NULL);
4596
4598
4599 if (0 != Error)
4600 {
4601 DPRINT1("Error in setting pixel sizes: %u\n", Error);
4603 }
4604 else
4605 {
4607
4609 pOS2 = FT_Get_Sfnt_Table(Face, ft_sfnt_os2);
4610 if (NULL == pOS2)
4611 {
4612 DPRINT1("Can't find OS/2 table - not TT font?\n");
4614 }
4615
4616 pHori = FT_Get_Sfnt_Table(Face, ft_sfnt_hhea);
4617 if (NULL == pHori)
4618 {
4619 DPRINT1("Can't find HHEA table - not TT font?\n");
4621 }
4622
4623 Error = FT_Get_WinFNT_Header(Face, &Win);
4624
4625 if (NT_SUCCESS(Status) || !Error)
4626 {
4627 FillTM(&ptmwi->TextMetric, FontGDI, pOS2, pHori, !Error ? &Win : 0);
4628
4629 /* FIXME: Fill Diff member */
4630 }
4631
4633 }
4634 TEXTOBJ_UnlockText(TextObj);
4635 }
4636 else
4637 {
4639 }
4640 DC_UnlockDc(dc);
4641
4642 if (!NT_SUCCESS(Status))
4643 {
4645 return FALSE;
4646 }
4647 return TRUE;
4648}
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:3445
static void FASTCALL FillTM(TEXTMETRICW *TM, PFONTGDI FontGDI, TT_OS2 *pOS2, TT_HoriHeader *pHori, FT_WinFNT_HeaderRec *pFNT)
Definition: freetype.c:2096
FT_Get_WinFNT_Header(FT_Face face, FT_WinFNT_HeaderRec *aheader)
Definition: ftwinfnt.c:29
#define STATUS_INTERNAL_ERROR
Definition: ntstatus.h:465
#define STATUS_INVALID_HANDLE
Definition: ntstatus.h:245
#define STATUS_SUCCESS
Definition: shellext.h:65
Definition: polytest.cpp:41
LONG lfHeight
Definition: dimm.idl:59
TEXTMETRICW TextMetric
Definition: ntgdityp.h:370
#define ft_sfnt_hhea
Definition: tttables.h:632
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
VOID FASTCALL SetLastNtError(_In_ NTSTATUS Status)
Definition: error.c:31

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

◆ ftGdiRealizationInfo()

BOOL FASTCALL ftGdiRealizationInfo ( PFONTGDI  Font,
PREALIZATION_INFO  Info 
)

Definition at line 5648 of file freetype.c.

5649{
5650 if (FT_HAS_FIXED_SIZES(Font->SharedFace->Face))
5651 Info->iTechnology = RI_TECH_BITMAP;
5652 else
5653 {
5654 if (FT_IS_SCALABLE(Font->SharedFace->Face))
5655 Info->iTechnology = RI_TECH_SCALABLE;
5656 else
5657 Info->iTechnology = RI_TECH_FIXED;
5658 }
5659 Info->iUniq = Font->FontObj.iUniq;
5660 Info->dwUnknown = -1;
5661 return TRUE;
5662}
#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 4481 of file freetype.c.

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

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

◆ InitFontSupport()

BOOL FASTCALL InitFontSupport ( VOID  )

Definition at line 657 of file freetype.c.

658{
659 ULONG ulError;
660
664 /* Fast Mutexes must be allocated from non paged pool */
666 if (g_FontListLock == NULL)
667 {
668 return FALSE;
669 }
670
673 if (g_FreeTypeLock == NULL)
674 {
675 return FALSE;
676 }
678
680 if (ulError)
681 {
682 DPRINT1("FT_Init_FreeType failed with error code 0x%x\n", ulError);
683 return FALSE;
684 }
685
687 {
688 DPRINT1("Fonts registry is empty.\n");
689
690 /* Load font(s) with writing registry */
692 }
693
694 IntLoadFontSubstList(&g_FontSubstListHead);
695
696#if DBG
697 DumpFontInfo(TRUE);
698#endif
699
700 return TRUE;
701}
#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:64
static LIST_ENTRY g_FontListHead
Definition: freetype.c:66
BOOL FASTCALL IntLoadFontSubstList(PLIST_ENTRY pHead)
Definition: freetype.c:510
static UINT g_FontCacheNumEntries
Definition: freetype.c:94
VOID FASTCALL IntLoadSystemFonts(VOID)
Definition: freetype.c:892
static LIST_ENTRY g_FontCacheListHead
Definition: freetype.c:93
static PFAST_MUTEX g_FontListLock
Definition: freetype.c:67
BOOL FASTCALL IntLoadFontsInRegistry(VOID)
Definition: freetype.c:1637
FT_Init_FreeType(FT_Library *alibrary)
Definition: ftinit.c:320
#define TAG_INTERNAL_SYNC
Definition: tags.h:18
FORCEINLINE VOID ExInitializeFastMutex(_Out_ PFAST_MUTEX FastMutex)
Definition: exfuncs.h:274
FAST_MUTEX
Definition: extypes.h:17

Referenced by InitializeGreCSRSS().

◆ IntCharSetFromCodePage()

BYTE FASTCALL IntCharSetFromCodePage ( UINT  uCodePage)

Definition at line 172 of file freetype.c.

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

1964{
1966}
static BOOL g_RenderingEnabled
Definition: freetype.c:68
_In_ ULONGLONG _In_ ULONGLONG _In_ BOOLEAN Enable
Definition: ntddpcm.h:142

◆ IntGdiAddFontMemResource()

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

Definition at line 1789 of file freetype.c.

1790{
1791 HANDLE Ret = NULL;
1793 PFONT_ENTRY_COLL_MEM EntryCollection;
1794 INT FaceCount;
1795
1797 if (!BufferCopy)
1798 {
1799 *pNumAdded = 0;
1800 return NULL;
1801 }
1802 RtlCopyMemory(BufferCopy, Buffer, dwSize);
1803
1804 LoadFont.pFileName = NULL;
1805 LoadFont.Memory = SharedMem_Create(BufferCopy, dwSize, FALSE);
1806 LoadFont.Characteristics = FR_PRIVATE | FR_NOT_ENUM;
1807 RtlInitUnicodeString(&LoadFont.RegValueName, NULL);
1808 LoadFont.IsTrueType = FALSE;
1809 LoadFont.PrivateEntry = NULL;
1811
1812 RtlFreeUnicodeString(&LoadFont.RegValueName);
1813
1814 /* Release our copy */
1818
1819 if (FaceCount > 0)
1820 {
1821 EntryCollection = ExAllocatePoolWithTag(PagedPool, sizeof(FONT_ENTRY_COLL_MEM), TAG_FONT);
1822 if (EntryCollection)
1823 {
1825 EntryCollection->Entry = LoadFont.PrivateEntry;
1826 IntLockProcessPrivateFonts(Win32Process);
1827 EntryCollection->Handle = ULongToHandle(++Win32Process->PrivateMemFontHandleCount);
1828 InsertTailList(&Win32Process->PrivateMemFontListHead, &EntryCollection->ListEntry);
1829 IntUnLockProcessPrivateFonts(Win32Process);
1830 Ret = EntryCollection->Handle;
1831 }
1832 }
1833 *pNumAdded = FaceCount;
1834
1835 return Ret;
1836}
#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:233
static INT FASTCALL IntGdiLoadFontsFromMemory(PGDI_LOAD_FONT pLoadFont, PSHARED_FACE SharedFace, FT_Long FontIndex, INT CharSetIndex)
Definition: freetype.c:1050
static void SharedMem_Release(PSHARED_MEM Ptr)
Definition: freetype.c:290
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 1621 of file freetype.c.

1622{
1623 return IntGdiAddFontResourceEx(FileName, Characteristics, 0);
1624}
INT FASTCALL IntGdiAddFontResourceEx(PUNICODE_STRING FileName, DWORD Characteristics, DWORD dwFlags)
Definition: freetype.c:1422

Referenced by NtGdiAddFontResourceW().

◆ IntGdiAddFontResourceEx()

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

Definition at line 1422 of file freetype.c.

1424{
1427 PVOID Buffer = NULL;
1430 SIZE_T ViewSize = 0, Length;
1431 LARGE_INTEGER SectionSize;
1434 INT FontCount;
1436 UNICODE_STRING PathName;
1437 LPWSTR pszBuffer;
1439 static const UNICODE_STRING TrueTypePostfix = RTL_CONSTANT_STRING(L" (TrueType)");
1440 static const UNICODE_STRING DosPathPrefix = RTL_CONSTANT_STRING(L"\\??\\");
1441
1442 /* Build PathName */
1444 {
1445 Length = DosPathPrefix.Length + FileName->Length + sizeof(UNICODE_NULL);
1447 if (!pszBuffer)
1448 return 0; /* failure */
1449
1450 RtlInitEmptyUnicodeString(&PathName, pszBuffer, Length);
1451 RtlAppendUnicodeStringToString(&PathName, &DosPathPrefix);
1453 }
1454 else
1455 {
1457 if (!NT_SUCCESS(Status))
1458 return 0; /* failure */
1459 }
1460
1461 /* Open the font file */
1465 &FileHandle,
1468 &Iosb,
1471 if (!NT_SUCCESS(Status))
1472 {
1473 DPRINT1("Could not load font file: %wZ\n", &PathName);
1474 RtlFreeUnicodeString(&PathName);
1475 return 0;
1476 }
1477
1480 if (!NT_SUCCESS(Status))
1481 {
1482 DPRINT1("ObReferenceObjectByHandle failed.\n");
1484 RtlFreeUnicodeString(&PathName);
1485 return 0;
1486 }
1487
1488 SectionSize.QuadPart = 0LL;
1491 NULL, &SectionSize, PAGE_READONLY,
1493 if (!NT_SUCCESS(Status))
1494 {
1495 DPRINT1("Could not map file: %wZ\n", &PathName);
1498 RtlFreeUnicodeString(&PathName);
1499 return 0;
1500 }
1502
1504 if (!NT_SUCCESS(Status))
1505 {
1506 DPRINT1("Could not map file: %wZ\n", &PathName);
1509 RtlFreeUnicodeString(&PathName);
1510 return 0;
1511 }
1512
1513 LoadFont.pFileName = &PathName;
1515 LoadFont.Characteristics = Characteristics;
1516 RtlInitUnicodeString(&LoadFont.RegValueName, NULL);
1517 LoadFont.IsTrueType = FALSE;
1518 LoadFont.CharSet = DEFAULT_CHARSET;
1519 LoadFont.PrivateEntry = NULL;
1520 FontCount = IntGdiLoadFontsFromMemory(&LoadFont, NULL, -1, -1);
1521
1522 /* Release our copy */
1526
1528
1530
1531 /* Save the loaded font name into the registry */
1532 if (FontCount > 0 && (dwFlags & AFRX_WRITE_REGISTRY))
1533 {
1534 UNICODE_STRING NewString;
1535 SIZE_T Length;
1536 PWCHAR pszBuffer;
1537 LPCWSTR CharSetName;
1538 if (LoadFont.IsTrueType)
1539 {
1540 /* Append " (TrueType)" */
1541 Length = LoadFont.RegValueName.Length + TrueTypePostfix.Length + sizeof(UNICODE_NULL);
1543 if (pszBuffer)
1544 {
1545 RtlInitEmptyUnicodeString(&NewString, pszBuffer, Length);
1546 NewString.Buffer[0] = UNICODE_NULL;
1547 RtlAppendUnicodeStringToString(&NewString, &LoadFont.RegValueName);
1548 RtlAppendUnicodeStringToString(&NewString, &TrueTypePostfix);
1549 RtlFreeUnicodeString(&LoadFont.RegValueName);
1550 LoadFont.RegValueName = NewString;
1551 }
1552 else
1553 {
1554 // FIXME!
1555 }
1556 }
1557 else if (LoadFont.CharSet != DEFAULT_CHARSET)
1558 {
1559 /* Append " (CharSetName)" */
1560 CharSetName = NameFromCharSet(LoadFont.CharSet);
1561 Length = LoadFont.RegValueName.Length +
1562 (wcslen(CharSetName) + 3) * sizeof(WCHAR) +
1563 sizeof(UNICODE_NULL);
1564
1566 if (pszBuffer)
1567 {
1568 RtlInitEmptyUnicodeString(&NewString, pszBuffer, Length);
1569 NewString.Buffer[0] = UNICODE_NULL;
1570 RtlAppendUnicodeStringToString(&NewString, &LoadFont.RegValueName);
1571 RtlAppendUnicodeToString(&NewString, L" (");
1572 RtlAppendUnicodeToString(&NewString, CharSetName);
1573 RtlAppendUnicodeToString(&NewString, L")");
1574 RtlFreeUnicodeString(&LoadFont.RegValueName);
1575 LoadFont.RegValueName = NewString;
1576 }
1577 else
1578 {
1579 // FIXME!
1580 }
1581 }
1582
1585 NULL, NULL);
1586 Status = ZwOpenKey(&KeyHandle, KEY_WRITE, &ObjectAttributes);
1587 if (NT_SUCCESS(Status))
1588 {
1590 LPWSTR pFileName;
1591
1593 {
1594 pFileName = PathName.Buffer;
1595 }
1596 else
1597 {
1598 pFileName = wcsrchr(PathName.Buffer, L'\\');
1599 }
1600
1601 if (pFileName)
1602 {
1604 {
1605 pFileName++;
1606 }
1607 DataSize = (wcslen(pFileName) + 1) * sizeof(WCHAR);
1608 ZwSetValueKey(KeyHandle, &LoadFont.RegValueName, 0, REG_SZ,
1609 pFileName, DataSize);
1610 }
1612 }
1613 }
1614 RtlFreeUnicodeString(&LoadFont.RegValueName);
1615
1616 RtlFreeUnicodeString(&PathName);
1617 return FontCount;
1618}
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:830
static UNICODE_STRING g_FontRegPath
Definition: freetype.c:58
static LPCWSTR FASTCALL NameFromCharSet(BYTE CharSet)
Definition: freetype.c:1388
#define FILE_SYNCHRONOUS_IO_NONALERT
Definition: from_kernel.h:31
_Must_inspect_result_ _Outptr_ PVOID * SectionObject
Definition: fsrtlfuncs.h:860
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define OBJ_KERNEL_HANDLE
Definition: winternl.h:231
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
#define REG_SZ
Definition: layer.c:22
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
_In_ NDIS_STATUS _In_ ULONG _In_ USHORT _In_opt_ PVOID _In_ ULONG DataSize
Definition: ndis.h:4755
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
Definition: ndis.h:4715
#define KernelMode
Definition: asm.h:34
NTSYSAPI NTSTATUS NTAPI ZwOpenFile(_Out_ PHANDLE FileHandle, _In_ ACCESS_MASK DesiredAccess, _In_ POBJECT_ATTRIBUTES ObjectAttributes, _Out_ PIO_STATUS_BLOCK IoStatusBlock, _In_ ULONG ShareAccess, _In_ ULONG OpenOptions)
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID _In_ ULONG_PTR _In_ SIZE_T _Inout_opt_ PLARGE_INTEGER _Inout_ PSIZE_T ViewSize
Definition: mmfuncs.h:408
#define SEC_COMMIT
Definition: mmtypes.h:100
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
#define SYNCHRONIZE
Definition: nt_native.h:61
#define FILE_READ_DATA
Definition: nt_native.h:628
NTSYSAPI NTSTATUS NTAPI RtlAppendUnicodeStringToString(PUNICODE_STRING Destination, PUNICODE_STRING Source)
#define SECTION_QUERY
Definition: nt_native.h:1287
#define KEY_WRITE
Definition: nt_native.h:1031
#define FILE_GENERIC_READ
Definition: nt_native.h:653
#define STANDARD_RIGHTS_REQUIRED
Definition: nt_native.h:63
#define UNICODE_NULL
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
#define L(x)
Definition: ntvdm.h:50
NTSTATUS NTAPI ObReferenceObjectByHandle(IN HANDLE Handle, IN ACCESS_MASK DesiredAccess, IN POBJECT_TYPE ObjectType, IN KPROCESSOR_MODE AccessMode, OUT PVOID *Object, OUT POBJECT_HANDLE_INFORMATION HandleInformation OPTIONAL)
Definition: obref.c:494
NTSTATUS NTAPI MmMapViewInSystemSpace(IN PVOID SectionObject, OUT PVOID *MappedBase, IN OUT PSIZE_T ViewSize)
Definition: section.c:4447
NTSTATUS NTAPI MmCreateSection(OUT PVOID *Section, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, IN PLARGE_INTEGER MaximumSize, IN ULONG SectionPageProtection, IN ULONG AllocationAttributes, IN HANDLE FileHandle OPTIONAL, IN PFILE_OBJECT FileObject OPTIONAL)
Definition: section.c:4620
#define TAG_USTR
Definition: tag.h:145
#define LL
Definition: tui.h:167
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14
ULONG_PTR SIZE_T
Definition: typedefs.h:80
uint16_t * PWCHAR
Definition: typedefs.h:56
LONGLONG QuadPart
Definition: typedefs.h:114
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
Definition: wdfdevice.h:550
#define AFRX_WRITE_REGISTRY
Definition: text.h:104
#define AFRX_DOS_DEVICE_PATH
Definition: text.h:106
#define AFRX_ALTERNATIVE_PATH
Definition: text.h:105
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176
* PFILE_OBJECT
Definition: iotypes.h:1998
#define ObDereferenceObject
Definition: obfuncs.h:203
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

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

◆ IntGdiCleanupPrivateFontsForProcess()

VOID FASTCALL IntGdiCleanupPrivateFontsForProcess ( VOID  )

Definition at line 1911 of file freetype.c.

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

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

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

Referenced by NtGdiRemoveFontMemResourceEx().

◆ IntGetCharDimensions()

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

Definition at line 329 of file font.c.

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

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

◆ IntGetFontLanguageInfo()

DWORD FASTCALL IntGetFontLanguageInfo ( PDC  Dc)

Definition at line 371 of file font.c.

372{
373 PDC_ATTR pdcattr;
374 FONTSIGNATURE fontsig;
375 static const DWORD GCP_DBCS_MASK=0x003F0000,
376 GCP_DIACRITIC_MASK=0x00000000,
377 FLI_GLYPHS_MASK=0x00000000,
378 GCP_GLYPHSHAPE_MASK=0x00000040,
379 GCP_KASHIDA_MASK=0x00000000,
380 GCP_LIGATE_MASK=0x00000000,
381 GCP_USEKERNING_MASK=0x00000000,
382 GCP_REORDER_MASK=0x00000060;
383
384 DWORD result=0;
385
386 ftGdiGetTextCharsetInfo( Dc, &fontsig, 0 );
387
388 /* We detect each flag we return using a bitmask on the Codepage Bitfields */
389 if( (fontsig.fsCsb[0]&GCP_DBCS_MASK)!=0 )
391
392 if( (fontsig.fsCsb[0]&GCP_DIACRITIC_MASK)!=0 )
394
395 if( (fontsig.fsCsb[0]&FLI_GLYPHS_MASK)!=0 )
397
398 if( (fontsig.fsCsb[0]&GCP_GLYPHSHAPE_MASK)!=0 )
400
401 if( (fontsig.fsCsb[0]&GCP_KASHIDA_MASK)!=0 )
403
404 if( (fontsig.fsCsb[0]&GCP_LIGATE_MASK)!=0 )
406
407 if( (fontsig.fsCsb[0]&GCP_USEKERNING_MASK)!=0 )
409
410 pdcattr = Dc->pdcattr;
411
412 /* This might need a test for a HEBREW- or ARABIC_CHARSET as well */
413 if ( pdcattr->flTextAlign & TA_RTLREADING )
414 if( (fontsig.fsCsb[0]&GCP_REORDER_MASK)!=0 )
416
417 return result;
418}
INT FASTCALL ftGdiGetTextCharsetInfo(PDC Dc, LPFONTSIGNATURE lpSig, DWORD dwFlags)
Definition: freetype.c:4368
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 2398 of file freetype.c.

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

1958{
1959 return (gpsi->BitsPixel > 8) && g_RenderingEnabled;
1960}
PSERVERINFO gpsi
Definition: imm.c:18

Referenced by IntExtTextOutW(), and TextIntGetTextExtentPoint().

◆ IntLoadFontsInRegistry()

BOOL FASTCALL IntLoadFontsInRegistry ( VOID  )

Definition at line 1637 of file freetype.c.

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

893{
895 UNICODE_STRING Directory, FileName, TempString;
897 HANDLE hDirectory;
898 BYTE *DirInfoBuffer;
900 BOOLEAN bRestartScan = TRUE;
902 INT i;
903 static UNICODE_STRING SearchPatterns[] =
904 {
905 RTL_CONSTANT_STRING(L"*.ttf"),
906 RTL_CONSTANT_STRING(L"*.ttc"),
907 RTL_CONSTANT_STRING(L"*.otf"),
908 RTL_CONSTANT_STRING(L"*.otc"),
909 RTL_CONSTANT_STRING(L"*.fon"),
910 RTL_CONSTANT_STRING(L"*.fnt")
911 };
912 static UNICODE_STRING IgnoreFiles[] =
913 {
916 };
917
918 RtlInitUnicodeString(&Directory, L"\\SystemRoot\\Fonts\\");
919
922 &Directory,
924 NULL,
925 NULL);
926
928 &hDirectory,
931 &Iosb,
934
935 if (NT_SUCCESS(Status))
936 {
937 for (i = 0; i < _countof(SearchPatterns); ++i)
938 {
939 DirInfoBuffer = ExAllocatePoolWithTag(PagedPool, 0x4000, TAG_FONT);
940 if (DirInfoBuffer == NULL)
941 {
942 ZwClose(hDirectory);
943 return;
944 }
945
947 if (FileName.Buffer == NULL)
948 {
949 ExFreePoolWithTag(DirInfoBuffer, TAG_FONT);
950 ZwClose(hDirectory);
951 return;
952 }
953 FileName.Length = 0;
954 FileName.MaximumLength = MAX_PATH * sizeof(WCHAR);
955
956 while (1)
957 {
958 Status = ZwQueryDirectoryFile(
959 hDirectory,
960 NULL,
961 NULL,
962 NULL,
963 &Iosb,
964 DirInfoBuffer,
965 0x4000,
967 FALSE,
968 &SearchPatterns[i],
969 bRestartScan);
970
972 {
973 break;
974 }
975
976 DirInfo = (PFILE_DIRECTORY_INFORMATION)DirInfoBuffer;
977 while (1)
978 {
979 SIZE_T ign;
980
981 TempString.Buffer = DirInfo->FileName;
982 TempString.Length = TempString.MaximumLength = DirInfo->FileNameLength;
983
984 /* Should we ignore this file? */
985 for (ign = 0; ign < _countof(IgnoreFiles); ++ign)
986 {
987 /* Yes.. */
988 if (RtlEqualUnicodeString(IgnoreFiles + ign, &TempString, FALSE))
989 break;
990 }
991
992 /* If we tried all Ignore patterns and there was no match, try to create a font */
993 if (ign == _countof(IgnoreFiles))
994 {
998 {
999 DPRINT1("ERR: Failed to load %wZ\n", &FileName);
1000 }
1001 }
1002
1003 if (DirInfo->NextEntryOffset == 0)
1004 break;
1005
1006 DirInfo = (PFILE_DIRECTORY_INFORMATION)((ULONG_PTR)DirInfo + DirInfo->NextEntryOffset);
1007 }
1008
1009 bRestartScan = FALSE;
1010 }
1011
1013 ExFreePoolWithTag(DirInfoBuffer, TAG_FONT);
1014 }
1015 ZwClose(hDirectory);
1016 }
1017}
@ IgnoreFiles
Definition: ACListISF.cpp:75
unsigned char BOOLEAN
#define FILE_DIRECTORY_FILE
Definition: constants.h:491
struct _FileName FileName
Definition: fatprocs.h:896
@ FileDirectoryInformation
Definition: from_kernel.h:62
struct _FILE_DIRECTORY_INFORMATION * PFILE_DIRECTORY_INFORMATION
NTSYSAPI VOID NTAPI RtlCopyUnicodeString(PUNICODE_STRING DestinationString, PUNICODE_STRING SourceString)
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
#define FILE_LIST_DIRECTORY
Definition: nt_native.h:629
#define FILE_SHARE_DELETE
Definition: nt_native.h:682
#define _countof(array)
Definition: sndvol32.h:68
base for all directory entries
Definition: entries.h:138
WCHAR FileName[ANYSIZE_ARRAY]
Definition: winternl.h:524
USHORT MaximumLength
Definition: env_spec_w32.h:370
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define STATUS_NO_MORE_FILES
Definition: udferr_usr.h:128

Referenced by InitFontSupport().

◆ RealizeFontInit()

◆ TextIntCreateFontIndirect()

NTSTATUS FASTCALL TextIntCreateFontIndirect ( CONST LPLOGFONTW  lf,
HFONT NewFont 
)

Definition at line 1991 of file freetype.c.

1992{
1993 PLFONT plfont;
1994 LOGFONTW *plf;
1995
1996 ASSERT(lf);
1997 plfont = LFONT_AllocFontWithHandle();
1998 if (!plfont)
1999 {
2000 return STATUS_NO_MEMORY;
2001 }
2002
2003 ExInitializePushLock(&plfont->lock);
2004 *NewFont = plfont->BaseObject.hHmgr;
2005 plf = &plfont->logfont.elfEnumLogfontEx.elfLogFont;
2006 RtlCopyMemory(plf, lf, sizeof(LOGFONTW));
2007 if (lf->lfEscapement != lf->lfOrientation)
2008 {
2009 /* This should really depend on whether GM_ADVANCED is set */
2010 plf->lfOrientation = plf->lfEscapement;
2011 }
2012 LFONT_UnlockFont(plfont);
2013
2014 return STATUS_SUCCESS;
2015}
HGDIOBJ hHmgr(VOID)
Definition: baseobj.hpp:95
#define ExInitializePushLock
Definition: ex.h:1013
#define STATUS_NO_MEMORY
Definition: ntstatus.h:260
LONG lfEscapement
Definition: dimm.idl:61
BASEOBJECT BaseObject
Definition: text.h:63
EX_PUSH_LOCK lock
Definition: text.h:71
#define LFONT_UnlockFont(plfnt)
Definition: text.h:79
#define LFONT_AllocFontWithHandle()
Definition: text.h:76

Referenced by CreateStockFonts(), and UserDrawCaptionText().

◆ TextIntGetTextExtentPoint()

BOOL FASTCALL TextIntGetTextExtentPoint ( PDC  dc,
PTEXTOBJ  TextObj,
LPCWSTR  String,
INT  Count,
ULONG  MaxExtent,
LPINT  Fit,
LPINT  Dx,
LPSIZE  Size,
FLONG  fl 
)

Definition at line 4258 of file freetype.c.

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

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

3589{
3590 FT_Face face;
3591 INT error, n;
3592 FT_CharMap charmap, found;
3593 LOGFONTW *plf;
3594
3595 if (bDoLock)
3597
3598 face = FontGDI->SharedFace->Face;
3599 if (face->charmap == NULL)
3600 {
3601 DPRINT("WARNING: No charmap selected!\n");
3602 DPRINT("This font face has %d charmaps\n", face->num_charmaps);
3603
3604 found = NULL;
3605 for (n = 0; n < face->num_charmaps; n++)
3606 {
3607 charmap = face->charmaps[n];
3608 if (charmap->encoding == FT_ENCODING_UNICODE)
3609 {
3610 found = charmap;
3611 break;
3612 }
3613 }
3614 if (!found)
3615 {
3616 for (n = 0; n < face->num_charmaps; n++)
3617 {
3618 charmap = face->charmaps[n];
3619 if (charmap->platform_id == TT_PLATFORM_APPLE_UNICODE)
3620 {
3621 found = charmap;
3622 break;
3623 }
3624 }
3625 }
3626 if (!found)
3627 {
3628 for (n = 0; n < face->num_charmaps; n++)
3629 {
3630 charmap = face->charmaps[n];
3631 if (charmap->encoding == FT_ENCODING_MS_SYMBOL)
3632 {
3633 found = charmap;
3634 break;
3635 }
3636 }
3637 }
3638 if (!found && face->num_charmaps > 0)
3639 {
3640 found = face->charmaps[0];
3641 }
3642 if (!found)
3643 {
3644 DPRINT1("WARNING: Could not find desired charmap!\n");
3645 }
3646 else
3647 {
3648 DPRINT("Found charmap encoding: %i\n", found->encoding);
3649 error = FT_Set_Charmap(face, found);
3650 if (error)
3651 {
3652 DPRINT1("WARNING: Could not set the charmap!\n");
3653 }
3654 }
3655 }
3656
3657 plf = &TextObj->logfont.elfEnumLogfontEx.elfLogFont;
3658
3659 error = IntRequestFontSize(dc, FontGDI, plf->lfWidth, plf->lfHeight);
3660
3661 if (bDoLock)
3663
3664 if (error)
3665 {
3666 DPRINT1("Error in setting pixel sizes: %d\n", error);
3667 return FALSE;
3668 }
3669
3670 return TRUE;
3671}
WORD face[3]
Definition: mesh.c:4747
#define TT_PLATFORM_APPLE_UNICODE
Definition: font.c:1172
FT_Set_Charmap(FT_Face face, FT_CharMap charmap)
Definition: ftobjs.c:3499
GLdouble n
Definition: glext.h:7729
FT_UShort platform_id
Definition: freetype.h:844

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

◆ TEXTOBJ_LockText()

FORCEINLINE PTEXTOBJ TEXTOBJ_LockText ( HFONT  hfont)

Definition at line 83 of file text.h.

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

Referenced by RealizeFontInit(), and TextIntRealizeFont().

◆ TEXTOBJ_UnlockText()