ReactOS  0.4.15-dev-2947-g59e1b78
text.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _STRGDI
 
struct  _LFONT
 

Macros

#define TAG_FINF   'FNIF'
 
#define TO_MEM_ALLOCATED   0x0001
 
#define TO_ALL_PTRS_VALID   0x0002
 
#define TO_VALID   0x0004
 
#define TO_ESC_NOT_ORIENT   0x0008
 
#define TO_PWSZ_ALLOCATED   0x0010
 
#define TSIM_UNDERLINE1   0x0020
 
#define TSIM_UNDERLINE2   0x0040
 
#define TSIM_STRIKEOUT   0x0080
 
#define TO_HIGHRESTEXT   0x0100
 
#define TO_BITMAPS   0x0200
 
#define TO_PARTITION_INIT   0x0400
 
#define TO_ALLOC_FACENAME   0x0800
 
#define TO_SYS_PARTITION   0x1000
 
#define TEXTOBJECT_INIT   0x00010000
 
#define LFONT_AllocFontWithHandle()   ((PLFONT)GDIOBJ_AllocObjWithHandle(GDI_OBJECT_TYPE_FONT, sizeof(TEXTOBJ)))
 
#define LFONT_ShareLockFont(hfont)   (PLFONT)GDIOBJ_ReferenceObjectByHandle(hfont, GDIObjType_LFONT_TYPE)
 
#define LFONT_ShareUnlockFont(plfnt)   GDIOBJ_vDereferenceObject((POBJ)plfnt)
 
#define LFONT_UnlockFont(plfnt)   GDIOBJ_vUnlockObject((POBJ)plfnt)
 
#define AFRX_WRITE_REGISTRY   0x1
 
#define AFRX_ALTERNATIVE_PATH   0x2
 
#define AFRX_DOS_DEVICE_PATH   0x4
 
#define IntLockProcessPrivateFonts(W32Process)   ExEnterCriticalRegionAndAcquireFastMutexUnsafe(&W32Process->PrivateFontListLock)
 
#define IntUnLockProcessPrivateFonts(W32Process)   ExReleaseFastMutexUnsafeAndLeaveCriticalRegion(&W32Process->PrivateFontListLock)
 

Typedefs

typedef struct _STRGDI STRGDI
 
typedef struct _STRGDIPSTRGDI
 
typedef struct _LFONT TEXTOBJ
 
typedef struct _LFONTPTEXTOBJ
 
typedef struct _LFONT LFONT
 
typedef struct _LFONTPLFONT
 

Functions

FORCEINLINE PTEXTOBJ TEXTOBJ_LockText (HFONT hfont)
 
FORCEINLINE VOID TEXTOBJ_UnlockText (PLFONT plfnt)
 
PTEXTOBJ FASTCALL RealizeFontInit (HFONT)
 
NTSTATUS FASTCALL TextIntRealizeFont (HFONT, PTEXTOBJ)
 
NTSTATUS FASTCALL TextIntCreateFontIndirect (CONST LPLOGFONTW lf, HFONT *NewFont)
 
BYTE FASTCALL IntCharSetFromCodePage (UINT uCodePage)
 
BOOL FASTCALL InitFontSupport (VOID)
 
BOOL FASTCALL IntIsFontRenderingEnabled (VOID)
 
VOID FASTCALL IntEnableFontRendering (BOOL Enable)
 
ULONG FASTCALL FontGetObject (PTEXTOBJ TextObj, ULONG Count, PVOID Buffer)
 
VOID FASTCALL IntLoadSystemFonts (VOID)
 
BOOL FASTCALL IntLoadFontsInRegistry (VOID)
 
VOID FASTCALL IntGdiCleanupPrivateFontsForProcess (VOID)
 
INT FASTCALL IntGdiAddFontResource (PUNICODE_STRING FileName, DWORD Characteristics)
 
INT FASTCALL IntGdiAddFontResourceEx (PUNICODE_STRING FileName, DWORD Characteristics, DWORD dwFlags)
 
HANDLE FASTCALL IntGdiAddFontMemResource (PVOID Buffer, DWORD dwSize, PDWORD pNumAdded)
 
BOOL FASTCALL IntGdiRemoveFontMemResource (HANDLE hMMFont)
 
ULONG FASTCALL ftGdiGetGlyphOutline (PDC, WCHAR, UINT, LPGLYPHMETRICS, ULONG, PVOID, LPMAT2, BOOL)
 
INT FASTCALL IntGetOutlineTextMetrics (PFONTGDI, UINT, OUTLINETEXTMETRICW *)
 
BOOL FASTCALL TextIntUpdateSize (PDC, PTEXTOBJ, PFONTGDI, BOOL)
 
BOOL FASTCALL ftGdiGetRasterizerCaps (LPRASTERIZER_STATUS)
 
BOOL FASTCALL TextIntGetTextExtentPoint (PDC, PTEXTOBJ, LPCWSTR, INT, ULONG, LPINT, LPINT, LPSIZE, FLONG)
 
BOOL FASTCALL ftGdiGetTextMetricsW (HDC, PTMW_INTERNAL)
 
DWORD FASTCALL IntGetFontLanguageInfo (PDC)
 
INT FASTCALL ftGdiGetTextCharsetInfo (PDC, PFONTSIGNATURE, DWORD)
 
DWORD FASTCALL ftGetFontUnicodeRanges (PFONTGDI, PGLYPHSET)
 
DWORD FASTCALL ftGdiGetFontData (PFONTGDI, DWORD, DWORD, PVOID, DWORD)
 
BOOL FASTCALL IntGdiGetFontResourceInfo (PUNICODE_STRING, PVOID, DWORD *, DWORD)
 
BOOL FASTCALL ftGdiRealizationInfo (PFONTGDI, PREALIZATION_INFO)
 
DWORD FASTCALL ftGdiGetKerningPairs (PFONTGDI, DWORD, LPKERNINGPAIR)
 
BOOL NTAPI GreExtTextOutW (IN HDC, IN INT, IN INT, IN UINT, IN OPTIONAL RECTL *, IN LPCWSTR, IN INT, IN OPTIONAL LPINT, IN DWORD)
 
DWORD FASTCALL IntGetCharDimensions (HDC, PTEXTMETRICW, PDWORD)
 
BOOL FASTCALL GreGetTextExtentW (HDC, LPCWSTR, INT, LPSIZE, UINT)
 
BOOL FASTCALL GreGetTextExtentExW (HDC, LPCWSTR, ULONG, ULONG, PULONG, PULONG, LPSIZE, FLONG)
 
BOOL FASTCALL GreTextOutW (HDC, int, int, LPCWSTR, int)
 
HFONT FASTCALL GreCreateFontIndirectW (LOGFONTW *)
 
BOOL WINAPI GreGetTextMetricsW (_In_ HDC hdc, _Out_ LPTEXTMETRICW lptm)
 

Macro Definition Documentation

◆ AFRX_ALTERNATIVE_PATH

#define AFRX_ALTERNATIVE_PATH   0x2

Definition at line 105 of file text.h.

◆ AFRX_DOS_DEVICE_PATH

#define AFRX_DOS_DEVICE_PATH   0x4

Definition at line 106 of file text.h.

◆ AFRX_WRITE_REGISTRY

#define AFRX_WRITE_REGISTRY   0x1

Definition at line 104 of file text.h.

◆ IntLockProcessPrivateFonts

#define IntLockProcessPrivateFonts (   W32Process)    ExEnterCriticalRegionAndAcquireFastMutexUnsafe(&W32Process->PrivateFontListLock)

Definition at line 147 of file text.h.

◆ IntUnLockProcessPrivateFonts

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

Definition at line 150 of file text.h.

◆ LFONT_AllocFontWithHandle

#define LFONT_AllocFontWithHandle ( )    ((PLFONT)GDIOBJ_AllocObjWithHandle(GDI_OBJECT_TYPE_FONT, sizeof(TEXTOBJ)))

Definition at line 76 of file text.h.

◆ LFONT_ShareLockFont

Definition at line 77 of file text.h.

◆ LFONT_ShareUnlockFont

#define LFONT_ShareUnlockFont (   plfnt)    GDIOBJ_vDereferenceObject((POBJ)plfnt)

Definition at line 78 of file text.h.

◆ LFONT_UnlockFont

#define LFONT_UnlockFont (   plfnt)    GDIOBJ_vUnlockObject((POBJ)plfnt)

Definition at line 79 of file text.h.

◆ TAG_FINF

#define TAG_FINF   'FNIF'

Definition at line 3 of file text.h.

◆ TEXTOBJECT_INIT

#define TEXTOBJECT_INIT   0x00010000

Definition at line 56 of file text.h.

◆ TO_ALL_PTRS_VALID

#define TO_ALL_PTRS_VALID   0x0002

Definition at line 8 of file text.h.

◆ TO_ALLOC_FACENAME

#define TO_ALLOC_FACENAME   0x0800

Definition at line 18 of file text.h.

◆ TO_BITMAPS

#define TO_BITMAPS   0x0200

Definition at line 16 of file text.h.

◆ TO_ESC_NOT_ORIENT

#define TO_ESC_NOT_ORIENT   0x0008

Definition at line 10 of file text.h.

◆ TO_HIGHRESTEXT

#define TO_HIGHRESTEXT   0x0100

Definition at line 15 of file text.h.

◆ TO_MEM_ALLOCATED

#define TO_MEM_ALLOCATED   0x0001

Definition at line 7 of file text.h.

◆ TO_PARTITION_INIT

#define TO_PARTITION_INIT   0x0400

Definition at line 17 of file text.h.

◆ TO_PWSZ_ALLOCATED

#define TO_PWSZ_ALLOCATED   0x0010

Definition at line 11 of file text.h.

◆ TO_SYS_PARTITION

#define TO_SYS_PARTITION   0x1000

Definition at line 19 of file text.h.

◆ TO_VALID

#define TO_VALID   0x0004

Definition at line 9 of file text.h.

◆ TSIM_STRIKEOUT

#define TSIM_STRIKEOUT   0x0080

Definition at line 14 of file text.h.

◆ TSIM_UNDERLINE1

#define TSIM_UNDERLINE1   0x0020

Definition at line 12 of file text.h.

◆ TSIM_UNDERLINE2

#define TSIM_UNDERLINE2   0x0040

Definition at line 13 of file text.h.

Typedef Documentation

◆ LFONT

typedef struct _LFONT LFONT

◆ PLFONT

typedef struct _LFONT * PLFONT

◆ PSTRGDI

typedef struct _STRGDI * PSTRGDI

◆ PTEXTOBJ

typedef struct _LFONT * PTEXTOBJ

◆ STRGDI

◆ TEXTOBJ

Function Documentation

◆ FontGetObject()

ULONG FASTCALL FontGetObject ( PTEXTOBJ  TextObj,
ULONG  Count,
PVOID  Buffer 
)

Definition at line 293 of file font.c.

294 {
295  ULONG cjMaxSize;
296  ENUMLOGFONTEXDVW *plf;
297 
298  ASSERT(plfont);
299  plf = &plfont->logfont;
300 
301  if (!(plfont->fl & TEXTOBJECT_INIT))
302  {
304  DPRINT("FontGetObject font not initialized!\n");
305 
306  Status = TextIntRealizeFont(plfont->BaseObject.hHmgr, plfont);
307  if (!NT_SUCCESS(Status))
308  {
309  DPRINT1("FontGetObject(TextIntRealizeFont) Status = 0x%lx\n", Status);
310  }
311  }
312 
313  /* If buffer is NULL, only the size is requested */
314  if (pvBuffer == NULL) return sizeof(LOGFONTW);
315 
316  /* Calculate the maximum size according to number of axes */
317  cjMaxSize = FIELD_OFFSET(ENUMLOGFONTEXDVW,
318  elfDesignVector.dvValues[plf->elfDesignVector.dvNumAxes]);
319 
320  if (cjBuffer > cjMaxSize) cjBuffer = cjMaxSize;
321 
322  RtlCopyMemory(pvBuffer, plf, cjBuffer);
323 
324  return cjBuffer;
325 }
LONG NTSTATUS
Definition: precomp.h:26
DWORD dvNumAxes
Definition: wingdi.h:2768
NTSTATUS FASTCALL TextIntRealizeFont(HFONT FontHandle, PTEXTOBJ pTextObj)
Definition: freetype.c:5201
Status
Definition: gdiplustypes.h:24
#define ASSERT(a)
Definition: mode.c:44
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
struct tagLOGFONTW LOGFONTW
#define TEXTOBJECT_INIT
Definition: text.h:56
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
#define NULL
Definition: types.h:112
#define DPRINT1
Definition: precomp.h:8
DESIGNVECTOR elfDesignVector
Definition: wingdi.h:2779
unsigned int ULONG
Definition: retypes.h:1
_In_ ULONG cjBuffer
Definition: ntgdi.h:2860
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define DPRINT
Definition: sndvol32.h:71

Referenced by GreGetObject().

◆ ftGdiGetFontData()

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

Definition at line 4662 of file freetype.c.

4668 {
4670  FT_Face Face = FontGdi->SharedFace->Face;
4671 
4672  IntLockFreeType();
4673 
4674  if (FT_IS_SFNT(Face))
4675  {
4676  if (Table)
4677  Table = Table >> 24 | Table << 24 | (Table >> 8 & 0xFF00) |
4678  (Table << 8 & 0xFF0000);
4679 
4680  if (!Buffer) Size = 0;
4681 
4682  if (Buffer && Size)
4683  {
4684  FT_Error Error;
4685  FT_ULong Needed = 0;
4686 
4687  Error = FT_Load_Sfnt_Table(Face, Table, Offset, NULL, &Needed);
4688 
4689  if ( !Error && Needed < Size) Size = Needed;
4690  }
4691  if (!FT_Load_Sfnt_Table(Face, Table, Offset, Buffer, &Size))
4692  Result = Size;
4693  }
4694 
4696 
4697  return Result;
4698 }
int FT_Error
Definition: fttypes.h:300
ASMGENDATA Table[]
Definition: genincdata.c:61
unsigned long FT_ULong
Definition: fttypes.h:253
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
_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_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
#define NULL
Definition: types.h:112
#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 3761 of file freetype.c.

