ReactOS  0.4.14-dev-815-ge410a12
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  DPRINT1("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 }
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
LONG NTSTATUS
Definition: precomp.h:26
#define TEXTOBJECT_INIT
Definition: text.h:56
DWORD dvNumAxes
Definition: wingdi.h:2768
NTSTATUS FASTCALL TextIntRealizeFont(HFONT FontHandle, PTEXTOBJ pTextObj)
Definition: freetype.c:5276
smooth NULL
Definition: ftsmooth.c:416
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
struct tagLOGFONTW LOGFONTW
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
Status
Definition: gdiplustypes.h:24
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
#define DPRINT1
Definition: precomp.h:8
DESIGNVECTOR elfDesignVector
Definition: wingdi.h:2779
unsigned int ULONG
Definition: retypes.h:1
_In_ ULONG cjBuffer
Definition: ntgdi.h:2860

Referenced by GreGetObject().

◆ ftGdiGetFontData()

DWORD FASTCALL ftGdiGetFontData ( PFONTGDI  ,
DWORD  ,
DWORD  ,
PVOID  ,
DWORD   
)

Definition at line 4737 of file freetype.c.

4743 {
4745  FT_Face Face = FontGdi->SharedFace->Face;
4746 
4747  IntLockFreeType();
4748 
4749  if (FT_IS_SFNT(Face))
4750  {
4751  if (Table)
4752  Table = Table >> 24 | Table << 24 | (Table >> 8 & 0xFF00) |
4753  (Table << 8 & 0xFF0000);
4754 
4755  if (!Buffer) Size = 0;
4756 
4757  if (Buffer && Size)
4758  {
4759  FT_Error Error;
4760  FT_ULong Needed = 0;
4761 
4762  Error = FT_Load_Sfnt_Table(Face, Table, Offset, NULL, &Needed);
4763 
4764  if ( !Error && Needed < Size) Size = Needed;
4765  }
4766  if (!FT_Load_Sfnt_Table(Face, Table, Offset, Buffer, &Size))
4767  Result = Size;
4768  }
4769 
4771 
4772  return Result;
4773 }
int FT_Error
Definition: fttypes.h:300
ASMGENDATA Table[]
Definition: genincdata.c:61
unsigned long FT_ULong
Definition: fttypes.h:253
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
smooth NULL
Definition: ftsmooth.c:416
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
Definition: bufpool.h:45
FT_Load_Sfnt_Table(FT_Face face, FT_ULong tag, FT_Long offset, FT_Byte *buffer, FT_ULong *length)
Definition: ftobjs.c:4134
#define IntUnLockFreeType()
Definition: freetype.c:82
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL Error
Definition: chkdsk.c:66
#define FT_IS_SFNT(face)
Definition: freetype.h:1331
#define IntLockFreeType()
Definition: freetype.c:79
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
#define GDI_ERROR
Definition: wingdi.h:1308

Referenced by NtGdiGetFontData().

◆ ftGdiGetGlyphOutline()

ULONG FASTCALL ftGdiGetGlyphOutline ( PDC  ,
WCHAR  ,
UINT  ,
LPGLYPHMETRICS  ,
ULONG  ,
PVOID  ,
LPMAT2  ,
BOOL   
)

Definition at line 3842 of file freetype.c.

3851 {
3852  PDC_ATTR pdcattr;
3853  PTEXTOBJ TextObj;
3854  PFONTGDI FontGDI;
3855  HFONT hFont = 0;
3856  GLYPHMETRICS gm;
3857  ULONG Size;
3858  FT_Face ft_face;
3859  FT_UInt glyph_index;
3860  DWORD width, height, pitch, needed = 0;
3861  FT_Bitmap ft_bitmap;
3862  FT_Error error;
3863  INT left, right, top = 0, bottom = 0;
3865  FLOATOBJ eM11, widthRatio, eTemp;
3866  FT_Matrix transMat = identityMat;
3867  BOOL needsTransform = FALSE;
3868  INT orientation;
3869  LONG aveWidth;
3870  INT adv, lsb, bbx; /* These three hold to widths of the unrotated chars */
3871  OUTLINETEXTMETRICW *potm;
3872  XFORMOBJ xo;
3873  XFORML xform;
3874  LOGFONTW *plf;
3875 
3876  DPRINT("%u, %08x, %p, %08lx, %p, %p\n", wch, iFormat, pgm,
3877  cjBuf, pvBuf, pmat2);
3878 
3879  pdcattr = dc->pdcattr;
3880 
3881  XFORMOBJ_vInit(&xo, &dc->pdcattr->mxWorldToDevice);
3882  XFORMOBJ_iGetXform(&xo, &xform);
3883  FLOATOBJ_SetFloat(&eM11, xform.eM11);
3884 
3885  hFont = pdcattr->hlfntNew;
3886  TextObj = RealizeFontInit(hFont);
3887 
3888  if (!TextObj)
3889  {
3891  return GDI_ERROR;
3892  }
3893  FontGDI = ObjToGDI(TextObj->Font, FONT);
3894  ft_face = FontGDI->SharedFace->Face;
3895 
3896  plf = &TextObj->logfont.elfEnumLogfontEx.elfLogFont;
3897  aveWidth = FT_IS_SCALABLE(ft_face) ? abs(plf->lfWidth) : 0;
3898  orientation = FT_IS_SCALABLE(ft_face) ? plf->lfOrientation : 0;
3899 
3900  Size = IntGetOutlineTextMetrics(FontGDI, 0, NULL);
3902  if (!potm)
3903  {
3905  TEXTOBJ_UnlockText(TextObj);
3906  return GDI_ERROR;
3907  }
3908  Size = IntGetOutlineTextMetrics(FontGDI, Size, potm);
3909  if (!Size)
3910  {
3911  /* FIXME: last error? */
3913  TEXTOBJ_UnlockText(TextObj);
3914  return GDI_ERROR;
3915  }
3916 
3917  IntLockFreeType();
3918  TextIntUpdateSize(dc, TextObj, FontGDI, FALSE);
3920 
3921  TEXTOBJ_UnlockText(TextObj);
3922 
3923  glyph_index = get_glyph_index_flagged(ft_face, wch, GGO_GLYPH_INDEX, iFormat);
3925 
3926  if (orientation || (iFormat != GGO_METRICS && iFormat != GGO_BITMAP) || aveWidth || pmat2)
3927  load_flags |= FT_LOAD_NO_BITMAP;
3928 
3929  if (iFormat & GGO_UNHINTED)
3930  {
3931  load_flags |= FT_LOAD_NO_HINTING;
3932  iFormat &= ~GGO_UNHINTED;
3933  }
3934 
3935  error = FT_Load_Glyph(ft_face, glyph_index, load_flags);
3936  if (error)
3937  {
3938  DPRINT1("WARNING: Failed to load and render glyph! [index: %u]\n", glyph_index);
3940  if (potm) ExFreePoolWithTag(potm, GDITAG_TEXT);
3941  return GDI_ERROR;
3942  }
3944 
3945  FLOATOBJ_Set1(&widthRatio);
3946  if (aveWidth && potm)
3947  {
3948  // widthRatio = aveWidth * eM11 / potm->otmTextMetrics.tmAveCharWidth
3949  FLOATOBJ_SetLong(&widthRatio, aveWidth);
3950  FLOATOBJ_Mul(&widthRatio, &eM11);
3951  FLOATOBJ_DivLong(&widthRatio, potm->otmTextMetrics.tmAveCharWidth);
3952  }
3953 
3954  //left = (INT)(ft_face->glyph->metrics.horiBearingX * widthRatio) & -64;
3955  FLOATOBJ_SetLong(&eTemp, ft_face->glyph->metrics.horiBearingX);
3956  FLOATOBJ_Mul(&eTemp, &widthRatio);
3957  left = FLOATOBJ_GetLong(&eTemp) & -64;
3958 
3959  //right = (INT)((ft_face->glyph->metrics.horiBearingX +
3960  // ft_face->glyph->metrics.width) * widthRatio + 63) & -64;
3961  FLOATOBJ_SetLong(&eTemp, ft_face->glyph->metrics.horiBearingX * ft_face->glyph->metrics.width);
3962  FLOATOBJ_Mul(&eTemp, &widthRatio);
3963  FLOATOBJ_AddLong(&eTemp, 63);
3964  right = FLOATOBJ_GetLong(&eTemp) & -64;
3965 
3966  //adv = (INT)((ft_face->glyph->metrics.horiAdvance * widthRatio) + 63) >> 6;
3967  FLOATOBJ_SetLong(&eTemp, ft_face->glyph->metrics.horiAdvance);
3968  FLOATOBJ_Mul(&eTemp, &widthRatio);
3969  FLOATOBJ_AddLong(&eTemp, 63);
3970  adv = FLOATOBJ_GetLong(&eTemp) >> 6;
3971 
3972  lsb = left >> 6;
3973  bbx = (right - left) >> 6;
3974 
3975  DPRINT("Advance = %d, lsb = %d, bbx = %d\n",adv, lsb, bbx);
3976 
3977  IntLockFreeType();
3978 
3979  /* Width scaling transform */
3980  if (!FLOATOBJ_Equal1(&widthRatio))
3981  {
3982  FT_Matrix scaleMat;
3983 
3984  eTemp = widthRatio;
3985  FLOATOBJ_MulLong(&eTemp, 1 << 16);
3986 
3987  scaleMat.xx = FLOATOBJ_GetLong(&eTemp);
3988  scaleMat.xy = 0;
3989  scaleMat.yx = 0;
3990  scaleMat.yy = INT_TO_FIXED(1);
3991  FT_Matrix_Multiply(&scaleMat, &transMat);
3992  needsTransform = TRUE;
3993  }
3994 
3995  /* World transform */
3996  {
3997  FT_Matrix ftmatrix;
3999 
4000  /* Create a freetype matrix, by converting to 16.16 fixpoint format */
4001  FtMatrixFromMx(&ftmatrix, pmx);
4002 
4003  if (memcmp(&ftmatrix, &identityMat, sizeof(identityMat)) != 0)
4004  {
4005  FT_Matrix_Multiply(&ftmatrix, &transMat);
4006  needsTransform = TRUE;
4007  }
4008  }
4009 
4010  /* Rotation transform */
4011  if (orientation)
4012  {
4013  FT_Matrix rotationMat;
4014  DPRINT("Rotation Trans!\n");
4015  IntEscapeMatrix(&rotationMat, orientation);
4016  FT_Matrix_Multiply(&rotationMat, &transMat);
4017  needsTransform = TRUE;
4018  }
4019 
4020  /* Extra transformation specified by caller */
4021  if (pmat2)
4022  {
4023  FT_Matrix extraMat;
4024  DPRINT("MAT2 Matrix Trans!\n");
4025  extraMat.xx = FT_FixedFromFIXED(pmat2->eM11);
4026  extraMat.xy = FT_FixedFromFIXED(pmat2->eM21);
4027  extraMat.yx = FT_FixedFromFIXED(pmat2->eM12);
4028  extraMat.yy = FT_FixedFromFIXED(pmat2->eM22);
4029  FT_Matrix_Multiply(&extraMat, &transMat);
4030  needsTransform = TRUE;
4031  }
4032 
4033  if (potm) ExFreePoolWithTag(potm, GDITAG_TEXT); /* It looks like we are finished with potm ATM. */
4034 
4035  if (!needsTransform)
4036  {
4037  DPRINT("No Need to be Transformed!\n");
4038  top = (ft_face->glyph->metrics.horiBearingY + 63) & -64;
4039  bottom = (ft_face->glyph->metrics.horiBearingY -
4040  ft_face->glyph->metrics.height) & -64;
4041  gm.gmCellIncX = adv;
4042  gm.gmCellIncY = 0;
4043  }
4044  else
4045  {
4046  INT xc, yc;
4047  FT_Vector vec;
4048  for (xc = 0; xc < 2; xc++)
4049  {
4050  for (yc = 0; yc < 2; yc++)
4051  {
4052  vec.x = (ft_face->glyph->metrics.horiBearingX +
4053  xc * ft_face->glyph->metrics.width);
4054  vec.y = ft_face->glyph->metrics.horiBearingY -
4055  yc * ft_face->glyph->metrics.height;
4056  DPRINT("Vec %ld,%ld\n", vec.x, vec.y);
4057  FT_Vector_Transform(&vec, &transMat);
4058  if (xc == 0 && yc == 0)
4059  {
4060  left = right = vec.x;
4061  top = bottom = vec.y;
4062  }
4063  else
4064  {
4065  if (vec.x < left) left = vec.x;
4066  else if (vec.x > right) right = vec.x;
4067  if (vec.y < bottom) bottom = vec.y;
4068  else if (vec.y > top) top = vec.y;
4069  }
4070  }
4071  }
4072  left = left & -64;
4073  right = (right + 63) & -64;
4074  bottom = bottom & -64;
4075  top = (top + 63) & -64;
4076 
4077  DPRINT("Transformed box: (%d,%d - %d,%d)\n", left, top, right, bottom);
4078  vec.x = ft_face->glyph->metrics.horiAdvance;
4079  vec.y = 0;
4080  FT_Vector_Transform(&vec, &transMat);
4081  gm.gmCellIncX = (vec.x+63) >> 6;
4082  gm.gmCellIncY = -((vec.y+63) >> 6);
4083  }
4084  gm.gmBlackBoxX = (right - left) >> 6;
4085  gm.gmBlackBoxY = (top - bottom) >> 6;
4086  gm.gmptGlyphOrigin.x = left >> 6;
4087  gm.gmptGlyphOrigin.y = top >> 6;
4088 
4089  DPRINT("CX %d CY %d BBX %u BBY %u GOX %d GOY %d\n",
4090  gm.gmCellIncX, gm.gmCellIncY,
4091  gm.gmBlackBoxX, gm.gmBlackBoxY,
4093 
4095 
4096 
4097  if (iFormat == GGO_METRICS)
4098  {
4099  DPRINT("GGO_METRICS Exit!\n");
4100  *pgm = gm;
4101  return 1; /* FIXME */
4102  }
4103 
4104  if (ft_face->glyph->format != ft_glyph_format_outline && iFormat != GGO_BITMAP)
4105  {
4106  DPRINT1("Loaded a bitmap\n");
4107  return GDI_ERROR;
4108  }
4109 
4110  switch (iFormat)
4111  {
4112  case GGO_BITMAP:
4113  {
4114  width = gm.gmBlackBoxX;
4115  height = gm.gmBlackBoxY;
4116  pitch = ((width + 31) >> 5) << 2;
4117  needed = pitch * height;
4118 
4119  if (!pvBuf || !cjBuf) break;
4120  if (!needed) return GDI_ERROR; /* empty glyph */
4121  if (needed > cjBuf)
4122  return GDI_ERROR;
4123 
4124  switch (ft_face->glyph->format)
4125  {
4127  {
4128  BYTE *src = ft_face->glyph->bitmap.buffer, *dst = pvBuf;
4129  INT w = min( pitch, (ft_face->glyph->bitmap.width + 7) >> 3 );
4130  INT h = min( height, ft_face->glyph->bitmap.rows );
4131  while (h--)
4132  {
4133  RtlCopyMemory(dst, src, w);
4134  src += ft_face->glyph->bitmap.pitch;
4135  dst += pitch;
4136  }
4137  break;
4138  }
4139 
4141  {
4142  ft_bitmap.width = width;
4143  ft_bitmap.rows = height;
4144  ft_bitmap.pitch = pitch;
4145  ft_bitmap.pixel_mode = FT_PIXEL_MODE_MONO;
4146  ft_bitmap.buffer = pvBuf;
4147 
4148  IntLockFreeType();
4149  if (needsTransform)
4150  {
4151  FT_Outline_Transform(&ft_face->glyph->outline, &transMat);
4152  }
4153  FT_Outline_Translate(&ft_face->glyph->outline, -left, -bottom );
4154  /* Note: FreeType will only set 'black' bits for us. */
4155  RtlZeroMemory(pvBuf, needed);
4156  FT_Outline_Get_Bitmap(g_FreeTypeLibrary, &ft_face->glyph->outline, &ft_bitmap);
4158  break;
4159  }
4160 
4161  default:
4162  DPRINT1("Loaded glyph format %x\n", ft_face->glyph->format);
4163  return GDI_ERROR;
4164  }
4165 
4166  break;
4167  }
4168 
4169  case GGO_GRAY2_BITMAP:
4170  case GGO_GRAY4_BITMAP:
4171  case GGO_GRAY8_BITMAP:
4172  {
4173  unsigned int mult, row, col;
4174  BYTE *start, *ptr;
4175 
4176  width = gm.gmBlackBoxX;
4177  height = gm.gmBlackBoxY;
4178  pitch = (width + 3) / 4 * 4;
4179  needed = pitch * height;
4180 
4181  if (!pvBuf || !cjBuf) break;
4182  if (!needed) return GDI_ERROR; /* empty glyph */
4183  if (needed > cjBuf)
4184  return GDI_ERROR;
4185 
4186  switch (ft_face->glyph->format)
4187  {
4189  {
4190  BYTE *src = ft_face->glyph->bitmap.buffer, *dst = pvBuf;
4191  INT h = min( height, ft_face->glyph->bitmap.rows );
4192  INT x;
4193  while (h--)
4194  {
4195  for (x = 0; (UINT)x < pitch; x++)
4196  {
4197  if (x < ft_face->glyph->bitmap.width)
4198  dst[x] = (src[x / 8] & (1 << ( (7 - (x % 8))))) ? 0xff : 0;
4199  else
4200  dst[x] = 0;
4201  }
4202  src += ft_face->glyph->bitmap.pitch;
4203  dst += pitch;
4204  }
4205  break;
4206  }
4208  {
4209  ft_bitmap.width = width;
4210  ft_bitmap.rows = height;
4211  ft_bitmap.pitch = pitch;
4212  ft_bitmap.pixel_mode = FT_PIXEL_MODE_GRAY;
4213  ft_bitmap.buffer = pvBuf;
4214 
4215  IntLockFreeType();
4216  if (needsTransform)
4217  {
4218  FT_Outline_Transform(&ft_face->glyph->outline, &transMat);
4219  }
4220  FT_Outline_Translate(&ft_face->glyph->outline, -left, -bottom );
4221  RtlZeroMemory(ft_bitmap.buffer, cjBuf);
4222  FT_Outline_Get_Bitmap(g_FreeTypeLibrary, &ft_face->glyph->outline, &ft_bitmap);
4224 
4225  if (iFormat == GGO_GRAY2_BITMAP)
4226  mult = 4;
4227  else if (iFormat == GGO_GRAY4_BITMAP)
4228  mult = 16;
4229  else if (iFormat == GGO_GRAY8_BITMAP)
4230  mult = 64;
4231  else
4232  {
4233  return GDI_ERROR;
4234  }
4235 
4236  start = pvBuf;
4237  for (row = 0; row < height; row++)
4238  {
4239  ptr = start;
4240  for (col = 0; col < width; col++, ptr++)
4241  {
4242  *ptr = (((int)*ptr) * mult + 128) / 256;
4243  }
4244  start += pitch;
4245  }
4246 
4247  break;
4248  }
4249  default:
4250  DPRINT1("Loaded glyph format %x\n", ft_face->glyph->format);
4251  return GDI_ERROR;
4252  }
4253 
4254  break;
4255  }
4256 
4257  case GGO_NATIVE:
4258  {
4259  FT_Outline *outline = &ft_face->glyph->outline;
4260 
4261  if (cjBuf == 0) pvBuf = NULL; /* This is okay, need cjBuf to allocate. */
4262 
4263  IntLockFreeType();
4264  if (needsTransform && pvBuf) FT_Outline_Transform(outline, &transMat);
4265 
4267 
4268  if (!pvBuf || !cjBuf)
4269  {
4271  break;
4272  }
4273  if (needed > cjBuf)
4274  {
4276  return GDI_ERROR;
4277  }
4280  break;
4281  }
4282 
4283  case GGO_BEZIER:
4284  {
4285  FT_Outline *outline = &ft_face->glyph->outline;
4286  if (cjBuf == 0) pvBuf = NULL;
4287 
4288  if (needsTransform && pvBuf)
4289  {
4290  IntLockFreeType();
4291  FT_Outline_Transform(outline, &transMat);
4293  }
4295 
4296  if (!pvBuf || !cjBuf)
4297  break;
4298  if (needed > cjBuf)
4299  return GDI_ERROR;
4300 
4302  break;
4303  }
4304 
4305  default:
4306  DPRINT1("Unsupported format %u\n", iFormat);
4307  return GDI_ERROR;
4308  }
4309 
4310  DPRINT("ftGdiGetGlyphOutline END and needed %lu\n", needed);
4311  *pgm = gm;
4312  return needed;
4313 }
#define abs(i)
Definition: fconv.c:206
int FT_Error
Definition: fttypes.h:300
GLint GLint GLsizei width
Definition: gl.h:1546
FT_Pos y
Definition: ftimage.h:77
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
FLOATL eM11
Definition: winddi.h:1234
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
#define GGO_METRICS
Definition: wingdi.h:847
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
unsigned char pixel_mode
Definition: ftimage.h:268
long y
Definition: polytest.cpp:48
unsigned int rows
Definition: ftimage.h:263
#define error(str)
Definition: mkdosfs.c:1605
long x
Definition: polytest.cpp:48
FT_Pos x
Definition: ftimage.h:76
FORCEINLINE VOID TEXTOBJ_UnlockText(PLFONT plfnt)
Definition: text.h:96
#define FLOATOBJ_Set1(fo)
Definition: floatobj.h:120
signed int FT_Int
Definition: fttypes.h:220
#define FLOATOBJ_DivLong(pf, l)
Definition: winddi.h:2829
FT_Glyph_Metrics metrics
Definition: freetype.h:1916
LONG tmAveCharWidth
Definition: wingdi.h:2387
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
#define FT_LOAD_NO_HINTING
Definition: freetype.h:3010
static __inline FT_Fixed FT_FixedFromFIXED(FIXED f)
Definition: freetype.c:382
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
unsigned char * buffer
Definition: ftimage.h:266
#define FLOATOBJ_GetLong(pf)
Definition: winddi.h:2817
#define GGO_GRAY4_BITMAP
Definition: wingdi.h:852
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
short gmCellIncY
Definition: wingdi.h:2445
FT_Matrix_Multiply(const FT_Matrix *a, FT_Matrix *b)
Definition: ftcalc.c:661
FORCEINLINE VOID XFORMOBJ_vInit(OUT XFORMOBJ *pxo, IN MATRIX *pmx)
Definition: xformobj.h:21
#define FT_LOAD_DEFAULT
Definition: freetype.h:3008
int32_t INT
Definition: typedefs.h:56
HFONT hFont
Definition: main.c:53
#define GGO_BITMAP
Definition: wingdi.h:848
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
FT_Outline_Get_Bitmap(FT_Library library, FT_Outline *outline, const FT_Bitmap *abitmap)
Definition: ftoutln.c:661
#define GGO_GRAY8_BITMAP
Definition: wingdi.h:853
#define GGO_BEZIER
Definition: wingdi.h:850
#define FLOATOBJ_SetFloat(pf, f)
Definition: winddi.h:2814
FT_Fixed xx
Definition: fttypes.h:387
BOOL FASTCALL TextIntUpdateSize(PDC dc, PTEXTOBJ TextObj, PFONTGDI FontGDI, BOOL bDoLock)
Definition: freetype.c:3704
Definition: text.h:59
unsigned int BOOL
Definition: ntddk_ex.h:94
#define XFORMOBJ_iGetXform
Definition: xformobj.h:9
long LONG
Definition: pedump.c:60
FT_Load_Glyph(FT_Face face, FT_UInt glyph_index, FT_Int32 load_flags)
Definition: ftobjs.c:760
LONG lfOrientation
Definition: dimm.idl:62
HANDLE hlfntNew
Definition: ntgdihdl.h:334
static PVOID ptr
Definition: dispmode.c:27
#define GGO_NATIVE
Definition: wingdi.h:849
#define FLOATOBJ_AddLong(pf, l)
Definition: winddi.h:2820
INT FASTCALL IntGetOutlineTextMetrics(PFONTGDI FontGDI, UINT Size, OUTLINETEXTMETRICW *Otm)
Definition: freetype.c:2538
LONG lfWidth
Definition: dimm.idl:60
smooth NULL
Definition: ftsmooth.c:416
FT_Library g_FreeTypeLibrary
Definition: freetype.c:55
void DPRINT(...)
Definition: polytest.cpp:61
GLint GLint bottom
Definition: glext.h:7726
FT_Outline_Transform(const FT_Outline *outline, const FT_Matrix *matrix)
Definition: ftoutln.c:711
#define ft_glyph_format_outline
Definition: ftimage.h:732
#define ft_glyph_format_bitmap
Definition: ftimage.h:731
VOID FASTCALL FtMatrixFromMx(FT_Matrix *pmat, PMATRIX pmx)
Definition: freetype.c:752
#define FLOATOBJ_MulLong(pf, l)
Definition: winddi.h:2826
POINT gmptGlyphOrigin
Definition: wingdi.h:2443
FLOAT FLOATOBJ
Definition: winddi.h:677
#define IntUnLockFreeType()
Definition: freetype.c:82
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint left
Definition: glext.h:7726
GLdouble GLdouble right
Definition: glext.h:10859
static unsigned int get_native_glyph_outline(FT_Outline *outline, unsigned int buflen, char *buf)
Definition: freetype.c:3388
FT_Face Face
Definition: engobjects.h:129
FT_Vector * vec
Definition: ftbbox.c:448
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define GGO_UNHINTED
Definition: wingdi.h:855
VOID FtSetCoordinateTransform(FT_Face face, PMATRIX pmx)
Definition: freetype.c:775
#define GGO_GLYPH_INDEX
Definition: wingdi.h:854
_In_ DWORD cjBuf
Definition: winddi.h:3827
static unsigned int get_bezier_glyph_outline(FT_Outline *outline, unsigned int buflen, char *buf)
Definition: freetype.c:3461
#define IntLockFreeType()
Definition: freetype.c:79
FT_Outline outline
Definition: freetype.h:1927
unsigned char BYTE
Definition: mem.h:68
static FT_UInt FASTCALL get_glyph_index_flagged(FT_Face face, FT_ULong code, DWORD indexed_flag, DWORD flags)
Definition: freetype.c:3822
GLenum src
Definition: glext.h:6340
FT_Bitmap bitmap
Definition: freetype.h:1923
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
Definition: mesh.c:5329
ENUMLOGFONTEXDVW logfont
Definition: text.h:70
short gmCellIncX
Definition: wingdi.h:2444
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
_In_ SIZEL _In_ ULONG iFormat
Definition: winddi.h:3467
FT_GlyphSlot glyph
Definition: freetype.h:1105
#define FLOATOBJ_SetLong(pf, l)
Definition: winddi.h:2815
FT_Glyph_Format format
Definition: freetype.h:1921
FONTOBJ * Font
Definition: text.h:66
VOID FASTCALL IntEscapeMatrix(FT_Matrix *pmat, LONG lfEscapement)
Definition: freetype.c:739
FT_Vector_Transform(FT_Vector *vec, const FT_Matrix *matrix)
Definition: ftoutln.c:688
#define GDITAG_TEXT
Definition: tags.h:171
PSHARED_FACE SharedFace
Definition: engobjects.h:142
PTEXTOBJ FASTCALL RealizeFontInit(HFONT hFont)
Definition: font.c:422
unsigned int FT_UInt
Definition: fttypes.h:231
GLuint start
Definition: gl.h:1545
FT_Fixed xy
Definition: fttypes.h:387
GLenum GLenum dst
Definition: glext.h:6340
UINT gmBlackBoxY
Definition: wingdi.h:2442
#define min(a, b)
Definition: monoChain.cc:55
#define GGO_GRAY2_BITMAP
Definition: wingdi.h:851
unsigned int UINT
Definition: ndis.h:50
TEXTMETRICW otmTextMetrics
Definition: wingdi.h:2513
#define FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH
Definition: freetype.h:3017
int pitch
Definition: ftimage.h:265
#define DPRINT1
Definition: precomp.h:8
static const FT_Matrix identityMat
Definition: freetype.c:50
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
FT_Outline_Translate(const FT_Outline *outline, FT_Pos xOffset, FT_Pos yOffset)
Definition: ftoutln.c:528
LOGFONTW elfLogFont
Definition: wingdi.h:2701
UINT gmBlackBoxX
Definition: wingdi.h:2441
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
#define ObjToGDI(ClipObj, Type)
Definition: engobjects.h:180
#define FLOATOBJ_Equal1(pf)
Definition: floatobj.h:107
static const WCHAR dc[]
FORCEINLINE PMATRIX DC_pmxWorldToDevice(PDC pdc)
Definition: coord.h:98
#define FT_LOAD_NO_BITMAP
Definition: freetype.h:3012
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
FT_Fixed yx
Definition: fttypes.h:388
ENUMLOGFONTEXW elfEnumLogfontEx
Definition: wingdi.h:2778
FT_Fixed yy
Definition: fttypes.h:388
#define INT_TO_FIXED(x)
Definition: ftcalc.h:404
#define FLOATOBJ_Mul(pf, pf1)
Definition: winddi.h:2824
#define GDI_ERROR
Definition: wingdi.h:1308
#define FT_IS_SCALABLE(face)
Definition: freetype.h:1312
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27
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 width
Definition: ftimage.h:264
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31

Referenced by NtGdiGetGlyphOutline(), and PATH_ExtTextOut().

◆ ftGdiGetKerningPairs()

DWORD FASTCALL ftGdiGetKerningPairs ( PFONTGDI  ,
DWORD  ,
LPKERNINGPAIR   
)

Definition at line 5754 of file freetype.c.

5757 {
5758  DWORD Count = 0;
5759  INT i = 0;
5760  FT_Face face = Font->SharedFace->Face;
5761 
5762  if (FT_HAS_KERNING(face) && face->charmap->encoding == FT_ENCODING_UNICODE)
5763  {
5764  FT_UInt previous_index = 0, glyph_index = 0;
5765  FT_ULong char_code, char_previous;
5766  FT_Vector delta;
5767 
5768  char_previous = char_code = FT_Get_First_Char(face, &glyph_index);
5769 
5770  IntLockFreeType();
5771 
5772  while (glyph_index)
5773  {
5774  if (previous_index && glyph_index)
5775  {
5776  FT_Get_Kerning(face, previous_index, glyph_index, FT_KERNING_DEFAULT, &delta);
5777 
5778  if (pKerningPair && cPairs)
5779  {
5780  pKerningPair[i].wFirst = char_previous;
5781  pKerningPair[i].wSecond = char_code;
5782  pKerningPair[i].iKernAmount = delta.x;
5783  i++;
5784  if (i == cPairs) break;
5785  }
5786  Count++;
5787  }
5788  previous_index = glyph_index;
5789  char_previous = char_code;
5790  char_code = FT_Get_Next_Char(face, char_code, &glyph_index);
5791  }
5793  }
5794  return Count;
5795 }
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
unsigned long FT_ULong
Definition: fttypes.h:253
FT_Pos x
Definition: ftimage.h:76
FT_Get_Next_Char(FT_Face face, FT_ULong char_code, FT_UInt *agindex)
Definition: ftobjs.c:3722
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1015
int32_t INT
Definition: typedefs.h:56
#define FT_HAS_KERNING(face)
Definition: freetype.h:1297
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
#define IntUnLockFreeType()
Definition: freetype.c:82
unsigned long DWORD
Definition: ntddk_ex.h:95
FT_Get_First_Char(FT_Face face, FT_UInt *agindex)
Definition: ftobjs.c:3697
#define IntLockFreeType()
Definition: freetype.c:79
unsigned int FT_UInt
Definition: fttypes.h:231
GLenum GLuint GLint GLenum face
Definition: glext.h:7025

Referenced by GreGetKerningPairs(), and NtGdiGetKerningPairs().

◆ ftGdiGetRasterizerCaps()

BOOL FASTCALL ftGdiGetRasterizerCaps ( LPRASTERIZER_STATUS  )

Definition at line 3213 of file freetype.c.

3214 {
3215  if ( lprs )
3216  {
3217  lprs->nSize = sizeof(RASTERIZER_STATUS);
3218  lprs->wFlags = TT_AVAILABLE | TT_ENABLED;
3219  lprs->nLanguageID = gusLanguageID;
3220  return TRUE;
3221  }
3223  return FALSE;
3224 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define TRUE
Definition: types.h:120
struct _RASTERIZER_STATUS RASTERIZER_STATUS
#define TT_AVAILABLE
Definition: wingdi.h:887
USHORT gusLanguageID
Definition: main.c:29
#define TT_ENABLED
Definition: wingdi.h:888
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27

Referenced by NtGdiGetRasterizerCaps().

◆ ftGdiGetTextCharsetInfo()

INT FASTCALL ftGdiGetTextCharsetInfo ( PDC  ,
PFONTSIGNATURE  ,
DWORD   
)

Definition at line 4460 of file freetype.c.

4464 {
4465  PDC_ATTR pdcattr;
4466  UINT Ret = DEFAULT_CHARSET;
4467  INT i;
4468  HFONT hFont;
4469  PTEXTOBJ TextObj;
4470  PFONTGDI FontGdi;
4471  FONTSIGNATURE fs;
4472  TT_OS2 *pOS2;
4473  FT_Face Face;
4474  CHARSETINFO csi;
4475  DWORD cp, fs0;
4476  USHORT usACP, usOEM;
4477 
4478  pdcattr = Dc->pdcattr;
4479  hFont = pdcattr->hlfntNew;
4480  TextObj = RealizeFontInit(hFont);
4481 
4482  if (!TextObj)
4483  {
4485  return Ret;
4486  }
4487  FontGdi = ObjToGDI(TextObj->Font, FONT);
4488  Face = FontGdi->SharedFace->Face;
4489  TEXTOBJ_UnlockText(TextObj);
4490 
4491  memset(&fs, 0, sizeof(FONTSIGNATURE));
4492  IntLockFreeType();
4493  pOS2 = FT_Get_Sfnt_Table(Face, ft_sfnt_os2);
4494  if (NULL != pOS2)
4495  {
4496  fs.fsCsb[0] = pOS2->ulCodePageRange1;
4497  fs.fsCsb[1] = pOS2->ulCodePageRange2;
4498  fs.fsUsb[0] = pOS2->ulUnicodeRange1;
4499  fs.fsUsb[1] = pOS2->ulUnicodeRange2;
4500  fs.fsUsb[2] = pOS2->ulUnicodeRange3;
4501  fs.fsUsb[3] = pOS2->ulUnicodeRange4;
4502  if (pOS2->version == 0)
4503  {
4504  FT_UInt dummy;
4505 
4506  if (FT_Get_First_Char( Face, &dummy ) < 0x100)
4507  fs.fsCsb[0] |= FS_LATIN1;
4508  else
4509  fs.fsCsb[0] |= FS_SYMBOL;
4510  }
4511  }
4512  pOS2 = NULL;
4514  DPRINT("Csb 1=%x 0=%x\n", fs.fsCsb[1],fs.fsCsb[0]);
4515  if (fs.fsCsb[0] == 0)
4516  { /* Let's see if we can find any interesting cmaps */
4517  for (i = 0; i < Face->num_charmaps; i++)
4518  {
4519  switch (Face->charmaps[i]->encoding)
4520  {
4521  case FT_ENCODING_UNICODE:
4522  case FT_ENCODING_APPLE_ROMAN:
4523  fs.fsCsb[0] |= FS_LATIN1;
4524  break;
4525  case FT_ENCODING_MS_SYMBOL:
4526  fs.fsCsb[0] |= FS_SYMBOL;
4527  break;
4528  default:
4529  break;
4530  }
4531  }
4532  }
4533  if (lpSig)
4534  {
4535  RtlCopyMemory(lpSig, &fs, sizeof(FONTSIGNATURE));
4536  }
4537 
4538  RtlGetDefaultCodePage(&usACP, &usOEM);
4539  cp = usACP;
4540 
4542  if (csi.fs.fsCsb[0] & fs.fsCsb[0])
4543  {
4544  DPRINT("Hit 1\n");
4545  Ret = csi.ciCharset;
4546  goto Exit;
4547  }
4548 
4549  for (i = 0; i < MAXTCIINDEX; i++)
4550  {
4551  fs0 = 1L << i;
4552  if (fs.fsCsb[0] & fs0)
4553  {
4554  if (IntTranslateCharsetInfo(&fs0, &csi, TCI_SRCFONTSIG))
4555  {
4556  // *cp = csi.ciACP;
4557  DPRINT("Hit 2\n");
4558  Ret = csi.ciCharset;
4559  goto Exit;
4560  }
4561  else
4562  DPRINT1("TCI failing on %x\n", fs0);
4563  }
4564  }
4565 Exit:
4566  DPRINT("CharSet %u CodePage %u\n", csi.ciCharset, csi.ciACP);
4567  return (MAKELONG(csi.ciACP, csi.ciCharset));
4568 }
FONTSIGNATURE fs
Definition: wingdi.h:1547
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
FT_CharMap * charmaps
Definition: freetype.h:1085
#define ft_sfnt_os2
Definition: tttables.h:631
#define TCI_SRCFONTSIG
Definition: wingdi.h:962
FORCEINLINE VOID TEXTOBJ_UnlockText(PLFONT plfnt)
Definition: text.h:96
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
Definition: fs.h:235
#define DEFAULT_CHARSET
Definition: wingdi.h:383
int32_t INT
Definition: typedefs.h:56
#define MAXTCIINDEX
Definition: freetype.c:123
HFONT hFont
Definition: main.c:53
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
FT_ULong ulUnicodeRange1
Definition: tttables.h:401
Definition: text.h:59
HANDLE hlfntNew
Definition: ntgdihdl.h:334
FT_Get_Sfnt_Table(FT_Face face, FT_Sfnt_Tag tag)
Definition: ftobjs.c:4113
UINT ciCharset
Definition: wingdi.h:1545
#define MAKELONG(a, b)
Definition: typedefs.h:248
smooth NULL
Definition: ftsmooth.c:416
FT_UShort version
Definition: tttables.h:382
void DPRINT(...)
Definition: polytest.cpp:61
NTSYSAPI VOID NTAPI RtlGetDefaultCodePage(_Out_ PUSHORT AnsiCodePage, _Out_ PUSHORT OemCodePage)
static BOOLEAN APIENTRY IntTranslateCharsetInfo(PDWORD Src, LPCHARSETINFO Cs, DWORD Flags)
Definition: freetype.c:2174
#define FS_SYMBOL
Definition: wingdi.h:574
static void Exit(void)
Definition: sock.c:1331
#define IntUnLockFreeType()
Definition: freetype.c:82
unsigned long DWORD
Definition: ntddk_ex.h:95
FT_Face Face
Definition: engobjects.h:129
FT_Get_First_Char(FT_Face face, FT_UInt *agindex)
Definition: ftobjs.c:3697
FT_Encoding encoding
Definition: freetype.h:843
static const WCHAR L[]
Definition: oid.c:1250
#define IntLockFreeType()
Definition: freetype.c:79
FT_Int num_charmaps
Definition: freetype.h:1084
FONTOBJ * Font
Definition: text.h:66
DWORD fsCsb[2]
Definition: wingdi.h:1542
FT_ULong ulCodePageRange1
Definition: tttables.h:419
PSHARED_FACE SharedFace
Definition: engobjects.h:142
unsigned short USHORT
Definition: pedump.c:61
PTEXTOBJ FASTCALL RealizeFontInit(HFONT hFont)
Definition: font.c:422
#define fs
Definition: i386-dis.c:435
unsigned int FT_UInt
Definition: fttypes.h:231
unsigned char dummy
Definition: maze.c:118
FT_ULong ulUnicodeRange4
Definition: tttables.h:404
unsigned int UINT
Definition: ndis.h:50
FT_ULong ulCodePageRange2
Definition: tttables.h:420
#define DPRINT1
Definition: precomp.h:8
FT_ULong ulUnicodeRange3
Definition: tttables.h:403
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
#define TCI_SRCCODEPAGE
Definition: wingdi.h:961
#define FS_LATIN1
Definition: wingdi.h:559
POINT cp
Definition: magnifier.c:59
#define ObjToGDI(ClipObj, Type)
Definition: engobjects.h:180
#define memset(x, y, z)
Definition: compat.h:39
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27
FT_ULong ulUnicodeRange2
Definition: tttables.h:402

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

◆ ftGdiGetTextMetricsW()

BOOL FASTCALL ftGdiGetTextMetricsW ( HDC  ,
PTMW_INTERNAL   
)

Definition at line 4641 of file freetype.c.

4644 {
4645  PDC dc;
4646  PDC_ATTR pdcattr;
4647  PTEXTOBJ TextObj;
4648  PFONTGDI FontGDI;
4649  FT_Face Face;
4650  TT_OS2 *pOS2;
4651  TT_HoriHeader *pHori;
4652  FT_WinFNT_HeaderRec Win;
4653  ULONG Error;
4655  LOGFONTW *plf;
4656 
4657  if (!ptmwi)
4658  {
4660  return FALSE;
4661  }
4662 
4663  if (!(dc = DC_LockDc(hDC)))
4664  {
4666  return FALSE;
4667  }
4668  pdcattr = dc->pdcattr;
4669  TextObj = RealizeFontInit(pdcattr->hlfntNew);
4670  if (NULL != TextObj)
4671  {
4672  plf = &TextObj->logfont.elfEnumLogfontEx.elfLogFont;
4673  FontGDI = ObjToGDI(TextObj->Font, FONT);
4674 
4675  Face = FontGDI->SharedFace->Face;
4676 
4677  IntLockFreeType();
4678  Error = IntRequestFontSize(dc, FontGDI, plf->lfWidth, plf->lfHeight);
4681 
4682  if (0 != Error)
4683  {
4684  DPRINT1("Error in setting pixel sizes: %u\n", Error);
4686  }
4687  else
4688  {
4689  FT_Face Face = FontGDI->SharedFace->Face;
4691 
4692  IntLockFreeType();
4693  pOS2 = FT_Get_Sfnt_Table(Face, ft_sfnt_os2);
4694  if (NULL == pOS2)
4695  {
4696  DPRINT1("Can't find OS/2 table - not TT font?\n");
4698  }
4699 
4700  pHori = FT_Get_Sfnt_Table(Face, ft_sfnt_hhea);
4701  if (NULL == pHori)
4702  {
4703  DPRINT1("Can't find HHEA table - not TT font?\n");
4705  }
4706 
4707  Error = FT_Get_WinFNT_Header(Face, &Win);
4708 
4709  if (NT_SUCCESS(Status) || !Error)
4710  {
4711  FillTM(&ptmwi->TextMetric, FontGDI, pOS2, pHori, !Error ? &Win : 0);
4712 
4713  /* FIXME: Fill Diff member */
4714  RtlZeroMemory(&ptmwi->Diff, sizeof(ptmwi->Diff));
4715  }
4716 
4718  }
4719  TEXTOBJ_UnlockText(TextObj);
4720  }
4721  else
4722  {
4724  }
4725  DC_UnlockDc(dc);
4726 
4727  if (!NT_SUCCESS(Status))
4728  {
4730  return FALSE;
4731  }
4732  return TRUE;
4733 }
#define TRUE
Definition: types.h:120
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
FT_Get_WinFNT_Header(FT_Face face, FT_WinFNT_HeaderRec *aheader)
Definition: ftwinfnt.c:29
#define ft_sfnt_os2
Definition: tttables.h:631
FORCEINLINE VOID TEXTOBJ_UnlockText(PLFONT plfnt)
Definition: text.h:96
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
LONG lfHeight
Definition: dimm.idl:59
LONG NTSTATUS
Definition: precomp.h:26
#define STATUS_INVALID_HANDLE
Definition: ntstatus.h:231
#define STATUS_INTERNAL_ERROR
Definition: ntstatus.h:451
Definition: text.h:59
HANDLE hlfntNew
Definition: ntgdihdl.h:334
FT_Get_Sfnt_Table(FT_Face face, FT_Sfnt_Tag tag)
Definition: ftobjs.c:4113
static void FASTCALL FillTM(TEXTMETRICW *TM, PFONTGDI FontGDI, TT_OS2 *pOS2, TT_HoriHeader *pHori, FT_WinFNT_HeaderRec *pFNT)
Definition: freetype.c:2237
LONG lfWidth
Definition: dimm.idl:60
smooth NULL
Definition: ftsmooth.c:416
#define ft_sfnt_hhea
Definition: tttables.h:632
Definition: polytest.cpp:40
static FT_Error IntRequestFontSize(PDC dc, PFONTGDI FontGDI, LONG lfWidth, LONG lfHeight)
Definition: freetype.c:3586
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define IntUnLockFreeType()
Definition: freetype.c:82
BOOL Error
Definition: chkdsk.c:66
FT_Face Face
Definition: engobjects.h:129
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
VOID FtSetCoordinateTransform(FT_Face face, PMATRIX pmx)
Definition: freetype.c:775
#define IntLockFreeType()
Definition: freetype.c:79
VOID FASTCALL SetLastNtError(NTSTATUS Status)
Definition: error.c:36
ENUMLOGFONTEXDVW logfont
Definition: text.h:70
Status
Definition: gdiplustypes.h:24
static HDC hDC
Definition: 3dtext.c:33
FONTOBJ * Font
Definition: text.h:66
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
PSHARED_FACE SharedFace
Definition: engobjects.h:142
PTEXTOBJ FASTCALL RealizeFontInit(HFONT hFont)
Definition: font.c:422
#define DPRINT1
Definition: precomp.h:8
LOGFONTW elfLogFont
Definition: wingdi.h:2701
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
#define ObjToGDI(ClipObj, Type)
Definition: engobjects.h:180
static const WCHAR dc[]
FORCEINLINE PMATRIX DC_pmxWorldToDevice(PDC pdc)
Definition: coord.h:98
ENUMLOGFONTEXW elfEnumLogfontEx
Definition: wingdi.h:2778
return STATUS_SUCCESS
Definition: btrfs.c:2938
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27

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

◆ ftGdiRealizationInfo()

BOOL FASTCALL ftGdiRealizationInfo ( PFONTGDI  ,
PREALIZATION_INFO   
)

Definition at line 5735 of file freetype.c.

5736 {
5737  if (FT_HAS_FIXED_SIZES(Font->SharedFace->Face))
5738  Info->iTechnology = RI_TECH_BITMAP;
5739  else
5740  {
5741  if (FT_IS_SCALABLE(Font->SharedFace->Face))
5742  Info->iTechnology = RI_TECH_SCALABLE;
5743  else
5744  Info->iTechnology = RI_TECH_FIXED;
5745  }
5746  Info->iUniq = Font->FontObj.iUniq;
5747  Info->dwUnknown = -1;
5748  return TRUE;
5749 }
#define TRUE
Definition: types.h:120
#define RI_TECH_BITMAP
Definition: ntgdityp.h:270
struct TraceInfo Info
#define RI_TECH_SCALABLE
Definition: ntgdityp.h:272
#define FT_HAS_FIXED_SIZES(face)
Definition: freetype.h:1361
#define RI_TECH_FIXED
Definition: ntgdityp.h:271
#define FT_IS_SCALABLE(face)
Definition: freetype.h:1312

Referenced by NtGdiGetRealizationInfo().

◆ ftGetFontUnicodeRanges()

DWORD FASTCALL ftGetFontUnicodeRanges ( PFONTGDI  ,
PGLYPHSET   
)

Definition at line 4573 of file freetype.c.

4574 {
4575  DWORD size = 0;
4576  DWORD num_ranges = 0;
4577  FT_Face face = Font->SharedFace->Face;
4578 
4579  if (face->charmap->encoding == FT_ENCODING_UNICODE)
4580  {
4581  FT_UInt glyph_code = 0;
4582  FT_ULong char_code, char_code_prev;
4583 
4584  char_code_prev = char_code = FT_Get_First_Char(face, &glyph_code);
4585 
4586  DPRINT("Face encoding FT_ENCODING_UNICODE, number of glyphs %ld, first glyph %u, first char %04lx\n",
4587  face->num_glyphs, glyph_code, char_code);
4588 
4589  if (!glyph_code) return 0;
4590 
4591  if (glyphset)
4592  {
4593  glyphset->ranges[0].wcLow = (USHORT)char_code;
4594  glyphset->ranges[0].cGlyphs = 0;
4595  glyphset->cGlyphsSupported = 0;
4596  }
4597 
4598  num_ranges = 1;
4599  while (glyph_code)
4600  {
4601  if (char_code < char_code_prev)
4602  {
4603  DPRINT1("Expected increasing char code from FT_Get_Next_Char\n");
4604  return 0;
4605  }
4606  if (char_code - char_code_prev > 1)
4607  {
4608  num_ranges++;
4609  if (glyphset)
4610  {
4611  glyphset->ranges[num_ranges - 1].wcLow = (USHORT)char_code;
4612  glyphset->ranges[num_ranges - 1].cGlyphs = 1;
4613  glyphset->cGlyphsSupported++;
4614  }
4615  }
4616  else if (glyphset)
4617  {
4618  glyphset->ranges[num_ranges - 1].cGlyphs++;
4619  glyphset->cGlyphsSupported++;
4620  }
4621  char_code_prev = char_code;
4622  char_code = FT_Get_Next_Char(face, char_code, &glyph_code);
4623  }
4624  }
4625  else
4626  DPRINT1("Encoding %i not supported\n", face->charmap->encoding);
4627 
4628  size = sizeof(GLYPHSET) + sizeof(WCRANGE) * (num_ranges - 1);
4629  if (glyphset)
4630  {
4631  glyphset->cbThis = size;
4632  glyphset->cRanges = num_ranges;
4633  glyphset->flAccel = 0;
4634  }
4635  return size;
4636 }
unsigned long FT_ULong
Definition: fttypes.h:253
FT_Get_Next_Char(FT_Face face, FT_ULong char_code, FT_UInt *agindex)
Definition: ftobjs.c:3722
void DPRINT(...)
Definition: polytest.cpp:61
GLsizeiptr size
Definition: glext.h:5919
unsigned long DWORD
Definition: ntddk_ex.h:95
FT_Get_First_Char(FT_Face face, FT_UInt *agindex)
Definition: ftobjs.c:3697
unsigned short USHORT
Definition: pedump.c:61
unsigned int FT_UInt
Definition: fttypes.h:231
#define DPRINT1
Definition: precomp.h:8
GLenum GLuint GLint GLenum face
Definition: glext.h:7025

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 }
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
WCHAR elfFullName[LF_FULLFACESIZE]
Definition: wingdi.h:2702
DWORD dvNumAxes
Definition: wingdi.h:2768
WCHAR elfStyle[LF_FACESIZE]
Definition: wingdi.h:2703
WCHAR elfScript[LF_FACESIZE]
Definition: wingdi.h:2704
smooth NULL
Definition: ftsmooth.c:416
HFONT APIENTRY HfontCreate(IN PENUMLOGFONTEXDVW pelfw, IN ULONG cjElfw, IN LFTYPE lft, IN FLONG fl, IN PVOID pvCliData)
Definition: font.c:1139
DESIGNVECTOR elfDesignVector
Definition: wingdi.h:2779
LOGFONTW elfLogFont
Definition: wingdi.h:2701
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
ENUMLOGFONTEXW elfEnumLogfontEx
Definition: wingdi.h:2778

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  ,
LPCWSTR  ,
ULONG  ,
ULONG  ,
PULONG  ,
PULONG  ,
LPSIZE  ,
FLONG   
)

Definition at line 93 of file text.c.

102 {
103  PDC pdc;
104  PDC_ATTR pdcattr;
105  BOOL Result;
106  PTEXTOBJ TextObj;
107 
108  if ( (!String && Count ) || !pSize )
109  {
111  return FALSE;
112  }
113 
114  if ( !Count )
115  {
116  if ( Fit ) Fit = 0;
117  return TRUE;
118  }
119 
120  pdc = DC_LockDc(hDC);
121  if (NULL == pdc)
122  {
124  return FALSE;
125  }
126  pdcattr = pdc->pdcattr;
127 
128  TextObj = RealizeFontInit(pdcattr->hlfntNew);
129  if ( TextObj )
130  {
132  TextObj,
133  String,
134  Count,
135  MaxExtent,
136  (LPINT)Fit,
137  (LPINT)Dx,
138  pSize,
139  fl);
140  TEXTOBJ_UnlockText(TextObj);
141  }
142  else
143  Result = FALSE;
144 
145  DC_UnlockDc(pdc);
146  return Result;
147 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define TRUE
Definition: types.h:120
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
FORCEINLINE VOID TEXTOBJ_UnlockText(PLFONT plfnt)
Definition: text.h:96
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1015
static WCHAR String[]
Definition: stringtable.c:55
_In_ FLONG fl
Definition: winddi.h:1279
Definition: text.h:59
unsigned int BOOL
Definition: ntddk_ex.h:94
HANDLE hlfntNew
Definition: ntgdihdl.h:334
smooth NULL
Definition: ftsmooth.c:416
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
Definition: polytest.cpp:40
static HDC hDC
Definition: 3dtext.c:33
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
PTEXTOBJ FASTCALL RealizeFontInit(HFONT hFont)
Definition: font.c:422
BOOL FASTCALL TextIntGetTextExtentPoint(PDC dc, PTEXTOBJ TextObj, LPCWSTR String, INT Count, ULONG MaxExtent, LPINT Fit, LPINT Dx, LPSIZE Size, FLONG fl)
Definition: freetype.c:4317
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27
int * LPINT
Definition: windef.h:178

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

◆ GreGetTextExtentW()

BOOL FASTCALL GreGetTextExtentW ( HDC  ,
LPCWSTR  ,
INT  ,
LPSIZE  ,
UINT   
)

Definition at line 36 of file text.c.

42 {
43  PDC pdc;
44  PDC_ATTR pdcattr;
45  BOOL Result;
46  PTEXTOBJ TextObj;
47 
48  if (!cwc)
49  {
50  psize->cx = 0;
51  psize->cy = 0;
52  return TRUE;
53  }
54 
55  pdc = DC_LockDc(hDC);
56  if (!pdc)
57  {
59  return FALSE;
60  }
61 
62  pdcattr = pdc->pdcattr;
63 
64  TextObj = RealizeFontInit(pdcattr->hlfntNew);
65  if ( TextObj )
66  {
68  TextObj,
69  lpwsz,
70  cwc,
71  0,
72  NULL,
73  0,
74  psize,
75  flOpts);
76  TEXTOBJ_UnlockText(TextObj);
77  }
78  else
79  Result = FALSE;
80 
81  DC_UnlockDc(pdc);
82  return Result;
83 }
#define TRUE
Definition: types.h:120
_Must_inspect_result_ _Out_ LPSIZE psize
Definition: ntgdi.h:1569
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
FORCEINLINE VOID TEXTOBJ_UnlockText(PLFONT plfnt)
Definition: text.h:96
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
Definition: text.h:59
unsigned int BOOL
Definition: ntddk_ex.h:94
HANDLE hlfntNew
Definition: ntgdihdl.h:334
smooth NULL
Definition: ftsmooth.c:416
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
LONG cx
Definition: windef.h:334
Definition: polytest.cpp:40
static HDC hDC
Definition: 3dtext.c:33
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
PTEXTOBJ FASTCALL RealizeFontInit(HFONT hFont)
Definition: font.c:422
BOOL FASTCALL TextIntGetTextExtentPoint(PDC dc, PTEXTOBJ TextObj, LPCWSTR String, INT Count, ULONG MaxExtent, LPINT Fit, LPINT Dx, LPSIZE Size, FLONG fl)
Definition: freetype.c:4317
LONG cy
Definition: windef.h:335
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27

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

