ReactOS  0.4.14-dev-77-gd9e7c48
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:2764
NTSTATUS FASTCALL TextIntRealizeFont(HFONT FontHandle, PTEXTOBJ pTextObj)
Definition: freetype.c:5342
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:2775
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 4800 of file freetype.c.

4806 {
4808  FT_Face Face = FontGdi->SharedFace->Face;
4809 
4810  IntLockFreeType();
4811 
4812  if (FT_IS_SFNT(Face))
4813  {
4814  if (Table)
4815  Table = Table >> 24 | Table << 24 | (Table >> 8 & 0xFF00) |
4816  (Table << 8 & 0xFF0000);
4817 
4818  if (!Buffer) Size = 0;
4819 
4820  if (Buffer && Size)
4821  {
4822  FT_Error Error;
4823  FT_ULong Needed = 0;
4824 
4825  Error = FT_Load_Sfnt_Table(Face, Table, Offset, NULL, &Needed);
4826 
4827  if ( !Error && Needed < Size) Size = Needed;
4828  }
4829  if (!FT_Load_Sfnt_Table(Face, Table, Offset, Buffer, &Size))
4830  Result = Size;
4831  }
4832 
4834 
4835  return Result;
4836 }
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 3908 of file freetype.c.

3917 {
3918  PDC_ATTR pdcattr;
3919  PTEXTOBJ TextObj;
3920  PFONTGDI FontGDI;
3921  HFONT hFont = 0;
3922  GLYPHMETRICS gm;
3923  ULONG Size;
3924  FT_Face ft_face;
3925  FT_UInt glyph_index;
3926  DWORD width, height, pitch, needed = 0;
3927  FT_Bitmap ft_bitmap;
3928  FT_Error error;
3929  INT left, right, top = 0, bottom = 0;
3931  FLOATOBJ eM11, widthRatio, eTemp;
3932  FT_Matrix transMat = identityMat;
3933  BOOL needsTransform = FALSE;
3934  INT orientation;
3935  LONG aveWidth;
3936  INT adv, lsb, bbx; /* These three hold to widths of the unrotated chars */
3937  OUTLINETEXTMETRICW *potm;
3938  XFORMOBJ xo;
3939  XFORML xform;
3940  LOGFONTW *plf;
3941 
3942  DPRINT("%u, %08x, %p, %08lx, %p, %p\n", wch, iFormat, pgm,
3943  cjBuf, pvBuf, pmat2);
3944 
3945  pdcattr = dc->pdcattr;
3946 
3947  XFORMOBJ_vInit(&xo, &dc->pdcattr->mxWorldToDevice);
3948  XFORMOBJ_iGetXform(&xo, &xform);
3949  FLOATOBJ_SetFloat(&eM11, xform.eM11);
3950 
3951  hFont = pdcattr->hlfntNew;
3952  TextObj = RealizeFontInit(hFont);
3953 
3954  if (!TextObj)
3955  {
3957  return GDI_ERROR;
3958  }
3959  FontGDI = ObjToGDI(TextObj->Font, FONT);
3960  ft_face = FontGDI->SharedFace->Face;
3961 
3962  plf = &TextObj->logfont.elfEnumLogfontEx.elfLogFont;
3963  aveWidth = FT_IS_SCALABLE(ft_face) ? abs(plf->lfWidth) : 0;
3964  orientation = FT_IS_SCALABLE(ft_face) ? plf->lfOrientation : 0;
3965 
3966  Size = IntGetOutlineTextMetrics(FontGDI, 0, NULL);
3968  if (!potm)
3969  {
3971  TEXTOBJ_UnlockText(TextObj);
3972  return GDI_ERROR;
3973  }
3974  Size = IntGetOutlineTextMetrics(FontGDI, Size, potm);
3975  if (!Size)
3976  {
3977  /* FIXME: last error? */
3979  TEXTOBJ_UnlockText(TextObj);
3980  return GDI_ERROR;
3981  }
3982 
3983  IntLockFreeType();
3984  TextIntUpdateSize(dc, TextObj, FontGDI, FALSE);
3986 
3987  TEXTOBJ_UnlockText(TextObj);
3988 
3989  glyph_index = get_glyph_index_flagged(ft_face, wch, GGO_GLYPH_INDEX, iFormat);
3991 
3992  if (orientation || (iFormat != GGO_METRICS && iFormat != GGO_BITMAP) || aveWidth || pmat2)
3993  load_flags |= FT_LOAD_NO_BITMAP;
3994 
3995  if (iFormat & GGO_UNHINTED)
3996  {
3997  load_flags |= FT_LOAD_NO_HINTING;
3998  iFormat &= ~GGO_UNHINTED;
3999  }
4000 
4001  error = FT_Load_Glyph(ft_face, glyph_index, load_flags);
4002  if (error)
4003  {
4004  DPRINT1("WARNING: Failed to load and render glyph! [index: %u]\n", glyph_index);
4006  if (potm) ExFreePoolWithTag(potm, GDITAG_TEXT);
4007  return GDI_ERROR;
4008  }
4010 
4011  FLOATOBJ_Set1(&widthRatio);
4012  if (aveWidth && potm)
4013  {
4014  // widthRatio = aveWidth * eM11 / potm->otmTextMetrics.tmAveCharWidth
4015  FLOATOBJ_SetLong(&widthRatio, aveWidth);
4016  FLOATOBJ_Mul(&widthRatio, &eM11);
4017  FLOATOBJ_DivLong(&widthRatio, potm->otmTextMetrics.tmAveCharWidth);
4018  }
4019 
4020  //left = (INT)(ft_face->glyph->metrics.horiBearingX * widthRatio) & -64;
4021  FLOATOBJ_SetLong(&eTemp, ft_face->glyph->metrics.horiBearingX);
4022  FLOATOBJ_Mul(&eTemp, &widthRatio);
4023  left = FLOATOBJ_GetLong(&eTemp) & -64;
4024 
4025  //right = (INT)((ft_face->glyph->metrics.horiBearingX +
4026  // ft_face->glyph->metrics.width) * widthRatio + 63) & -64;
4027  FLOATOBJ_SetLong(&eTemp, ft_face->glyph->metrics.horiBearingX * ft_face->glyph->metrics.width);
4028  FLOATOBJ_Mul(&eTemp, &widthRatio);
4029  FLOATOBJ_AddLong(&eTemp, 63);
4030  right = FLOATOBJ_GetLong(&eTemp) & -64;
4031 
4032  //adv = (INT)((ft_face->glyph->metrics.horiAdvance * widthRatio) + 63) >> 6;
4033  FLOATOBJ_SetLong(&eTemp, ft_face->glyph->metrics.horiAdvance);
4034  FLOATOBJ_Mul(&eTemp, &widthRatio);
4035  FLOATOBJ_AddLong(&eTemp, 63);
4036  adv = FLOATOBJ_GetLong(&eTemp) >> 6;
4037 
4038  lsb = left >> 6;
4039  bbx = (right - left) >> 6;
4040 
4041  DPRINT("Advance = %d, lsb = %d, bbx = %d\n",adv, lsb, bbx);
4042 
4043  IntLockFreeType();
4044 
4045  /* Width scaling transform */
4046  if (!FLOATOBJ_Equal1(&widthRatio))
4047  {
4048  FT_Matrix scaleMat;
4049 
4050  eTemp = widthRatio;
4051  FLOATOBJ_MulLong(&eTemp, 1 << 16);
4052 
4053  scaleMat.xx = FLOATOBJ_GetLong(&eTemp);
4054  scaleMat.xy = 0;
4055  scaleMat.yx = 0;
4056  scaleMat.yy = INT_TO_FIXED(1);
4057  FT_Matrix_Multiply(&scaleMat, &transMat);
4058  needsTransform = TRUE;
4059  }
4060 
4061  /* World transform */
4062  {
4063  FT_Matrix ftmatrix;
4065 
4066  /* Create a freetype matrix, by converting to 16.16 fixpoint format */
4067  FtMatrixFromMx(&ftmatrix, pmx);
4068 
4069  if (memcmp(&ftmatrix, &identityMat, sizeof(identityMat)) != 0)
4070  {
4071  FT_Matrix_Multiply(&ftmatrix, &transMat);
4072  needsTransform = TRUE;
4073  }
4074  }
4075 
4076  /* Rotation transform */
4077  if (orientation)
4078  {
4079  FT_Matrix rotationMat;
4080  DPRINT("Rotation Trans!\n");
4081  IntEscapeMatrix(&rotationMat, orientation);
4082  FT_Matrix_Multiply(&rotationMat, &transMat);
4083  needsTransform = TRUE;
4084  }
4085 
4086  /* Extra transformation specified by caller */
4087  if (pmat2)
4088  {
4089  FT_Matrix extraMat;
4090  DPRINT("MAT2 Matrix Trans!\n");
4091  extraMat.xx = FT_FixedFromFIXED(pmat2->eM11);
4092  extraMat.xy = FT_FixedFromFIXED(pmat2->eM21);
4093  extraMat.yx = FT_FixedFromFIXED(pmat2->eM12);
4094  extraMat.yy = FT_FixedFromFIXED(pmat2->eM22);
4095  FT_Matrix_Multiply(&extraMat, &transMat);
4096  needsTransform = TRUE;
4097  }
4098 
4099  if (potm) ExFreePoolWithTag(potm, GDITAG_TEXT); /* It looks like we are finished with potm ATM. */
4100 
4101  if (!needsTransform)
4102  {
4103  DPRINT("No Need to be Transformed!\n");
4104  top = (ft_face->glyph->metrics.horiBearingY + 63) & -64;
4105  bottom = (ft_face->glyph->metrics.horiBearingY -
4106  ft_face->glyph->metrics.height) & -64;
4107  gm.gmCellIncX = adv;
4108  gm.gmCellIncY = 0;
4109  }
4110  else
4111  {
4112  INT xc, yc;
4113  FT_Vector vec;
4114  for (xc = 0; xc < 2; xc++)
4115  {
4116  for (yc = 0; yc < 2; yc++)
4117  {
4118  vec.x = (ft_face->glyph->metrics.horiBearingX +
4119  xc * ft_face->glyph->metrics.width);
4120  vec.y = ft_face->glyph->metrics.horiBearingY -
4121  yc * ft_face->glyph->metrics.height;
4122  DPRINT("Vec %ld,%ld\n", vec.x, vec.y);
4123  FT_Vector_Transform(&vec, &transMat);
4124  if (xc == 0 && yc == 0)
4125  {
4126  left = right = vec.x;
4127  top = bottom = vec.y;
4128  }
4129  else
4130  {
4131  if (vec.x < left) left = vec.x;
4132  else if (vec.x > right) right = vec.x;
4133  if (vec.y < bottom) bottom = vec.y;
4134  else if (vec.y > top) top = vec.y;
4135  }
4136  }
4137  }
4138  left = left & -64;
4139  right = (right + 63) & -64;
4140  bottom = bottom & -64;
4141  top = (top + 63) & -64;
4142 
4143  DPRINT("Transformed box: (%d,%d - %d,%d)\n", left, top, right, bottom);
4144  vec.x = ft_face->glyph->metrics.horiAdvance;
4145  vec.y = 0;
4146  FT_Vector_Transform(&vec, &transMat);
4147  gm.gmCellIncX = (vec.x+63) >> 6;
4148  gm.gmCellIncY = -((vec.y+63) >> 6);
4149  }
4150  gm.gmBlackBoxX = (right - left) >> 6;
4151  gm.gmBlackBoxY = (top - bottom) >> 6;
4152  gm.gmptGlyphOrigin.x = left >> 6;
4153  gm.gmptGlyphOrigin.y = top >> 6;
4154 
4155  DPRINT("CX %d CY %d BBX %u BBY %u GOX %d GOY %d\n",
4156  gm.gmCellIncX, gm.gmCellIncY,
4157  gm.gmBlackBoxX, gm.gmBlackBoxY,
4159 
4161 
4162 
4163  if (iFormat == GGO_METRICS)
4164  {
4165  DPRINT("GGO_METRICS Exit!\n");
4166  *pgm = gm;
4167  return 1; /* FIXME */
4168  }
4169 
4170  if (ft_face->glyph->format != ft_glyph_format_outline && iFormat != GGO_BITMAP)
4171  {
4172  DPRINT1("Loaded a bitmap\n");
4173  return GDI_ERROR;
4174  }
4175 
4176  switch (iFormat)
4177  {
4178  case GGO_BITMAP:
4179  {
4180  width = gm.gmBlackBoxX;
4181  height = gm.gmBlackBoxY;
4182  pitch = ((width + 31) >> 5) << 2;
4183  needed = pitch * height;
4184 
4185  if (!pvBuf || !cjBuf) break;
4186  if (!needed) return GDI_ERROR; /* empty glyph */
4187  if (needed > cjBuf)
4188  return GDI_ERROR;
4189 
4190  switch (ft_face->glyph->format)
4191  {
4193  {
4194  BYTE *src = ft_face->glyph->bitmap.buffer, *dst = pvBuf;
4195  INT w = min( pitch, (ft_face->glyph->bitmap.width + 7) >> 3 );
4196  INT h = min( height, ft_face->glyph->bitmap.rows );
4197  while (h--)
4198  {
4199  RtlCopyMemory(dst, src, w);
4200  src += ft_face->glyph->bitmap.pitch;
4201  dst += pitch;
4202  }
4203  break;
4204  }
4205 
4207  {
4208  ft_bitmap.width = width;
4209  ft_bitmap.rows = height;
4210  ft_bitmap.pitch = pitch;
4211  ft_bitmap.pixel_mode = FT_PIXEL_MODE_MONO;
4212  ft_bitmap.buffer = pvBuf;
4213 
4214  IntLockFreeType();
4215  if (needsTransform)
4216  {
4217  FT_Outline_Transform(&ft_face->glyph->outline, &transMat);
4218  }
4219  FT_Outline_Translate(&ft_face->glyph->outline, -left, -bottom );
4220  /* Note: FreeType will only set 'black' bits for us. */
4221  RtlZeroMemory(pvBuf, needed);
4222  FT_Outline_Get_Bitmap(g_FreeTypeLibrary, &ft_face->glyph->outline, &ft_bitmap);
4224  break;
4225  }
4226 
4227  default:
4228  DPRINT1("Loaded glyph format %x\n", ft_face->glyph->format);
4229  return GDI_ERROR;
4230  }
4231 
4232  break;
4233  }
4234 
4235  case GGO_GRAY2_BITMAP:
4236  case GGO_GRAY4_BITMAP:
4237  case GGO_GRAY8_BITMAP:
4238  {
4239  unsigned int mult, row, col;
4240  BYTE *start, *ptr;
4241 
4242  width = gm.gmBlackBoxX;
4243  height = gm.gmBlackBoxY;
4244  pitch = (width + 3) / 4 * 4;
4245  needed = pitch * height;
4246 
4247  if (!pvBuf || !cjBuf) break;
4248  if (!needed) return GDI_ERROR; /* empty glyph */
4249  if (needed > cjBuf)
4250  return GDI_ERROR;
4251 
4252  switch (ft_face->glyph->format)
4253  {
4255  {
4256  BYTE *src = ft_face->glyph->bitmap.buffer, *dst = pvBuf;
4257  INT h = min( height, ft_face->glyph->bitmap.rows );
4258  INT x;
4259  while (h--)
4260  {
4261  for (x = 0; (UINT)x < pitch; x++)
4262  {
4263  if (x < ft_face->glyph->bitmap.width)
4264  dst[x] = (src[x / 8] & (1 << ( (7 - (x % 8))))) ? 0xff : 0;
4265  else
4266  dst[x] = 0;
4267  }
4268  src += ft_face->glyph->bitmap.pitch;
4269  dst += pitch;
4270  }
4271  break;
4272  }
4274  {
4275  ft_bitmap.width = width;
4276  ft_bitmap.rows = height;
4277  ft_bitmap.pitch = pitch;
4278  ft_bitmap.pixel_mode = FT_PIXEL_MODE_GRAY;
4279  ft_bitmap.buffer = pvBuf;
4280 
4281  IntLockFreeType();
4282  if (needsTransform)
4283  {
4284  FT_Outline_Transform(&ft_face->glyph->outline, &transMat);
4285  }
4286  FT_Outline_Translate(&ft_face->glyph->outline, -left, -bottom );
4287  RtlZeroMemory(ft_bitmap.buffer, cjBuf);
4288  FT_Outline_Get_Bitmap(g_FreeTypeLibrary, &ft_face->glyph->outline, &ft_bitmap);
4290 
4291  if (iFormat == GGO_GRAY2_BITMAP)
4292  mult = 4;
4293  else if (iFormat == GGO_GRAY4_BITMAP)
4294  mult = 16;
4295  else if (iFormat == GGO_GRAY8_BITMAP)
4296  mult = 64;
4297  else
4298  {
4299  return GDI_ERROR;
4300  }
4301 
4302  start = pvBuf;
4303  for (row = 0; row < height; row++)
4304  {
4305  ptr = start;
4306  for (col = 0; col < width; col++, ptr++)
4307  {
4308  *ptr = (((int)*ptr) * mult + 128) / 256;
4309  }
4310  start += pitch;
4311  }
4312 
4313  break;
4314  }
4315  default:
4316  DPRINT1("Loaded glyph format %x\n", ft_face->glyph->format);
4317  return GDI_ERROR;
4318  }
4319 
4320  break;
4321  }
4322 
4323  case GGO_NATIVE:
4324  {
4325  FT_Outline *outline = &ft_face->glyph->outline;
4326 
4327  if (cjBuf == 0) pvBuf = NULL; /* This is okay, need cjBuf to allocate. */
4328 
4329  IntLockFreeType();
4330  if (needsTransform && pvBuf) FT_Outline_Transform(outline, &transMat);
4331 
4333 
4334  if (!pvBuf || !cjBuf)
4335  {
4337  break;
4338  }
4339  if (needed > cjBuf)
4340  {
4342  return GDI_ERROR;
4343  }
4346  break;
4347  }
4348 
4349  case GGO_BEZIER:
4350  {
4351  FT_Outline *outline = &ft_face->glyph->outline;
4352  if (cjBuf == 0) pvBuf = NULL;
4353 
4354  if (needsTransform && pvBuf)
4355  {
4356  IntLockFreeType();
4357  FT_Outline_Transform(outline, &transMat);
4359  }
4361 
4362  if (!pvBuf || !cjBuf)
4363  break;
4364  if (needed > cjBuf)
4365  return GDI_ERROR;
4366 
4368  break;
4369  }
4370 
4371  default:
4372  DPRINT1("Unsupported format %u\n", iFormat);
4373  return GDI_ERROR;
4374  }
4375 
4376  DPRINT("ftGdiGetGlyphOutline END and needed %lu\n", needed);
4377  *pgm = gm;
4378  return needed;
4379 }
#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:2383
#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
HDC dc
Definition: cylfrac.c:34
short gmCellIncY
Definition: wingdi.h:2441
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:3770
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:2604
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:2439
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:3454
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:3527
#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:3888
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:2440
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:2438
#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:2509
#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:2697
UINT gmBlackBoxX
Definition: wingdi.h:2437
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
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:2774
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 5828 of file freetype.c.

5831 {
5832  DWORD Count = 0;
5833  INT i = 0;
5834  FT_Face face = Font->SharedFace->Face;
5835 
5836  if (FT_HAS_KERNING(face) && face->charmap->encoding == FT_ENCODING_UNICODE)
5837  {
5838  FT_UInt previous_index = 0, glyph_index = 0;
5839  FT_ULong char_code, char_previous;
5840  FT_Vector delta;
5841 
5842  char_previous = char_code = FT_Get_First_Char(face, &glyph_index);
5843 
5844  IntLockFreeType();
5845 
5846  while (glyph_index)
5847  {
5848  if (previous_index && glyph_index)
5849  {
5850  FT_Get_Kerning(face, previous_index, glyph_index, FT_KERNING_DEFAULT, &delta);
5851 
5852  if (pKerningPair && cPairs)
5853  {
5854  pKerningPair[i].wFirst = char_previous;
5855  pKerningPair[i].wSecond = char_code;
5856  pKerningPair[i].iKernAmount = delta.x;
5857  i++;
5858  if (i == cPairs) break;
5859  }
5860  Count++;
5861  }
5862  previous_index = glyph_index;
5863  char_previous = char_code;
5864  char_code = FT_Get_Next_Char(face, char_code, &glyph_index);
5865  }
5867  }
5868  return Count;
5869 }
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 3279 of file freetype.c.

3280 {
3281  if ( lprs )
3282  {
3283  lprs->nSize = sizeof(RASTERIZER_STATUS);
3284  lprs->wFlags = TT_AVAILABLE | TT_ENABLED;
3285  lprs->nLanguageID = gusLanguageID;
3286  return TRUE;
3287  }
3289  return FALSE;
3290 }
#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 4523 of file freetype.c.

4527 {
4528  PDC_ATTR pdcattr;
4529  UINT Ret = DEFAULT_CHARSET;
4530  INT i;
4531  HFONT hFont;
4532  PTEXTOBJ TextObj;
4533  PFONTGDI FontGdi;
4534  FONTSIGNATURE fs;
4535  TT_OS2 *pOS2;
4536  FT_Face Face;
4537  CHARSETINFO csi;
4538  DWORD cp, fs0;
4539  USHORT usACP, usOEM;
4540 
4541  pdcattr = Dc->pdcattr;
4542  hFont = pdcattr->hlfntNew;
4543  TextObj = RealizeFontInit(hFont);
4544 
4545  if (!TextObj)
4546  {
4548  return Ret;
4549  }
4550  FontGdi = ObjToGDI(TextObj->Font, FONT);
4551  Face = FontGdi->SharedFace->Face;
4552  TEXTOBJ_UnlockText(TextObj);
4553 
4554  memset(&fs, 0, sizeof(FONTSIGNATURE));
4555  IntLockFreeType();
4556  pOS2 = FT_Get_Sfnt_Table(Face, ft_sfnt_os2);
4557  if (NULL != pOS2)
4558  {
4559  fs.fsCsb[0] = pOS2->ulCodePageRange1;
4560  fs.fsCsb[1] = pOS2->ulCodePageRange2;
4561  fs.fsUsb[0] = pOS2->ulUnicodeRange1;
4562  fs.fsUsb[1] = pOS2->ulUnicodeRange2;
4563  fs.fsUsb[2] = pOS2->ulUnicodeRange3;
4564  fs.fsUsb[3] = pOS2->ulUnicodeRange4;
4565  if (pOS2->version == 0)
4566  {
4567  FT_UInt dummy;
4568 
4569  if (FT_Get_First_Char( Face, &dummy ) < 0x100)
4570  fs.fsCsb[0] |= FS_LATIN1;
4571  else
4572  fs.fsCsb[0] |= FS_SYMBOL;
4573  }
4574  }
4575  pOS2 = NULL;
4577  DPRINT("Csb 1=%x 0=%x\n", fs.fsCsb[1],fs.fsCsb[0]);
4578  if (fs.fsCsb[0] == 0)
4579  { /* Let's see if we can find any interesting cmaps */
4580  for (i = 0; i < Face->num_charmaps; i++)
4581  {
4582  switch (Face->charmaps[i]->encoding)
4583  {
4584  case FT_ENCODING_UNICODE:
4585  case FT_ENCODING_APPLE_ROMAN:
4586  fs.fsCsb[0] |= FS_LATIN1;
4587  break;
4588  case FT_ENCODING_MS_SYMBOL:
4589  fs.fsCsb[0] |= FS_SYMBOL;
4590  break;
4591  default:
4592  break;
4593  }
4594  }
4595  }
4596  if (lpSig)
4597  {
4598  RtlCopyMemory(lpSig, &fs, sizeof(FONTSIGNATURE));
4599  }
4600 
4601  RtlGetDefaultCodePage(&usACP, &usOEM);
4602  cp = usACP;
4603 
4605  if (csi.fs.fsCsb[0] & fs.fsCsb[0])
4606  {
4607  DPRINT("Hit 1\n");
4608  Ret = csi.ciCharset;
4609  goto Exit;
4610  }
4611 
4612  for (i = 0; i < MAXTCIINDEX; i++)
4613  {
4614  fs0 = 1L << i;
4615  if (fs.fsCsb[0] & fs0)
4616  {
4617  if (IntTranslateCharsetInfo(&fs0, &csi, TCI_SRCFONTSIG))
4618  {
4619  // *cp = csi.ciACP;
4620  DPRINT("Hit 2\n");
4621  Ret = csi.ciCharset;
4622  goto Exit;
4623  }
4624  else
4625  DPRINT1("TCI failing on %x\n", fs0);
4626  }
4627  }
4628 Exit:
4629  DPRINT("CharSet %u CodePage %u\n", csi.ciCharset, csi.ciACP);
4630  return (MAKELONG(csi.ciACP, csi.ciCharset));
4631 }
FONTSIGNATURE fs
Definition: wingdi.h:1543
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:1541
#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:2209
#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:1538
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 4704 of file freetype.c.

4707 {
4708  PDC dc;
4709  PDC_ATTR pdcattr;
4710  PTEXTOBJ TextObj;
4711  PFONTGDI FontGDI;
4712  FT_Face Face;
4713  TT_OS2 *pOS2;
4714  TT_HoriHeader *pHori;
4715  FT_WinFNT_HeaderRec Win;
4716  ULONG Error;
4718  LOGFONTW *plf;
4719 
4720  if (!ptmwi)
4721  {
4723  return FALSE;
4724  }
4725 
4726  if (!(dc = DC_LockDc(hDC)))
4727  {
4729  return FALSE;
4730  }
4731  pdcattr = dc->pdcattr;
4732  TextObj = RealizeFontInit(pdcattr->hlfntNew);
4733  if (NULL != TextObj)
4734  {
4735  plf = &TextObj->logfont.elfEnumLogfontEx.elfLogFont;
4736  FontGDI = ObjToGDI(TextObj->Font, FONT);
4737 
4738  Face = FontGDI->SharedFace->Face;
4739 
4740  IntLockFreeType();
4741  Error = IntRequestFontSize(dc, FontGDI, plf->lfWidth, plf->lfHeight);
4744 
4745  if (0 != Error)
4746  {
4747  DPRINT1("Error in setting pixel sizes: %u\n", Error);
4749  }
4750  else
4751  {
4752  FT_Face Face = FontGDI->SharedFace->Face;
4754 
4755  IntLockFreeType();
4756  pOS2 = FT_Get_Sfnt_Table(Face, ft_sfnt_os2);
4757  if (NULL == pOS2)
4758  {
4759  DPRINT1("Can't find OS/2 table - not TT font?\n");
4761  }
4762 
4763  pHori = FT_Get_Sfnt_Table(Face, ft_sfnt_hhea);
4764  if (NULL == pHori)
4765  {
4766  DPRINT1("Can't find HHEA table - not TT font?\n");
4768  }
4769 
4770  Error = FT_Get_WinFNT_Header(Face, &Win);
4771 
4772  if (NT_SUCCESS(Status) || !Error)
4773  {
4774  FillTM(&ptmwi->TextMetric, FontGDI, pOS2, pHori, !Error ? &Win : 0);
4775 
4776  /* FIXME: Fill Diff member */
4777  RtlZeroMemory(&ptmwi->Diff, sizeof(ptmwi->Diff));
4778  }
4779 
4781  }
4782  TEXTOBJ_UnlockText(TextObj);
4783  }
4784  else
4785  {
4787  }
4788  DC_UnlockDc(dc);
4789 
4790  if (!NT_SUCCESS(Status))
4791  {
4793  return FALSE;
4794  }
4795  return TRUE;
4796 }
#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
HDC dc
Definition: cylfrac.c:34
#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:2510
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:3652
#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:2697
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
#define ObjToGDI(ClipObj, Type)
Definition: engobjects.h:180
FORCEINLINE PMATRIX DC_pmxWorldToDevice(PDC pdc)
Definition: coord.h:98
ENUMLOGFONTEXW elfEnumLogfontEx
Definition: wingdi.h:2774
return STATUS_SUCCESS
Definition: btrfs.c:2966
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 5809 of file freetype.c.

5810 {
5811  if (FT_HAS_FIXED_SIZES(Font->SharedFace->Face))
5812  Info->iTechnology = RI_TECH_BITMAP;
5813  else
5814  {
5815  if (FT_IS_SCALABLE(Font->SharedFace->Face))
5816  Info->iTechnology = RI_TECH_SCALABLE;
5817  else
5818  Info->iTechnology = RI_TECH_FIXED;
5819  }
5820  Info->iUniq = Font->FontObj.iUniq;
5821  Info->dwUnknown = -1;
5822  return TRUE;
5823 }
#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 4636 of file freetype.c.

4637 {
4638  DWORD size = 0;
4639  DWORD num_ranges = 0;
4640  FT_Face face = Font->SharedFace->Face;
4641 
4642  if (face->charmap->encoding == FT_ENCODING_UNICODE)
4643  {
4644  FT_UInt glyph_code = 0;
4645  FT_ULong char_code, char_code_prev;
4646 
4647  char_code_prev = char_code = FT_Get_First_Char(face, &glyph_code);
4648 
4649  DPRINT("Face encoding FT_ENCODING_UNICODE, number of glyphs %ld, first glyph %u, first char %04lx\n",
4650  face->num_glyphs, glyph_code, char_code);
4651 
4652  if (!glyph_code) return 0;
4653 
4654  if (glyphset)
4655  {
4656  glyphset->ranges[0].wcLow = (USHORT)char_code;
4657  glyphset->ranges[0].cGlyphs = 0;
4658  glyphset->cGlyphsSupported = 0;
4659  }
4660 
4661  num_ranges = 1;
4662  while (glyph_code)
4663  {
4664  if (char_code < char_code_prev)
4665  {
4666  DPRINT1("Expected increasing char code from FT_Get_Next_Char\n");
4667  return 0;
4668  }
4669  if (char_code - char_code_prev > 1)
4670  {
4671  num_ranges++;
4672  if (glyphset)
4673  {
4674  glyphset->ranges[num_ranges - 1].wcLow = (USHORT)char_code;
4675  glyphset->ranges[num_ranges - 1].cGlyphs = 1;
4676  glyphset->cGlyphsSupported++;
4677  }
4678  }
4679  else if (glyphset)
4680  {
4681  glyphset->ranges[num_ranges - 1].cGlyphs++;
4682  glyphset->cGlyphsSupported++;
4683  }
4684  char_code_prev = char_code;
4685  char_code = FT_Get_Next_Char(face, char_code, &glyph_code);
4686  }
4687  }
4688  else
4689  DPRINT1("Encoding %i not supported\n", face->charmap->encoding);
4690 
4691  size = sizeof(GLYPHSET) + sizeof(WCRANGE) * (num_ranges - 1);
4692  if (glyphset)
4693  {
4694  glyphset->cbThis = size;
4695  glyphset->cRanges = num_ranges;
4696  glyphset->flAccel = 0;
4697  }
4698  return size;
4699 }
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:2698
DWORD dvNumAxes
Definition: wingdi.h:2764
WCHAR elfStyle[LF_FACESIZE]
Definition: wingdi.h:2699
WCHAR elfScript[LF_FACESIZE]
Definition: wingdi.h:2700
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:1140
DESIGNVECTOR elfDesignVector
Definition: wingdi.h:2775
LOGFONTW elfLogFont
Definition: wingdi.h:2697
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
ENUMLOGFONTEXW elfEnumLogfontEx
Definition: wingdi.h:2774

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:4383
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:319
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:4383
LONG cy
Definition: windef.h:320
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:4704
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:6765
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:1811
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:1541
#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 2139 of file freetype.c.

2140 {
2142 }
_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 1965 of file freetype.c.

1966 {
1967  HANDLE Ret = NULL;
1969  PFONT_ENTRY_COLL_MEM EntryCollection;
1970  INT FaceCount;
1971 
1973  if (!BufferCopy)
1974  {
1975  *pNumAdded = 0;
1976  return NULL;
1977  }
1978  RtlCopyMemory(BufferCopy, Buffer, dwSize);
1979 
1980  LoadFont.pFileName = NULL;
1981  LoadFont.Memory = SharedMem_Create(BufferCopy, dwSize, FALSE);
1982  LoadFont.Characteristics = FR_PRIVATE | FR_NOT_ENUM;
1983  RtlInitUnicodeString(&LoadFont.RegValueName, NULL);
1984  LoadFont.IsTrueType = FALSE;
1985  LoadFont.PrivateEntry = NULL;
1987 
1988  RtlFreeUnicodeString(&LoadFont.RegValueName);
1989 
1990  /* Release our copy */
1991  IntLockFreeType();
1992  SharedMem_Release(LoadFont.Memory);
1994 
1995  if (FaceCount > 0)
1996  {
1997  EntryCollection = ExAllocatePoolWithTag(PagedPool, sizeof(FONT_ENTRY_COLL_MEM), TAG_FONT);
1998  if (EntryCollection)
1999  {
2001  EntryCollection->Entry = LoadFont.PrivateEntry;
2002  IntLockProcessPrivateFonts(Win32Process);
2003  EntryCollection->Handle = ULongToHandle(++Win32Process->PrivateMemFontHandleCount);
2004  InsertTailList(&Win32Process->PrivateMemFontListHead, &EntryCollection->ListEntry);
2005  IntUnLockProcessPrivateFonts(Win32Process);
2006  Ret = EntryCollection->Handle;
2007  }
2008  }
2009  *pNumAdded = FaceCount;
2010 
2011  return Ret;
2012 }
#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:277
#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:1136
HANDLE Handle
Definition: font.h:22
LIST_ENTRY PrivateMemFontListHead
Definition: win32.h:276
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 1795 of file freetype.c.

1796 {
1797  return IntGdiAddFontResourceEx(FileName, Characteristics, 0);
1798 }
INT FASTCALL IntGdiAddFontResourceEx(PUNICODE_STRING FileName, DWORD Characteristics, DWORD dwFlags)
Definition: freetype.c:1596

Referenced by NtGdiAddFontResourceW().

◆ IntGdiAddFontResourceEx()

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

Definition at line 1596 of file freetype.c.

1598 {
1599  NTSTATUS Status;
1601  PVOID Buffer = NULL;
1604  SIZE_T ViewSize = 0, Length;
1605  LARGE_INTEGER SectionSize;
1608  INT FontCount;
1609  HANDLE KeyHandle;
1610  UNICODE_STRING PathName;
1611  LPWSTR pszBuffer;
1613  static const UNICODE_STRING TrueTypePostfix = RTL_CONSTANT_STRING(L" (TrueType)");
1614  static const UNICODE_STRING DosPathPrefix = RTL_CONSTANT_STRING(L"\\??\\");
1615 
1616  /* Build PathName */
1618  {
1619  Length = DosPathPrefix.Length + FileName->Length + sizeof(UNICODE_NULL);
1621  if (!pszBuffer)
1622  return 0; /* failure */
1623 
1624  RtlInitEmptyUnicodeString(&PathName, pszBuffer, Length);
1625  RtlAppendUnicodeStringToString(&PathName, &DosPathPrefix);
1627  }
1628  else
1629  {
1630  Status = DuplicateUnicodeString(FileName, &PathName);
1631  if (!NT_SUCCESS(Status))
1632  return 0; /* failure */
1633  }
1634 
1635  /* Open the font file */
1638  Status = ZwOpenFile(
1639  &FileHandle,
1642  &Iosb,
1645  if (!NT_SUCCESS(Status))
1646  {
1647  DPRINT1("Could not load font file: %wZ\n", &PathName);
1648  RtlFreeUnicodeString(&PathName);
1649  return 0;
1650  }
1651 
1654  if (!NT_SUCCESS(Status))
1655  {
1656  DPRINT1("ObReferenceObjectByHandle failed.\n");
1658  RtlFreeUnicodeString(&PathName);
1659  return 0;
1660  }
1661 
1662  SectionSize.QuadPart = 0LL;
1665  NULL, &SectionSize, PAGE_READONLY,
1667  if (!NT_SUCCESS(Status))
1668  {
1669  DPRINT1("Could not map file: %wZ\n", &PathName);
1672  RtlFreeUnicodeString(&PathName);
1673  return 0;
1674  }
1676 
1678  if (!NT_SUCCESS(Status))
1679  {
1680  DPRINT1("Could not map file: %wZ\n", &PathName);
1683  RtlFreeUnicodeString(&PathName);
1684  return 0;
1685  }
1686 
1687  LoadFont.pFileName = &PathName;
1689  LoadFont.Characteristics = Characteristics;
1690  RtlInitUnicodeString(&LoadFont.RegValueName, NULL);
1691  LoadFont.IsTrueType = FALSE;
1692  LoadFont.CharSet = DEFAULT_CHARSET;
1693  LoadFont.PrivateEntry = NULL;
1694  FontCount = IntGdiLoadFontsFromMemory(&LoadFont);
1695 
1696  /* Release our copy */
1697  IntLockFreeType();
1698  SharedMem_Release(LoadFont.Memory);
1700 
1702 
1704 
1705  /* Save the loaded font name into the registry */
1706  if (FontCount > 0 && (dwFlags & AFRX_WRITE_REGISTRY))
1707  {
1708  UNICODE_STRING NewString;
1709  SIZE_T Length;
1710  PWCHAR pszBuffer;
1711  LPCWSTR CharSetName;
1712  if (LoadFont.IsTrueType)
1713  {
1714  /* Append " (TrueType)" */
1715  Length = LoadFont.RegValueName.Length + TrueTypePostfix.Length + sizeof(UNICODE_NULL);
1717  if (pszBuffer)
1718  {
1719  RtlInitEmptyUnicodeString(&NewString, pszBuffer, Length);
1720  NewString.Buffer[0] = UNICODE_NULL;
1721  RtlAppendUnicodeStringToString(&NewString, &LoadFont.RegValueName);
1722  RtlAppendUnicodeStringToString(&NewString, &TrueTypePostfix);
1723  RtlFreeUnicodeString(&LoadFont.RegValueName);
1724  LoadFont.RegValueName = NewString;
1725  }
1726  else
1727  {
1728  // FIXME!
1729  }
1730  }
1731  else if (LoadFont.CharSet != DEFAULT_CHARSET)
1732  {
1733  /* Append " (CharSetName)" */
1734  CharSetName = NameFromCharSet(LoadFont.CharSet);
1735  Length = LoadFont.RegValueName.Length +
1736  (wcslen(CharSetName) + 3) * sizeof(WCHAR) +
1737  sizeof(UNICODE_NULL);
1738 
1740  if (pszBuffer)
1741  {
1742  RtlInitEmptyUnicodeString(&NewString, pszBuffer, Length);
1743  NewString.Buffer[0] = UNICODE_NULL;
1744  RtlAppendUnicodeStringToString(&NewString, &LoadFont.RegValueName);
1745  RtlAppendUnicodeToString(&NewString, L" (");
1746  RtlAppendUnicodeToString(&NewString, CharSetName);
1747  RtlAppendUnicodeToString(&NewString, L")");
1748  RtlFreeUnicodeString(&LoadFont.RegValueName);
1749  LoadFont.RegValueName = NewString;
1750  }
1751  else
1752  {
1753  // FIXME!
1754  }
1755  }
1756 
1759  NULL, NULL);
1760  Status = ZwOpenKey(&KeyHandle, KEY_WRITE, &ObjectAttributes);
1761  if (NT_SUCCESS(Status))
1762  {
1763  SIZE_T DataSize;
1764  LPWSTR pFileName;
1765 
1767  {
1768  pFileName = PathName.Buffer;
1769  }
1770  else
1771  {
1772  pFileName = wcsrchr(PathName.Buffer, L'\\');
1773  }
1774 
1775  if (pFileName)
1776  {
1777  if (!(dwFlags & AFRX_ALTERNATIVE_PATH))
1778  {
1779  pFileName++;
1780  }
1781  DataSize = (wcslen(pFileName) + 1) * sizeof(WCHAR);
1782  ZwSetValueKey(KeyHandle, &LoadFont.RegValueName, 0, REG_SZ,
1783  pFileName, DataSize);
1784  }
1785  ZwClose(KeyHandle);
1786  }
1787  }
1788  RtlFreeUnicodeString(&LoadFont.RegValueName);
1789 
1790  RtlFreeUnicodeString(&PathName);
1791  return FontCount;
1792 }
_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:1136
__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:1562
#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 2087 of file freetype.c.

2088 {
2091  PFONT_ENTRY_COLL_MEM EntryCollection;
2092 
2093  DPRINT("IntGdiCleanupPrivateFontsForProcess()\n");
2094  do {
2095  Entry = NULL;
2096  EntryCollection = NULL;
2097 
2098  IntLockProcessPrivateFonts(Win32Process);
2099  if (!IsListEmpty(&Win32Process->PrivateMemFontListHead))
2100  {
2101  Entry = Win32Process->PrivateMemFontListHead.Flink;
2102  EntryCollection = CONTAINING_RECORD(Entry, FONT_ENTRY_COLL_MEM, ListEntry);
2103  UnlinkFontMemCollection(EntryCollection);
2104  }
2105  IntUnLockProcessPrivateFonts(Win32Process);
2106 
2107  if (EntryCollection)
2108  {
2109  IntGdiCleanupMemEntry(EntryCollection->Entry);
2110  ExFreePoolWithTag(EntryCollection, TAG_FONT);
2111  }
2112  else
2113  {
2114  /* No Mem fonts anymore, see if we have any other private fonts left */
2115  Entry = NULL;
2116  IntLockProcessPrivateFonts(Win32Process);
2117  if (!IsListEmpty(&Win32Process->PrivateFontListHead))
2118  {
2119  Entry = RemoveHeadList(&Win32Process->PrivateFontListHead);
2120  }
2121  IntUnLockProcessPrivateFonts(Win32Process);
2122 
2123  if (Entry)
2124  {
2126  }
2127  }
2128 
2129  } while (Entry);
2130 }
#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:2017
_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:276
Definition: typedefs.h:117
static VOID FASTCALL UnlinkFontMemCollection(PFONT_ENTRY_COLL_MEM Collection)
Definition: freetype.c:2036
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:275

Referenced by GdiProcessDestroy().

◆ IntGdiGetFontResourceInfo()

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

Definition at line 5541 of file freetype.c.

5546 {
5547  UNICODE_STRING EntryFileName;
5548  POBJECT_NAME_INFORMATION NameInfo1 = NULL, NameInfo2 = NULL;
5549  PLIST_ENTRY ListEntry;
5550  PFONT_ENTRY FontEntry;
5551  ULONG Size, i, Count;
5552  LPBYTE pbBuffer;
5553  BOOL IsEqual;
5554  FONTFAMILYINFO *FamInfo;
5555  const ULONG MaxFamInfo = 64;
5556  const ULONG MAX_FAM_INFO_BYTES = sizeof(FONTFAMILYINFO) * MaxFamInfo;
5557  BOOL bSuccess;
5558  const ULONG NAMEINFO_SIZE = sizeof(OBJECT_NAME_INFORMATION) + MAX_PATH * sizeof(WCHAR);
5559 
5560  DPRINT("IntGdiGetFontResourceInfo: dwType == %lu\n", dwType);
5561 
5562  do
5563  {
5564  /* Create buffer for full path name */
5565  NameInfo1 = ExAllocatePoolWithTag(PagedPool, NAMEINFO_SIZE, TAG_FINF);
5566  if (!NameInfo1)
5567  break;
5568 
5569  /* Get the full path name */
5570  if (!IntGetFullFileName(NameInfo1, NAMEINFO_SIZE, FileName))
5571  break;
5572 
5573  /* Create a buffer for the entries' names */
5574  NameInfo2 = ExAllocatePoolWithTag(PagedPool, NAMEINFO_SIZE, TAG_FINF);
5575  if (!NameInfo2)
5576  break;
5577 
5578  FamInfo = ExAllocatePoolWithTag(PagedPool, MAX_FAM_INFO_BYTES, TAG_FINF);
5579  } while (0);
5580 
5581  if (!NameInfo1 || !NameInfo2 || !FamInfo)
5582  {
5583  if (NameInfo2)
5584  ExFreePoolWithTag(NameInfo2, TAG_FINF);
5585 
5586  if (NameInfo1)
5587  ExFreePoolWithTag(NameInfo1, TAG_FINF);
5588 
5590  return FALSE;
5591  }
5592 
5593  Count = 0;
5594 
5595  /* Try to find the pathname in the global font list */
5597  for (ListEntry = g_FontListHead.Flink; ListEntry != &g_FontListHead;
5598  ListEntry = ListEntry->Flink)
5599  {
5600  FontEntry = CONTAINING_RECORD(ListEntry, FONT_ENTRY, ListEntry);
5601  if (FontEntry->Font->Filename == NULL)
5602  continue;
5603 
5604  RtlInitUnicodeString(&EntryFileName , FontEntry->Font->Filename);
5605  if (!IntGetFullFileName(NameInfo2, NAMEINFO_SIZE, &EntryFileName))
5606  continue;
5607 
5608  if (!RtlEqualUnicodeString(&NameInfo1->Name, &NameInfo2->Name, FALSE))
5609  continue;
5610 
5611  IsEqual = FALSE;
5612  FontFamilyFillInfo(&FamInfo[Count], FontEntry->FaceName.Buffer,
5613  NULL, FontEntry->Font);
5614  for (i = 0; i < Count; ++i)
5615  {
5616  if (EqualFamilyInfo(&FamInfo[i], &FamInfo[Count]))
5617  {
5618  IsEqual = TRUE;
5619  break;
5620  }
5621  }
5622  if (!IsEqual)
5623  {
5624  /* Found */
5625  ++Count;
5626  if (Count >= MaxFamInfo)
5627  break;
5628  }
5629  }
5631 
5632  /* Free the buffers */
5633  ExFreePoolWithTag(NameInfo1, TAG_FINF);
5634  ExFreePoolWithTag(NameInfo2, TAG_FINF);
5635 
5636  if (Count == 0 && dwType != 5)
5637  {
5638  /* Font could not be found in system table
5639  dwType == 5 will still handle this */
5640  ExFreePoolWithTag(FamInfo, TAG_FINF);
5641  return FALSE;
5642  }
5643 
5644  bSuccess = FALSE;
5645  switch (dwType)
5646  {
5647  case 0: /* FIXME: Returns 1 or 2, don't know what this is atm */
5648  Size = sizeof(DWORD);
5649  if (*pdwBytes == 0)
5650  {
5651  *pdwBytes = Size;
5652  bSuccess = TRUE;
5653  }
5654  else if (pBuffer)
5655  {
5656  if (*pdwBytes >= Size)
5657  {
5658  *(DWORD*)pBuffer = Count;
5659  }
5660  *pdwBytes = Size;
5661  bSuccess = TRUE;
5662  }
5663  break;
5664 
5665  case 1: /* copy the font title */
5666  /* calculate the required size */
5667  Size = 0;
5668  for (i = 0; i < Count; ++i)
5669  {
5670  if (i > 0)
5671  Size += 3; /* " & " */
5672  Size += wcslen(FamInfo[i].EnumLogFontEx.elfLogFont.lfFaceName);
5673  if (FamInfo[i].EnumLogFontEx.elfStyle[0] &&
5674  _wcsicmp(FamInfo[i].EnumLogFontEx.elfStyle, L"Regular") != 0)
5675  {
5676  Size += 1 + wcslen(FamInfo[i].EnumLogFontEx.elfStyle);
5677  }
5678  }
5679  Size += 2; /* "\0\0" */
5680  Size *= sizeof(WCHAR);
5681 
5682  if (*pdwBytes == 0)
5683  {
5684  *pdwBytes = Size;
5685  bSuccess = TRUE;
5686  }
5687  else if (pBuffer)
5688  {
5689  if (*pdwBytes >= Size)
5690  {
5691  /* store font title to buffer */
5692  WCHAR *psz = pBuffer;
5693  *psz = 0;
5694  for (i = 0; i < Count; ++i)
5695  {
5696  if (i > 0)
5697  wcscat(psz, L" & ");
5698  IntAddNameFromFamInfo(psz, &FamInfo[i]);
5699  }
5700  psz[wcslen(psz) + 1] = UNICODE_NULL;
5701  *pdwBytes = Size;
5702  bSuccess = TRUE;
5703  }
5704  else
5705  {
5706  *pdwBytes = 1024; /* this is confirmed value */
5707  }
5708  }
5709  break;
5710 
5711  case 2: /* Copy an array of LOGFONTW */
5712  Size = Count * sizeof(LOGFONTW);
5713  if (*pdwBytes == 0)
5714  {
5715  *pdwBytes = Size;
5716  bSuccess = TRUE;
5717  }
5718  else if (pBuffer)
5719  {
5720  if (*pdwBytes >= Size)
5721  {
5722  pbBuffer = (LPBYTE)pBuffer;
5723  for (i = 0; i < Count; ++i)
5724  {
5725  FamInfo[i].EnumLogFontEx.elfLogFont.lfWidth = 0;
5726  RtlCopyMemory(pbBuffer, &FamInfo[i].EnumLogFontEx.elfLogFont, sizeof(LOGFONTW));
5727  pbBuffer += sizeof(LOGFONTW);
5728  }
5729  }
5730  *pdwBytes = Size;
5731  bSuccess = TRUE;
5732  }
5733  else
5734  {
5735  *pdwBytes = 1024; /* this is confirmed value */
5736  }
5737  break;
5738 
5739  case 3:
5740  Size = sizeof(DWORD);
5741  if (*pdwBytes == 0)
5742  {
5743  *pdwBytes = Size;
5744  bSuccess = TRUE;
5745  }
5746  else if (pBuffer)
5747  {
5748  if (*pdwBytes >= Size)
5749  {
5750  /* FIXME: What exactly is copied here? */
5751  *(DWORD*)pBuffer = 1;
5752  }
5753  *pdwBytes = Size;
5754  bSuccess = TRUE;
5755  }
5756  break;
5757 
5758  case 4: /* full file path */
5759  if (FileName->Length >= 4 * sizeof(WCHAR))
5760  {
5761  /* The beginning of FileName is \??\ */
5762  LPWSTR pch = FileName->Buffer + 4;
5763  DWORD Length = FileName->Length - 4 * sizeof(WCHAR);
5764 
5765  Size = Length + sizeof(WCHAR);
5766  if (*pdwBytes == 0)
5767  {
5768  *pdwBytes = Size;
5769  bSuccess = TRUE;
5770  }
5771  else if (pBuffer)
5772  {
5773  if (*pdwBytes >= Size)
5774  {
5776  }
5777  *pdwBytes = Size;
5778  bSuccess = TRUE;
5779  }
5780  }
5781  break;
5782 
5783  case 5: /* Looks like a BOOL that is copied, TRUE, if the font was not found */
5784  Size = sizeof(BOOL);
5785  if (*pdwBytes == 0)
5786  {
5787  *pdwBytes = Size;
5788  bSuccess = TRUE;
5789  }
5790  else if (pBuffer)
5791  {
5792  if (*pdwBytes >= Size)
5793  {
5794  *(BOOL*)pBuffer = Count == 0;
5795  }
5796  *pdwBytes = Size;
5797  bSuccess = TRUE;
5798  }
5799  break;
5800  }
5801  ExFreePoolWithTag(FamInfo, TAG_FINF);
5802 
5803  return bSuccess;
5804 }
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:5507
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:5464
#define BOOL
Definition: nt_native.h:43
#define DWORD
Definition: nt_native.h:44
static BOOLEAN bSuccess
Definition: drive.cpp:417
#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:5528
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:2969
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:2697
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 2053 of file freetype.c.

2054 {
2056  PFONT_ENTRY_COLL_MEM CurrentEntry;
2057  PFONT_ENTRY_COLL_MEM EntryCollection = NULL;
2059 
2060  IntLockProcessPrivateFonts(Win32Process);
2061  for (Entry = Win32Process->PrivateMemFontListHead.Flink;
2062  Entry != &Win32Process->PrivateMemFontListHead;
2063  Entry = Entry->Flink)
2064  {
2065  CurrentEntry = CONTAINING_RECORD(Entry, FONT_ENTRY_COLL_MEM, ListEntry);
2066 
2067  if (CurrentEntry->Handle == hMMFont)
2068  {
2069  EntryCollection = CurrentEntry;
2070  UnlinkFontMemCollection(CurrentEntry);
2071  break;
2072  }
2073  }
2074  IntUnLockProcessPrivateFonts(Win32Process);
2075 
2076  if (EntryCollection)
2077  {
2078  IntGdiCleanupMemEntry(EntryCollection->Entry);
2079  ExFreePoolWithTag(EntryCollection, TAG_FONT);
2080  return TRUE;
2081  }
2082  return FALSE;
2083 }
#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:2017
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:276
Definition: typedefs.h:117
static VOID FASTCALL UnlinkFontMemCollection(PFONT_ENTRY_COLL_MEM Collection)
Definition: freetype.c:2036
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:319
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:4704
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:2378
BOOL FASTCALL TextIntGetTextExtentPoint(PDC dc, PTEXTOBJ TextObj, LPCWSTR String, INT Count, ULONG MaxExtent, LPINT Fit, LPINT Dx, LPSIZE Size, FLONG fl)
Definition: freetype.c:4383

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:1538
#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:4523
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 2604 of file freetype.c.

2607 {
2608  TT_OS2 *pOS2;
2609  TT_HoriHeader *pHori;
2610  TT_Postscript *pPost;
2611  FT_Fixed XScale, YScale;
2612  FT_WinFNT_HeaderRec WinFNT;
2613  FT_Error Error;
2614  BYTE *pb;
2615  FONT_NAMES FontNames;
2616  PSHARED_FACE SharedFace = FontGDI->SharedFace;
2618  FT_Face Face = SharedFace->Face;
2619 
2621  {
2622  Cache = &SharedFace->EnglishUS;
2623  }
2624  else
2625  {
2626  Cache = &SharedFace->UserLanguage;
2627  }
2628 
2629  if (Size == 0 && Cache->OutlineRequiredSize > 0)
2630  {
2631  ASSERT(Otm == NULL);
2632  return Cache->OutlineRequiredSize;
2633  }
2634 
2635  IntInitFontNames(&FontNames, SharedFace);
2636  Cache->OutlineRequiredSize = FontNames.OtmSize;
2637 
2638  if (Size == 0)
2639  {
2640  ASSERT(Otm == NULL);
2641  IntFreeFontNames(&FontNames);
2642  return Cache->OutlineRequiredSize;
2643  }
2644 
2645  ASSERT(Otm != NULL);
2646 
2647  if (Size < Cache->OutlineRequiredSize)
2648  {
2649  DPRINT1("Size %u < OutlineRequiredSize %u\n", Size,
2650  Cache->OutlineRequiredSize);
2651  IntFreeFontNames(&FontNames);
2652  return 0; /* failure */
2653  }
2654 
2655  XScale = Face->size->metrics.x_scale;
2656  YScale = Face->size->metrics.y_scale;
2657 
2658  IntLockFreeType();
2659 
2660  pOS2 = FT_Get_Sfnt_Table(Face, FT_SFNT_OS2);
2661  pHori = FT_Get_Sfnt_Table(Face, FT_SFNT_HHEA);
2662  pPost = FT_Get_Sfnt_Table(Face, FT_SFNT_POST); /* We can live with this failing */
2663  Error = FT_Get_WinFNT_Header(Face, &WinFNT);
2664 
2665  if (pOS2 == NULL && Error)
2666  {
2668  DPRINT1("Can't find OS/2 table - not TT font?\n");
2669  IntFreeFontNames(&FontNames);
2670  return 0;
2671  }
2672 
2673  if (pHori == NULL && Error)
2674  {
2676  DPRINT1("Can't find HHEA table - not TT font?\n");
2677  IntFreeFontNames(&FontNames);
2678  return 0;
2679  }
2680 
2681  Otm->otmSize = Cache->OutlineRequiredSize;
2682 
2683  FillTM(&Otm->otmTextMetrics, FontGDI, pOS2, pHori, !Error ? &WinFNT : 0);
2684 
2685  if (!pOS2)
2686  goto skip_os2;
2687 
2688  Otm->otmFiller = 0;
2689  RtlCopyMemory(&Otm->otmPanoseNumber, pOS2->panose, PANOSE_COUNT);
2690  Otm->otmfsSelection = pOS2->fsSelection;
2691  Otm->otmfsType = pOS2->fsType;
2692  Otm->otmsCharSlopeRise = pHori->caret_Slope_Rise;
2693  Otm->otmsCharSlopeRun = pHori->caret_Slope_Run;
2694  Otm->otmItalicAngle = 0; /* POST table */
2695  Otm->otmEMSquare = Face->units_per_EM;
2696 
2697 #define SCALE_X(value) ((FT_MulFix((value), XScale) + 32) >> 6)
2698 #define SCALE_Y(value) ((FT_MulFix((value), YScale) + 32) >> 6)
2699 
2700  Otm->otmAscent = SCALE_Y(pOS2->sTypoAscender);
2701  Otm->otmDescent = SCALE_Y(pOS2->sTypoDescender);
2702  Otm->otmLineGap = SCALE_Y(pOS2->sTypoLineGap);
2703  Otm->otmsCapEmHeight = SCALE_Y(pOS2->sCapHeight);
2704  Otm->otmsXHeight = SCALE_Y(pOS2->sxHeight);
2705  Otm->otmrcFontBox.left = SCALE_X(Face->bbox.xMin);
2706  Otm->otmrcFontBox.right = SCALE_X(Face->bbox.xMax);
2707  Otm->otmrcFontBox.top = SCALE_Y(Face->bbox.yMax);
2708  Otm->otmrcFontBox.bottom = SCALE_Y(Face->bbox.yMin);
2709  Otm->otmMacAscent = Otm->otmTextMetrics.tmAscent;
2710  Otm->otmMacDescent = -Otm->otmTextMetrics.tmDescent;
2711  Otm->otmMacLineGap = Otm->otmLineGap;
2712  Otm->otmusMinimumPPEM = 0; /* TT Header */
2713  Otm->otmptSubscriptSize.x = SCALE_X(pOS2->ySubscriptXSize);
2714  Otm->otmptSubscriptSize.y = SCALE_Y(pOS2->ySubscriptYSize);
2715  Otm->otmptSubscriptOffset.x = SCALE_X(pOS2->ySubscriptXOffset);
2716  Otm->otmptSubscriptOffset.y = SCALE_Y(pOS2->ySubscriptYOffset);
2717  Otm->otmptSuperscriptSize.x = SCALE_X(pOS2->ySuperscriptXSize);
2718  Otm->otmptSuperscriptSize.y = SCALE_Y(pOS2->ySuperscriptYSize);
2719  Otm->otmptSuperscriptOffset.x = SCALE_X(pOS2->ySuperscriptXOffset);
2720  Otm->otmptSuperscriptOffset.y = SCALE_Y(pOS2->ySuperscriptYOffset);
2721  Otm->otmsStrikeoutSize = SCALE_Y(pOS2->yStrikeoutSize);
2722  Otm->otmsStrikeoutPosition = SCALE_Y(pOS2->yStrikeoutPosition);
2723 
2724  if (!pPost)
2725  {
2726  Otm->otmsUnderscoreSize = 0;
2727  Otm->otmsUnderscorePosition = 0;
2728  }
2729  else
2730  {
2731  Otm->otmsUnderscoreSize = SCALE_Y(pPost->underlineThickness);
2732  Otm->otmsUnderscorePosition = SCALE_Y(pPost->underlinePosition);
2733  }
2734 
2735 #undef SCALE_X
2736 #undef SCALE_Y
2737 
2738 skip_os2:
2740 
2741  pb = IntStoreFontNames(&FontNames, Otm);
2742  ASSERT(pb - (BYTE*)Otm == Cache->OutlineRequiredSize);
2743 
2744  IntFreeFontNames(&FontNames);
2745 
2746  return Cache->OutlineRequiredSize;
2747 }
SHARED_FACE_CACHE EnglishUS
Definition: engobjects.h:132
ULONG OtmSize
Definition: freetype.c:2527
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:2531
static __inline BYTE *FASTCALL IntStoreFontNames(const FONT_NAMES *Names, OUTLINETEXTMETRICW *Otm)
Definition: freetype.c:2567
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:2591
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:2510
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 2133 of file freetype.c.

2134 {
2135  return (gpsi->BitsPixel > 8) && g_RenderingEnabled;
2136 }
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 1811 of file freetype.c.

1812 {
1813  NTSTATUS Status;
1814  HANDLE KeyHandle;
1816  KEY_FULL_INFORMATION KeyFullInfo;
1817  ULONG i, Length;
1818  UNICODE_STRING FontTitleW, FileNameW;
1819  SIZE_T InfoSize;
1820  LPBYTE InfoBuffer;
1822  LPWSTR pchPath;
1823  BOOLEAN Success;
1825  INT nFontCount = 0;
1826  DWORD dwFlags;
1827 
1828  /* open registry key */
1831  NULL, NULL);
1832  Status = ZwOpenKey(&KeyHandle, KEY_READ, &ObjectAttributes);
1833  if (!NT_SUCCESS(Status))
1834  {
1835  DPRINT1("ZwOpenKey failed: 0x%08X\n", Status);
1836  return FALSE; /* failure */
1837  }
1838 
1839  /* query count of values */
1840  Status = ZwQueryKey(KeyHandle, KeyFullInformation,
1841  &KeyFullInfo, sizeof(KeyFullInfo), &Length);
1842  if (!NT_SUCCESS(Status))
1843  {
1844  DPRINT1("ZwQueryKey failed: 0x%08X\n", Status);
1845  ZwClose(KeyHandle);
1846  return FALSE; /* failure */
1847  }
1848 
1849  /* allocate buffer */
1850  InfoSize = (MAX_PATH + 256) * sizeof(WCHAR);
1851  InfoBuffer = ExAllocatePoolWithTag(PagedPool, InfoSize, TAG_FONT);
1852  if (!InfoBuffer)
1853  {
1854  DPRINT1("ExAllocatePoolWithTag failed\n");
1855  ZwClose(KeyHandle);
1856  return FALSE;
1857  }
1858 
1859  /* for each value */
1860  for (i = 0; i < KeyFullInfo.Values; ++i)
1861  {
1862  /* get value name */
1863  Status = ZwEnumerateValueKey(KeyHandle, i, KeyValueFullInformation,
1864  InfoBuffer, InfoSize, &Length);
1866  {
1867  /* too short buffer */
1868  ExFreePoolWithTag(InfoBuffer, TAG_FONT);
1869  InfoSize *= 2;
1870  InfoBuffer = ExAllocatePoolWithTag(PagedPool, InfoSize, TAG_FONT);
1871  if (!InfoBuffer)
1872  {
1873  DPRINT1("ExAllocatePoolWithTag failed\n");
1874  break;
1875  }
1876  /* try again */
1877  Status = ZwEnumerateValueKey(KeyHandle, i, KeyValueFullInformation,
1878  InfoBuffer, InfoSize, &Length);
1879  }
1880  if (!NT_SUCCESS(Status))
1881  {
1882  DPRINT1("ZwEnumerateValueKey failed: 0x%08X\n", Status);
1883  break; /* failure */
1884  }
1885 
1886  /* create FontTitleW string */
1887  pInfo = (PKEY_VALUE_FULL_INFORMATION)InfoBuffer;
1888  Length = pInfo->NameLength / sizeof(WCHAR);
1889  pInfo->Name[Length] = UNICODE_NULL; /* truncate */
1890  Success = RtlCreateUnicodeString(&FontTitleW, pInfo->Name);
1891  if (!Success)
1892  {
1894  DPRINT1("RtlCreateUnicodeString failed\n");
1895  break; /* failure */
1896  }
1897 
1898  /* query value */
1899  Status = ZwQueryValueKey(KeyHandle, &FontTitleW, KeyValueFullInformation,
1900  InfoBuffer, InfoSize, &Length);
1902  {
1903  /* too short buffer */
1904  ExFreePoolWithTag(InfoBuffer, TAG_FONT);
1905  InfoSize *= 2;
1906  InfoBuffer = ExAllocatePoolWithTag(PagedPool, InfoSize, TAG_FONT);
1907  if (!InfoBuffer)
1908  {
1909  DPRINT1("ExAllocatePoolWithTag failed\n");
1910  break;
1911  }
1912  /* try again */
1913  Status = ZwQueryValueKey(KeyHandle, &FontTitleW, KeyValueFullInformation,
1914  InfoBuffer, InfoSize, &Length);
1915  }
1916  pInfo = (PKEY_VALUE_FULL_INFORMATION)InfoBuffer;
1917  if (!NT_SUCCESS(Status) || !pInfo->DataLength)
1918  {
1919  DPRINT1("ZwQueryValueKey failed: 0x%08X\n", Status);
1920  RtlFreeUnicodeString(&FontTitleW);
1921  break; /* failure */
1922  }
1923 
1924  /* Build pchPath */
1925  pchPath = (LPWSTR)((PUCHAR)pInfo + pInfo->DataOffset);
1926  Length = pInfo->DataLength / sizeof(WCHAR);
1927  pchPath[Length] = UNICODE_NULL; /* truncate */
1928 
1929  /* Load font(s) without writing registry */
1930  if (PathIsRelativeW(pchPath))
1931  {
1932  dwFlags = 0;
1934  L"\\SystemRoot\\Fonts\\%s", pchPath);
1935  }
1936  else
1937  {
1939  Status = RtlStringCbCopyW(szPath, sizeof(szPath), pchPath);
1940  }
1941 
1942  if (NT_SUCCESS(Status))
1943  {
1944  RtlCreateUnicodeString(&FileNameW, szPath);
1945  nFontCount += IntGdiAddFontResourceEx(&FileNameW, 0, dwFlags);
1946  RtlFreeUnicodeString(&FileNameW);
1947  }
1948 
1949  RtlFreeUnicodeString(&FontTitleW);
1950  }
1951 
1952  /* close now */
1953  ZwClose(KeyHandle);
1954 
1955  /* free memory block */
1956  if (InfoBuffer)
1957  {
1958  ExFreePoolWithTag(InfoBuffer, TAG_FONT);
1959  }
1960 
1961  return (KeyFullInfo.Values != 0 && nFontCount != 0);
1962 }
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:64
BOOL WINAPI PathIsRelativeW(LPCWSTR lpszPath)
Definition: freetype.c:1801
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:61
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:1596
#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:1596
#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:3734
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:5342
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:2966

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