3770 {
3771  PDC_ATTR pdcattr;
3772  PTEXTOBJ TextObj;
3773  PFONTGDI FontGDI;
3774  HFONT hFont = 0;
3775  GLYPHMETRICS gm;
3776  ULONG Size;
3777  FT_Face ft_face;
3778  FT_UInt glyph_index;
3779  DWORD width, height, pitch, needed = 0;
3780  FT_Bitmap ft_bitmap;
3781  FT_Error error;
3782  INT left, right, top = 0, bottom = 0;
3784  FLOATOBJ eM11, widthRatio, eTemp;
3785  FT_Matrix transMat = identityMat;
3786  BOOL needsTransform = FALSE;
3787  INT orientation;
3788  LONG aveWidth;
3789  INT adv, lsb, bbx; /* These three hold to widths of the unrotated chars */
3790  OUTLINETEXTMETRICW *potm;
3791  XFORMOBJ xo;
3792  XFORML xform;
3793  LOGFONTW *plf;
3794 
3795  DPRINT("%u, %08x, %p, %08lx, %p, %p\n", wch, iFormat, pgm,
3796  cjBuf, pvBuf, pmat2);
3797 
3798  pdcattr = dc->pdcattr;
3799 
3800  XFORMOBJ_vInit(&xo, &dc->pdcattr->mxWorldToDevice);
3801  XFORMOBJ_iGetXform(&xo, &xform);
3802  FLOATOBJ_SetFloat(&eM11, xform.eM11);
3803 
3804  hFont = pdcattr->hlfntNew;
3805  TextObj = RealizeFontInit(hFont);
3806 
3807  if (!TextObj)
3808  {
3810  return GDI_ERROR;
3811  }
3812  FontGDI = ObjToGDI(TextObj->Font, FONT);
3813  ft_face = FontGDI->SharedFace->Face;
3814 
3815  plf = &TextObj->logfont.elfEnumLogfontEx.elfLogFont;
3816  aveWidth = FT_IS_SCALABLE(ft_face) ? abs(plf->lfWidth) : 0;
3817  orientation = FT_IS_SCALABLE(ft_face) ? plf->lfOrientation : 0;
3818 
3819  Size = IntGetOutlineTextMetrics(FontGDI, 0, NULL);
3821  if (!potm)
3822  {
3824  TEXTOBJ_UnlockText(TextObj);
3825  return GDI_ERROR;
3826  }
3827  Size = IntGetOutlineTextMetrics(FontGDI, Size, potm);
3828  if (!Size)
3829  {
3830  /* FIXME: last error? */
3832  TEXTOBJ_UnlockText(TextObj);
3833  return GDI_ERROR;
3834  }
3835 
3836  IntLockFreeType();
3837  TextIntUpdateSize(dc, TextObj, FontGDI, FALSE);
3839 
3840  TEXTOBJ_UnlockText(TextObj);
3841 
3842  glyph_index = get_glyph_index_flagged(ft_face, wch, GGO_GLYPH_INDEX, iFormat);
3844 
3845  if (orientation || (iFormat != GGO_METRICS && iFormat != GGO_BITMAP) || aveWidth || pmat2)
3846  load_flags |= FT_LOAD_NO_BITMAP;
3847 
3848  if (iFormat & GGO_UNHINTED)
3849  {
3850  load_flags |= FT_LOAD_NO_HINTING;
3851  iFormat &= ~GGO_UNHINTED;
3852  }
3853 
3854  error = FT_Load_Glyph(ft_face, glyph_index, load_flags);
3855  if (error)
3856  {
3857  DPRINT1("WARNING: Failed to load and render glyph! [index: %u]\n", glyph_index);
3859  if (potm) ExFreePoolWithTag(potm, GDITAG_TEXT);
3860  return GDI_ERROR;
3861  }
3863 
3864  FLOATOBJ_Set1(&widthRatio);
3865  if (aveWidth && potm)
3866  {
3867  // widthRatio = aveWidth * eM11 / potm->otmTextMetrics.tmAveCharWidth
3868  FLOATOBJ_SetLong(&widthRatio, aveWidth);
3869  FLOATOBJ_Mul(&widthRatio, &eM11);
3870  FLOATOBJ_DivLong(&widthRatio, potm->otmTextMetrics.tmAveCharWidth);
3871  }
3872 
3873  //left = (INT)(ft_face->glyph->metrics.horiBearingX * widthRatio) & -64;
3874  FLOATOBJ_SetLong(&eTemp, ft_face->glyph->metrics.horiBearingX);
3875  FLOATOBJ_Mul(&eTemp, &widthRatio);
3876  left = FLOATOBJ_GetLong(&eTemp) & -64;
3877 
3878  //right = (INT)((ft_face->glyph->metrics.horiBearingX +
3879  // ft_face->glyph->metrics.width) * widthRatio + 63) & -64;
3880  FLOATOBJ_SetLong(&eTemp, ft_face->glyph->metrics.horiBearingX * ft_face->glyph->metrics.width);
3881  FLOATOBJ_Mul(&eTemp, &widthRatio);
3882  FLOATOBJ_AddLong(&eTemp, 63);
3883  right = FLOATOBJ_GetLong(&eTemp) & -64;
3884 
3885  //adv = (INT)((ft_face->glyph->metrics.horiAdvance * widthRatio) + 63) >> 6;
3886  FLOATOBJ_SetLong(&eTemp, ft_face->glyph->metrics.horiAdvance);
3887  FLOATOBJ_Mul(&eTemp, &widthRatio);
3888  FLOATOBJ_AddLong(&eTemp, 63);
3889  adv = FLOATOBJ_GetLong(&eTemp) >> 6;
3890 
3891  lsb = left >> 6;
3892  bbx = (right - left) >> 6;
3893 
3894  DPRINT("Advance = %d, lsb = %d, bbx = %d\n",adv, lsb, bbx);
3895 
3896  IntLockFreeType();
3897 
3898  /* Width scaling transform */
3899  if (!FLOATOBJ_Equal1(&widthRatio))
3900  {
3901  FT_Matrix scaleMat;
3902 
3903  eTemp = widthRatio;
3904  FLOATOBJ_MulLong(&eTemp, 1 << 16);
3905 
3906  scaleMat.xx = FLOATOBJ_GetLong(&eTemp);
3907  scaleMat.xy = 0;
3908  scaleMat.yx = 0;
3909  scaleMat.yy = INT_TO_FIXED(1);
3910  FT_Matrix_Multiply(&scaleMat, &transMat);
3911  needsTransform = TRUE;
3912  }
3913 
3914  /* World transform */
3915  {
3916  FT_Matrix ftmatrix;
3918 
3919  /* Create a freetype matrix, by converting to 16.16 fixpoint format */
3920  FtMatrixFromMx(&ftmatrix, pmx);
3921 
3922  if (memcmp(&ftmatrix, &identityMat, sizeof(identityMat)) != 0)
3923  {
3924  FT_Matrix_Multiply(&ftmatrix, &transMat);
3925  needsTransform = TRUE;
3926  }
3927  }
3928 
3929  /* Rotation transform */
3930  if (orientation)
3931  {
3932  FT_Matrix rotationMat;
3933  DPRINT("Rotation Trans!\n");
3934  IntEscapeMatrix(&rotationMat, orientation);
3935  FT_Matrix_Multiply(&rotationMat, &transMat);
3936  needsTransform = TRUE;
3937  }
3938 
3939  /* Extra transformation specified by caller */
3940  if (pmat2)
3941  {
3942  FT_Matrix extraMat;
3943  DPRINT("MAT2 Matrix Trans!\n");
3944  extraMat.xx = FT_FixedFromFIXED(pmat2->eM11);
3945  extraMat.xy = FT_FixedFromFIXED(pmat2->eM21);
3946  extraMat.yx = FT_FixedFromFIXED(pmat2->eM12);
3947  extraMat.yy = FT_FixedFromFIXED(pmat2->eM22);
3948  FT_Matrix_Multiply(&extraMat, &transMat);
3949  needsTransform = TRUE;
3950  }
3951 
3952  if (potm) ExFreePoolWithTag(potm, GDITAG_TEXT); /* It looks like we are finished with potm ATM. */
3953 
3954  if (!needsTransform)
3955  {
3956  DPRINT("No Need to be Transformed!\n");
3957  top = (ft_face->glyph->metrics.horiBearingY + 63) & -64;
3958  bottom = (ft_face->glyph->metrics.horiBearingY -
3959  ft_face->glyph->metrics.height) & -64;
3960  gm.gmCellIncX = adv;
3961  gm.gmCellIncY = 0;
3962  }
3963  else
3964  {
3965  INT xc, yc;
3966  FT_Vector vec;
3967  for (xc = 0; xc < 2; xc++)
3968  {
3969  for (yc = 0; yc < 2; yc++)
3970  {
3971  vec.x = (ft_face->glyph->metrics.horiBearingX +
3972  xc * ft_face->glyph->metrics.width);
3973  vec.y = ft_face->glyph->metrics.horiBearingY -
3974  yc * ft_face->glyph->metrics.height;
3975  DPRINT("Vec %ld,%ld\n", vec.x, vec.y);
3976  FT_Vector_Transform(&vec, &transMat);
3977  if (xc == 0 && yc == 0)
3978  {
3979  left = right = vec.x;
3980  top = bottom = vec.y;
3981  }
3982  else
3983  {
3984  if (vec.x < left) left = vec.x;
3985  else if (vec.x > right) right = vec.x;
3986  if (vec.y < bottom) bottom = vec.y;
3987  else if (vec.y > top) top = vec.y;
3988  }
3989  }
3990  }
3991  left = left & -64;
3992  right = (right + 63) & -64;
3993  bottom = bottom & -64;
3994  top = (top + 63) & -64;
3995 
3996  DPRINT("Transformed box: (%d,%d - %d,%d)\n", left, top, right, bottom);
3997  vec.x = ft_face->glyph->metrics.horiAdvance;
3998  vec.y = 0;
3999  FT_Vector_Transform(&vec, &transMat);
4000  gm.gmCellIncX = (vec.x+63) >> 6;
4001  gm.gmCellIncY = -((vec.y+63) >> 6);
4002  }
4003  gm.gmBlackBoxX = (right - left) >> 6;
4004  gm.gmBlackBoxY = (top - bottom) >> 6;
4005  gm.gmptGlyphOrigin.x = left >> 6;
4006  gm.gmptGlyphOrigin.y = top >> 6;
4007 
4008  DPRINT("CX %d CY %d BBX %u BBY %u GOX %d GOY %d\n",
4009  gm.gmCellIncX, gm.gmCellIncY,
4010  gm.gmBlackBoxX, gm.gmBlackBoxY,
4012 
4014 
4015 
4016  if (iFormat == GGO_METRICS)
4017  {
4018  DPRINT("GGO_METRICS Exit!\n");
4019  *pgm = gm;
4020  return 1; /* FIXME */
4021  }
4022 
4023  if (ft_face->glyph->format != ft_glyph_format_outline && iFormat != GGO_BITMAP)
4024  {
4025  DPRINT1("Loaded a bitmap\n");
4026  return GDI_ERROR;
4027  }
4028 
4029  switch (iFormat)
4030  {
4031  case GGO_BITMAP:
4032  {
4033  width = gm.gmBlackBoxX;
4034  height = gm.gmBlackBoxY;
4035  pitch = ((width + 31) >> 5) << 2;
4036  needed = pitch * height;
4037 
4038  if (!pvBuf || !cjBuf) break;
4039  if (!needed) return GDI_ERROR; /* empty glyph */
4040  if (needed > cjBuf)
4041  return GDI_ERROR;
4042 
4043  switch (ft_face->glyph->format)
4044  {
4046  {
4047  BYTE *src = ft_face->glyph->bitmap.buffer, *dst = pvBuf;
4048  INT w = min( pitch, (ft_face->glyph->bitmap.width + 7) >> 3 );
4049  INT h = min( height, ft_face->glyph->bitmap.rows );
4050  while (h--)
4051  {
4052  RtlCopyMemory(dst, src, w);
4053  src += ft_face->glyph->bitmap.pitch;
4054  dst += pitch;
4055  }
4056  break;
4057  }
4058 
4060  {
4061  ft_bitmap.width = width;
4062  ft_bitmap.rows = height;
4063  ft_bitmap.pitch = pitch;
4064  ft_bitmap.pixel_mode = FT_PIXEL_MODE_MONO;
4065  ft_bitmap.buffer = pvBuf;
4066 
4067  IntLockFreeType();
4068  if (needsTransform)
4069  {
4070  FT_Outline_Transform(&ft_face->glyph->outline, &transMat);
4071  }
4072  FT_Outline_Translate(&ft_face->glyph->outline, -left, -bottom );
4073  /* Note: FreeType will only set 'black' bits for us. */
4074  RtlZeroMemory(pvBuf, needed);
4075  FT_Outline_Get_Bitmap(g_FreeTypeLibrary, &ft_face->glyph->outline, &ft_bitmap);
4077  break;
4078  }
4079 
4080  default:
4081  DPRINT1("Loaded glyph format %x\n", ft_face->glyph->format);
4082  return GDI_ERROR;
4083  }
4084 
4085  break;
4086  }
4087 
4088  case GGO_GRAY2_BITMAP:
4089  case GGO_GRAY4_BITMAP:
4090  case GGO_GRAY8_BITMAP:
4091  {
4092  unsigned int mult, row, col;
4093  BYTE *start, *ptr;
4094 
4095  width = gm.gmBlackBoxX;
4096  height = gm.gmBlackBoxY;
4097  pitch = (width + 3) / 4 * 4;
4098  needed = pitch * height;
4099 
4100  if (!pvBuf || !cjBuf) break;
4101  if (!needed) return GDI_ERROR; /* empty glyph */
4102  if (needed > cjBuf)
4103  return GDI_ERROR;
4104 
4105  switch (ft_face->glyph->format)
4106  {
4108  {
4109  BYTE *src = ft_face->glyph->bitmap.buffer, *dst = pvBuf;
4110  INT h = min( height, ft_face->glyph->bitmap.rows );
4111  INT x;
4112  while (h--)
4113  {
4114  for (x = 0; (UINT)x < pitch; x++)
4115  {
4116  if (x < ft_face->glyph->bitmap.width)
4117  dst[x] = (src[x / 8] & (1 << ( (7 - (x % 8))))) ? 0xff : 0;
4118  else
4119  dst[x] = 0;
4120  }
4121  src += ft_face->glyph->bitmap.pitch;
4122  dst += pitch;
4123  }
4124  break;
4125  }
4127  {
4128  ft_bitmap.width = width;
4129  ft_bitmap.rows = height;
4130  ft_bitmap.pitch = pitch;
4131  ft_bitmap.pixel_mode = FT_PIXEL_MODE_GRAY;
4132  ft_bitmap.buffer = pvBuf;
4133 
4134  IntLockFreeType();
4135  if (needsTransform)
4136  {
4137  FT_Outline_Transform(&ft_face->glyph->outline, &transMat);
4138  }
4139  FT_Outline_Translate(&ft_face->glyph->outline, -left, -bottom );
4140  RtlZeroMemory(ft_bitmap.buffer, cjBuf);
4141  FT_Outline_Get_Bitmap(g_FreeTypeLibrary, &ft_face->glyph->outline, &ft_bitmap);
4143 
4144  if (iFormat == GGO_GRAY2_BITMAP)
4145  mult = 4;
4146  else if (iFormat == GGO_GRAY4_BITMAP)
4147  mult = 16;
4148  else if (iFormat == GGO_GRAY8_BITMAP)
4149  mult = 64;
4150  else
4151  {
4152  return GDI_ERROR;
4153  }
4154 
4155  start = pvBuf;
4156  for (row = 0; row < height; row++)
4157  {
4158  ptr = start;
4159  for (col = 0; col < width; col++, ptr++)
4160  {
4161  *ptr = (((int)*ptr) * mult + 128) / 256;
4162  }
4163  start += pitch;
4164  }
4165 
4166  break;
4167  }
4168  default:
4169  DPRINT1("Loaded glyph format %x\n", ft_face->glyph->format);
4170  return GDI_ERROR;
4171  }
4172 
4173  break;
4174  }
4175 
4176  case GGO_NATIVE:
4177  {
4178  FT_Outline *outline = &ft_face->glyph->outline;
4179 
4180  if (cjBuf == 0) pvBuf = NULL; /* This is okay, need cjBuf to allocate. */
4181 
4182  IntLockFreeType();
4183  if (needsTransform && pvBuf) FT_Outline_Transform(outline, &transMat);
4184 
4186 
4187  if (!pvBuf || !cjBuf)
4188  {
4190  break;
4191  }
4192  if (needed > cjBuf)
4193  {
4195  return GDI_ERROR;
4196  }
4199  break;
4200  }
4201 
4202  case GGO_BEZIER:
4203  {
4204  FT_Outline *outline = &ft_face->glyph->outline;
4205  if (cjBuf == 0) pvBuf = NULL;
4206 
4207  if (needsTransform && pvBuf)
4208  {
4209  IntLockFreeType();
4210  FT_Outline_Transform(outline, &transMat);
4212  }
4214 
4215  if (!pvBuf || !cjBuf)
4216  break;
4217  if (needed > cjBuf)
4218  return GDI_ERROR;
4219 
4221  break;
4222  }
4223 
4224  default:
4225  DPRINT1("Unsupported format %u\n", iFormat);
4226  return GDI_ERROR;
4227  }
4228 
4229  DPRINT("ftGdiGetGlyphOutline END and needed %lu\n", needed);
4230 
4231  if (gm.gmBlackBoxX == 0)
4232  gm.gmBlackBoxX = 1;
4233  if (gm.gmBlackBoxY == 0)
4234  gm.gmBlackBoxY = 1;
4235 
4236  *pgm = gm;
4237  return needed;
4238 }
#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
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
#define TRUE
Definition: types.h:120
#define FLOATOBJ_Set1(fo)
Definition: floatobj.h:119
signed int FT_Int
Definition: fttypes.h:220
#define FLOATOBJ_DivLong(pf, l)
Definition: winddi.h:2829
FT_Glyph_Metrics metrics
Definition: freetype.h:1916
LONG tmAveCharWidth
Definition: wingdi.h:2387
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
#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
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
unsigned char * buffer
Definition: ftimage.h:266
#define GGO_GRAY4_BITMAP
Definition: wingdi.h:852
FORCEINLINE VOID TEXTOBJ_UnlockText(PLFONT plfnt)
Definition: text.h:96
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
short gmCellIncY
Definition: wingdi.h:2445
FT_Matrix_Multiply(const FT_Matrix *a, FT_Matrix *b)
Definition: ftcalc.c:661
FORCEINLINE VOID XFORMOBJ_vInit(OUT XFORMOBJ *pxo, IN MATRIX *pmx)
Definition: xformobj.h:21
#define FT_LOAD_DEFAULT
Definition: freetype.h:3008
int32_t INT
Definition: typedefs.h:58
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
#define FALSE
Definition: types.h:117
BOOL FASTCALL TextIntUpdateSize(PDC dc, PTEXTOBJ TextObj, PFONTGDI FontGDI, BOOL bDoLock)
Definition: freetype.c:3623
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:2457
LONG lfWidth
Definition: dimm.idl:60
FT_Library g_FreeTypeLibrary
Definition: freetype.c:55
GLint GLint bottom
Definition: glext.h:7726
FT_Outline_Transform(const FT_Outline *outline, const FT_Matrix *matrix)
Definition: ftoutln.c:711
#define ft_glyph_format_outline
Definition: ftimage.h:732
#define ft_glyph_format_bitmap
Definition: ftimage.h:731
VOID FASTCALL FtMatrixFromMx(FT_Matrix *pmat, PMATRIX pmx)
Definition: freetype.c:752
#define FLOATOBJ_MulLong(pf, l)
Definition: winddi.h:2826
POINT gmptGlyphOrigin
Definition: wingdi.h:2443
FLOAT FLOATOBJ
Definition: winddi.h:677
#define IntUnLockFreeType()
Definition: freetype.c:82
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint left
Definition: glext.h:7726
GLdouble GLdouble right
Definition: glext.h:10859
static unsigned int get_native_glyph_outline(FT_Outline *outline, unsigned int buflen, char *buf)
Definition: freetype.c:3307
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:3380
#define IntLockFreeType()
Definition: freetype.c:79
FT_Outline outline
Definition: freetype.h:1927
static FT_UInt FASTCALL get_glyph_index_flagged(FT_Face face, FT_ULong code, DWORD indexed_flag, DWORD flags)
Definition: freetype.c:3741
GLenum src
Definition: glext.h:6340
FT_Bitmap bitmap
Definition: freetype.h:1923
LONG APIENTRY FLOATOBJ_GetLong(FLOATOBJ *pf)
Definition: floatobj.c:17
Definition: mesh.c:5329
ENUMLOGFONTEXDVW logfont
Definition: text.h:70
unsigned char BYTE
Definition: xxhash.c:193
short gmCellIncX
Definition: wingdi.h:2444
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
_In_ SIZEL _In_ ULONG iFormat
Definition: winddi.h:3467
FT_GlyphSlot glyph
Definition: freetype.h:1105
#define FLOATOBJ_SetLong(pf, l)
Definition: winddi.h:2815
FT_Glyph_Format format
Definition: freetype.h:1921
FONTOBJ * Font
Definition: text.h:66
VOID FASTCALL IntEscapeMatrix(FT_Matrix *pmat, LONG lfEscapement)
Definition: freetype.c:739
FT_Vector_Transform(FT_Vector *vec, const FT_Matrix *matrix)
Definition: ftoutln.c:688
#define GDITAG_TEXT
Definition: tags.h:171
PSHARED_FACE SharedFace
Definition: engobjects.h:142
PTEXTOBJ FASTCALL RealizeFontInit(HFONT hFont)
Definition: font.c:422
unsigned int FT_UInt
Definition: fttypes.h:231
GLuint start
Definition: gl.h:1545
FT_Fixed xy
Definition: fttypes.h:387
GLenum GLenum dst
Definition: glext.h:6340
UINT gmBlackBoxY
Definition: wingdi.h:2442
#define min(a, b)
Definition: monoChain.cc:55
#define GGO_GRAY2_BITMAP
Definition: wingdi.h:851
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
TEXTMETRICW otmTextMetrics
Definition: wingdi.h:2513
#define FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH
Definition: freetype.h:3017
int pitch
Definition: ftimage.h:265
#define DPRINT1
Definition: precomp.h:8
static const FT_Matrix identityMat
Definition: freetype.c:50
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
FT_Outline_Translate(const FT_Outline *outline, FT_Pos xOffset, FT_Pos yOffset)
Definition: ftoutln.c:528
LOGFONTW elfLogFont
Definition: wingdi.h:2701
UINT gmBlackBoxX
Definition: wingdi.h:2441
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define ObjToGDI(ClipObj, Type)
Definition: engobjects.h:180
#define FLOATOBJ_Equal1(pf)
Definition: floatobj.h:105
static const WCHAR dc[]
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
FORCEINLINE PMATRIX DC_pmxWorldToDevice(PDC pdc)
Definition: coord.h:135
#define FT_LOAD_NO_BITMAP
Definition: freetype.h:3012
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
FT_Fixed yx
Definition: fttypes.h:388
ENUMLOGFONTEXW elfEnumLogfontEx
Definition: wingdi.h:2778
FT_Fixed yy
Definition: fttypes.h:388
#define DPRINT
Definition: sndvol32.h:71
#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 5679 of file freetype.c.

5682 {
5683  DWORD Count = 0;
5684  INT i = 0;
5685  FT_Face face = Font->SharedFace->Face;
5686 
5687  if (FT_HAS_KERNING(face) && face->charmap->encoding == FT_ENCODING_UNICODE)
5688  {
5689  FT_UInt previous_index = 0, glyph_index = 0;
5690  FT_ULong char_code, char_previous;
5691  FT_Vector delta;
5692 
5693  char_previous = char_code = FT_Get_First_Char(face, &glyph_index);
5694 
5695  IntLockFreeType();
5696 
5697  while (glyph_index)
5698  {
5699  if (previous_index && glyph_index)
5700  {
5701  FT_Get_Kerning(face, previous_index, glyph_index, FT_KERNING_DEFAULT, &delta);
5702 
5703  if (pKerningPair && cPairs)
5704  {
5705  pKerningPair[i].wFirst = char_previous;
5706  pKerningPair[i].wSecond = char_code;
5707  pKerningPair[i].iKernAmount = delta.x;
5708  i++;
5709  if (i == cPairs) break;
5710  }
5711  Count++;
5712  }
5713  previous_index = glyph_index;
5714  char_previous = char_code;
5715  char_code = FT_Get_Next_Char(face, char_code, &glyph_index);
5716  }
5718  }
5719  return Count;
5720 }
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
int32_t INT
Definition: typedefs.h:58
#define FT_HAS_KERNING(face)
Definition: freetype.h:1297
int Count
Definition: noreturn.cpp:7
#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
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 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 3132 of file freetype.c.

3133 {
3134  if ( lprs )
3135  {
3136  lprs->nSize = sizeof(RASTERIZER_STATUS);
3137  lprs->wFlags = TT_AVAILABLE | TT_ENABLED;
3138  lprs->nLanguageID = gusLanguageID;
3139  return TRUE;
3140  }
3142  return FALSE;
3143 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define TRUE
Definition: types.h:120
struct _RASTERIZER_STATUS RASTERIZER_STATUS
#define FALSE
Definition: types.h:117
#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 4385 of file freetype.c.

4389 {
4390  PDC_ATTR pdcattr;
4391  UINT Ret = DEFAULT_CHARSET;
4392  INT i;
4393  HFONT hFont;
4394  PTEXTOBJ TextObj;
4395  PFONTGDI FontGdi;
4396  FONTSIGNATURE fs;
4397  TT_OS2 *pOS2;
4398  FT_Face Face;
4399  CHARSETINFO csi;
4400  DWORD cp, fs0;
4401  USHORT usACP, usOEM;
4402 
4403  pdcattr = Dc->pdcattr;
4404  hFont = pdcattr->hlfntNew;
4405  TextObj = RealizeFontInit(hFont);
4406 
4407  if (!TextObj)
4408  {
4410  return Ret;
4411  }
4412  FontGdi = ObjToGDI(TextObj->Font, FONT);
4413  Face = FontGdi->SharedFace->Face;
4414  TEXTOBJ_UnlockText(TextObj);
4415 
4416  memset(&fs, 0, sizeof(FONTSIGNATURE));
4417  IntLockFreeType();
4418  pOS2 = FT_Get_Sfnt_Table(Face, ft_sfnt_os2);
4419  if (NULL != pOS2)
4420  {
4421  fs.fsCsb[0] = pOS2->ulCodePageRange1;
4422  fs.fsCsb[1] = pOS2->ulCodePageRange2;
4423  fs.fsUsb[0] = pOS2->ulUnicodeRange1;
4424  fs.fsUsb[1] = pOS2->ulUnicodeRange2;
4425  fs.fsUsb[2] = pOS2->ulUnicodeRange3;
4426  fs.fsUsb[3] = pOS2->ulUnicodeRange4;
4427  if (pOS2->version == 0)
4428  {
4429  FT_UInt dummy;
4430 
4431  if (FT_Get_First_Char( Face, &dummy ) < 0x100)
4432  fs.fsCsb[0] |= FS_LATIN1;
4433  else
4434  fs.fsCsb[0] |= FS_SYMBOL;
4435  }
4436  }
4437  pOS2 = NULL;
4439  DPRINT("Csb 1=%x 0=%x\n", fs.fsCsb[1],fs.fsCsb[0]);
4440  if (fs.fsCsb[0] == 0)
4441  { /* Let's see if we can find any interesting cmaps */
4442  for (i = 0; i < Face->num_charmaps; i++)
4443  {
4444  switch (Face->charmaps[i]->encoding)
4445  {
4446  case FT_ENCODING_UNICODE:
4447  case FT_ENCODING_APPLE_ROMAN:
4448  fs.fsCsb[0] |= FS_LATIN1;
4449  break;
4450  case FT_ENCODING_MS_SYMBOL:
4451  fs.fsCsb[0] |= FS_SYMBOL;
4452  break;
4453  default:
4454  break;
4455  }
4456  }
4457  }
4458  if (lpSig)
4459  {
4460  RtlCopyMemory(lpSig, &fs, sizeof(FONTSIGNATURE));
4461  }
4462 
4463  RtlGetDefaultCodePage(&usACP, &usOEM);
4464  cp = usACP;
4465 
4467  if (csi.fs.fsCsb[0] & fs.fsCsb[0])
4468  {
4469  DPRINT("Hit 1\n");
4470  Ret = csi.ciCharset;
4471  goto Exit;
4472  }
4473 
4474  for (i = 0; i < MAXTCIINDEX; i++)
4475  {
4476  fs0 = 1L << i;
4477  if (fs.fsCsb[0] & fs0)
4478  {
4479  if (IntTranslateCharsetInfo(&fs0, &csi, TCI_SRCFONTSIG))
4480  {
4481  // *cp = csi.ciACP;
4482  DPRINT("Hit 2\n");
4483  Ret = csi.ciCharset;
4484  goto Exit;
4485  }
4486  else
4487  DPRINT1("TCI failing on %x\n", fs0);
4488  }
4489  }
4490 Exit:
4491  DPRINT("CharSet %u CodePage %u\n", csi.ciCharset, csi.ciACP);
4492  return (MAKELONG(csi.ciACP, csi.ciCharset));
4493 }
FONTSIGNATURE fs
Definition: wingdi.h:1547
FT_CharMap * charmaps
Definition: freetype.h:1085
#define ft_sfnt_os2
Definition: tttables.h:631
#define TCI_SRCFONTSIG
Definition: wingdi.h:962
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
FORCEINLINE VOID TEXTOBJ_UnlockText(PLFONT plfnt)
Definition: text.h:96
Definition: fs.h:235
#define DEFAULT_CHARSET
Definition: wingdi.h:383
int32_t INT
Definition: typedefs.h:58
#define MAXTCIINDEX
Definition: freetype.c:123
HFONT hFont
Definition: main.c:53
FT_ULong ulUnicodeRange1
Definition: tttables.h:401
Definition: text.h:59
HANDLE hlfntNew
Definition: ntgdihdl.h:334
FT_Get_Sfnt_Table(FT_Face face, FT_Sfnt_Tag tag)
Definition: ftobjs.c:4113
UINT ciCharset
Definition: wingdi.h:1545
#define MAKELONG(a, b)
Definition: typedefs.h:249
FT_UShort version
Definition: tttables.h:382
NTSYSAPI VOID NTAPI RtlGetDefaultCodePage(_Out_ PUSHORT AnsiCodePage, _Out_ PUSHORT OemCodePage)
#define fs
Definition: i386-dis.c:437
static BOOLEAN APIENTRY IntTranslateCharsetInfo(PDWORD Src, LPCHARSETINFO Cs, DWORD Flags)
Definition: freetype.c:2093
#define FS_SYMBOL
Definition: wingdi.h:574
static void Exit(void)
Definition: sock.c:1331
#define IntUnLockFreeType()
Definition: freetype.c:82
unsigned long DWORD
Definition: ntddk_ex.h:95
FT_Face Face
Definition: engobjects.h:129
FT_Get_First_Char(FT_Face face, FT_UInt *agindex)
Definition: ftobjs.c:3697
FT_Encoding encoding
Definition: freetype.h:843
static const WCHAR L[]
Definition: oid.c:1250
#define IntLockFreeType()
Definition: freetype.c:79
FT_Int num_charmaps
Definition: freetype.h:1084
FONTOBJ * Font
Definition: text.h:66
DWORD fsCsb[2]
Definition: wingdi.h:1542
FT_ULong ulCodePageRange1
Definition: tttables.h:419
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
PSHARED_FACE SharedFace
Definition: engobjects.h:142
unsigned short USHORT
Definition: pedump.c:61
PTEXTOBJ FASTCALL RealizeFontInit(HFONT hFont)
Definition: font.c:422
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
#define NULL
Definition: types.h:112
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 RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define DPRINT
Definition: sndvol32.h:71
#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 4566 of file freetype.c.

4569 {
4570  PDC dc;
4571  PDC_ATTR pdcattr;
4572  PTEXTOBJ TextObj;
4573  PFONTGDI FontGDI;
4574  FT_Face Face;
4575  TT_OS2 *pOS2;
4576  TT_HoriHeader *pHori;
4577  FT_WinFNT_HeaderRec Win;
4578  ULONG Error;
4580  LOGFONTW *plf;
4581 
4582  if (!ptmwi)
4583  {
4585  return FALSE;
4586  }
4587  RtlZeroMemory(ptmwi, sizeof(TMW_INTERNAL));
4588 
4589  if (!(dc = DC_LockDc(hDC)))
4590  {
4592  return FALSE;
4593  }
4594  pdcattr = dc->pdcattr;
4595  TextObj = RealizeFontInit(pdcattr->hlfntNew);
4596  if (NULL != TextObj)
4597  {
4598  plf = &TextObj->logfont.elfEnumLogfontEx.elfLogFont;
4599  FontGDI = ObjToGDI(TextObj->Font, FONT);
4600 
4601  Face = FontGDI->SharedFace->Face;
4602 
4603  IntLockFreeType();
4604  Error = IntRequestFontSize(dc, FontGDI, plf->lfWidth, plf->lfHeight);
4607 
4608  if (0 != Error)
4609  {
4610  DPRINT1("Error in setting pixel sizes: %u\n", Error);
4612  }
4613  else
4614  {
4615  FT_Face Face = FontGDI->SharedFace->Face;
4617 
4618  IntLockFreeType();
4619  pOS2 = FT_Get_Sfnt_Table(Face, ft_sfnt_os2);
4620  if (NULL == pOS2)
4621  {
4622  DPRINT1("Can't find OS/2 table - not TT font?\n");
4624  }
4625 
4626  pHori = FT_Get_Sfnt_Table(Face, ft_sfnt_hhea);
4627  if (NULL == pHori)
4628  {
4629  DPRINT1("Can't find HHEA table - not TT font?\n");
4631  }
4632 
4633  Error = FT_Get_WinFNT_Header(Face, &Win);
4634 
4635  if (NT_SUCCESS(Status) || !Error)
4636  {
4637  FillTM(&ptmwi->TextMetric, FontGDI, pOS2, pHori, !Error ? &Win : 0);
4638 
4639  /* FIXME: Fill Diff member */
4640  }
4641 
4643  }
4644  TEXTOBJ_UnlockText(TextObj);
4645  }
4646  else
4647  {
4649  }
4650  DC_UnlockDc(dc);
4651 
4652  if (!NT_SUCCESS(Status))
4653  {
4655  return FALSE;
4656  }
4657  return TRUE;
4658 }
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
#define TRUE
Definition: types.h:120
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
LONG lfHeight
Definition: dimm.idl:59
LONG NTSTATUS
Definition: precomp.h:26
FORCEINLINE VOID TEXTOBJ_UnlockText(PLFONT plfnt)
Definition: text.h:96
#define STATUS_INVALID_HANDLE
Definition: ntstatus.h:245
#define STATUS_INTERNAL_ERROR
Definition: ntstatus.h:465
#define FALSE
Definition: types.h:117
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:2156
LONG lfWidth
Definition: dimm.idl:60
#define ft_sfnt_hhea
Definition: tttables.h:632
Status
Definition: gdiplustypes.h:24
Definition: polytest.cpp:40
static FT_Error IntRequestFontSize(PDC dc, PFONTGDI FontGDI, LONG lfWidth, LONG lfHeight)
Definition: freetype.c:3505
#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
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 NULL
Definition: types.h:112
#define DPRINT1
Definition: precomp.h:8
LOGFONTW elfLogFont
Definition: wingdi.h:2701
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define ObjToGDI(ClipObj, Type)
Definition: engobjects.h:180
static const WCHAR dc[]
FORCEINLINE PMATRIX DC_pmxWorldToDevice(PDC pdc)
Definition: coord.h:135
#define STATUS_SUCCESS
Definition: shellext.h:65
ENUMLOGFONTEXW elfEnumLogfontEx
Definition: wingdi.h:2778
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 5660 of file freetype.c.

5661 {
5662  if (FT_HAS_FIXED_SIZES(Font->SharedFace->Face))
5663  Info->iTechnology = RI_TECH_BITMAP;
5664  else
5665  {
5666  if (FT_IS_SCALABLE(Font->SharedFace->Face))
5667  Info->iTechnology = RI_TECH_SCALABLE;
5668  else
5669  Info->iTechnology = RI_TECH_FIXED;
5670  }
5671  Info->iUniq = Font->FontObj.iUniq;
5672  Info->dwUnknown = -1;
5673  return TRUE;
5674 }
#define RI_TECH_BITMAP
Definition: ntgdityp.h:271
#define TRUE
Definition: types.h:120
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:683
#define RI_TECH_SCALABLE
Definition: ntgdityp.h:273
#define FT_HAS_FIXED_SIZES(face)
Definition: freetype.h:1361
#define RI_TECH_FIXED
Definition: ntgdityp.h:272
#define FT_IS_SCALABLE(face)
Definition: freetype.h:1312

Referenced by NtGdiGetRealizationInfo().

◆ ftGetFontUnicodeRanges()

DWORD FASTCALL ftGetFontUnicodeRanges ( PFONTGDI  ,
PGLYPHSET   
)

Definition at line 4498 of file freetype.c.

4499 {
4500  DWORD size = 0;
4501  DWORD num_ranges = 0;
4502  FT_Face face = Font->SharedFace->Face;
4503 
4504  if (face->charmap->encoding == FT_ENCODING_UNICODE)
4505  {
4506  FT_UInt glyph_code = 0;
4507  FT_ULong char_code, char_code_prev;
4508 
4509  char_code_prev = char_code = FT_Get_First_Char(face, &glyph_code);
4510 
4511  DPRINT("Face encoding FT_ENCODING_UNICODE, number of glyphs %ld, first glyph %u, first char %04lx\n",
4512  face->num_glyphs, glyph_code, char_code);
4513 
4514  if (!glyph_code) return 0;
4515 
4516  if (glyphset)
4517  {
4518  glyphset->ranges[0].wcLow = (USHORT)char_code;
4519  glyphset->ranges[0].cGlyphs = 0;
4520  glyphset->cGlyphsSupported = 0;
4521  }
4522 
4523  num_ranges = 1;
4524  while (glyph_code)
4525  {
4526  if (char_code < char_code_prev)
4527  {
4528  DPRINT1("Expected increasing char code from FT_Get_Next_Char\n");
4529  return 0;
4530  }
4531  if (char_code - char_code_prev > 1)
4532  {
4533  num_ranges++;
4534  if (glyphset)
4535  {
4536  glyphset->ranges[num_ranges - 1].wcLow = (USHORT)char_code;
4537  glyphset->ranges[num_ranges - 1].cGlyphs = 1;
4538  glyphset->cGlyphsSupported++;
4539  }
4540  }
4541  else if (glyphset)
4542  {
4543  glyphset->ranges[num_ranges - 1].cGlyphs++;
4544  glyphset->cGlyphsSupported++;
4545  }
4546  char_code_prev = char_code;
4547  char_code = FT_Get_Next_Char(face, char_code, &glyph_code);
4548  }
4549  }
4550  else
4551  DPRINT1("Encoding %i not supported\n", face->charmap->encoding);
4552 
4553  size = sizeof(GLYPHSET) + sizeof(WCRANGE) * (num_ranges - 1);
4554  if (glyphset)
4555  {
4556  glyphset->cbThis = size;
4557  glyphset->cRanges = num_ranges;
4558  glyphset->flAccel = 0;
4559  }
4560  return size;
4561 }
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
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
#define DPRINT
Definition: sndvol32.h:71
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 }
WCHAR elfFullName[LF_FULLFACESIZE]
Definition: wingdi.h:2702
DWORD dvNumAxes
Definition: wingdi.h:2768
WCHAR elfStyle[LF_FACESIZE]
Definition: wingdi.h:2703
WCHAR elfScript[LF_FACESIZE]
Definition: wingdi.h:2704
HFONT APIENTRY HfontCreate(IN PENUMLOGFONTEXDVW pelfw, IN ULONG cjElfw, IN LFTYPE lft, IN FLONG fl, IN PVOID pvCliData)
Definition: font.c:1140
#define NULL
Definition: types.h:112
DESIGNVECTOR elfDesignVector
Definition: wingdi.h:2779
LOGFONTW elfLogFont
Definition: wingdi.h:2701
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
ENUMLOGFONTEXW elfEnumLogfontEx
Definition: wingdi.h:2778

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

◆ GreExtTextOutW()

BOOL NTAPI GreExtTextOutW ( IN  HDC,
IN  INT,
IN  INT,
IN  UINT,
IN OPTIONAL RECTL ,
IN  LPCWSTR,
IN  INT,
IN OPTIONAL  LPINT,
IN  DWORD 
)

◆ GreGetTextExtentExW()

BOOL FASTCALL GreGetTextExtentExW ( HDC  ,
LPCWSTR  ,
ULONG  ,
ULONG  ,
PULONG  ,
PULONG  ,
LPSIZE  ,
FLONG   
)

Definition at line 135 of file text.c.

144 {
145  PDC pdc;
146  PDC_ATTR pdcattr;
147  BOOL Result;
148  PTEXTOBJ TextObj;
149 
150  if ( (!String && Count ) || !pSize )
151  {
153  return FALSE;
154  }
155 
156  if ( !Count )
157  {
158  if ( Fit ) Fit = 0;
159  return TRUE;
160  }
161 
162  pdc = DC_LockDc(hDC);
163  if (NULL == pdc)
164  {
166  return FALSE;
167  }
168  pdcattr = pdc->pdcattr;
169 
170  TextObj = RealizeFontInit(pdcattr->hlfntNew);
171  if ( TextObj )
172  {
174  TextObj,
175  String,
176  Count,
177  MaxExtent,
178  (LPINT)Fit,
179  (LPINT)Dx,
180  pSize,
181  fl);
182  TEXTOBJ_UnlockText(TextObj);
183  }
184  else
185  Result = FALSE;
186 
187  DC_UnlockDc(pdc);
188  return Result;
189 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
#define TRUE
Definition: types.h:120
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
FORCEINLINE VOID TEXTOBJ_UnlockText(PLFONT plfnt)
Definition: text.h:96
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFSTRING String
Definition: wdfdevice.h:2430
_In_ FLONG fl
Definition: winddi.h:1279
#define FALSE
Definition: types.h:117
Definition: text.h:59
unsigned int BOOL
Definition: ntddk_ex.h:94
HANDLE hlfntNew
Definition: ntgdihdl.h:334
_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
int Count
Definition: noreturn.cpp:7
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
#define NULL
Definition: types.h:112
BOOL FASTCALL TextIntGetTextExtentPoint(PDC dc, PTEXTOBJ TextObj, LPCWSTR String, INT Count, ULONG MaxExtent, LPINT Fit, LPINT Dx, LPSIZE Size, FLONG fl)
Definition: freetype.c:4242
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 78 of file text.c.

84 {
85  PDC pdc;
86  PDC_ATTR pdcattr;
87  BOOL Result;
88  PTEXTOBJ TextObj;
89 
90  if (!cwc)
91  {
92  psize->cx = 0;
93  psize->cy = 0;
94  return TRUE;
95  }
96 
97  pdc = DC_LockDc(hDC);
98  if (!pdc)
99  {
101  return FALSE;
102  }
103 
104  pdcattr = pdc->pdcattr;
105 
106  TextObj = RealizeFontInit(pdcattr->hlfntNew);
107  if ( TextObj )
108  {
110  TextObj,
111  lpwsz,
112  cwc,
113  0,
114  NULL,
115  0,
116  psize,
117  flOpts);
118  TEXTOBJ_UnlockText(TextObj);
119  }
120  else
121  Result = FALSE;
122 
123  DC_UnlockDc(pdc);
124  return Result;
125 }
_Must_inspect_result_ _Out_ LPSIZE psize
Definition: ntgdi.h:1569
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
#define TRUE
Definition: types.h:120
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
FORCEINLINE VOID TEXTOBJ_UnlockText(PLFONT plfnt)
Definition: text.h:96
#define FALSE
Definition: types.h:117
Definition: text.h:59
unsigned int BOOL
Definition: ntddk_ex.h:94
HANDLE hlfntNew
Definition: ntgdihdl.h:334
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
LONG cx
Definition: windef.h:334
Definition: polytest.cpp:40
static HDC hDC
Definition: 3dtext.c:33
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
PTEXTOBJ FASTCALL RealizeFontInit(HFONT hFont)
Definition: font.c:422
#define NULL
Definition: types.h:112
BOOL FASTCALL TextIntGetTextExtentPoint(PDC dc, PTEXTOBJ TextObj, LPCWSTR String, INT Count, ULONG MaxExtent, LPINT Fit, LPINT Dx, LPSIZE Size, FLONG fl)
Definition: freetype.c:4242
LONG cy
Definition: windef.h:335
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27

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