◆ GreGetTextMetricsW()

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

Definition at line 151 of file text.c.

154 {
155  TMW_INTERNAL tmwi;
156  if (!ftGdiGetTextMetricsW(hdc, &tmwi)) return FALSE;
157  *lptm = tmwi.TextMetric;
158  return TRUE;
159 }
TEXTMETRICW TextMetric
Definition: ntgdityp.h:369
#define TRUE
Definition: types.h:120
HDC hdc
Definition: main.c:9
BOOL FASTCALL ftGdiGetTextMetricsW(HDC hDC, PTMW_INTERNAL ptmwi)
Definition: freetype.c:4641
static LPTEXTMETRICW lptm
Definition: font.c:42

Referenced by DrawTextExWorker().

◆ GreTextOutW()

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

Functions

Definition at line 19 of file text.c.

25 {
26  return GreExtTextOutW(hdc, nXStart, nYStart, 0, NULL, lpString, cchString, NULL, 0);
27 }
smooth NULL
Definition: ftsmooth.c:416
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:6700
HDC hdc
Definition: main.c:9

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

◆ InitFontSupport()

BOOL FASTCALL InitFontSupport ( VOID  )

Definition at line 660 of file freetype.c.

661 {
662  ULONG ulError;
663 
667  /* Fast Mutexes must be allocated from non paged pool */
669  if (g_FontListLock == NULL)
670  {
671  return FALSE;
672  }
673 
676  if (g_FreeTypeLock == NULL)
677  {
678  return FALSE;
679  }
681 
683  if (ulError)
684  {
685  DPRINT1("FT_Init_FreeType failed with error code 0x%x\n", ulError);
686  return FALSE;
687  }
688 
689  if (!IntLoadFontsInRegistry())
690  {
691  DPRINT1("Fonts registry is empty.\n");
692 
693  /* Load font(s) with writing registry */
695  }
696 
697  IntLoadFontSubstList(&g_FontSubstListHead);
698 
699 #if DBG
700  DumpFontInfo(TRUE);
701 #endif
702 
703  return TRUE;
704 }
static LIST_ENTRY g_FontListHead
Definition: freetype.c:66
#define TRUE
Definition: types.h:120
static UINT g_FontCacheNumEntries
Definition: freetype.c:94
BOOL FASTCALL IntLoadFontsInRegistry(VOID)
Definition: freetype.c:1776
FT_Init_FreeType(FT_Library *alibrary)
Definition: ftinit.c:320
smooth NULL
Definition: ftsmooth.c:416
FT_Library g_FreeTypeLibrary
Definition: freetype.c:55
static PFAST_MUTEX g_FontListLock
Definition: freetype.c:67
FAST_MUTEX
Definition: extypes.h:17
FORCEINLINE VOID ExInitializeFastMutex(_Out_ PFAST_MUTEX FastMutex)
Definition: exfuncs.h:274
VOID FASTCALL IntLoadSystemFonts(VOID)
Definition: freetype.c:943
static LIST_ENTRY g_FontCacheListHead
Definition: freetype.c:93
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define TAG_INTERNAL_SYNC
Definition: tags.h:18
BOOL FASTCALL IntLoadFontSubstList(PLIST_ENTRY pHead)
Definition: freetype.c:510
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
static PFAST_MUTEX g_FreeTypeLock
Definition: freetype.c:64
#define DPRINT1
Definition: precomp.h:8
unsigned int ULONG
Definition: retypes.h:1