2168 {
2169  PLFONT plfont;
2170  LOGFONTW *plf;
2171 
2172  ASSERT(lf);
2173  plfont = LFONT_AllocFontWithHandle();
2174  if (!plfont)
2175  {
2176  return STATUS_NO_MEMORY;
2177  }
2178 
2179  ExInitializePushLock(&plfont->lock);
2180  *NewFont = plfont->BaseObject.hHmgr;
2181  plf = &plfont->logfont.elfEnumLogfontEx.elfLogFont;
2182  RtlCopyMemory(plf, lf, sizeof(LOGFONTW));
2183  if (lf->lfEscapement != lf->lfOrientation)
2184  {
2185  /* This should really depend on whether GM_ADVANCED is set */
2186  plf->lfOrientation = plf->lfEscapement;
2187  }
2188  LFONT_UnlockFont(plfont);
2189 
2190  return STATUS_SUCCESS;
2191 }
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:2697
ENUMLOGFONTEXW elfEnumLogfontEx
Definition: wingdi.h:2774
return STATUS_SUCCESS
Definition: btrfs.c:2966

Referenced by CreateStockFonts(), and UserDrawCaptionText().

◆ TextIntGetTextExtentPoint()

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

Definition at line 4383 of file freetype.c.

4392 {
4393  PFONTGDI FontGDI;
4394  FT_Face face;
4395  FT_GlyphSlot glyph;
4396  FT_BitmapGlyph realglyph;
4397  INT error, glyph_index, i, previous;
4398  ULONGLONG TotalWidth64 = 0;
4399  BOOL use_kerning;
4400  FT_Render_Mode RenderMode;
4401  BOOLEAN Render;
4402  PMATRIX pmxWorldToDevice;
4403  LOGFONTW *plf;
4404  BOOL EmuBold, EmuItalic;
4405  LONG ascender, descender;
4406 
4407  FontGDI = ObjToGDI(TextObj->Font, FONT);
4408 
4409  face = FontGDI->SharedFace->Face;
4410  if (NULL != Fit)
4411  {
4412  *Fit = 0;
4413  }
4414 
4415  IntLockFreeType();
4416 
4417  TextIntUpdateSize(dc, TextObj, FontGDI, FALSE);
4418 
4419  plf = &TextObj->logfont.elfEnumLogfontEx.elfLogFont;
4420  EmuBold = EMUBOLD_NEEDED(FontGDI->OriginalWeight, plf->lfWeight);
4421  EmuItalic = (plf->lfItalic && !FontGDI->OriginalItalic);
4422 
4423  Render = IntIsFontRenderingEnabled();
4424  if (Render)
4425  RenderMode = IntGetFontRenderMode(plf);
4426  else
4427  RenderMode = FT_RENDER_MODE_MONO;
4428 
4429  /* Get the DC's world-to-device transformation matrix */
4430  pmxWorldToDevice = DC_pmxWorldToDevice(dc);
4431  FtSetCoordinateTransform(face, pmxWorldToDevice);
4432 
4433  use_kerning = FT_HAS_KERNING(face);
4434  previous = 0;
4435 
4436  for (i = 0; i < Count; i++)
4437  {
4438  glyph_index = get_glyph_index_flagged(face, *String, GTEF_INDICES, fl);
4439 
4440  if (EmuBold || EmuItalic)
4441  realglyph = NULL;
4442  else
4443  realglyph = ftGdiGlyphCacheGet(face, glyph_index, plf->lfHeight,
4444  RenderMode, pmxWorldToDevice);
4445 
4446  if (EmuBold || EmuItalic || !realglyph)
4447  {
4448  error = FT_Load_Glyph(face, glyph_index, FT_LOAD_DEFAULT);
4449  if (error)
4450  {
4451  DPRINT1("WARNING: Failed to load and render glyph! [index: %d]\n", glyph_index);
4452  break;
4453  }
4454 
4455  glyph = face->glyph;
4456  if (EmuBold || EmuItalic)
4457  {
4458  if (EmuBold)
4459  FT_GlyphSlot_Embolden(glyph);
4460  if (EmuItalic)
4461  FT_GlyphSlot_Oblique(glyph);
4462  realglyph = ftGdiGlyphSet(face, glyph, RenderMode);
4463  }
4464  else
4465  {
4466  realglyph = ftGdiGlyphCacheSet(face,
4467  glyph_index,
4468  plf->lfHeight,
4469  pmxWorldToDevice,
4470  glyph,
4471  RenderMode);
4472  }
4473 
4474  if (!realglyph)
4475  {
4476  DPRINT1("Failed to render glyph! [index: %d]\n", glyph_index);
4477  break;
4478  }
4479  }
4480 
4481  /* Retrieve kerning distance */
4482  if (use_kerning && previous && glyph_index)
4483  {
4484  FT_Vector delta;
4485  FT_Get_Kerning(face, previous, glyph_index, 0, &delta);
4486  TotalWidth64 += delta.x;
4487  }
4488 
4489  TotalWidth64 += realglyph->root.advance.x >> 10;
4490 
4491  if (((TotalWidth64 + 32) >> 6) <= MaxExtent && NULL != Fit)
4492  {
4493  *Fit = i + 1;
4494  }
4495  if (NULL != Dx)
4496  {
4497  Dx[i] = (TotalWidth64 + 32) >> 6;
4498  }
4499 
4500  /* Bold and italic do not use the cache */
4501  if (EmuBold || EmuItalic)
4502  {
4503  FT_Done_Glyph((FT_Glyph)realglyph);
4504  }
4505 
4506  previous = glyph_index;
4507  String++;
4508  }
4509  ASSERT(FontGDI->Magic == FONTGDI_MAGIC);
4510  ascender = FontGDI->tmAscent; /* Units above baseline */
4511  descender = FontGDI->tmDescent; /* Units below baseline */
4513 
4514  Size->cx = (TotalWidth64 + 32) >> 6;
4515  Size->cy = ascender + descender;
4516 
4517  return TRUE;
4518 }
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
HDC dc
Definition: cylfrac.c:34
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:3342
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:3770
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:2133
#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:3888
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:3383
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:3305
#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:2145
#define FONTGDI_MAGIC
Definition: engobjects.h:167
#define ObjToGDI(ClipObj, Type)
Definition: engobjects.h:180
FORCEINLINE PMATRIX DC_pmxWorldToDevice(PDC pdc)
Definition: coord.h:98
#define EMUBOLD_NEEDED(original, request)
Definition: freetype.c:45
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 5342 of file freetype.c.