◆ GreGetTextMetricsW()

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

Definition at line 193 of file text.c.

196 {
197  TMW_INTERNAL tmwi;
198  if (!ftGdiGetTextMetricsW(hdc, &tmwi)) return FALSE;
199  IntTMWFixUp(hdc, &tmwi);
200  *lptm = tmwi.TextMetric;
201  return TRUE;
202 }
TEXTMETRICW TextMetric
Definition: ntgdityp.h:370
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
VOID FASTCALL IntTMWFixUp(HDC hDC, TMW_INTERNAL *ptm)
Definition: text.c:30
HDC hdc
Definition: main.c:9
BOOL FASTCALL ftGdiGetTextMetricsW(HDC hDC, PTMW_INTERNAL ptmwi)
Definition: freetype.c:4566
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 61 of file text.c.

67 {
68  return GreExtTextOutW(hdc, nXStart, nYStart, 0, NULL, lpString, cchString, NULL, 0);
69 }
BOOL APIENTRY GreExtTextOutW(IN HDC hDC, IN INT XStart, IN INT YStart, IN UINT fuOptions, IN OPTIONAL PRECTL lprc, IN LPCWSTR String, IN INT Count, IN OPTIONAL LPINT Dx, IN DWORD dwCodePage)
Definition: freetype.c:6625
HDC hdc
Definition: main.c:9
#define NULL
Definition: types.h:112

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
static UINT g_FontCacheNumEntries
Definition: freetype.c:94
#define TRUE
Definition: types.h:120
BOOL FASTCALL IntLoadFontsInRegistry(VOID)
Definition: freetype.c:1695
FT_Init_FreeType(FT_Library *alibrary)
Definition: ftinit.c:320
#define FALSE
Definition: types.h:117
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 NULL
Definition: types.h:112
#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
UINT ciCharset
Definition: wingdi.h:1545
#define OEM_CHARSET
Definition: wingdi.h:399
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 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 2023 of file freetype.c.