Referenced by DriverEntry().

◆ 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 }
static const CHARSETINFO g_FontTci[MAXTCIINDEX]
Definition: freetype.c:124
#define MAC_CHARSET
Definition: wingdi.h:402
#define DEFAULT_CHARSET
Definition: wingdi.h:383
#define MAXTCIINDEX
Definition: freetype.c:123
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
UINT ciCharset
Definition: wingdi.h:1545
#define OEM_CHARSET
Definition: wingdi.h:399
unsigned int UINT
Definition: ndis.h:50
#define CP_OEMCP
Definition: freetype.c:166
#define CP_MACCP
Definition: freetype.c:167

Referenced by CreateStockFonts().

◆ IntEnableFontRendering()

VOID FASTCALL IntEnableFontRendering ( BOOL  Enable)

Definition at line 2104 of file freetype.c.

2105 {
2107 }
_In_ ULONGLONG _In_ ULONGLONG _In_ BOOLEAN Enable
Definition: ntddpcm.h:140
static BOOL g_RenderingEnabled
Definition: freetype.c:68

◆ IntGdiAddFontMemResource()

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

Definition at line 1930 of file freetype.c.

1931 {
1932  HANDLE Ret = NULL;
1934  PFONT_ENTRY_COLL_MEM EntryCollection;
1935  INT FaceCount;
1936 
1938  if (!BufferCopy)
1939  {
1940  *pNumAdded = 0;
1941  return NULL;
1942  }
1943  RtlCopyMemory(BufferCopy, Buffer, dwSize);
1944 
1945  LoadFont.pFileName = NULL;
1946  LoadFont.Memory = SharedMem_Create(BufferCopy, dwSize, FALSE);
1947  LoadFont.Characteristics = FR_PRIVATE | FR_NOT_ENUM;
1948  RtlInitUnicodeString(&LoadFont.RegValueName, NULL);
1949  LoadFont.IsTrueType = FALSE;
1950  LoadFont.PrivateEntry = NULL;
1952 
1953  RtlFreeUnicodeString(&LoadFont.RegValueName);
1954 
1955  /* Release our copy */
1956  IntLockFreeType();
1957  SharedMem_Release(LoadFont.Memory);
1959 
1960  if (FaceCount > 0)
1961  {
1962  EntryCollection = ExAllocatePoolWithTag(PagedPool, sizeof(FONT_ENTRY_COLL_MEM), TAG_FONT);
1963  if (EntryCollection)
1964  {
1966  EntryCollection->Entry = LoadFont.PrivateEntry;
1967  IntLockProcessPrivateFonts(Win32Process);
1968  EntryCollection->Handle = ULongToHandle(++Win32Process->PrivateMemFontHandleCount);
1969  InsertTailList(&Win32Process->PrivateMemFontListHead, &EntryCollection->ListEntry);
1970  IntUnLockProcessPrivateFonts(Win32Process);
1971  Ret = EntryCollection->Handle;
1972  }
1973  }
1974  *pNumAdded = FaceCount;
1975 
1976  return Ret;
1977 }
#define ULongToHandle(h)
Definition: basetsd.h:81
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
UINT PrivateMemFontHandleCount
Definition: win32.h:278
#define IntUnLockProcessPrivateFonts(W32Process)
Definition: text.h:150
#define TAG_FONT
Definition: tags.h:12
#define InsertTailList(ListHead, Entry)
int32_t INT
Definition: typedefs.h:56
FONT_ENTRY_MEM * Entry
Definition: font.h:23
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
BOOL LoadFont(LPWSTR lpCmdLine)
static INT FASTCALL IntGdiLoadFontsFromMemory(PGDI_LOAD_FONT pLoadFont)
Definition: freetype.c:1080
HANDLE Handle
Definition: font.h:22
LIST_ENTRY PrivateMemFontListHead
Definition: win32.h:277
LIST_ENTRY ListEntry
Definition: font.h:21
#define IntUnLockFreeType()
Definition: freetype.c:82
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define IntLockFreeType()
Definition: freetype.c:79
static PSHARED_MEM SharedMem_Create(PBYTE Buffer, ULONG BufferSize, BOOL IsMapping)
Definition: freetype.c:233
Definition: font.h:19
static void SharedMem_Release(PSHARED_MEM Ptr)
Definition: freetype.c:290
PVOID NTAPI PsGetCurrentProcessWin32Process(VOID)
Definition: process.c:1183
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54
#define IntLockProcessPrivateFonts(W32Process)
Definition: text.h:147