5343 {
5345  PTEXTOBJ TextObj;
5346  PPROCESSINFO Win32Process;
5347  ULONG MatchPenalty;
5348  LOGFONTW *pLogFont;
5349  LOGFONTW SubstitutedLogFont;
5350  FT_Face Face;
5351 
5352  if (!pTextObj)
5353  {
5354  TextObj = TEXTOBJ_LockText(FontHandle);
5355  if (NULL == TextObj)
5356  {
5357  return STATUS_INVALID_HANDLE;
5358  }
5359 
5360  if (TextObj->fl & TEXTOBJECT_INIT)
5361  {
5362  TEXTOBJ_UnlockText(TextObj);
5363  return STATUS_SUCCESS;
5364  }
5365  }
5366  else
5367  {
5368  TextObj = pTextObj;
5369  }
5370 
5371  pLogFont = &TextObj->logfont.elfEnumLogfontEx.elfLogFont;
5372 
5373  /* substitute */
5374  SubstitutedLogFont = *pLogFont;
5375  DPRINT("Font '%S,%u' is substituted by: ", pLogFont->lfFaceName, pLogFont->lfCharSet);
5376  SubstituteFontRecurse(&SubstitutedLogFont);
5377  DPRINT("'%S,%u'.\n", SubstitutedLogFont.lfFaceName, SubstitutedLogFont.lfCharSet);
5378 
5379  MatchPenalty = 0xFFFFFFFF;
5380  TextObj->Font = NULL;
5381 
5382  Win32Process = PsGetCurrentProcessWin32Process();
5383 
5384  /* Search private fonts */
5385  IntLockProcessPrivateFonts(Win32Process);
5386  FindBestFontFromList(&TextObj->Font, &MatchPenalty, &SubstitutedLogFont,
5387  &Win32Process->PrivateFontListHead);
5388  IntUnLockProcessPrivateFonts(Win32Process);
5389 
5390  /* Search system fonts */
5392  FindBestFontFromList(&TextObj->Font, &MatchPenalty, &SubstitutedLogFont,
5393  &g_FontListHead);
5395 
5396  if (NULL == TextObj->Font)
5397  {
5398  DPRINT1("Request font %S not found, no fonts loaded at all\n",
5399  pLogFont->lfFaceName);
5401  }
5402  else
5403  {
5405  PFONTGDI FontGdi = ObjToGDI(TextObj->Font, FONT);
5406  PSHARED_FACE SharedFace = FontGdi->SharedFace;
5407 
5408  IntLockFreeType();
5409  IntRequestFontSize(NULL, FontGdi, pLogFont->lfWidth, pLogFont->lfHeight);
5411 
5412  TextObj->TextFace[0] = UNICODE_NULL;
5413  if (MatchFontNames(SharedFace, SubstitutedLogFont.lfFaceName))
5414  {
5415  RtlStringCchCopyW(TextObj->TextFace, _countof(TextObj->TextFace), pLogFont->lfFaceName);
5416  }
5417  else
5418  {
5421  if (NT_SUCCESS(Status))
5422  {
5423  /* truncated copy */
5424  IntUnicodeStringToBuffer(TextObj->TextFace, sizeof(TextObj->TextFace), &Name);
5426  }
5427  }
5428 
5429  // Need hdev, when freetype is loaded need to create DEVOBJ for
5430  // Consumer and Producer.
5431  TextObj->Font->iUniq = 1; // Now it can be cached.
5432  IntFontType(FontGdi);
5433  FontGdi->flType = TextObj->Font->flFontType;
5434  FontGdi->RequestUnderline = pLogFont->lfUnderline ? 0xFF : 0;
5435  FontGdi->RequestStrikeOut = pLogFont->lfStrikeOut ? 0xFF : 0;
5436  FontGdi->RequestItalic = pLogFont->lfItalic ? 0xFF : 0;
5437  if (pLogFont->lfWeight != FW_DONTCARE)
5438  FontGdi->RequestWeight = pLogFont->lfWeight;
5439  else
5440  FontGdi->RequestWeight = FW_NORMAL;
5441 
5442  Face = FontGdi->SharedFace->Face;
5443 
5444  //FontGdi->OriginalWeight = WeightFromStyle(Face->style_name);
5445 
5446  if (!FontGdi->OriginalItalic)
5447  FontGdi->OriginalItalic = ItalicFromStyle(Face->style_name);
5448 
5449  TextObj->fl |= TEXTOBJECT_INIT;
5451  }
5452 
5453  if (!pTextObj) TEXTOBJ_UnlockText(TextObj);
5454 
5455  ASSERT((NT_SUCCESS(Status) ^ (NULL == TextObj->Font)) != 0);
5456 
5457  return Status;
5458 }
static LIST_ENTRY g_FontListHead
Definition: freetype.c:66