2024 {
2026 }
_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 1849 of file freetype.c.

1850 {
1851  HANDLE Ret = NULL;
1853  PFONT_ENTRY_COLL_MEM EntryCollection;
1854  INT FaceCount;
1855 
1857  if (!BufferCopy)
1858  {
1859  *pNumAdded = 0;
1860  return NULL;
1861  }
1862  RtlCopyMemory(BufferCopy, Buffer, dwSize);
1863 
1864  LoadFont.pFileName = NULL;
1865  LoadFont.Memory = SharedMem_Create(BufferCopy, dwSize, FALSE);
1866  LoadFont.Characteristics = FR_PRIVATE | FR_NOT_ENUM;
1867  RtlInitUnicodeString(&LoadFont.RegValueName, NULL);
1868  LoadFont.IsTrueType = FALSE;
1869  LoadFont.PrivateEntry = NULL;
1871 
1872  RtlFreeUnicodeString(&LoadFont.RegValueName);
1873 
1874  /* Release our copy */
1875  IntLockFreeType();
1876  SharedMem_Release(LoadFont.Memory);
1878 
1879  if (FaceCount > 0)
1880  {
1881  EntryCollection = ExAllocatePoolWithTag(PagedPool, sizeof(FONT_ENTRY_COLL_MEM), TAG_FONT);
1882  if (EntryCollection)
1883  {
1885  EntryCollection->Entry = LoadFont.PrivateEntry;
1886  IntLockProcessPrivateFonts(Win32Process);
1887  EntryCollection->Handle = ULongToHandle(++Win32Process->PrivateMemFontHandleCount);
1888  InsertTailList(&Win32Process->PrivateMemFontListHead, &EntryCollection->ListEntry);
1889  IntUnLockProcessPrivateFonts(Win32Process);
1890  Ret = EntryCollection->Handle;
1891  }
1892  }
1893  *pNumAdded = FaceCount;
1894 
1895  return Ret;
1896 }
#define ULongToHandle(h)
Definition: basetsd.h:81
UINT PrivateMemFontHandleCount
Definition: win32.h:278
#define IntLockProcessPrivateFonts(W32Process)
Definition: text.h:147
#define TAG_FONT
Definition: tags.h:12
#define IntUnLockProcessPrivateFonts(W32Process)
Definition: text.h:150
#define InsertTailList(ListHead, Entry)
int32_t INT
Definition: typedefs.h:58
FONT_ENTRY_MEM * Entry
Definition: font.h:23
#define FALSE
Definition: types.h:117
Definition: bufpool.h:45
BOOL LoadFont(LPWSTR lpCmdLine)
HANDLE Handle
Definition: font.h:22
LIST_ENTRY PrivateMemFontListHead
Definition: win32.h:277
LIST_ENTRY ListEntry
Definition: font.h:21
#define IntUnLockFreeType()
Definition: freetype.c:82
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define IntLockFreeType()
Definition: freetype.c:79
static PSHARED_MEM SharedMem_Create(PBYTE Buffer, ULONG BufferSize, BOOL IsMapping)
Definition: freetype.c:233
Definition: font.h:19
static void SharedMem_Release(PSHARED_MEM Ptr)
Definition: freetype.c:290
#define NULL
Definition: types.h:112
PVOID NTAPI PsGetCurrentProcessWin32Process(VOID)
Definition: process.c:1183
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
static INT FASTCALL IntGdiLoadFontsFromMemory(PGDI_LOAD_FONT pLoadFont, PSHARED_FACE SharedFace, FT_Long FontIndex, INT CharSetIndex)
Definition: freetype.c:1104