Referenced by NtGdiAddFontMemResourceEx().

◆ IntGdiAddFontResource()

INT FASTCALL IntGdiAddFontResource ( PUNICODE_STRING  FileName,
DWORD  Characteristics 
)

Definition at line 1760 of file freetype.c.

1761 {
1762  return IntGdiAddFontResourceEx(FileName, Characteristics, 0);
1763 }
INT FASTCALL IntGdiAddFontResourceEx(PUNICODE_STRING FileName, DWORD Characteristics, DWORD dwFlags)
Definition: freetype.c:1561

Referenced by NtGdiAddFontResourceW().

◆ IntGdiAddFontResourceEx()

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

Definition at line 1561 of file freetype.c.

1563 {
1564  NTSTATUS Status;
1566  PVOID Buffer = NULL;
1569  SIZE_T ViewSize = 0, Length;
1570  LARGE_INTEGER SectionSize;
1573  INT FontCount;
1574  HANDLE KeyHandle;
1575  UNICODE_STRING PathName;
1576  LPWSTR pszBuffer;
1578  static const UNICODE_STRING TrueTypePostfix = RTL_CONSTANT_STRING(L" (TrueType)");
1579  static const UNICODE_STRING DosPathPrefix = RTL_CONSTANT_STRING(L"\\??\\");
1580 
1581  /* Build PathName */
1583  {
1584  Length = DosPathPrefix.Length + FileName->Length + sizeof(UNICODE_NULL);
1586  if (!pszBuffer)
1587  return 0; /* failure */
1588 
1589  RtlInitEmptyUnicodeString(&PathName, pszBuffer, Length);
1590  RtlAppendUnicodeStringToString(&PathName, &DosPathPrefix);
1592  }
1593  else
1594  {
1595  Status = DuplicateUnicodeString(FileName, &PathName);
1596  if (!NT_SUCCESS(Status))
1597  return 0; /* failure */
1598  }
1599 
1600  /* Open the font file */
1603  Status = ZwOpenFile(
1604  &FileHandle,
1607  &Iosb,
1610  if (!NT_SUCCESS(Status))
1611  {
1612  DPRINT1("Could not load font file: %wZ\n", &PathName);
1613  RtlFreeUnicodeString(&PathName);
1614  return 0;
1615  }
1616 
1619  if (!NT_SUCCESS(Status))
1620  {
1621  DPRINT1("ObReferenceObjectByHandle failed.\n");
1623  RtlFreeUnicodeString(&PathName);
1624  return 0;
1625  }
1626 
1627  SectionSize.QuadPart = 0LL;
1630  NULL, &SectionSize, PAGE_READONLY,
1632  if (!NT_SUCCESS(Status))
1633  {
1634  DPRINT1("Could not map file: %wZ\n", &PathName);
1637  RtlFreeUnicodeString(&PathName);
1638  return 0;
1639  }
1641 
1643  if (!NT_SUCCESS(Status))
1644  {
1645  DPRINT1("Could not map file: %wZ\n", &PathName);
1648  RtlFreeUnicodeString(&PathName);
1649  return 0;
1650  }
1651 
1652  LoadFont.pFileName = &PathName;
1654  LoadFont.Characteristics = Characteristics;
1655  RtlInitUnicodeString(&LoadFont.RegValueName, NULL);
1656  LoadFont.IsTrueType = FALSE;
1657  LoadFont.CharSet = DEFAULT_CHARSET;
1658  LoadFont.PrivateEntry = NULL;
1659  FontCount = IntGdiLoadFontsFromMemory(&LoadFont);
1660 
1661  /* Release our copy */
1662  IntLockFreeType();
1663  SharedMem_Release(LoadFont.Memory);
1665 
1667 
1669 
1670  /* Save the loaded font name into the registry */
1671  if (FontCount > 0 && (dwFlags & AFRX_WRITE_REGISTRY))
1672  {
1673  UNICODE_STRING NewString;
1674  SIZE_T Length;
1675  PWCHAR pszBuffer;
1676  LPCWSTR CharSetName;
1677  if (LoadFont.IsTrueType)
1678  {
1679  /* Append " (TrueType)" */
1680  Length = LoadFont.RegValueName.Length + TrueTypePostfix.Length + sizeof(UNICODE_NULL);
1682  if (pszBuffer)
1683  {
1684  RtlInitEmptyUnicodeString(&NewString, pszBuffer, Length);
1685  NewString.Buffer[0] = UNICODE_NULL;
1686  RtlAppendUnicodeStringToString(&NewString, &LoadFont.RegValueName);
1687  RtlAppendUnicodeStringToString(&NewString, &TrueTypePostfix);
1688  RtlFreeUnicodeString(&LoadFont.RegValueName);
1689  LoadFont.RegValueName = NewString;
1690  }
1691  else
1692  {
1693  // FIXME!
1694  }
1695  }
1696  else if (LoadFont.CharSet != DEFAULT_CHARSET)
1697  {
1698  /* Append " (CharSetName)" */
1699  CharSetName = NameFromCharSet(LoadFont.CharSet);
1700  Length = LoadFont.RegValueName.Length +
1701  (wcslen(CharSetName) + 3) * sizeof(WCHAR) +
1702  sizeof(UNICODE_NULL);
1703 
1705  if (pszBuffer)
1706  {
1707  RtlInitEmptyUnicodeString(&NewString, pszBuffer, Length);
1708  NewString.Buffer[0] = UNICODE_NULL;
1709  RtlAppendUnicodeStringToString(&NewString, &LoadFont.RegValueName);
1710  RtlAppendUnicodeToString(&NewString, L" (");
1711  RtlAppendUnicodeToString(&NewString, CharSetName);
1712  RtlAppendUnicodeToString(&NewString, L")");
1713  RtlFreeUnicodeString(&LoadFont.RegValueName);
1714  LoadFont.RegValueName = NewString;
1715  }
1716  else
1717  {
1718  // FIXME!
1719  }
1720  }
1721 
1724  NULL, NULL);
1725  Status = ZwOpenKey(&KeyHandle, KEY_WRITE, &ObjectAttributes);
1726  if (NT_SUCCESS(Status))
1727  {
1728  SIZE_T DataSize;
1729  LPWSTR pFileName;
1730 
1732  {
1733  pFileName = PathName.Buffer;
1734  }
1735  else
1736  {
1737  pFileName = wcsrchr(PathName.Buffer, L'\\');
1738  }
1739 
1740  if (pFileName)
1741  {
1742  if (!(dwFlags & AFRX_ALTERNATIVE_PATH))
1743  {
1744  pFileName++;
1745  }
1746  DataSize = (wcslen(pFileName) + 1) * sizeof(WCHAR);
1747  ZwSetValueKey(KeyHandle, &LoadFont.RegValueName, 0, REG_SZ,
1748  pFileName, DataSize);
1749  }
1750  ZwClose(KeyHandle);
1751  }
1752  }
1753  RtlFreeUnicodeString(&LoadFont.RegValueName);
1754 
1755  RtlFreeUnicodeString(&PathName);
1756  return FontCount;
1757 }
_Must_inspect_result_ _Outptr_ PVOID * SectionObject
Definition: fsrtlfuncs.h:860
#define FILE_GENERIC_READ
Definition: nt_native.h:653
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
#define TRUE
Definition: types.h:120
#define LL
Definition: tui.h:85
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
Definition: ndis.h:4711
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
#define SECTION_QUERY
Definition: nt_native.h:1287
LONG NTSTATUS
Definition: precomp.h:26
VOID NTAPI ObDereferenceObject(IN PVOID Object)
Definition: obref.c:375
uint16_t * PWCHAR
Definition: typedefs.h:54
#define DEFAULT_CHARSET
Definition: wingdi.h:383
int32_t INT
Definition: typedefs.h:56
#define FILE_SHARE_READ
Definition: compat.h:125
#define AFRX_WRITE_REGISTRY
Definition: text.h:104
HANDLE FileHandle
Definition: stats.c:38
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:496
#define SEC_COMMIT
Definition: mmtypes.h:99
#define AFRX_ALTERNATIVE_PATH
Definition: text.h:105
#define UNICODE_NULL
#define FILE_READ_DATA
Definition: nt_native.h:628
smooth NULL
Definition: ftsmooth.c:416
_Check_return_ _CRTIMP _CONST_RETURN wchar_t *__cdecl wcsrchr(_In_z_ const wchar_t *_Str, _In_ wchar_t _Ch)
Definition: bufpool.h:45
_Inout_ PFILE_OBJECT FileObject
Definition: cdprocs.h:593
BOOL LoadFont(LPWSTR lpCmdLine)
#define KEY_WRITE
Definition: nt_native.h:1031
NTSTATUS RtlAppendUnicodeToString(IN PUNICODE_STRING Str1, IN PWSTR Str2)
Definition: string_lib.cpp:62
static INT FASTCALL IntGdiLoadFontsFromMemory(PGDI_LOAD_FONT pLoadFont)
Definition: freetype.c:1080
__wchar_t WCHAR
Definition: xmlstorage.h:180
return Iosb
Definition: create.c:4426
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
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:4975
#define IntUnLockFreeType()
Definition: freetype.c:82
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
* PFILE_OBJECT
Definition: iotypes.h:1955
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
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)
NTSTATUS NTAPI MmMapViewInSystemSpace(IN PVOID SectionObject, OUT PVOID *MappedBase, IN OUT PSIZE_T ViewSize)
Definition: section.c:4847
static const WCHAR L[]
Definition: oid.c:1250
#define IntLockFreeType()
Definition: freetype.c:79
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define SECTION_MAP_READ
Definition: compat.h:128
static PSHARED_MEM SharedMem_Create(PBYTE Buffer, ULONG BufferSize, BOOL IsMapping)
Definition: freetype.c:233
#define SYNCHRONIZE
Definition: nt_native.h:61
#define TAG_USTR
Definition: libsupp.c:111
Status
Definition: gdiplustypes.h:24
ULONG_PTR SIZE_T
Definition: typedefs.h:78
static void SharedMem_Release(PSHARED_MEM Ptr)
Definition: freetype.c:290
NTSYSAPI NTSTATUS NTAPI RtlAppendUnicodeStringToString(PUNICODE_STRING Destination, PUNICODE_STRING Source)
#define PAGE_READONLY
Definition: compat.h:127
#define DPRINT1
Definition: precomp.h:8
static UNICODE_STRING g_FontRegPath
Definition: freetype.c:58
#define FILE_SYNCHRONOUS_IO_NONALERT
Definition: from_kernel.h:31
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID _In_ ULONG_PTR _In_ SIZE_T _Inout_opt_ PLARGE_INTEGER _Inout_ PSIZE_T ViewSize
Definition: mmfuncs.h:404
#define STANDARD_RIGHTS_REQUIRED
Definition: nt_native.h:63
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
static LPCWSTR FASTCALL NameFromCharSet(BYTE CharSet)
Definition: freetype.c:1527
#define AFRX_DOS_DEVICE_PATH
Definition: text.h:106
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define OBJ_KERNEL_HANDLE
Definition: winternl.h:231
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
_In_ NDIS_STATUS _In_ ULONG _In_ USHORT _In_opt_ PVOID _In_ ULONG DataSize
Definition: ndis.h:4751
static NTSTATUS DuplicateUnicodeString(PUNICODE_STRING Source, PUNICODE_STRING Destination)
Definition: freetype.c:881
LONGLONG QuadPart
Definition: typedefs.h:112
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14
#define REG_SZ
Definition: layer.c:22

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

◆ IntGdiCleanupPrivateFontsForProcess()

VOID FASTCALL IntGdiCleanupPrivateFontsForProcess ( VOID  )

Definition at line 2052 of file freetype.c.

2053 {
2056  PFONT_ENTRY_COLL_MEM EntryCollection;
2057 
2058  DPRINT("IntGdiCleanupPrivateFontsForProcess()\n");
2059  do {
2060  Entry = NULL;
2061  EntryCollection = NULL;
2062 
2063  IntLockProcessPrivateFonts(Win32Process);
2064  if (!IsListEmpty(&Win32Process->PrivateMemFontListHead))
2065  {
2066  Entry = Win32Process->PrivateMemFontListHead.Flink;
2067  EntryCollection = CONTAINING_RECORD(Entry, FONT_ENTRY_COLL_MEM, ListEntry);
2068  UnlinkFontMemCollection(EntryCollection);
2069  }
2070  IntUnLockProcessPrivateFonts(Win32Process);
2071 
2072  if (EntryCollection)
2073  {
2074  IntGdiCleanupMemEntry(EntryCollection->Entry);
2075  ExFreePoolWithTag(EntryCollection, TAG_FONT);
2076  }
2077  else
2078  {
2079  /* No Mem fonts anymore, see if we have any other private fonts left */
2080  Entry = NULL;
2081  IntLockProcessPrivateFonts(Win32Process);
2082  if (!IsListEmpty(&Win32Process->PrivateFontListHead))
2083  {
2084  Entry = RemoveHeadList(&Win32Process->PrivateFontListHead);
2085  }
2086  IntUnLockProcessPrivateFonts(Win32Process);
2087 
2088  if (Entry)
2089  {
2091  }
2092  }
2093 
2094  } while (Entry);
2095 }
#define IntUnLockProcessPrivateFonts(W32Process)
Definition: text.h:150
struct _Entry Entry
Definition: kefuncs.h:640
#define TAG_FONT
Definition: tags.h:12
VOID FASTCALL IntGdiCleanupMemEntry(PFONT_ENTRY_MEM Head)
Definition: freetype.c:1982
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
FONT_ENTRY_MEM * Entry
Definition: font.h:23
smooth NULL
Definition: ftsmooth.c:416
FORCEINLINE PLIST_ENTRY RemoveHeadList(_Inout_ PLIST_ENTRY ListHead)
Definition: rtlfuncs.h:128
void DPRINT(...)
Definition: polytest.cpp:61
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
LIST_ENTRY PrivateMemFontListHead
Definition: win32.h:277
Definition: typedefs.h:117
static VOID FASTCALL UnlinkFontMemCollection(PFONT_ENTRY_COLL_MEM Collection)
Definition: freetype.c:2001
Definition: font.h:19
PVOID NTAPI PsGetCurrentProcessWin32Process(VOID)
Definition: process.c:1183
static __inline VOID FASTCALL CleanupFontEntry(PFONT_ENTRY FontEntry)
Definition: freetype.c:362
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
base of all file and directory entries
Definition: entries.h:82
#define IntLockProcessPrivateFonts(W32Process)
Definition: text.h:147
LIST_ENTRY PrivateFontListHead
Definition: win32.h:276

Referenced by GdiProcessDestroy().

◆ IntGdiGetFontResourceInfo()

BOOL FASTCALL IntGdiGetFontResourceInfo ( PUNICODE_STRING  ,
PVOID  ,
DWORD ,
DWORD   
)

Definition at line 5467 of file freetype.c.