Referenced by NtGdiAddFontMemResourceEx().

◆ IntGdiAddFontResource()

INT FASTCALL IntGdiAddFontResource ( PUNICODE_STRING  FileName,
DWORD  Characteristics 
)

Definition at line 1679 of file freetype.c.

1680 {
1681  return IntGdiAddFontResourceEx(FileName, Characteristics, 0);
1682 }
INT FASTCALL IntGdiAddFontResourceEx(PUNICODE_STRING FileName, DWORD Characteristics, DWORD dwFlags)
Definition: freetype.c:1480

Referenced by NtGdiAddFontResourceW().

◆ IntGdiAddFontResourceEx()

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

Definition at line 1480 of file freetype.c.

1482 {
1483  NTSTATUS Status;
1485  PVOID Buffer = NULL;
1488  SIZE_T ViewSize = 0, Length;
1489  LARGE_INTEGER SectionSize;
1492  INT FontCount;
1493  HANDLE KeyHandle;
1494  UNICODE_STRING PathName;
1495  LPWSTR pszBuffer;
1497  static const UNICODE_STRING TrueTypePostfix = RTL_CONSTANT_STRING(L" (TrueType)");
1498  static const UNICODE_STRING DosPathPrefix = RTL_CONSTANT_STRING(L"\\??\\");
1499 
1500  /* Build PathName */
1502  {
1503  Length = DosPathPrefix.Length + FileName->Length + sizeof(UNICODE_NULL);
1505  if (!pszBuffer)
1506  return 0; /* failure */
1507 
1508  RtlInitEmptyUnicodeString(&PathName, pszBuffer, Length);
1509  RtlAppendUnicodeStringToString(&PathName, &DosPathPrefix);
1511  }
1512  else
1513  {
1514  Status = DuplicateUnicodeString(FileName, &PathName);
1515  if (!NT_SUCCESS(Status))
1516  return 0; /* failure */
1517  }
1518 
1519  /* Open the font file */
1522  Status = ZwOpenFile(
1523  &FileHandle,
1526  &Iosb,
1529  if (!NT_SUCCESS(Status))
1530  {
1531  DPRINT1("Could not load font file: %wZ\n", &PathName);
1532  RtlFreeUnicodeString(&PathName);
1533  return 0;
1534  }
1535 
1538  if (!NT_SUCCESS(Status))
1539  {
1540  DPRINT1("ObReferenceObjectByHandle failed.\n");
1542  RtlFreeUnicodeString(&PathName);
1543  return 0;
1544  }
1545 
1546  SectionSize.QuadPart = 0LL;
1549  NULL, &SectionSize, PAGE_READONLY,
1551  if (!NT_SUCCESS(Status))
1552  {
1553  DPRINT1("Could not map file: %wZ\n", &PathName);
1556  RtlFreeUnicodeString(&PathName);
1557  return 0;
1558  }
1560 
1562  if (!NT_SUCCESS(Status))
1563  {
1564  DPRINT1("Could not map file: %wZ\n", &PathName);
1567  RtlFreeUnicodeString(&PathName);
1568  return 0;
1569  }
1570 
1571  LoadFont.pFileName = &PathName;
1573  LoadFont.Characteristics = Characteristics;
1574  RtlInitUnicodeString(&LoadFont.RegValueName, NULL);
1575  LoadFont.IsTrueType = FALSE;
1576  LoadFont.CharSet = DEFAULT_CHARSET;
1577  LoadFont.PrivateEntry = NULL;
1578  FontCount = IntGdiLoadFontsFromMemory(&LoadFont, NULL, -1, -1);
1579 
1580  /* Release our copy */
1581  IntLockFreeType();
1582  SharedMem_Release(LoadFont.Memory);
1584 
1586 
1588 
1589  /* Save the loaded font name into the registry */
1590  if (FontCount > 0 && (dwFlags & AFRX_WRITE_REGISTRY))
1591  {
1592  UNICODE_STRING NewString;
1593  SIZE_T Length;
1594  PWCHAR pszBuffer;
1595  LPCWSTR CharSetName;
1596  if (LoadFont.IsTrueType)
1597  {
1598  /* Append " (TrueType)" */
1599  Length = LoadFont.RegValueName.Length + TrueTypePostfix.Length + sizeof(UNICODE_NULL);
1601  if (pszBuffer)
1602  {
1603  RtlInitEmptyUnicodeString(&NewString, pszBuffer, Length);
1604  NewString.Buffer[0] = UNICODE_NULL;
1605  RtlAppendUnicodeStringToString(&NewString, &LoadFont.RegValueName);
1606  RtlAppendUnicodeStringToString(&NewString, &TrueTypePostfix);
1607  RtlFreeUnicodeString(&LoadFont.RegValueName);
1608  LoadFont.RegValueName = NewString;
1609  }
1610  else
1611  {
1612  // FIXME!
1613  }
1614  }
1615  else if (LoadFont.CharSet != DEFAULT_CHARSET)
1616  {
1617  /* Append " (CharSetName)" */
1618  CharSetName = NameFromCharSet(LoadFont.CharSet);
1619  Length = LoadFont.RegValueName.Length +
1620  (wcslen(CharSetName) + 3) * sizeof(WCHAR) +
1621  sizeof(UNICODE_NULL);
1622 
1624  if (pszBuffer)
1625  {
1626  RtlInitEmptyUnicodeString(&NewString, pszBuffer, Length);
1627  NewString.Buffer[0] = UNICODE_NULL;
1628  RtlAppendUnicodeStringToString(&NewString, &LoadFont.RegValueName);
1629  RtlAppendUnicodeToString(&NewString, L" (");
1630  RtlAppendUnicodeToString(&NewString, CharSetName);
1631  RtlAppendUnicodeToString(&NewString, L")");
1632  RtlFreeUnicodeString(&LoadFont.RegValueName);
1633  LoadFont.RegValueName = NewString;
1634  }
1635  else
1636  {
1637  // FIXME!
1638  }
1639  }
1640 
1643  NULL, NULL);
1644  Status = ZwOpenKey(&KeyHandle, KEY_WRITE, &ObjectAttributes);
1645  if (NT_SUCCESS(Status))
1646  {
1647  SIZE_T DataSize;
1648  LPWSTR pFileName;
1649 
1651  {
1652  pFileName = PathName.Buffer;
1653  }
1654  else
1655  {
1656  pFileName = wcsrchr(PathName.Buffer, L'\\');
1657  }
1658 
1659  if (pFileName)
1660  {
1661  if (!(dwFlags & AFRX_ALTERNATIVE_PATH))
1662  {
1663  pFileName++;
1664  }
1665  DataSize = (wcslen(pFileName) + 1) * sizeof(WCHAR);
1666  ZwSetValueKey(KeyHandle, &LoadFont.RegValueName, 0, REG_SZ,
1667  pFileName, DataSize);
1668  }
1669  ZwClose(KeyHandle);
1670  }
1671  }
1672  RtlFreeUnicodeString(&LoadFont.RegValueName);
1673 
1674  RtlFreeUnicodeString(&PathName);
1675  return FontCount;
1676 }
_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 LL
Definition: tui.h:84
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
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
#define TRUE
Definition: types.h:120
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
#define SECTION_QUERY
Definition: nt_native.h:1287
LONG NTSTATUS
Definition: precomp.h:26
#define AFRX_ALTERNATIVE_PATH
Definition: text.h:105
uint16_t * PWCHAR
Definition: typedefs.h:56
#define DEFAULT_CHARSET
Definition: wingdi.h:383
#define OBJ_KERNEL_HANDLE
Definition: winternl.h:231
int32_t INT
Definition: typedefs.h:58
#define FILE_SHARE_READ
Definition: compat.h:136
#define AFRX_DOS_DEVICE_PATH
Definition: text.h:106
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:494
#define SEC_COMMIT
Definition: mmtypes.h:99
#define FALSE
Definition: types.h:117
#define UNICODE_NULL
#define FILE_READ_DATA
Definition: nt_native.h:628
Definition: bufpool.h:45
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
Definition: wdfdevice.h:547
BOOL LoadFont(LPWSTR lpCmdLine)
Status
Definition: gdiplustypes.h:24
#define KEY_WRITE
Definition: nt_native.h:1031
NTSTATUS RtlAppendUnicodeToString(IN PUNICODE_STRING Str1, IN PWSTR Str2)
Definition: string_lib.cpp:62
__wchar_t WCHAR
Definition: xmlstorage.h:180
return Iosb
Definition: create.c:4402
#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:4479
#define ObDereferenceObject
Definition: obfuncs.h:203
#define IntUnLockFreeType()
Definition: freetype.c:82
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
* PFILE_OBJECT
Definition: iotypes.h:1998
#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:4306
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:139
#define wcsrchr
Definition: compat.h:16
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:118
ULONG_PTR SIZE_T
Definition: typedefs.h:80
static void SharedMem_Release(PSHARED_MEM Ptr)
Definition: freetype.c:290
NTSYSAPI NTSTATUS NTAPI RtlAppendUnicodeStringToString(PUNICODE_STRING Destination, PUNICODE_STRING Source)
#define NULL
Definition: types.h:112
#define PAGE_READONLY
Definition: compat.h:138
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#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
#define AFRX_WRITE_REGISTRY
Definition: text.h:104
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:1446
WCHAR * LPWSTR
Definition: xmlstorage.h:184
_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
static INT FASTCALL IntGdiLoadFontsFromMemory(PGDI_LOAD_FONT pLoadFont, PSHARED_FACE SharedFace, FT_Long FontIndex, INT CharSetIndex)
Definition: freetype.c:1104
LONGLONG QuadPart
Definition: typedefs.h:114
#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 1971 of file freetype.c.

1972 {
1975  PFONT_ENTRY_COLL_MEM EntryCollection;
1976 
1977  DPRINT("IntGdiCleanupPrivateFontsForProcess()\n");
1978  do {
1979  Entry = NULL;
1980  EntryCollection = NULL;
1981 
1982  IntLockProcessPrivateFonts(Win32Process);
1983  if (!IsListEmpty(&Win32Process->PrivateMemFontListHead))
1984  {
1985  Entry = Win32Process->PrivateMemFontListHead.Flink;
1986  EntryCollection = CONTAINING_RECORD(Entry, FONT_ENTRY_COLL_MEM, ListEntry);
1987  UnlinkFontMemCollection(EntryCollection);
1988  }
1989  IntUnLockProcessPrivateFonts(Win32Process);
1990 
1991  if (EntryCollection)
1992  {
1993  IntGdiCleanupMemEntry(EntryCollection->Entry);
1994  ExFreePoolWithTag(EntryCollection, TAG_FONT);
1995  }
1996  else
1997  {
1998  /* No Mem fonts anymore, see if we have any other private fonts left */
1999  Entry = NULL;
2000  IntLockProcessPrivateFonts(Win32Process);
2001  if (!IsListEmpty(&Win32Process->PrivateFontListHead))
2002  {
2003  Entry = RemoveHeadList(&Win32Process->PrivateFontListHead);
2004  }
2005  IntUnLockProcessPrivateFonts(Win32Process);
2006 
2007  if (Entry)
2008  {
2010  }
2011  }
2012 
2013  } while (Entry);
2014 }
#define IntLockProcessPrivateFonts(W32Process)
Definition: text.h:147
struct _Entry Entry
Definition: kefuncs.h:627
#define TAG_FONT
Definition: tags.h:12
VOID FASTCALL IntGdiCleanupMemEntry(PFONT_ENTRY_MEM Head)
Definition: freetype.c:1901
#define IntUnLockProcessPrivateFonts(W32Process)
Definition: text.h:150
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
FONT_ENTRY_MEM * Entry
Definition: font.h:23
FORCEINLINE PLIST_ENTRY RemoveHeadList(_Inout_ PLIST_ENTRY ListHead)
Definition: rtlfuncs.h:128
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:121
LIST_ENTRY PrivateMemFontListHead
Definition: win32.h:277
Definition: typedefs.h:119
static VOID FASTCALL UnlinkFontMemCollection(PFONT_ENTRY_COLL_MEM Collection)
Definition: freetype.c:1920
Definition: font.h:19
#define NULL
Definition: types.h:112
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
#define DPRINT
Definition: sndvol32.h:71
base of all file and directory entries
Definition: entries.h:82
LIST_ENTRY PrivateFontListHead
Definition: win32.h:276