5472 {
5473  UNICODE_STRING EntryFileName;
5474  POBJECT_NAME_INFORMATION NameInfo1 = NULL, NameInfo2 = NULL;
5475  PLIST_ENTRY ListEntry;
5476  PFONT_ENTRY FontEntry;
5477  ULONG Size, i, Count;
5478  LPBYTE pbBuffer;
5479  BOOL IsEqual;
5480  FONTFAMILYINFO *FamInfo;
5481  const ULONG MaxFamInfo = 64;
5482  const ULONG MAX_FAM_INFO_BYTES = sizeof(FONTFAMILYINFO) * MaxFamInfo;
5483  BOOL bSuccess;
5484  const ULONG NAMEINFO_SIZE = sizeof(OBJECT_NAME_INFORMATION) + MAX_PATH * sizeof(WCHAR);
5485 
5486  DPRINT("IntGdiGetFontResourceInfo: dwType == %lu\n", dwType);
5487 
5488  do
5489  {
5490  /* Create buffer for full path name */
5491  NameInfo1 = ExAllocatePoolWithTag(PagedPool, NAMEINFO_SIZE, TAG_FINF);
5492  if (!NameInfo1)
5493  break;
5494 
5495  /* Get the full path name */
5496  if (!IntGetFullFileName(NameInfo1, NAMEINFO_SIZE, FileName))
5497  break;
5498 
5499  /* Create a buffer for the entries' names */
5500  NameInfo2 = ExAllocatePoolWithTag(PagedPool, NAMEINFO_SIZE, TAG_FINF);
5501  if (!NameInfo2)
5502  break;
5503 
5504  FamInfo = ExAllocatePoolWithTag(PagedPool, MAX_FAM_INFO_BYTES, TAG_FINF);
5505  } while (0);
5506 
5507  if (!NameInfo1 || !NameInfo2 || !FamInfo)
5508  {
5509  if (NameInfo2)
5510  ExFreePoolWithTag(NameInfo2, TAG_FINF);
5511 
5512  if (NameInfo1)
5513  ExFreePoolWithTag(NameInfo1, TAG_FINF);
5514 
5516  return FALSE;
5517  }
5518 
5519  Count = 0;
5520 
5521  /* Try to find the pathname in the global font list */
5523  for (ListEntry = g_FontListHead.Flink; ListEntry != &g_FontListHead;
5524  ListEntry = ListEntry->Flink)
5525  {
5526  FontEntry = CONTAINING_RECORD(ListEntry, FONT_ENTRY, ListEntry);
5527  if (FontEntry->Font->Filename == NULL)
5528  continue;
5529 
5530  RtlInitUnicodeString(&EntryFileName , FontEntry->Font->Filename);
5531  if (!IntGetFullFileName(NameInfo2, NAMEINFO_SIZE, &EntryFileName))
5532  continue;
5533 
5534  if (!RtlEqualUnicodeString(&NameInfo1->Name, &NameInfo2->Name, FALSE))
5535  continue;
5536 
5537  IsEqual = FALSE;
5538  FontFamilyFillInfo(&FamInfo[Count], FontEntry->FaceName.Buffer,
5539  NULL, FontEntry->Font);
5540  for (i = 0; i < Count; ++i)
5541  {
5542  if (EqualFamilyInfo(&FamInfo[i], &FamInfo[Count]))
5543  {
5544  IsEqual = TRUE;
5545  break;
5546  }
5547  }
5548  if (!IsEqual)
5549  {
5550  /* Found */
5551  ++Count;
5552  if (Count >= MaxFamInfo)
5553  break;
5554  }
5555  }
5557 
5558  /* Free the buffers */
5559  ExFreePoolWithTag(NameInfo1, TAG_FINF);
5560  ExFreePoolWithTag(NameInfo2, TAG_FINF);
5561 
5562  if (Count == 0 && dwType != 5)
5563  {
5564  /* Font could not be found in system table
5565  dwType == 5 will still handle this */
5566  ExFreePoolWithTag(FamInfo, TAG_FINF);
5567  return FALSE;
5568  }
5569 
5570  bSuccess = FALSE;
5571  switch (dwType)
5572  {
5573  case 0: /* FIXME: Returns 1 or 2, don't know what this is atm */
5574  Size = sizeof(DWORD);
5575  if (*pdwBytes == 0)
5576  {
5577  *pdwBytes = Size;
5578  bSuccess = TRUE;
5579  }
5580  else if (pBuffer)
5581  {
5582  if (*pdwBytes >= Size)
5583  {
5584  *(DWORD*)pBuffer = Count;
5585  }
5586  *pdwBytes = Size;
5587  bSuccess = TRUE;
5588  }
5589  break;
5590 
5591  case 1: /* copy the font title */
5592  /* calculate the required size */
5593  Size = 0;
5594  for (i = 0; i < Count; ++i)
5595  {
5596  if (i > 0)
5597  Size += 3; /* " & " */
5598  Size += wcslen(FamInfo[i].EnumLogFontEx.elfLogFont.lfFaceName);
5599  if (FamInfo[i].EnumLogFontEx.elfStyle[0] &&
5600  _wcsicmp(FamInfo[i].EnumLogFontEx.elfStyle, L"Regular") != 0)
5601  {
5602  Size += 1 + wcslen(FamInfo[i].EnumLogFontEx.elfStyle);
5603  }
5604  }
5605  Size += 2; /* "\0\0" */
5606  Size *= sizeof(WCHAR);
5607 
5608  if (*pdwBytes == 0)
5609  {
5610  *pdwBytes = Size;
5611  bSuccess = TRUE;
5612  }
5613  else if (pBuffer)
5614  {
5615  if (*pdwBytes >= Size)
5616  {
5617  /* store font title to buffer */
5618  WCHAR *psz = pBuffer;
5619  *psz = 0;
5620  for (i = 0; i < Count; ++i)
5621  {
5622  if (i > 0)
5623  wcscat(psz, L" & ");
5624  IntAddNameFromFamInfo(psz, &FamInfo[i]);
5625  }
5626  psz[wcslen(psz) + 1] = UNICODE_NULL;
5627  *pdwBytes = Size;
5628  bSuccess = TRUE;
5629  }
5630  else
5631  {
5632  *pdwBytes = 1024; /* this is confirmed value */
5633  }
5634  }
5635  break;
5636 
5637  case 2: /* Copy an array of LOGFONTW */
5638  Size = Count * sizeof(LOGFONTW);
5639  if (*pdwBytes == 0)
5640  {
5641  *pdwBytes = Size;
5642  bSuccess = TRUE;
5643  }
5644  else if (pBuffer)
5645  {
5646  if (*pdwBytes >= Size)
5647  {
5648  pbBuffer = (LPBYTE)pBuffer;
5649  for (i = 0; i < Count; ++i)
5650  {
5651  FamInfo[i].EnumLogFontEx.elfLogFont.lfWidth = 0;
5652  RtlCopyMemory(pbBuffer, &FamInfo[i].EnumLogFontEx.elfLogFont, sizeof(LOGFONTW));
5653  pbBuffer += sizeof(LOGFONTW);
5654  }
5655  }
5656  *pdwBytes = Size;
5657  bSuccess = TRUE;
5658  }
5659  else
5660  {
5661  *pdwBytes = 1024; /* this is confirmed value */
5662  }
5663  break;
5664 
5665  case 3:
5666  Size = sizeof(DWORD);
5667  if (*pdwBytes == 0)
5668  {
5669  *pdwBytes = Size;
5670  bSuccess = TRUE;
5671  }
5672  else if (pBuffer)
5673  {
5674  if (*pdwBytes >= Size)
5675  {
5676  /* FIXME: What exactly is copied here? */
5677  *(DWORD*)pBuffer = 1;
5678  }
5679  *pdwBytes = Size;
5680  bSuccess = TRUE;
5681  }
5682  break;
5683 
5684  case 4: /* full file path */
5685  if (FileName->Length >= 4 * sizeof(WCHAR))
5686  {
5687  /* The beginning of FileName is \??\ */
5688  LPWSTR pch = FileName->Buffer + 4;
5689  DWORD Length = FileName->Length - 4 * sizeof(WCHAR);
5690 
5691  Size = Length + sizeof(WCHAR);
5692  if (*pdwBytes == 0)
5693  {
5694  *pdwBytes = Size;
5695  bSuccess = TRUE;
5696  }
5697  else if (pBuffer)
5698  {
5699  if (*pdwBytes >= Size)
5700  {
5702  }
5703  *pdwBytes = Size;
5704  bSuccess = TRUE;
5705  }
5706  }
5707  break;
5708 
5709  case 5: /* Looks like a BOOL that is copied, TRUE, if the font was not found */
5710  Size = sizeof(BOOL);
5711  if (*pdwBytes == 0)
5712  {
5713  *pdwBytes = Size;
5714  bSuccess = TRUE;
5715  }
5716  else if (pBuffer)
5717  {
5718  if (*pdwBytes >= Size)
5719  {
5720  *(BOOL*)pBuffer = Count == 0;
5721  }
5722  *pdwBytes = Size;
5723  bSuccess = TRUE;
5724  }
5725  break;
5726  }
5727  ExFreePoolWithTag(FamInfo, TAG_FINF);
5728 
5729  return bSuccess;
5730 }
static LIST_ENTRY g_FontListHead
Definition: freetype.c:66
#define TAG_FINF
Definition: text.h:3
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
static BOOL EqualFamilyInfo(const FONTFAMILYINFO *pInfo1, const FONTFAMILYINFO *pInfo2)
Definition: freetype.c:5433
UNICODE_STRING FaceName
Definition: font.h:8
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1015
UNICODE_STRING Name
Definition: nt_native.h:1270
static BOOL FASTCALL IntGetFullFileName(POBJECT_NAME_INFORMATION NameInfo, ULONG Size, PUNICODE_STRING FileName)
Definition: freetype.c:5390
#define BOOL
Definition: nt_native.h:43
#define DWORD
Definition: nt_native.h:44
static BOOLEAN bSuccess
Definition: drive.cpp:419
#define IntUnLockGlobalFonts()
Definition: freetype.c:73
#define pch(ap)
Definition: match.c:418
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
unsigned char * LPBYTE
Definition: typedefs.h:52
#define UNICODE_NULL
unsigned int BOOL
Definition: ntddk_ex.h:94
LPWSTR Filename
Definition: engobjects.h:148
struct _OBJECT_NAME_INFORMATION OBJECT_NAME_INFORMATION
LONG lfWidth
Definition: dimm.idl:60
smooth NULL
Definition: ftsmooth.c:416
PVOID pBuffer
static VOID IntAddNameFromFamInfo(LPWSTR psz, FONTFAMILYINFO *FamInfo)
Definition: freetype.c:5454
void DPRINT(...)
Definition: polytest.cpp:61
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
Definition: font.h:4
static void FASTCALL FontFamilyFillInfo(PFONTFAMILYINFO Info, LPCWSTR FaceName, LPCWSTR FullName, PFONTGDI FontGDI)
Definition: freetype.c:2903
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
__wchar_t WCHAR
Definition: xmlstorage.h:180
struct tagLOGFONTW LOGFONTW
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
static PWSTR PDWORD pdwBytes
Definition: layerapi.c:35
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
static const WCHAR L[]
Definition: oid.c:1250
Definition: typedefs.h:117
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
#define IntLockGlobalFonts()
Definition: freetype.c:70
ENUMLOGFONTEXW EnumLogFontEx
Definition: ntgdibad.h:47
FONTGDI * Font
Definition: font.h:7
struct tagFONTFAMILYINFO FONTFAMILYINFO
_CRTIMP wchar_t *__cdecl wcscat(_Inout_updates_z_(_String_length_(_Dest)+_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
LOGFONTW elfLogFont
Definition: wingdi.h:2701
unsigned int ULONG
Definition: retypes.h:1
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
WCHAR * LPWSTR
Definition: xmlstorage.h:184
NTSYSAPI BOOLEAN NTAPI RtlEqualUnicodeString(PUNICODE_STRING String1, PUNICODE_STRING String2, BOOLEAN CaseInSensitive)
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)

Referenced by NtGdiGetFontResourceInfoInternalW().

◆ IntGdiRemoveFontMemResource()

BOOL FASTCALL IntGdiRemoveFontMemResource ( HANDLE  hMMFont)

Definition at line 2018 of file freetype.c.

2019 {
2021  PFONT_ENTRY_COLL_MEM CurrentEntry;
2022  PFONT_ENTRY_COLL_MEM EntryCollection = NULL;
2024 
2025  IntLockProcessPrivateFonts(Win32Process);
2026  for (Entry = Win32Process->PrivateMemFontListHead.Flink;
2027  Entry != &Win32Process->PrivateMemFontListHead;
2028  Entry = Entry->Flink)
2029  {
2030  CurrentEntry = CONTAINING_RECORD(Entry, FONT_ENTRY_COLL_MEM, ListEntry);
2031 
2032  if (CurrentEntry->Handle == hMMFont)
2033  {
2034  EntryCollection = CurrentEntry;
2035  UnlinkFontMemCollection(CurrentEntry);
2036  break;
2037  }
2038  }
2039  IntUnLockProcessPrivateFonts(Win32Process);
2040 
2041  if (EntryCollection)
2042  {
2043  IntGdiCleanupMemEntry(EntryCollection->Entry);
2044  ExFreePoolWithTag(EntryCollection, TAG_FONT);
2045  return TRUE;
2046  }
2047  return FALSE;
2048 }
#define TRUE
Definition: types.h:120
#define IntUnLockProcessPrivateFonts(W32Process)
Definition: text.h:150
struct _Entry Entry
Definition: kefuncs.h:640
#define TAG_FONT
Definition: tags.h:12
VOID FASTCALL IntGdiCleanupMemEntry(PFONT_ENTRY_MEM Head)
Definition: freetype.c:1982
FONT_ENTRY_MEM * Entry
Definition: font.h:23
smooth NULL
Definition: ftsmooth.c:416
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
HANDLE Handle
Definition: font.h:22
LIST_ENTRY PrivateMemFontListHead
Definition: win32.h:277
Definition: typedefs.h:117
static VOID FASTCALL UnlinkFontMemCollection(PFONT_ENTRY_COLL_MEM Collection)
Definition: freetype.c:2001
Definition: font.h:19
PVOID NTAPI PsGetCurrentProcessWin32Process(VOID)
Definition: process.c:1183
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
base of all file and directory entries
Definition: entries.h:82
#define IntLockProcessPrivateFonts(W32Process)
Definition: text.h:147

Referenced by NtGdiRemoveFontMemResourceEx().

◆ IntGetCharDimensions()

DWORD FASTCALL IntGetCharDimensions ( HDC  ,
PTEXTMETRICW  ,
PDWORD   
)

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 }
TEXTMETRICW TextMetric
Definition: ntgdityp.h:369
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
FORCEINLINE VOID TEXTOBJ_UnlockText(PLFONT plfnt)
Definition: text.h:96
Definition: text.h:59
unsigned int BOOL
Definition: ntddk_ex.h:94
HANDLE hlfntNew
Definition: ntgdihdl.h:334
smooth NULL
Definition: ftsmooth.c:416
LONG cx
Definition: windef.h:334
Definition: polytest.cpp:40
__wchar_t WCHAR
Definition: xmlstorage.h:180
HDC hdc
Definition: main.c:9
BOOL FASTCALL ftGdiGetTextMetricsW(HDC hDC, PTMW_INTERNAL ptmwi)
Definition: freetype.c:4641
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
PTEXTOBJ FASTCALL RealizeFontInit(HFONT hFont)
Definition: font.c:422
LONG tmHeight
Definition: wingdi.h:2382
BOOL FASTCALL TextIntGetTextExtentPoint(PDC dc, PTEXTOBJ TextObj, LPCWSTR String, INT Count, ULONG MaxExtent, LPINT Fit, LPINT Dx, LPSIZE Size, FLONG fl)
Definition: freetype.c:4317

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

◆ IntGetFontLanguageInfo()

DWORD FASTCALL IntGetFontLanguageInfo ( PDC  )

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 )
390  result|=GCP_DBCS;
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 }
#define FLI_GLYPHS
Definition: wingdi.h:845
#define GCP_DIACRITIC
Definition: wingdi.h:830
#define GCP_LIGATE
Definition: wingdi.h:836
#define GCP_KASHIDA
Definition: wingdi.h:835
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD fsCsb[2]
Definition: wingdi.h:1542
#define GCP_GLYPHSHAPE
Definition: wingdi.h:832
FLONG flTextAlign
Definition: ntgdihdl.h:328
#define GCP_REORDER
Definition: wingdi.h:842
#define GCP_DBCS
Definition: wingdi.h:827
#define TA_RTLREADING
Definition: wingdi.h:933
INT FASTCALL ftGdiGetTextCharsetInfo(PDC Dc, LPFONTSIGNATURE lpSig, DWORD dwFlags)
Definition: freetype.c:4460
GLuint64EXT * result
Definition: glext.h:11304
#define GCP_USEKERNING
Definition: wingdi.h:844

Referenced by NtGdiGetDCDword().

◆ IntGetOutlineTextMetrics()

INT FASTCALL IntGetOutlineTextMetrics ( PFONTGDI  ,
UINT  ,
OUTLINETEXTMETRICW  
)

Definition at line 2538 of file freetype.c.

2541 {
2542  TT_OS2 *pOS2;
2543  TT_HoriHeader *pHori;
2544  TT_Postscript *pPost;
2545  FT_Fixed XScale, YScale;
2546  FT_WinFNT_HeaderRec WinFNT;
2547  FT_Error Error;
2548  BYTE *pb;
2549  FONT_NAMES FontNames;
2550  PSHARED_FACE SharedFace = FontGDI->SharedFace;
2552  FT_Face Face = SharedFace->Face;
2553 
2555  {
2556  Cache = &SharedFace->EnglishUS;
2557  }
2558  else
2559  {
2560  Cache = &SharedFace->UserLanguage;
2561  }
2562 
2563  if (Size == 0 && Cache->OutlineRequiredSize > 0)
2564  {
2565  ASSERT(Otm == NULL);
2566  return Cache->OutlineRequiredSize;
2567  }
2568 
2569  IntInitFontNames(&FontNames, SharedFace);
2570  Cache->OutlineRequiredSize = FontNames.OtmSize;
2571 
2572  if (Size == 0)
2573  {
2574  ASSERT(Otm == NULL);
2575  IntFreeFontNames(&FontNames);
2576  return Cache->OutlineRequiredSize;
2577  }
2578 
2579  ASSERT(Otm != NULL);
2580 
2581  if (Size < Cache->OutlineRequiredSize)
2582  {
2583  DPRINT1("Size %u < OutlineRequiredSize %u\n", Size,
2584  Cache->OutlineRequiredSize);
2585  IntFreeFontNames(&FontNames);
2586  return 0; /* failure */
2587  }
2588 
2589  XScale = Face->size->metrics.x_scale;
2590  YScale = Face->size->metrics.y_scale;
2591 
2592  IntLockFreeType();
2593 
2594  pOS2 = FT_Get_Sfnt_Table(Face, FT_SFNT_OS2);
2595  pHori = FT_Get_Sfnt_Table(Face, FT_SFNT_HHEA);
2596  pPost = FT_Get_Sfnt_Table(Face, FT_SFNT_POST); /* We can live with this failing */
2597  Error = FT_Get_WinFNT_Header(Face, &WinFNT);
2598 
2599  if (pOS2 == NULL && Error)
2600  {
2602  DPRINT1("Can't find OS/2 table - not TT font?\n");
2603  IntFreeFontNames(&FontNames);
2604  return 0;
2605  }
2606 
2607  if (pHori == NULL && Error)
2608  {
2610  DPRINT1("Can't find HHEA table - not TT font?\n");
2611  IntFreeFontNames(&FontNames);
2612  return 0;
2613  }
2614 
2615  Otm->otmSize = Cache->OutlineRequiredSize;
2616 
2617  FillTM(&Otm->otmTextMetrics, FontGDI, pOS2, pHori, !Error ? &WinFNT : 0);
2618 
2619  if (!pOS2)
2620  goto skip_os2;
2621 
2622  Otm->otmFiller = 0;
2623  RtlCopyMemory(&Otm->otmPanoseNumber, pOS2->panose, PANOSE_COUNT);
2624  Otm->otmfsSelection = pOS2->fsSelection;
2625  Otm->otmfsType = pOS2->fsType;
2626  Otm->otmsCharSlopeRise = pHori->caret_Slope_Rise;
2627  Otm->otmsCharSlopeRun = pHori->caret_Slope_Run;
2628  Otm->otmItalicAngle = 0; /* POST table */
2629  Otm->otmEMSquare = Face->units_per_EM;
2630 
2631 #define SCALE_X(value) ((FT_MulFix((value), XScale) + 32) >> 6)
2632 #define SCALE_Y(value) ((FT_MulFix((value), YScale) + 32) >> 6)
2633 
2634  Otm->otmAscent = SCALE_Y(pOS2->sTypoAscender);
2635  Otm->otmDescent = SCALE_Y(pOS2->sTypoDescender);
2636  Otm->otmLineGap = SCALE_Y(pOS2->sTypoLineGap);
2637  Otm->otmsCapEmHeight = SCALE_Y(pOS2->sCapHeight);
2638  Otm->otmsXHeight = SCALE_Y(pOS2->sxHeight);
2639  Otm->otmrcFontBox.left = SCALE_X(Face->bbox.xMin);
2640  Otm->otmrcFontBox.right = SCALE_X(Face->bbox.xMax);
2641  Otm->otmrcFontBox.top = SCALE_Y(Face->bbox.yMax);
2642  Otm->otmrcFontBox.bottom = SCALE_Y(Face->bbox.yMin);
2643  Otm->otmMacAscent = Otm->otmTextMetrics.tmAscent;
2644  Otm->otmMacDescent = -Otm->otmTextMetrics.tmDescent;
2645  Otm->otmMacLineGap = Otm->otmLineGap;
2646  Otm->otmusMinimumPPEM = 0; /* TT Header */
2647  Otm->otmptSubscriptSize.x = SCALE_X(pOS2->ySubscriptXSize);
2648  Otm->otmptSubscriptSize.y = SCALE_Y(pOS2->ySubscriptYSize);
2649  Otm->otmptSubscriptOffset.x = SCALE_X(pOS2->ySubscriptXOffset);
2650  Otm->otmptSubscriptOffset.y = SCALE_Y(pOS2->ySubscriptYOffset);
2651  Otm->otmptSuperscriptSize.x = SCALE_X(pOS2->ySuperscriptXSize);
2652  Otm->otmptSuperscriptSize.y = SCALE_Y(pOS2->ySuperscriptYSize);
2653  Otm->otmptSuperscriptOffset.x = SCALE_X(pOS2->ySuperscriptXOffset);
2654  Otm->otmptSuperscriptOffset.y = SCALE_Y(pOS2->ySuperscriptYOffset);
2655  Otm->otmsStrikeoutSize = SCALE_Y(pOS2->yStrikeoutSize);
2656  Otm->otmsStrikeoutPosition = SCALE_Y(pOS2->yStrikeoutPosition);
2657 
2658  if (!pPost)
2659  {
2660  Otm->otmsUnderscoreSize = 0;
2661  Otm->otmsUnderscorePosition = 0;
2662  }
2663  else
2664  {
2665  Otm->otmsUnderscoreSize = SCALE_Y(pPost->underlineThickness);
2666  Otm->otmsUnderscorePosition = SCALE_Y(pPost->underlinePosition);
2667  }
2668 
2669 #undef SCALE_X
2670 #undef SCALE_Y
2671 
2672 skip_os2:
2674 
2675  pb = IntStoreFontNames(&FontNames, Otm);
2676  ASSERT(pb - (BYTE*)Otm == Cache->OutlineRequiredSize);
2677 
2678  IntFreeFontNames(&FontNames);
2679 
2680  return Cache->OutlineRequiredSize;
2681 }
SHARED_FACE_CACHE EnglishUS
Definition: engobjects.h:132
ULONG OtmSize
Definition: freetype.c:2461
FT_Short sxHeight
Definition: tttables.h:424
int FT_Error
Definition: fttypes.h:300
#define PANOSE_COUNT
Definition: wingdi.h:452
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
#define SCALE_X(value)
static __inline void FASTCALL IntInitFontNames(FONT_NAMES *Names, PSHARED_FACE SharedFace)
Definition: freetype.c:2465
static __inline BYTE *FASTCALL IntStoreFontNames(const FONT_NAMES *Names, OUTLINETEXTMETRICW *Otm)
Definition: freetype.c:2501
FT_Get_WinFNT_Header(FT_Face face, FT_WinFNT_HeaderRec *aheader)
Definition: ftwinfnt.c:29
FT_Size size
Definition: freetype.h:1106
Definition: fatfs.h:173
FT_Short sTypoDescender
Definition: tttables.h:412
FT_Fixed y_scale
Definition: freetype.h:1644
FT_Short ySuperscriptXOffset
Definition: tttables.h:393
FT_Short yStrikeoutPosition
Definition: tttables.h:396
FT_Short sCapHeight
Definition: tttables.h:425
FT_Short caret_Slope_Run
Definition: tttables.h:212
FT_UShort units_per_EM
Definition: freetype.h:1094
SHARED_FACE_CACHE UserLanguage
Definition: engobjects.h:133
FT_UShort fsSelection
Definition: tttables.h:408
FT_UShort fsType
Definition: tttables.h:386
static __inline void FASTCALL IntFreeFontNames(FONT_NAMES *Names)
Definition: freetype.c:2525
FT_Get_Sfnt_Table(FT_Face face, FT_Sfnt_Tag tag)
Definition: ftobjs.c:4113
#define SCALE_Y(value)
static void FASTCALL FillTM(TEXTMETRICW *TM, PFONTGDI FontGDI, TT_OS2 *pOS2, TT_HoriHeader *pHori, FT_WinFNT_HeaderRec *pFNT)
Definition: freetype.c:2237
smooth NULL
Definition: ftsmooth.c:416
FT_Pos yMax
Definition: ftimage.h:118
FT_Short ySuperscriptYSize
Definition: tttables.h:392
FT_Short caret_Slope_Rise
Definition: tttables.h:211
FT_Short yStrikeoutSize
Definition: tttables.h:395
FT_Short ySubscriptXOffset
Definition: tttables.h:389
FT_Pos xMin
Definition: ftimage.h:117
FT_Short ySubscriptXSize
Definition: tttables.h:387
FT_Pos xMax
Definition: ftimage.h:118
#define IntUnLockFreeType()
Definition: freetype.c:82
BOOL Error
Definition: chkdsk.c:66
FT_Face Face
Definition: engobjects.h:129
#define LANG_ENGLISH
Definition: nls.h:52
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
FT_Short ySuperscriptXSize
Definition: tttables.h:391
USHORT gusLanguageID
Definition: main.c:29
#define IntLockFreeType()
Definition: freetype.c:79
FT_Size_Metrics metrics
Definition: freetype.h:1677
unsigned char BYTE
Definition: mem.h:68
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
signed long FT_Fixed
Definition: fttypes.h:288
FT_Fixed x_scale
Definition: freetype.h:1643
FT_Short underlinePosition
Definition: tttables.h:459
FT_Short sTypoAscender
Definition: tttables.h:411
FT_Pos yMin
Definition: ftimage.h:117
#define DPRINT1
Definition: precomp.h:8
FT_Short ySubscriptYOffset
Definition: tttables.h:390
FT_Short sTypoLineGap
Definition: tttables.h:413
FT_Short ySubscriptYSize
Definition: tttables.h:388
FT_BBox bbox
Definition: freetype.h:1092
FT_Short underlineThickness
Definition: tttables.h:460
FT_Byte panose[10]
Definition: tttables.h:399
#define PRIMARYLANGID(l)
Definition: nls.h:16
FT_Short ySuperscriptYOffset
Definition: tttables.h:394

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

◆ IntIsFontRenderingEnabled()

BOOL FASTCALL IntIsFontRenderingEnabled ( VOID  )

Definition at line 2098 of file freetype.c.

2099 {
2100  return (gpsi->BitsPixel > 8) && g_RenderingEnabled;
2101 }
PSERVERINFO gpsi
Definition: main.c:27
static BOOL g_RenderingEnabled
Definition: freetype.c:68

Referenced by IntExtTextOutW(), and TextIntGetTextExtentPoint().

◆ IntLoadFontsInRegistry()

BOOL FASTCALL IntLoadFontsInRegistry ( VOID  )

Definition at line 1776 of file freetype.c.

1777 {
1778  NTSTATUS Status;
1779  HANDLE KeyHandle;
1781  KEY_FULL_INFORMATION KeyFullInfo;
1782  ULONG i, Length;
1783  UNICODE_STRING FontTitleW, FileNameW;
1784  SIZE_T InfoSize;
1785  LPBYTE InfoBuffer;
1787  LPWSTR pchPath;
1788  BOOLEAN Success;
1790  INT nFontCount = 0;
1791  DWORD dwFlags;
1792 
1793  /* open registry key */
1796  NULL, NULL);
1797  Status = ZwOpenKey(&KeyHandle, KEY_READ, &ObjectAttributes);
1798  if (!NT_SUCCESS(Status))
1799  {
1800  DPRINT1("ZwOpenKey failed: 0x%08X\n", Status);
1801  return FALSE; /* failure */
1802  }
1803 
1804  /* query count of values */
1805  Status = ZwQueryKey(KeyHandle, KeyFullInformation,
1806  &KeyFullInfo, sizeof(KeyFullInfo), &Length);
1807  if (!NT_SUCCESS(Status))
1808  {
1809  DPRINT1("ZwQueryKey failed: 0x%08X\n", Status);
1810  ZwClose(KeyHandle);
1811  return FALSE; /* failure */
1812  }
1813 
1814  /* allocate buffer */
1815  InfoSize = (MAX_PATH + 256) * sizeof(WCHAR);
1816  InfoBuffer = ExAllocatePoolWithTag(PagedPool, InfoSize, TAG_FONT);
1817  if (!InfoBuffer)
1818  {
1819  DPRINT1("ExAllocatePoolWithTag failed\n");
1820  ZwClose(KeyHandle);
1821  return FALSE;
1822  }
1823 
1824  /* for each value */
1825  for (i = 0; i < KeyFullInfo.Values; ++i)
1826  {
1827  /* get value name */
1828  Status = ZwEnumerateValueKey(KeyHandle, i, KeyValueFullInformation,
1829  InfoBuffer, InfoSize, &Length);
1831  {
1832  /* too short buffer */
1833  ExFreePoolWithTag(InfoBuffer, TAG_FONT);
1834  InfoSize *= 2;
1835  InfoBuffer = ExAllocatePoolWithTag(PagedPool, InfoSize, TAG_FONT);
1836  if (!InfoBuffer)
1837  {
1838  DPRINT1("ExAllocatePoolWithTag failed\n");
1839  break;
1840  }
1841  /* try again */
1842  Status = ZwEnumerateValueKey(KeyHandle, i, KeyValueFullInformation,
1843  InfoBuffer, InfoSize, &Length);
1844  }
1845  if (!NT_SUCCESS(Status))
1846  {
1847  DPRINT1("ZwEnumerateValueKey failed: 0x%08X\n", Status);
1848  break; /* failure */
1849  }
1850 
1851  /* create FontTitleW string */
1852  pInfo = (PKEY_VALUE_FULL_INFORMATION)InfoBuffer;
1853  Length = pInfo->NameLength / sizeof(WCHAR);
1854  pInfo->Name[Length] = UNICODE_NULL; /* truncate */
1855  Success = RtlCreateUnicodeString(&FontTitleW, pInfo->Name);
1856  if (!Success)
1857  {
1859  DPRINT1("RtlCreateUnicodeString failed\n");
1860  break; /* failure */
1861  }
1862 
1863  /* query value */
1864  Status = ZwQueryValueKey(KeyHandle, &FontTitleW, KeyValueFullInformation,
1865  InfoBuffer, InfoSize, &Length);
1867  {
1868  /* too short buffer */
1869  ExFreePoolWithTag(InfoBuffer, TAG_FONT);
1870  InfoSize *= 2;
1871  InfoBuffer = ExAllocatePoolWithTag(PagedPool, InfoSize, TAG_FONT);
1872  if (!InfoBuffer)
1873  {
1874  DPRINT1("ExAllocatePoolWithTag failed\n");
1875  break;
1876  }
1877  /* try again */
1878  Status = ZwQueryValueKey(KeyHandle, &FontTitleW, KeyValueFullInformation,
1879  InfoBuffer, InfoSize, &Length);
1880  }
1881  pInfo = (PKEY_VALUE_FULL_INFORMATION)InfoBuffer;
1882  if (!NT_SUCCESS(Status) || !pInfo->DataLength)
1883  {
1884  DPRINT1("ZwQueryValueKey failed: 0x%08X\n", Status);
1885  RtlFreeUnicodeString(&FontTitleW);
1886  break; /* failure */
1887  }
1888 
1889  /* Build pchPath */
1890  pchPath = (LPWSTR)((PUCHAR)pInfo + pInfo->DataOffset);
1891  Length = pInfo->DataLength / sizeof(WCHAR);
1892  pchPath[Length] = UNICODE_NULL; /* truncate */
1893 
1894  /* Load font(s) without writing registry */
1895  if (PathIsRelativeW(pchPath))
1896  {
1897  dwFlags = 0;
1899  L"\\SystemRoot\\Fonts\\%s", pchPath);
1900  }
1901  else
1902  {
1904  Status = RtlStringCbCopyW(szPath, sizeof(szPath), pchPath);
1905  }
1906 
1907  if (NT_SUCCESS(Status))
1908  {
1909  RtlCreateUnicodeString(&FileNameW, szPath);
1910  nFontCount += IntGdiAddFontResourceEx(&FileNameW, 0, dwFlags);
1911  RtlFreeUnicodeString(&FileNameW);
1912  }
1913 
1914  RtlFreeUnicodeString(&FontTitleW);
1915  }
1916 
1917  /* close now */
1918  ZwClose(KeyHandle);
1919 
1920  /* free memory block */
1921  if (InfoBuffer)
1922  {
1923  ExFreePoolWithTag(InfoBuffer, TAG_FONT);
1924  }
1925 
1926  return (KeyFullInfo.Values != 0 && nFontCount != 0);
1927 }
NTSTRSAFEAPI RtlStringCbCopyW(_Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest, _In_ size_t cbDest, _In_ NTSTRSAFE_PCWSTR pszSrc)
Definition: ntstrsafe.h:174
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
Definition: ndis.h:4711
#define KEY_READ
Definition: nt_native.h:1023
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
unsigned char * PUCHAR
Definition: retypes.h:3
LONG NTSTATUS
Definition: precomp.h:26
#define TAG_FONT
Definition: tags.h:12
int32_t INT
Definition: typedefs.h:56
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
BOOL WINAPI PathIsRelativeW(LPCWSTR lpszPath)
Definition: freetype.c:1766
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
unsigned char * LPBYTE
Definition: typedefs.h:52
#define AFRX_ALTERNATIVE_PATH
Definition: text.h:105
#define UNICODE_NULL
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
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 MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
static const WCHAR L[]
Definition: oid.c:1250
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
Status
Definition: gdiplustypes.h:24
ULONG_PTR SIZE_T
Definition: typedefs.h:78
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
LPCWSTR szPath
Definition: env.c:35
#define DPRINT1
Definition: precomp.h:8
static UNICODE_STRING g_FontRegPath
Definition: freetype.c:58
unsigned int ULONG
Definition: retypes.h:1
INT FASTCALL IntGdiAddFontResourceEx(PUNICODE_STRING FileName, DWORD Characteristics, DWORD dwFlags)
Definition: freetype.c:1561
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
#define AFRX_DOS_DEVICE_PATH
Definition: text.h:106
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define OBJ_KERNEL_HANDLE
Definition: winternl.h:231
struct _KEY_VALUE_FULL_INFORMATION * PKEY_VALUE_FULL_INFORMATION

Referenced by InitFontSupport().

◆ IntLoadSystemFonts()

VOID FASTCALL IntLoadSystemFonts ( VOID  )

Definition at line 943 of file freetype.c.

944 {
946  UNICODE_STRING Directory, FileName, TempString;
948  HANDLE hDirectory;
949  BYTE *DirInfoBuffer;
951  BOOLEAN bRestartScan = TRUE;
953  INT i;
954  static UNICODE_STRING SearchPatterns[] =
955  {
956  RTL_CONSTANT_STRING(L"*.ttf"),
957  RTL_CONSTANT_STRING(L"*.ttc"),
958  RTL_CONSTANT_STRING(L"*.otf"),
959  RTL_CONSTANT_STRING(L"*.otc"),
960  RTL_CONSTANT_STRING(L"*.fon"),
961  RTL_CONSTANT_STRING(L"*.fnt")
962  };
963 
964  RtlInitUnicodeString(&Directory, L"\\SystemRoot\\Fonts\\");
965 
968  &Directory,
970  NULL,
971  NULL);
972 
973  Status = ZwOpenFile(
974  &hDirectory,
977  &Iosb,
980 
981  if (NT_SUCCESS(Status))
982  {
983  for (i = 0; i < _countof(SearchPatterns); ++i)
984  {
985  DirInfoBuffer = ExAllocatePoolWithTag(PagedPool, 0x4000, TAG_FONT);
986  if (DirInfoBuffer == NULL)
987  {
988  ZwClose(hDirectory);
989  return;
990  }
991 
993  if (FileName.Buffer == NULL)
994  {
995  ExFreePoolWithTag(DirInfoBuffer, TAG_FONT);
996  ZwClose(hDirectory);
997  return;
998  }
999  FileName.Length = 0;
1000  FileName.MaximumLength = MAX_PATH * sizeof(WCHAR);
1001 
1002  while (1)
1003  {
1004  Status = ZwQueryDirectoryFile(
1005  hDirectory,
1006  NULL,
1007  NULL,
1008  NULL,
1009  &Iosb,
1010  DirInfoBuffer,
1011  0x4000,
1013  FALSE,
1014  &SearchPatterns[i],
1015  bRestartScan);
1016 
1018  {
1019  break;
1020  }
1021 
1022  DirInfo = (PFILE_DIRECTORY_INFORMATION)DirInfoBuffer;
1023  while (1)
1024  {
1025  TempString.Buffer = DirInfo->FileName;
1026  TempString.Length =
1027  TempString.MaximumLength = DirInfo->FileNameLength;
1031  if (DirInfo->NextEntryOffset == 0)
1032  break;
1033  DirInfo = (PFILE_DIRECTORY_INFORMATION)((ULONG_PTR)DirInfo + DirInfo->NextEntryOffset);
1034  }
1035 
1036  bRestartScan = FALSE;
1037  }
1038 
1040  ExFreePoolWithTag(DirInfoBuffer, TAG_FONT);
1041  }
1042  ZwClose(hDirectory);
1043  }
1044 }
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
#define TRUE
Definition: types.h:120
USHORT MaximumLength
Definition: env_spec_w32.h:370
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
#define FILE_DIRECTORY_FILE
Definition: constants.h:491
#define _countof(array)
Definition: fontsub.cpp:30
LONG NTSTATUS
Definition: precomp.h:26
struct _FILE_DIRECTORY_INFORMATION * PFILE_DIRECTORY_INFORMATION
#define TAG_FONT
Definition: tags.h:12
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
int32_t INT
Definition: typedefs.h:56
#define FILE_SHARE_READ
Definition: compat.h:125
NTSYSAPI VOID NTAPI RtlCopyUnicodeString(PUNICODE_STRING DestinationString, PUNICODE_STRING SourceString)
uint32_t ULONG_PTR
Definition: typedefs.h:63
#define AFRX_WRITE_REGISTRY
Definition: text.h:104
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
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
#define FILE_LIST_DIRECTORY
Definition: nt_native.h:629
__wchar_t WCHAR
Definition: xmlstorage.h:180
return Iosb
Definition: create.c:4426
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_NO_MORE_FILES
Definition: udferr_usr.h:128
#define MAX_PATH
Definition: compat.h:26
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
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)
#define FILE_SHARE_DELETE
Definition: nt_native.h:682
static const WCHAR L[]
Definition: oid.c:1250
unsigned char BYTE
Definition: mem.h:68
#define SYNCHRONIZE
Definition: nt_native.h:61
Status
Definition: gdiplustypes.h:24
struct _FileName FileName
Definition: fatprocs.h:884
NTSYSAPI NTSTATUS NTAPI RtlAppendUnicodeStringToString(PUNICODE_STRING Destination, PUNICODE_STRING Source)
#define FILE_SYNCHRONOUS_IO_NONALERT
Definition: from_kernel.h:31
base for all directory entries
Definition: entries.h:138
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
INT FASTCALL IntGdiAddFontResourceEx(PUNICODE_STRING FileName, DWORD Characteristics, DWORD dwFlags)
Definition: freetype.c:1561
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
_In_ BOOLEAN _In_ USHORT Directory
Definition: rtlfuncs.h:3765
WCHAR FileName[ANYSIZE_ARRAY]
Definition: winternl.h:524
#define OBJ_KERNEL_HANDLE
Definition: winternl.h:231
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14

Referenced by InitFontSupport().

◆ RealizeFontInit()

PTEXTOBJ FASTCALL RealizeFontInit ( HFONT  )

Definition at line 422 of file font.c.