Referenced by GdiProcessDestroy().

◆ IntGdiGetFontResourceInfo()

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

Definition at line 5392 of file freetype.c.

5397 {
5398  UNICODE_STRING EntryFileName;
5399  POBJECT_NAME_INFORMATION NameInfo1 = NULL, NameInfo2 = NULL;
5400  PLIST_ENTRY ListEntry;
5401  PFONT_ENTRY FontEntry;
5402  ULONG Size, i, Count;
5403  LPBYTE pbBuffer;
5404  BOOL IsEqual;
5405  FONTFAMILYINFO *FamInfo;
5406  const ULONG MaxFamInfo = 64;
5407  const ULONG MAX_FAM_INFO_BYTES = sizeof(FONTFAMILYINFO) * MaxFamInfo;
5408  BOOL bSuccess;
5409  const ULONG NAMEINFO_SIZE = sizeof(OBJECT_NAME_INFORMATION) + MAX_PATH * sizeof(WCHAR);
5410 
5411  DPRINT("IntGdiGetFontResourceInfo: dwType == %lu\n", dwType);
5412 
5413  do
5414  {
5415  /* Create buffer for full path name */
5416  NameInfo1 = ExAllocatePoolWithTag(PagedPool, NAMEINFO_SIZE, TAG_FINF);
5417  if (!NameInfo1)
5418  break;
5419 
5420  /* Get the full path name */
5421  if (!IntGetFullFileName(NameInfo1, NAMEINFO_SIZE, FileName))
5422  break;
5423 
5424  /* Create a buffer for the entries' names */
5425  NameInfo2 = ExAllocatePoolWithTag(PagedPool, NAMEINFO_SIZE, TAG_FINF);
5426  if (!NameInfo2)
5427  break;
5428 
5429  FamInfo = ExAllocatePoolWithTag(PagedPool, MAX_FAM_INFO_BYTES, TAG_FINF);
5430  } while (0);
5431 
5432  if (!NameInfo1 || !NameInfo2 || !FamInfo)
5433  {
5434  if (NameInfo2)
5435  ExFreePoolWithTag(NameInfo2, TAG_FINF);
5436 
5437  if (NameInfo1)
5438  ExFreePoolWithTag(NameInfo1, TAG_FINF);
5439 
5441  return FALSE;
5442  }
5443 
5444  Count = 0;
5445 
5446  /* Try to find the pathname in the global font list */
5448  for (ListEntry = g_FontListHead.Flink; ListEntry != &g_FontListHead;
5449  ListEntry = ListEntry->Flink)
5450  {
5451  FontEntry = CONTAINING_RECORD(ListEntry, FONT_ENTRY, ListEntry);
5452  if (FontEntry->Font->Filename == NULL)
5453  continue;
5454 
5455  RtlInitUnicodeString(&EntryFileName , FontEntry->Font->Filename);
5456  if (!IntGetFullFileName(NameInfo2, NAMEINFO_SIZE, &EntryFileName))
5457  continue;
5458 
5459  if (!RtlEqualUnicodeString(&NameInfo1->Name, &NameInfo2->Name, FALSE))
5460  continue;
5461 
5462  IsEqual = FALSE;
5463  FontFamilyFillInfo(&FamInfo[Count], FontEntry->FaceName.Buffer,
5464  NULL, FontEntry->Font);
5465  for (i = 0; i < Count; ++i)
5466  {
5467  if (EqualFamilyInfo(&FamInfo[i], &FamInfo[Count]))
5468  {
5469  IsEqual = TRUE;
5470  break;
5471  }
5472  }
5473  if (!IsEqual)
5474  {
5475  /* Found */
5476  ++Count;
5477  if (Count >= MaxFamInfo)
5478  break;
5479  }
5480  }
5482 
5483  /* Free the buffers */
5484  ExFreePoolWithTag(NameInfo1, TAG_FINF);
5485  ExFreePoolWithTag(NameInfo2, TAG_FINF);
5486 
5487  if (Count == 0 && dwType != 5)
5488  {
5489  /* Font could not be found in system table
5490  dwType == 5 will still handle this */
5491  ExFreePoolWithTag(FamInfo, TAG_FINF);
5492  return FALSE;
5493  }
5494 
5495  bSuccess = FALSE;
5496  switch (dwType)
5497  {
5498  case 0: /* FIXME: Returns 1 or 2, don't know what this is atm */
5499  Size = sizeof(DWORD);
5500  if (*pdwBytes == 0)
5501  {
5502  *pdwBytes = Size;
5503  bSuccess = TRUE;
5504  }
5505  else if (pBuffer)
5506  {
5507  if (*pdwBytes >= Size)
5508  {
5509  *(DWORD*)pBuffer = Count;
5510  }
5511  *pdwBytes = Size;
5512  bSuccess = TRUE;
5513  }
5514  break;
5515 
5516  case 1: /* copy the font title */
5517  /* calculate the required size */
5518  Size = 0;
5519  for (i = 0; i < Count; ++i)
5520  {
5521  if (i > 0)
5522  Size += 3; /* " & " */
5523  Size += wcslen(FamInfo[i].EnumLogFontEx.elfLogFont.lfFaceName);
5524  if (FamInfo[i].EnumLogFontEx.elfStyle[0] &&
5525  _wcsicmp(FamInfo[i].EnumLogFontEx.elfStyle, L"Regular") != 0)
5526  {
5527  Size += 1 + wcslen(FamInfo[i].EnumLogFontEx.elfStyle);
5528  }
5529  }
5530  Size += 2; /* "\0\0" */
5531  Size *= sizeof(WCHAR);
5532 
5533  if (*pdwBytes == 0)
5534  {
5535  *pdwBytes = Size;
5536  bSuccess = TRUE;
5537  }
5538  else if (pBuffer)
5539  {
5540  if (*pdwBytes >= Size)
5541  {
5542  /* store font title to buffer */
5543  WCHAR *psz = pBuffer;
5544  *psz = 0;
5545  for (i = 0; i < Count; ++i)
5546  {
5547  if (i > 0)
5548  wcscat(psz, L" & ");
5549  IntAddNameFromFamInfo(psz, &FamInfo[i]);
5550  }
5551  psz[wcslen(psz) + 1] = UNICODE_NULL;
5552  *pdwBytes = Size;
5553  bSuccess = TRUE;
5554  }
5555  else
5556  {
5557  *pdwBytes = 1024; /* this is confirmed value */
5558  }
5559  }
5560  break;
5561 
5562  case 2: /* Copy an array of LOGFONTW */
5563  Size = Count * sizeof(LOGFONTW);
5564  if (*pdwBytes == 0)
5565  {
5566  *pdwBytes = Size;
5567  bSuccess = TRUE;
5568  }
5569  else if (pBuffer)
5570  {
5571  if (*pdwBytes >= Size)
5572  {
5573  pbBuffer = (LPBYTE)pBuffer;
5574  for (i = 0; i < Count; ++i)
5575  {
5576  FamInfo[i].EnumLogFontEx.elfLogFont.lfWidth = 0;
5577  RtlCopyMemory(pbBuffer, &FamInfo[i].EnumLogFontEx.elfLogFont, sizeof(LOGFONTW));
5578  pbBuffer += sizeof(LOGFONTW);
5579  }
5580  }
5581  *pdwBytes = Size;
5582  bSuccess = TRUE;
5583  }
5584  else
5585  {
5586  *pdwBytes = 1024; /* this is confirmed value */
5587  }
5588  break;
5589 
5590  case 3:
5591  Size = sizeof(DWORD);
5592  if (*pdwBytes == 0)
5593  {
5594  *pdwBytes = Size;
5595  bSuccess = TRUE;
5596  }
5597  else if (pBuffer)
5598  {
5599  if (*pdwBytes >= Size)
5600  {
5601  /* FIXME: What exactly is copied here? */
5602  *(DWORD*)pBuffer = 1;
5603  }
5604  *pdwBytes = Size;
5605  bSuccess = TRUE;
5606  }
5607  break;
5608 
5609  case 4: /* full file path */
5610  if (FileName->Length >= 4 * sizeof(WCHAR))
5611  {
5612  /* The beginning of FileName is \??\ */
5613  LPWSTR pch = FileName->Buffer + 4;
5614  DWORD Length = FileName->Length - 4 * sizeof(WCHAR);
5615 
5616  Size = Length + sizeof(WCHAR);
5617  if (*pdwBytes == 0)
5618  {
5619  *pdwBytes = Size;
5620  bSuccess = TRUE;
5621  }
5622  else if (pBuffer)
5623  {
5624  if (*pdwBytes >= Size)
5625  {
5627  }
5628  *pdwBytes = Size;
5629  bSuccess = TRUE;
5630  }
5631  }
5632  break;
5633 
5634  case 5: /* Looks like a BOOL that is copied, TRUE, if the font was not found */
5635  Size = sizeof(BOOL);
5636  if (*pdwBytes == 0)
5637  {
5638  *pdwBytes = Size;
5639  bSuccess = TRUE;
5640  }
5641  else if (pBuffer)
5642  {
5643  if (*pdwBytes >= Size)
5644  {
5645  *(BOOL*)pBuffer = Count == 0;
5646  }
5647  *pdwBytes = Size;
5648  bSuccess = TRUE;
5649  }
5650  break;
5651  }
5652  ExFreePoolWithTag(FamInfo, TAG_FINF);
5653 
5654  return bSuccess;
5655 }
static LIST_ENTRY g_FontListHead
Definition: freetype.c:66
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define TRUE
Definition: types.h:120
static BOOL EqualFamilyInfo(const FONTFAMILYINFO *pInfo1, const FONTFAMILYINFO *pInfo2)
Definition: freetype.c:5358
UNICODE_STRING FaceName
Definition: font.h:8
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
UNICODE_STRING Name
Definition: nt_native.h:1270
static BOOL FASTCALL IntGetFullFileName(POBJECT_NAME_INFORMATION NameInfo, ULONG Size, PUNICODE_STRING FileName)
Definition: freetype.c:5315
#define BOOL
Definition: nt_native.h:43
#define DWORD
Definition: nt_native.h:44
static BOOLEAN bSuccess
Definition: drive.cpp:432
#define IntUnLockGlobalFonts()
Definition: freetype.c:73
#define pch(ap)
Definition: match.c:418
unsigned char * LPBYTE
Definition: typedefs.h:53
#define FALSE
Definition: types.h:117
#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
PVOID pBuffer
static VOID IntAddNameFromFamInfo(LPWSTR psz, FONTFAMILYINFO *FamInfo)
Definition: freetype.c:5379
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:2822
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
int Count
Definition: noreturn.cpp:7
__wchar_t WCHAR
Definition: xmlstorage.h:180
struct tagLOGFONTW LOGFONTW
#define MAX_PATH
Definition: compat.h:34
unsigned long DWORD
Definition: ntddk_ex.h:95
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:119
#define IntLockGlobalFonts()
Definition: freetype.c:70
ENUMLOGFONTEXW EnumLogFontEx
Definition: ntgdibad.h:47
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
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)
#define NULL
Definition: types.h:112
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
LOGFONTW elfLogFont
Definition: wingdi.h:2701
unsigned int ULONG
Definition: retypes.h:1
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
#define TAG_FINF
Definition: text.h:3
#define DPRINT
Definition: sndvol32.h:71
WCHAR * LPWSTR
Definition: xmlstorage.h:184
NTSYSAPI BOOLEAN NTAPI RtlEqualUnicodeString(PUNICODE_STRING String1, PUNICODE_STRING String2, BOOLEAN CaseInSensitive)
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 1937 of file freetype.c.

1938 {
1940  PFONT_ENTRY_COLL_MEM CurrentEntry;
1941  PFONT_ENTRY_COLL_MEM EntryCollection = NULL;
1943 
1944  IntLockProcessPrivateFonts(Win32Process);
1945  for (Entry = Win32Process->PrivateMemFontListHead.Flink;
1946  Entry != &Win32Process->PrivateMemFontListHead;
1947  Entry = Entry->Flink)
1948  {
1949  CurrentEntry = CONTAINING_RECORD(Entry, FONT_ENTRY_COLL_MEM, ListEntry);
1950 
1951  if (CurrentEntry->Handle == hMMFont)
1952  {
1953  EntryCollection = CurrentEntry;
1954  UnlinkFontMemCollection(CurrentEntry);
1955  break;
1956  }
1957  }
1958  IntUnLockProcessPrivateFonts(Win32Process);
1959 
1960  if (EntryCollection)
1961  {
1962  IntGdiCleanupMemEntry(EntryCollection->Entry);
1963  ExFreePoolWithTag(EntryCollection, TAG_FONT);
1964  return TRUE;
1965  }
1966  return FALSE;
1967 }
#define IntLockProcessPrivateFonts(W32Process)
Definition: text.h:147
struct _Entry Entry
Definition: kefuncs.h:627
#define TRUE
Definition: types.h:120
#define TAG_FONT
Definition: tags.h:12
VOID FASTCALL IntGdiCleanupMemEntry(PFONT_ENTRY_MEM Head)
Definition: freetype.c:1901
#define IntUnLockProcessPrivateFonts(W32Process)
Definition: text.h:150
FONT_ENTRY_MEM * Entry
Definition: font.h:23
#define FALSE
Definition: types.h:117
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:121
HANDLE Handle
Definition: font.h:22
LIST_ENTRY PrivateMemFontListHead
Definition: win32.h:277
Definition: typedefs.h:119
static VOID FASTCALL UnlinkFontMemCollection(PFONT_ENTRY_COLL_MEM Collection)
Definition: freetype.c:1920
Definition: font.h:19
#define NULL
Definition: types.h:112
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

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:370
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
LONG cx
Definition: windef.h:334
Definition: polytest.cpp:40
__wchar_t WCHAR
Definition: xmlstorage.h:180
HDC hdc
Definition: main.c:9
BOOL FASTCALL ftGdiGetTextMetricsW(HDC hDC, PTMW_INTERNAL ptmwi)
Definition: freetype.c:4566
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
#define NULL
Definition: types.h:112
LONG tmHeight
Definition: wingdi.h:2382
BOOL FASTCALL TextIntGetTextExtentPoint(PDC dc, PTEXTOBJ TextObj, LPCWSTR String, INT Count, ULONG MaxExtent, LPINT Fit, LPINT Dx, LPSIZE Size, FLONG fl)
Definition: freetype.c:4242

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

Referenced by NtGdiGetDCDword().

◆ IntGetOutlineTextMetrics()

INT FASTCALL IntGetOutlineTextMetrics ( PFONTGDI  ,
UINT  ,
OUTLINETEXTMETRICW  
)

Definition at line 2457 of file freetype.c.