423 {
425  PTEXTOBJ pTextObj;
426 
427  pTextObj = TEXTOBJ_LockText(hFont);
428 
429  if ( pTextObj && !(pTextObj->fl & TEXTOBJECT_INIT))
430  {
431  Status = TextIntRealizeFont(hFont, pTextObj);
432  if (!NT_SUCCESS(Status))
433  {
434  TEXTOBJ_UnlockText(pTextObj);
435  return NULL;
436  }
437  }
438  return pTextObj;
439 }
FORCEINLINE VOID TEXTOBJ_UnlockText(PLFONT plfnt)
Definition: text.h:96
LONG NTSTATUS
Definition: precomp.h:26
FORCEINLINE PTEXTOBJ TEXTOBJ_LockText(HFONT hfont)
Definition: text.h:83
#define TEXTOBJECT_INIT
Definition: text.h:56
HFONT hFont
Definition: main.c:53
NTSTATUS FASTCALL TextIntRealizeFont(HFONT FontHandle, PTEXTOBJ pTextObj)
Definition: freetype.c:5276
Definition: text.h:59
FLONG fl
Definition: text.h:65
smooth NULL
Definition: ftsmooth.c:416
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Status
Definition: gdiplustypes.h:24
return STATUS_SUCCESS
Definition: btrfs.c:2938

Referenced by ftGdiGetGlyphOutline(), ftGdiGetTextCharsetInfo(), ftGdiGetTextMetricsW(), GreGetKerningPairs(), GreGetTextExtentExW(), GreGetTextExtentW(), IntExtTextOutW(), IntGetCharDimensions(), NtGdiGetCharABCWidthsW(), NtGdiGetCharWidthW(), NtGdiGetFontData(), NtGdiGetFontUnicodeRanges(), NtGdiGetGlyphIndicesW(), NtGdiGetKerningPairs(), NtGdiGetOutlineTextMetricsInternalW(), NtGdiGetRealizationInfo(), NtGdiGetTextExtentExW(), and NtGdiGetTextFaceW().

◆ TextIntCreateFontIndirect()

NTSTATUS FASTCALL TextIntCreateFontIndirect ( CONST LPLOGFONTW  lf,
HFONT NewFont 
)

Definition at line 2132 of file freetype.c.

2133 {
2134  PLFONT plfont;
2135  LOGFONTW *plf;
2136 
2137  ASSERT(lf);
2138  plfont = LFONT_AllocFontWithHandle();
2139  if (!plfont)
2140  {
2141  return STATUS_NO_MEMORY;
2142  }
2143 
2144  ExInitializePushLock(&plfont->lock);
2145  *NewFont = plfont->BaseObject.hHmgr;
2146  plf = &plfont->logfont.elfEnumLogfontEx.elfLogFont;
2147  RtlCopyMemory(plf, lf, sizeof(LOGFONTW));
2148  if (lf->lfEscapement != lf->lfOrientation)
2149  {
2150  /* This should really depend on whether GM_ADVANCED is set */
2151  plf->lfOrientation = plf->lfEscapement;
2152  }
2153  LFONT_UnlockFont(plfont);
2154 
2155  return STATUS_SUCCESS;
2156 }
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
#define LFONT_AllocFontWithHandle()
Definition: text.h:76
LONG lfEscapement
Definition: dimm.idl:61
#define LFONT_UnlockFont(plfnt)
Definition: text.h:79
Definition: text.h:59
LONG lfOrientation
Definition: dimm.idl:62
HGDIOBJ hHmgr(VOID)
Definition: baseobj.hpp:95
#define ExInitializePushLock
Definition: ex.h:999
BASEOBJECT BaseObject
Definition: text.h:63
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
ENUMLOGFONTEXDVW logfont
Definition: text.h:70
EX_PUSH_LOCK lock
Definition: text.h:71
#define STATUS_NO_MEMORY
Definition: ntstatus.h:246
LOGFONTW elfLogFont
Definition: wingdi.h:2701
ENUMLOGFONTEXW elfEnumLogfontEx
Definition: wingdi.h:2778
return STATUS_SUCCESS
Definition: btrfs.c:2938

Referenced by CreateStockFonts(), and UserDrawCaptionText().

◆ TextIntGetTextExtentPoint()

BOOL FASTCALL TextIntGetTextExtentPoint ( PDC  ,
PTEXTOBJ  ,
LPCWSTR  ,
INT  ,
ULONG  ,
LPINT  ,
LPINT  ,
LPSIZE  ,
FLONG   
)

Definition at line 4317 of file freetype.c.

4326 {
4327  PFONTGDI FontGDI;
4328  FT_Face face;
4329  FT_GlyphSlot glyph;
4330  FT_BitmapGlyph realglyph;
4331  INT error, glyph_index, i, previous;
4332  ULONGLONG TotalWidth64 = 0;
4333  BOOL use_kerning;
4334  FT_Render_Mode RenderMode;
4335  BOOLEAN Render;
4336  PMATRIX pmxWorldToDevice;
4337  LOGFONTW *plf;
4338  BOOL EmuBold, EmuItalic;
4339  LONG ascender, descender;
4340 
4341  FontGDI = ObjToGDI(TextObj->Font, FONT);
4342 
4343  face = FontGDI->SharedFace->Face;
4344  if (NULL != Fit)
4345  {
4346  *Fit = 0;
4347  }
4348 
4349  IntLockFreeType();
4350 
4351  TextIntUpdateSize(dc, TextObj, FontGDI, FALSE);
4352 
4353  plf = &TextObj->logfont.elfEnumLogfontEx.elfLogFont;
4354  EmuBold = EMUBOLD_NEEDED(FontGDI->OriginalWeight, plf->lfWeight);
4355  EmuItalic = (plf->lfItalic && !FontGDI->OriginalItalic);
4356 
4357  Render = IntIsFontRenderingEnabled();
4358  if (Render)
4359  RenderMode = IntGetFontRenderMode(plf);
4360  else
4361  RenderMode = FT_RENDER_MODE_MONO;
4362 
4363  /* Get the DC's world-to-device transformation matrix */
4364  pmxWorldToDevice = DC_pmxWorldToDevice(dc);
4365  FtSetCoordinateTransform(face, pmxWorldToDevice);
4366 
4367  use_kerning = FT_HAS_KERNING(face);
4368  previous = 0;
4369 
4370  for (i = 0; i < Count; i++)
4371  {
4372  glyph_index = get_glyph_index_flagged(face, *String, GTEF_INDICES, fl);
4373 
4374  if (EmuBold || EmuItalic)
4375  realglyph = NULL;
4376  else
4377  realglyph = ftGdiGlyphCacheGet(face, glyph_index, plf->lfHeight,
4378  RenderMode, pmxWorldToDevice);
4379 
4380  if (EmuBold || EmuItalic || !realglyph)
4381  {
4382  if (EmuItalic)
4383  error = FT_Load_Glyph(face, glyph_index, FT_LOAD_NO_BITMAP);
4384  else
4385  error = FT_Load_Glyph(face, glyph_index, FT_LOAD_DEFAULT);
4386  if (error)
4387  {
4388  DPRINT1("WARNING: Failed to load and render glyph! [index: %d]\n", glyph_index);
4389  break;
4390  }
4391 
4392  glyph = face->glyph;
4393  if (EmuBold || EmuItalic)
4394  {
4395  if (EmuBold)
4396  FT_GlyphSlot_Embolden(glyph);
4397  if (EmuItalic)
4398  FT_GlyphSlot_Oblique(glyph);
4399  realglyph = ftGdiGlyphSet(face, glyph, RenderMode);
4400  }
4401  else
4402  {
4403  realglyph = ftGdiGlyphCacheSet(face,
4404  glyph_index,
4405  plf->lfHeight,
4406  pmxWorldToDevice,
4407  glyph,
4408  RenderMode);
4409  }
4410 
4411  if (!realglyph)
4412  {
4413  DPRINT1("Failed to render glyph! [index: %d]\n", glyph_index);
4414  break;
4415  }
4416  }
4417 
4418  /* Retrieve kerning distance */
4419  if (use_kerning && previous && glyph_index)
4420  {
4421  FT_Vector delta;
4422  FT_Get_Kerning(face, previous, glyph_index, 0, &delta);
4423  TotalWidth64 += delta.x;
4424  }
4425 
4426  TotalWidth64 += realglyph->root.advance.x >> 10;
4427 
4428  if (((TotalWidth64 + 32) >> 6) <= MaxExtent && NULL != Fit)
4429  {
4430  *Fit = i + 1;
4431  }
4432  if (NULL != Dx)
4433  {
4434  Dx[i] = (TotalWidth64 + 32) >> 6;
4435  }
4436 
4437  /* Bold and italic do not use the cache */
4438  if (EmuBold || EmuItalic)
4439  {
4440  FT_Done_Glyph((FT_Glyph)realglyph);
4441  }
4442 
4443  previous = glyph_index;
4444  String++;
4445  }
4446  ASSERT(FontGDI->Magic == FONTGDI_MAGIC);
4447  ascender = FontGDI->tmAscent; /* Units above baseline */
4448  descender = FontGDI->tmDescent; /* Units below baseline */
4450 
4451  Size->cx = (TotalWidth64 + 32) >> 6;
4452  Size->cy = ascender + descender;
4453 
4454  return TRUE;
4455 }
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
LONG tmAscent
Definition: engobjects.h:159
#define TRUE
Definition: types.h:120
#define error(str)
Definition: mkdosfs.c:1605
FT_Pos x
Definition: ftimage.h:76
enum FT_Render_Mode_ FT_Render_Mode
LONG lfHeight
Definition: dimm.idl:59
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1015
static WCHAR String[]
Definition: stringtable.c:55
WORD face[3]
Definition: mesh.c:4747
#define FT_LOAD_DEFAULT
Definition: freetype.h:3008
int32_t INT
Definition: typedefs.h:56
#define FT_HAS_KERNING(face)
Definition: freetype.h:1297
FT_BitmapGlyph APIENTRY ftGdiGlyphSet(FT_Face Face, FT_GlyphSlot GlyphSlot, FT_Render_Mode RenderMode)
Definition: freetype.c:3276
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
_In_ FLONG fl
Definition: winddi.h:1279
LONG tmDescent
Definition: engobjects.h:160
BOOL FASTCALL TextIntUpdateSize(PDC dc, PTEXTOBJ TextObj, PFONTGDI FontGDI, BOOL bDoLock)
Definition: freetype.c:3704
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
FT_Load_Glyph(FT_Face face, FT_UInt glyph_index, FT_Int32 load_flags)
Definition: ftobjs.c:760
FT_BEGIN_HEADER FT_GlyphSlot_Embolden(FT_GlyphSlot slot)
Definition: ftsynth.c:90
BYTE OriginalItalic
Definition: engobjects.h:153
unsigned char BOOLEAN
FT_GlyphSlot_Oblique(FT_GlyphSlot slot)
Definition: ftsynth.c:48
smooth NULL
Definition: ftsmooth.c:416
FT_GlyphRec root
Definition: ftglyph.h:162
uint64_t ULONGLONG
Definition: typedefs.h:65
LONG OriginalWeight
Definition: engobjects.h:154
#define IntUnLockFreeType()
Definition: freetype.c:82
FT_Face Face
Definition: engobjects.h:129
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
VOID FtSetCoordinateTransform(FT_Face face, PMATRIX pmx)
Definition: freetype.c:775
BOOL FASTCALL IntIsFontRenderingEnabled(VOID)
Definition: freetype.c:2098
#define IntLockFreeType()
Definition: freetype.c:79
static FT_UInt FASTCALL get_glyph_index_flagged(FT_Face face, FT_ULong code, DWORD indexed_flag, DWORD flags)
Definition: freetype.c:3822
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
FT_BitmapGlyph APIENTRY ftGdiGlyphCacheSet(FT_Face Face, INT GlyphIndex, INT Height, PMATRIX pmx, FT_GlyphSlot GlyphSlot, FT_Render_Mode RenderMode)
Definition: freetype.c:3317
PSHARED_FACE SharedFace
Definition: engobjects.h:142
BYTE lfItalic
Definition: dimm.idl:64
FT_BitmapGlyph APIENTRY ftGdiGlyphCacheGet(FT_Face Face, INT GlyphIndex, INT Height, FT_Render_Mode RenderMode, PMATRIX pmx)
Definition: freetype.c:3239
#define DPRINT1
Definition: precomp.h:8
FT_Vector advance
Definition: ftglyph.h:113
LONG Magic
Definition: engobjects.h:163
FT_Render_Mode FASTCALL IntGetFontRenderMode(LOGFONTW *logfont)
Definition: freetype.c:2110
#define FONTGDI_MAGIC
Definition: engobjects.h:167
#define ObjToGDI(ClipObj, Type)
Definition: engobjects.h:180
static const WCHAR dc[]
FORCEINLINE PMATRIX DC_pmxWorldToDevice(PDC pdc)
Definition: coord.h:98
#define EMUBOLD_NEEDED(original, request)
Definition: freetype.c:45
#define FT_LOAD_NO_BITMAP
Definition: freetype.h:3012
LONG lfWeight
Definition: dimm.idl:63
FT_Done_Glyph(FT_Glyph glyph)
Definition: ftglyph.c:633
#define GTEF_INDICES
Definition: ntgdityp.h:212
GLenum GLuint GLint GLenum face
Definition: glext.h:7025

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

◆ TextIntRealizeFont()

NTSTATUS FASTCALL TextIntRealizeFont ( HFONT  ,
PTEXTOBJ   
)

Definition at line 5276 of file freetype.c.

5277 {
5279  PTEXTOBJ TextObj;
5280  PPROCESSINFO Win32Process;
5281  ULONG MatchPenalty;
5282  LOGFONTW *pLogFont;
5283  LOGFONTW SubstitutedLogFont;
5284 
5285  if (!pTextObj)
5286  {
5287  TextObj = TEXTOBJ_LockText(FontHandle);
5288  if (NULL == TextObj)
5289  {
5290  return STATUS_INVALID_HANDLE;
5291  }
5292 
5293  if (TextObj->fl & TEXTOBJECT_INIT)
5294  {
5295  TEXTOBJ_UnlockText(TextObj);
5296  return STATUS_SUCCESS;
5297  }
5298  }
5299  else
5300  {
5301  TextObj = pTextObj;
5302  }
5303 
5304  pLogFont = &TextObj->logfont.elfEnumLogfontEx.elfLogFont;
5305 
5306  /* substitute */
5307  SubstitutedLogFont = *pLogFont;
5308  DPRINT("Font '%S,%u' is substituted by: ", pLogFont->lfFaceName, pLogFont->lfCharSet);
5309  SubstituteFontRecurse(&SubstitutedLogFont);
5310  DPRINT("'%S,%u'.\n", SubstitutedLogFont.lfFaceName, SubstitutedLogFont.lfCharSet);
5311 
5312  MatchPenalty = 0xFFFFFFFF;
5313  TextObj->Font = NULL;
5314 
5315  Win32Process = PsGetCurrentProcessWin32Process();
5316 
5317  /* Search private fonts */
5318  IntLockProcessPrivateFonts(Win32Process);
5319  FindBestFontFromList(&TextObj->Font, &MatchPenalty, &SubstitutedLogFont,
5320  &Win32Process->PrivateFontListHead);
5321  IntUnLockProcessPrivateFonts(Win32Process);
5322 
5323  /* Search system fonts */
5325  FindBestFontFromList(&TextObj->Font, &MatchPenalty, &SubstitutedLogFont,
5326  &g_FontListHead);
5328 
5329  if (NULL == TextObj->Font)
5330  {
5331  DPRINT1("Request font %S not found, no fonts loaded at all\n",
5332  pLogFont->lfFaceName);
5334  }
5335  else
5336  {
5338  PFONTGDI FontGdi = ObjToGDI(TextObj->Font, FONT);
5339  PSHARED_FACE SharedFace = FontGdi->SharedFace;
5340 
5341  IntLockFreeType();
5342  IntRequestFontSize(NULL, FontGdi, pLogFont->lfWidth, pLogFont->lfHeight);
5344 
5345  TextObj->TextFace[0] = UNICODE_NULL;
5346  if (MatchFontNames(SharedFace, SubstitutedLogFont.lfFaceName))
5347  {
5348  RtlStringCchCopyW(TextObj->TextFace, _countof(TextObj->TextFace), pLogFont->lfFaceName);
5349  }
5350  else
5351  {
5354  if (NT_SUCCESS(Status))
5355  {
5356  /* truncated copy */
5357  IntUnicodeStringToBuffer(TextObj->TextFace, sizeof(TextObj->TextFace), &Name);
5359  }
5360  }
5361 
5362  // Need hdev, when freetype is loaded need to create DEVOBJ for
5363  // Consumer and Producer.
5364  TextObj->Font->iUniq = 1; // Now it can be cached.
5365  IntFontType(FontGdi);
5366  FontGdi->flType = TextObj->Font->flFontType;
5367  FontGdi->RequestUnderline = pLogFont->lfUnderline ? 0xFF : 0;
5368  FontGdi->RequestStrikeOut = pLogFont->lfStrikeOut ? 0xFF : 0;
5369  FontGdi->RequestItalic = pLogFont->lfItalic ? 0xFF : 0;
5370  if (pLogFont->lfWeight != FW_DONTCARE)
5371  FontGdi->RequestWeight = pLogFont->lfWeight;
5372  else
5373  FontGdi->RequestWeight = FW_NORMAL;
5374 
5375  TextObj->fl |= TEXTOBJECT_INIT;
5377  }
5378 
5379  if (!pTextObj) TEXTOBJ_UnlockText(TextObj);
5380 
5381  ASSERT((NT_SUCCESS(Status) ^ (NULL == TextObj->Font)) != 0);
5382 
5383  return Status;
5384 }
static LIST_ENTRY g_FontListHead
Definition: freetype.c:66