2460 {
2461  TT_OS2 *pOS2;
2462  TT_HoriHeader *pHori;
2463  TT_Postscript *pPost;
2464  FT_Fixed XScale, YScale;
2465  FT_WinFNT_HeaderRec WinFNT;
2466  FT_Error Error;
2467  BYTE *pb;
2468  FONT_NAMES FontNames;
2469  PSHARED_FACE SharedFace = FontGDI->SharedFace;
2471  FT_Face Face = SharedFace->Face;
2472 
2474  {
2475  Cache = &SharedFace->EnglishUS;
2476  }
2477  else
2478  {
2479  Cache = &SharedFace->UserLanguage;
2480  }
2481 
2482  if (Size == 0 && Cache->OutlineRequiredSize > 0)
2483  {
2484  ASSERT(Otm == NULL);
2485  return Cache->OutlineRequiredSize;
2486  }
2487 
2488  IntInitFontNames(&FontNames, SharedFace);
2489  Cache->OutlineRequiredSize = FontNames.OtmSize;
2490 
2491  if (Size == 0)
2492  {
2493  ASSERT(Otm == NULL);
2494  IntFreeFontNames(&FontNames);
2495  return Cache->OutlineRequiredSize;
2496  }
2497 
2498  ASSERT(Otm != NULL);
2499 
2500  if (Size < Cache->OutlineRequiredSize)
2501  {
2502  DPRINT1("Size %u < OutlineRequiredSize %u\n", Size,
2503  Cache->OutlineRequiredSize);
2504  IntFreeFontNames(&FontNames);
2505  return 0; /* failure */
2506  }
2507 
2508  XScale = Face->size->metrics.x_scale;
2509  YScale = Face->size->metrics.y_scale;
2510 
2511  IntLockFreeType();
2512 
2513  pOS2 = FT_Get_Sfnt_Table(Face, FT_SFNT_OS2);
2514  pHori = FT_Get_Sfnt_Table(Face, FT_SFNT_HHEA);
2515  pPost = FT_Get_Sfnt_Table(Face, FT_SFNT_POST); /* We can live with this failing */
2516  Error = FT_Get_WinFNT_Header(Face, &WinFNT);
2517 
2518  if (pOS2 == NULL && Error)
2519  {
2521  DPRINT1("Can't find OS/2 table - not TT font?\n");
2522  IntFreeFontNames(&FontNames);
2523  return 0;
2524  }
2525 
2526  if (pHori == NULL && Error)
2527  {
2529  DPRINT1("Can't find HHEA table - not TT font?\n");
2530  IntFreeFontNames(&FontNames);
2531  return 0;
2532  }
2533 
2534  Otm->otmSize = Cache->OutlineRequiredSize;
2535 
2536  FillTM(&Otm->otmTextMetrics, FontGDI, pOS2, pHori, !Error ? &WinFNT : 0);
2537 
2538  if (!pOS2)
2539  goto skip_os2;
2540 
2541  Otm->otmFiller = 0;
2542  RtlCopyMemory(&Otm->otmPanoseNumber, pOS2->panose, PANOSE_COUNT);
2543  Otm->otmfsSelection = pOS2->fsSelection;
2544  Otm->otmfsType = pOS2->fsType;
2545  Otm->otmsCharSlopeRise = pHori->caret_Slope_Rise;
2546  Otm->otmsCharSlopeRun = pHori->caret_Slope_Run;
2547  Otm->otmItalicAngle = 0; /* POST table */
2548  Otm->otmEMSquare = Face->units_per_EM;
2549 
2550 #define SCALE_X(value) ((FT_MulFix((value), XScale) + 32) >> 6)
2551 #define SCALE_Y(value) ((FT_MulFix((value), YScale) + 32) >> 6)
2552 
2553  Otm->otmAscent = SCALE_Y(pOS2->sTypoAscender);
2554  Otm->otmDescent = SCALE_Y(pOS2->sTypoDescender);
2555  Otm->otmLineGap = SCALE_Y(pOS2->sTypoLineGap);
2556  Otm->otmsCapEmHeight = SCALE_Y(pOS2->sCapHeight);
2557  Otm->otmsXHeight = SCALE_Y(pOS2->sxHeight);
2558  Otm->otmrcFontBox.left = SCALE_X(Face->bbox.xMin);
2559  Otm->otmrcFontBox.right = SCALE_X(Face->bbox.xMax);
2560  Otm->otmrcFontBox.top = SCALE_Y(Face->bbox.yMax);
2561  Otm->otmrcFontBox.bottom = SCALE_Y(Face->bbox.yMin);
2562  Otm->otmMacAscent = Otm->otmTextMetrics.tmAscent;
2563  Otm->otmMacDescent = -Otm->otmTextMetrics.tmDescent;
2564  Otm->otmMacLineGap = Otm->otmLineGap;
2565  Otm->otmusMinimumPPEM = 0; /* TT Header */
2566  Otm->otmptSubscriptSize.x = SCALE_X(pOS2->ySubscriptXSize);
2567  Otm->otmptSubscriptSize.y = SCALE_Y(pOS2->ySubscriptYSize);
2568  Otm->otmptSubscriptOffset.x = SCALE_X(pOS2->ySubscriptXOffset);
2569  Otm->otmptSubscriptOffset.y = SCALE_Y(pOS2->ySubscriptYOffset);
2570  Otm->otmptSuperscriptSize.x = SCALE_X(pOS2->ySuperscriptXSize);
2571  Otm->otmptSuperscriptSize.y = SCALE_Y(pOS2->ySuperscriptYSize);
2572  Otm->otmptSuperscriptOffset.x = SCALE_X(pOS2->ySuperscriptXOffset);
2573  Otm->otmptSuperscriptOffset.y = SCALE_Y(pOS2->ySuperscriptYOffset);
2574  Otm->otmsStrikeoutSize = SCALE_Y(pOS2->yStrikeoutSize);
2575  Otm->otmsStrikeoutPosition = SCALE_Y(pOS2->yStrikeoutPosition);
2576 
2577  if (!pPost)
2578  {
2579  Otm->otmsUnderscoreSize = 0;
2580  Otm->otmsUnderscorePosition = 0;
2581  }
2582  else
2583  {
2584  Otm->otmsUnderscoreSize = SCALE_Y(pPost->underlineThickness);
2585  Otm->otmsUnderscorePosition = SCALE_Y(pPost->underlinePosition);
2586  }
2587 
2588 #undef SCALE_X
2589 #undef SCALE_Y
2590 
2591 skip_os2:
2593 
2594  pb = IntStoreFontNames(&FontNames, Otm);
2595  ASSERT(pb - (BYTE*)Otm == Cache->OutlineRequiredSize);
2596 
2597  IntFreeFontNames(&FontNames);
2598 
2599  return Cache->OutlineRequiredSize;
2600 }
SHARED_FACE_CACHE EnglishUS
Definition: engobjects.h:132
ULONG OtmSize
Definition: freetype.c:2380
FT_Short sxHeight
Definition: tttables.h:424
int FT_Error
Definition: fttypes.h:300
#define PANOSE_COUNT
Definition: wingdi.h:452
#define SCALE_X(value)
static __inline void FASTCALL IntInitFontNames(FONT_NAMES *Names, PSHARED_FACE SharedFace)
Definition: freetype.c:2384
static __inline BYTE *FASTCALL IntStoreFontNames(const FONT_NAMES *Names, OUTLINETEXTMETRICW *Otm)
Definition: freetype.c:2420
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
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
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:2444
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:2156
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
#define ASSERT(a)
Definition: mode.c:44
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
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: xxhash.c:193
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 NULL
Definition: types.h:112
#define DPRINT1
Definition: precomp.h:8
FT_Short ySubscriptYOffset
Definition: tttables.h:390
FT_Short sTypoLineGap
Definition: tttables.h:413
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
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 2017 of file freetype.c.

2018 {
2019  return (gpsi->BitsPixel > 8) && g_RenderingEnabled;
2020 }
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 1695 of file freetype.c.

1696 {
1697  NTSTATUS Status;
1698  HANDLE KeyHandle;
1700  KEY_FULL_INFORMATION KeyFullInfo;
1701  ULONG i, Length;
1702  UNICODE_STRING FontTitleW, FileNameW;
1703  SIZE_T InfoSize;
1704  LPBYTE InfoBuffer;
1706  LPWSTR pchPath;
1707  BOOLEAN Success;
1709  INT nFontCount = 0;
1710  DWORD dwFlags;
1711 
1712  /* open registry key */
1715  NULL, NULL);
1716  Status = ZwOpenKey(&KeyHandle, KEY_READ, &ObjectAttributes);
1717  if (!NT_SUCCESS(Status))
1718  {
1719  DPRINT1("ZwOpenKey failed: 0x%08X\n", Status);
1720  return FALSE; /* failure */
1721  }
1722 
1723  /* query count of values */
1724  Status = ZwQueryKey(KeyHandle, KeyFullInformation,
1725  &KeyFullInfo, sizeof(KeyFullInfo), &Length);
1726  if (!NT_SUCCESS(Status))
1727  {
1728  DPRINT1("ZwQueryKey failed: 0x%08X\n", Status);
1729  ZwClose(KeyHandle);
1730  return FALSE; /* failure */
1731  }
1732 
1733  /* allocate buffer */
1734  InfoSize = (MAX_PATH + 256) * sizeof(WCHAR);
1735  InfoBuffer = ExAllocatePoolWithTag(PagedPool, InfoSize, TAG_FONT);
1736  if (!InfoBuffer)
1737  {
1738  DPRINT1("ExAllocatePoolWithTag failed\n");
1739  ZwClose(KeyHandle);
1740  return FALSE;
1741  }
1742 
1743  /* for each value */
1744  for (i = 0; i < KeyFullInfo.Values; ++i)
1745  {
1746  /* get value name */
1747  Status = ZwEnumerateValueKey(KeyHandle, i, KeyValueFullInformation,
1748  InfoBuffer, InfoSize, &Length);
1750  {
1751  /* too short buffer */
1752  ExFreePoolWithTag(InfoBuffer, TAG_FONT);
1753  InfoSize *= 2;
1754  InfoBuffer = ExAllocatePoolWithTag(PagedPool, InfoSize, TAG_FONT);
1755  if (!InfoBuffer)
1756  {
1757  DPRINT1("ExAllocatePoolWithTag failed\n");
1758  break;
1759  }
1760  /* try again */
1761  Status = ZwEnumerateValueKey(KeyHandle, i, KeyValueFullInformation,
1762  InfoBuffer, InfoSize, &Length);
1763  }
1764  if (!NT_SUCCESS(Status))
1765  {
1766  DPRINT1("ZwEnumerateValueKey failed: 0x%08X\n", Status);
1767  break; /* failure */
1768  }
1769 
1770  /* create FontTitleW string */
1771  pInfo = (PKEY_VALUE_FULL_INFORMATION)InfoBuffer;
1772  Length = pInfo->NameLength / sizeof(WCHAR);
1773  pInfo->Name[Length] = UNICODE_NULL; /* truncate */
1774  Success = RtlCreateUnicodeString(&FontTitleW, pInfo->Name);
1775  if (!Success)
1776  {
1778  DPRINT1("RtlCreateUnicodeString failed\n");
1779  break; /* failure */
1780  }
1781 
1782  /* query value */
1783  Status = ZwQueryValueKey(KeyHandle, &FontTitleW, KeyValueFullInformation,
1784  InfoBuffer, InfoSize, &Length);
1786  {
1787  /* too short buffer */
1788  ExFreePoolWithTag(InfoBuffer, TAG_FONT);
1789  InfoSize *= 2;
1790  InfoBuffer = ExAllocatePoolWithTag(PagedPool, InfoSize, TAG_FONT);
1791  if (!InfoBuffer)
1792  {
1793  DPRINT1("ExAllocatePoolWithTag failed\n");
1794  break;
1795  }
1796  /* try again */
1797  Status = ZwQueryValueKey(KeyHandle, &FontTitleW, KeyValueFullInformation,
1798  InfoBuffer, InfoSize, &Length);
1799  }
1800  pInfo = (PKEY_VALUE_FULL_INFORMATION)InfoBuffer;
1801  if (!NT_SUCCESS(Status) || !pInfo->DataLength)
1802  {
1803  DPRINT1("ZwQueryValueKey failed: 0x%08X\n", Status);
1804  RtlFreeUnicodeString(&FontTitleW);
1805  break; /* failure */
1806  }
1807 
1808  /* Build pchPath */
1809  pchPath = (LPWSTR)((PUCHAR)pInfo + pInfo->DataOffset);
1810  Length = pInfo->DataLength / sizeof(WCHAR);
1811  pchPath[Length] = UNICODE_NULL; /* truncate */
1812 
1813  /* Load font(s) without writing registry */
1814  if (PathIsRelativeW(pchPath))
1815  {
1816  dwFlags = 0;
1818  L"\\SystemRoot\\Fonts\\%s", pchPath);
1819  }
1820  else
1821  {
1823  Status = RtlStringCbCopyW(szPath, sizeof(szPath), pchPath);
1824  }
1825 
1826  if (NT_SUCCESS(Status))
1827  {
1828  RtlCreateUnicodeString(&FileNameW, szPath);
1829  nFontCount += IntGdiAddFontResourceEx(&FileNameW, 0, dwFlags);
1830  RtlFreeUnicodeString(&FileNameW);
1831  }
1832 
1833  RtlFreeUnicodeString(&FontTitleW);
1834  }
1835 
1836  /* close now */
1837  ZwClose(KeyHandle);
1838 
1839  /* free memory block */
1840  if (InfoBuffer)
1841  {
1842  ExFreePoolWithTag(InfoBuffer, TAG_FONT);
1843  }
1844 
1845  return (KeyFullInfo.Values != 0 && nFontCount != 0);
1846 }
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
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
_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 AFRX_ALTERNATIVE_PATH
Definition: text.h:105
#define TAG_FONT
Definition: tags.h:12
#define OBJ_KERNEL_HANDLE
Definition: winternl.h:231
int32_t INT
Definition: typedefs.h:58
#define AFRX_DOS_DEVICE_PATH
Definition: text.h:106
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
BOOL WINAPI PathIsRelativeW(LPCWSTR lpszPath)
Definition: freetype.c:1685
unsigned char * LPBYTE
Definition: typedefs.h:53
#define FALSE
Definition: types.h:117
#define UNICODE_NULL
unsigned char BOOLEAN
Status
Definition: gdiplustypes.h:24
__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:34
unsigned long DWORD
Definition: ntddk_ex.h:95
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
#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
ULONG_PTR SIZE_T
Definition: typedefs.h:80
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
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
LPCWSTR szPath
Definition: env.c:37
#define NULL
Definition: types.h:112
#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:1480
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
WCHAR * LPWSTR
Definition: xmlstorage.h:184
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  static UNICODE_STRING IgnoreFiles[] =
964  {
966  RTL_CONSTANT_STRING(L".."),
967  };
968 
969  RtlInitUnicodeString(&Directory, L"\\SystemRoot\\Fonts\\");
970 
973  &Directory,
975  NULL,
976  NULL);
977 
978  Status = ZwOpenFile(
979  &hDirectory,
982  &Iosb,
985 
986  if (NT_SUCCESS(Status))
987  {
988  for (i = 0; i < _countof(SearchPatterns); ++i)
989  {
990  DirInfoBuffer = ExAllocatePoolWithTag(PagedPool, 0x4000, TAG_FONT);
991  if (DirInfoBuffer == NULL)
992  {
993  ZwClose(hDirectory);
994  return;
995  }
996 
998  if (FileName.Buffer == NULL)
999  {
1000  ExFreePoolWithTag(DirInfoBuffer, TAG_FONT);
1001  ZwClose(hDirectory);
1002  return;
1003  }
1004  FileName.Length = 0;
1005  FileName.MaximumLength = MAX_PATH * sizeof(WCHAR);
1006 
1007  while (1)
1008  {
1009  Status = ZwQueryDirectoryFile(
1010  hDirectory,
1011  NULL,
1012  NULL,
1013  NULL,
1014  &Iosb,
1015  DirInfoBuffer,
1016  0x4000,
1018  FALSE,
1019  &SearchPatterns[i],
1020  bRestartScan);
1021 
1023  {
1024  break;
1025  }
1026 
1027  DirInfo = (PFILE_DIRECTORY_INFORMATION)DirInfoBuffer;
1028  while (1)
1029  {
1030  SIZE_T ign;
1031 
1032  TempString.Buffer = DirInfo->FileName;
1033  TempString.Length = TempString.MaximumLength = DirInfo->FileNameLength;
1034 
1035  /* Should we ignore this file? */
1036  for (ign = 0; ign < _countof(IgnoreFiles); ++ign)
1037  {
1038  /* Yes.. */
1039  if (RtlEqualUnicodeString(IgnoreFiles + ign, &TempString, FALSE))
1040  break;
1041  }
1042 
1043  /* If we tried all Ignore patterns and there was no match, try to create a font */
1044  if (ign == _countof(IgnoreFiles))
1045  {
1049  {
1050  DPRINT1("ERR: Failed to load %wZ\n", &FileName);
1051  }
1052  }
1053 
1054  if (DirInfo->NextEntryOffset == 0)
1055  break;
1056 
1057  DirInfo = (PFILE_DIRECTORY_INFORMATION)((ULONG_PTR)DirInfo + DirInfo->NextEntryOffset);
1058  }
1059 
1060  bRestartScan = FALSE;
1061  }
1062 
1064  ExFreePoolWithTag(DirInfoBuffer, TAG_FONT);
1065  }
1066  ZwClose(hDirectory);
1067  }
1068 }
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
USHORT MaximumLength
Definition: env_spec_w32.h:370
struct _FILE_DIRECTORY_INFORMATION * PFILE_DIRECTORY_INFORMATION
#define TRUE
Definition: types.h:120
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
#define FILE_DIRECTORY_FILE
Definition: constants.h:491
LONG NTSTATUS
Definition: precomp.h:26
#define TAG_FONT
Definition: tags.h:12
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
#define OBJ_KERNEL_HANDLE
Definition: winternl.h:231
int32_t INT
Definition: typedefs.h:58
#define FILE_SHARE_READ
Definition: compat.h:136
NTSYSAPI VOID NTAPI RtlCopyUnicodeString(PUNICODE_STRING DestinationString, PUNICODE_STRING SourceString)
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define FALSE
Definition: types.h:117
unsigned char BOOLEAN
Status
Definition: gdiplustypes.h:24
#define FILE_LIST_DIRECTORY
Definition: nt_native.h:629
__wchar_t WCHAR
Definition: xmlstorage.h:180
return Iosb
Definition: create.c:4402
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_NO_MORE_FILES
Definition: udferr_usr.h:128
#define _countof(array)
Definition: sndvol32.h:68
#define MAX_PATH
Definition: compat.h:34
#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
#define SYNCHRONIZE
Definition: nt_native.h:61
unsigned char BYTE
Definition: xxhash.c:193
ULONG_PTR SIZE_T
Definition: typedefs.h:80
struct _FileName FileName
Definition: fatprocs.h:893
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
NTSYSAPI NTSTATUS NTAPI RtlAppendUnicodeStringToString(PUNICODE_STRING Destination, PUNICODE_STRING Source)
#define NULL
Definition: types.h:112
#define DPRINT1
Definition: precomp.h:8
#define FILE_SYNCHRONOUS_IO_NONALERT
Definition: from_kernel.h:31
#define AFRX_WRITE_REGISTRY
Definition: text.h:104
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:1480
#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:3885
WCHAR FileName[ANYSIZE_ARRAY]
Definition: winternl.h:524
NTSYSAPI BOOLEAN NTAPI RtlEqualUnicodeString(PUNICODE_STRING String1, PUNICODE_STRING String2, BOOLEAN CaseInSensitive)
#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 PTEXTOBJ TEXTOBJ_LockText(HFONT hfont)
Definition: text.h:83
LONG NTSTATUS
Definition: precomp.h:26
FORCEINLINE VOID TEXTOBJ_UnlockText(PLFONT plfnt)
Definition: text.h:96
HFONT hFont
Definition: main.c:53
NTSTATUS FASTCALL TextIntRealizeFont(HFONT FontHandle, PTEXTOBJ pTextObj)
Definition: freetype.c:5201
Definition: text.h:59
FLONG fl
Definition: text.h:65
Status
Definition: gdiplustypes.h:24
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define TEXTOBJECT_INIT
Definition: text.h:56
#define NULL
Definition: types.h:112
#define STATUS_SUCCESS
Definition: shellext.h:65

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

2052 {
2053  PLFONT plfont;
2054  LOGFONTW *plf;
2055 
2056  ASSERT(lf);
2057  plfont = LFONT_AllocFontWithHandle();
2058  if (!plfont)
2059  {
2060  return STATUS_NO_MEMORY;
2061  }
2062 
2063  ExInitializePushLock(&plfont->lock);
2064  *NewFont = plfont->BaseObject.hHmgr;
2065  plf = &plfont->logfont.elfEnumLogfontEx.elfLogFont;
2066  RtlCopyMemory(plf, lf, sizeof(LOGFONTW));
2067  if (lf->lfEscapement != lf->lfOrientation)
2068  {
2069  /* This should really depend on whether GM_ADVANCED is set */
2070  plf->lfOrientation = plf->lfEscapement;
2071  }
2072  LFONT_UnlockFont(plfont);
2073 
2074  return STATUS_SUCCESS;
2075 }
#define LFONT_UnlockFont(plfnt)
Definition: text.h:79
LONG lfEscapement
Definition: dimm.idl:61
Definition: text.h:59
LONG lfOrientation
Definition: dimm.idl:62
HGDIOBJ hHmgr(VOID)
Definition: baseobj.hpp:95
#define ExInitializePushLock
Definition: ex.h:1011
BASEOBJECT BaseObject
Definition: text.h:63
#define ASSERT(a)
Definition: mode.c:44
ENUMLOGFONTEXDVW logfont
Definition: text.h:70
EX_PUSH_LOCK lock
Definition: text.h:71
#define STATUS_NO_MEMORY
Definition: ntstatus.h:260
LOGFONTW elfLogFont
Definition: wingdi.h:2701
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define STATUS_SUCCESS
Definition: shellext.h:65
ENUMLOGFONTEXW elfEnumLogfontEx
Definition: wingdi.h:2778
#define LFONT_AllocFontWithHandle()
Definition: text.h:76

Referenced by CreateStockFonts(), and UserDrawCaptionText().

◆ TextIntGetTextExtentPoint()

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

Definition at line 4242 of file freetype.c.

4251 {
4252  PFONTGDI FontGDI;
4253  FT_Face face;
4254  FT_GlyphSlot glyph;
4255  FT_BitmapGlyph realglyph;
4256  INT error, glyph_index, i, previous;
4257  ULONGLONG TotalWidth64 = 0;
4258  BOOL use_kerning;
4259  FT_Render_Mode RenderMode;
4260  BOOLEAN Render;
4261  PMATRIX pmxWorldToDevice;
4262  LOGFONTW *plf;
4263  BOOL EmuBold, EmuItalic;
4264  LONG ascender, descender;
4265 
4266  FontGDI = ObjToGDI(TextObj->Font, FONT);
4267 
4268  face = FontGDI->SharedFace->Face;
4269  if (NULL != Fit)
4270  {
4271  *Fit = 0;
4272  }
4273 
4274  IntLockFreeType();
4275 
4276  TextIntUpdateSize(dc, TextObj, FontGDI, FALSE);
4277 
4278  plf = &TextObj->logfont.elfEnumLogfontEx.elfLogFont;
4279  EmuBold = EMUBOLD_NEEDED(FontGDI->OriginalWeight, plf->lfWeight);
4280  EmuItalic = (plf->lfItalic && !FontGDI->OriginalItalic);
4281 
4282  Render = IntIsFontRenderingEnabled();
4283  if (Render)
4284  RenderMode = IntGetFontRenderMode(plf);
4285  else
4286  RenderMode = FT_RENDER_MODE_MONO;
4287 
4288  /* Get the DC's world-to-device transformation matrix */
4289  pmxWorldToDevice = DC_pmxWorldToDevice(dc);
4290  FtSetCoordinateTransform(face, pmxWorldToDevice);
4291 
4292  use_kerning = FT_HAS_KERNING(face);
4293  previous = 0;
4294 
4295  for (i = 0; i < Count; i++)
4296  {
4297  glyph_index = get_glyph_index_flagged(face, *String, GTEF_INDICES, fl);
4298 
4299  if (EmuBold || EmuItalic)
4300  realglyph = NULL;
4301  else
4302  realglyph = ftGdiGlyphCacheGet(face, glyph_index, plf->lfHeight,
4303  RenderMode, pmxWorldToDevice);
4304 
4305  if (EmuBold || EmuItalic || !realglyph)
4306  {
4307  if (EmuItalic)
4308  error = FT_Load_Glyph(face, glyph_index, FT_LOAD_NO_BITMAP);
4309  else
4310  error = FT_Load_Glyph(face, glyph_index, FT_LOAD_DEFAULT);
4311  if (error)
4312  {
4313  DPRINT1("WARNING: Failed to load and render glyph! [index: %d]\n", glyph_index);
4314  break;
4315  }
4316 
4317  glyph = face->glyph;
4318  if (EmuBold || EmuItalic)
4319  {
4320  if (EmuBold)
4321  FT_GlyphSlot_Embolden(glyph);
4322  if (EmuItalic)
4323  FT_GlyphSlot_Oblique(glyph);
4324  realglyph = ftGdiGlyphSet(face, glyph, RenderMode);
4325  }
4326  else
4327  {
4328  realglyph = ftGdiGlyphCacheSet(face,
4329  glyph_index,
4330  plf->lfHeight,
4331  pmxWorldToDevice,
4332  glyph,
4333  RenderMode);
4334  }
4335 
4336  if (!realglyph)
4337  {
4338  DPRINT1("Failed to render glyph! [index: %d]\n", glyph_index);
4339  break;
4340  }
4341  }
4342 
4343  /* Retrieve kerning distance */
4344  if (use_kerning && previous && glyph_index)
4345  {
4346  FT_Vector delta;
4347  FT_Get_Kerning(face, previous, glyph_index, 0, &delta);
4348  TotalWidth64 += delta.x;
4349  }
4350 
4351  TotalWidth64 += realglyph->root.advance.x >> 10;
4352 
4353  if (((TotalWidth64 + 32) >> 6) <= MaxExtent && NULL != Fit)
4354  {
4355  *Fit = i + 1;
4356  }
4357  if (NULL != Dx)
4358  {
4359  Dx[i] = (TotalWidth64 + 32) >> 6;
4360  }
4361 
4362  /* Bold and italic do not use the cache */
4363  if (EmuBold || EmuItalic)
4364  {
4365  FT_Done_Glyph((FT_Glyph)realglyph);
4366  }
4367 
4368  previous = glyph_index;
4369  String++;
4370  }
4371  ASSERT(FontGDI->Magic == FONTGDI_MAGIC);
4372  ascender = FontGDI->tmAscent; /* Units above baseline */
4373  descender = FontGDI->tmDescent; /* Units below baseline */
4375 
4376  Size->cx = (TotalWidth64 + 32) >> 6;
4377  Size->cy = ascender + descender;
4378 
4379  return TRUE;
4380 }
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 error(str)
Definition: mkdosfs.c:1605
FT_Pos x
Definition: ftimage.h:76
#define TRUE
Definition: types.h:120
enum FT_Render_Mode_ FT_Render_Mode
LONG lfHeight
Definition: dimm.idl:59
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
#define FT_LOAD_DEFAULT
Definition: freetype.h:3008
int32_t INT
Definition: typedefs.h:58
#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:3195
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFSTRING String
Definition: wdfdevice.h:2430
_In_ FLONG fl
Definition: winddi.h:1279
LONG tmDescent
Definition: engobjects.h:160
#define FALSE
Definition: types.h:117
BOOL FASTCALL TextIntUpdateSize(PDC dc, PTEXTOBJ TextObj, PFONTGDI FontGDI, BOOL bDoLock)
Definition: freetype.c:3623
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
FT_GlyphRec root
Definition: ftglyph.h:162
int Count
Definition: noreturn.cpp:7
#define ASSERT(a)
Definition: mode.c:44
uint64_t ULONGLONG
Definition: typedefs.h:67
LONG OriginalWeight
Definition: engobjects.h:154
#define IntUnLockFreeType()
Definition: freetype.c:82
WORD face[3]
Definition: mesh.c:4747
FT_Face Face
Definition: engobjects.h:129
VOID FtSetCoordinateTransform(FT_Face face, PMATRIX pmx)
Definition: freetype.c:775
BOOL FASTCALL IntIsFontRenderingEnabled(VOID)
Definition: freetype.c:2017
#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:3741
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_BitmapGlyph APIENTRY ftGdiGlyphCacheSet(FT_Face Face, INT GlyphIndex, INT Height, PMATRIX pmx, FT_GlyphSlot GlyphSlot, FT_Render_Mode RenderMode)
Definition: freetype.c:3236
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:3158
#define NULL
Definition: types.h:112
#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:2029
#define FONTGDI_MAGIC
Definition: engobjects.h:167
#define ObjToGDI(ClipObj, Type)
Definition: engobjects.h:180
static const WCHAR dc[]
FORCEINLINE PMATRIX DC_pmxWorldToDevice(PDC pdc)
Definition: coord.h:135
#define EMUBOLD_NEEDED(original, request)
Definition: freetype.c:45
#define FT_LOAD_NO_BITMAP
Definition: freetype.h:3012
LONG lfWeight
Definition: dimm.idl:63
FT_Done_Glyph(FT_Glyph glyph)
Definition: ftglyph.c:633
#define GTEF_INDICES
Definition: ntgdityp.h:213
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 5201 of file freetype.c.

5202 {
5204  PTEXTOBJ TextObj;
5205  PPROCESSINFO Win32Process;
5206  ULONG MatchPenalty;
5207  LOGFONTW *pLogFont;
5208  LOGFONTW SubstitutedLogFont;
5209 
5210  if (!pTextObj)
5211  {
5212  TextObj = TEXTOBJ_LockText(FontHandle);
5213  if (NULL == TextObj)
5214  {
5215  return STATUS_INVALID_HANDLE;
5216  }
5217 
5218  if (TextObj->fl & TEXTOBJECT_INIT)
5219  {
5220  TEXTOBJ_UnlockText(TextObj);
5221  return STATUS_SUCCESS;
5222  }
5223  }
5224  else
5225  {
5226  TextObj