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

Referenced by GreGetObject().

◆ ftGdiGetFontData()

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

Definition at line 4638 of file freetype.c.

4644 {
4646  FT_Face Face = FontGdi->SharedFace->Face;
4647 
4648  IntLockFreeType();
4649 
4650  if (FT_IS_SFNT(Face))
4651  {
4652  if (Table)
4653  Table = Table >> 24 | Table << 24 | (Table >> 8 & 0xFF00) |
4654  (Table << 8 & 0xFF0000);
4655 
4656  if (!Buffer) Size = 0;
4657 
4658  if (Buffer && Size)
4659  {
4660  FT_Error Error;
4661  FT_ULong Needed = 0;
4662 
4663  Error = FT_Load_Sfnt_Table(Face, Table, Offset, NULL, &Needed);
4664 
4665  if ( !Error && Needed < Size) Size = Needed;
4666  }
4667  if (!FT_Load_Sfnt_Table(Face, Table, Offset, Buffer, &Size))
4668  Result = Size;
4669  }
4670 
4672 
4673  return Result;
4674 }
int FT_Error
Definition: fttypes.h:300
ASMGENDATA Table[]
Definition: genincdata.c:61
unsigned long FT_ULong
Definition: fttypes.h:253
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
smooth NULL
Definition: ftsmooth.c:416
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
Definition: bufpool.h:45
FT_Load_Sfnt_Table(FT_Face face, FT_ULong tag, FT_Long offset, FT_Byte *buffer, FT_ULong *length)
Definition: ftobjs.c:4134
#define IntUnLockFreeType()
Definition: freetype.c:82
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL Error
Definition: chkdsk.c:66
#define FT_IS_SFNT(face)
Definition: freetype.h:1331
#define IntLockFreeType()
Definition: freetype.c:79
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
#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 3737 of file freetype.c.

3746 {
3747  PDC_ATTR pdcattr;
3748  PTEXTOBJ TextObj;
3749  PFONTGDI FontGDI;
3750  HFONT hFont = 0;
3751  GLYPHMETRICS gm;
3752  ULONG Size;
3753  FT_Face ft_face;
3754  FT_UInt glyph_index;
3755  DWORD width, height, pitch, needed = 0;
3756  FT_Bitmap ft_bitmap;
3757  FT_Error error;
3758  INT left, right, top = 0, bottom = 0;
3760  FLOATOBJ eM11, widthRatio, eTemp;
3761  FT_Matrix transMat = identityMat;
3762  BOOL needsTransform = FALSE;
3763  INT orientation;
3764  LONG aveWidth;
3765  INT adv, lsb, bbx; /* These three hold to widths of the unrotated chars */
3766  OUTLINETEXTMETRICW *potm;
3767  XFORMOBJ xo;
3768  XFORML xform;
3769  LOGFONTW *plf;
3770 
3771  DPRINT("%u, %08x, %p, %08lx, %p, %p\n", wch, iFormat, pgm,
3772  cjBuf, pvBuf, pmat2);
3773 
3774  pdcattr = dc->pdcattr;
3775 
3776  XFORMOBJ_vInit(&xo, &dc->pdcattr->mxWorldToDevice);
3777  XFORMOBJ_iGetXform(&xo, &xform);
3778  FLOATOBJ_SetFloat(&eM11, xform.eM11);
3779 
3780  hFont = pdcattr->hlfntNew;
3781  TextObj = RealizeFontInit(hFont);
3782 
3783  if (!TextObj)
3784  {
3786  return GDI_ERROR;
3787  }
3788  FontGDI = ObjToGDI(TextObj->Font, FONT);
3789  ft_face = FontGDI->SharedFace->Face;
3790 
3791  plf = &TextObj->logfont.elfEnumLogfontEx.elfLogFont;
3792  aveWidth = FT_IS_SCALABLE(ft_face) ? abs(plf->lfWidth) : 0;
3793  orientation = FT_IS_SCALABLE(ft_face) ? plf->lfOrientation : 0;
3794 
3795  Size = IntGetOutlineTextMetrics(FontGDI, 0, NULL);
3797  if (!potm)
3798  {
3800  TEXTOBJ_UnlockText(TextObj);
3801  return GDI_ERROR;
3802  }
3803  Size = IntGetOutlineTextMetrics(FontGDI, Size, potm);
3804  if (!Size)
3805  {
3806  /* FIXME: last error? */
3808  TEXTOBJ_UnlockText(TextObj);
3809  return GDI_ERROR;
3810  }
3811 
3812  IntLockFreeType();
3813  TextIntUpdateSize(dc, TextObj, FontGDI, FALSE);
3815 
3816  TEXTOBJ_UnlockText(TextObj);
3817 
3818  glyph_index = get_glyph_index_flagged(ft_face, wch, GGO_GLYPH_INDEX, iFormat);
3820 
3821  if (orientation || (iFormat != GGO_METRICS && iFormat != GGO_BITMAP) || aveWidth || pmat2)
3822  load_flags |= FT_LOAD_NO_BITMAP;
3823 
3824  if (iFormat & GGO_UNHINTED)
3825  {
3826  load_flags |= FT_LOAD_NO_HINTING;
3827  iFormat &= ~GGO_UNHINTED;
3828  }
3829 
3830  error = FT_Load_Glyph(ft_face, glyph_index, load_flags);
3831  if (error)
3832  {
3833  DPRINT1("WARNING: Failed to load and render glyph! [index: %u]\n", glyph_index);
3835  if (potm) ExFreePoolWithTag(potm, GDITAG_TEXT);
3836  return GDI_ERROR;
3837  }
3839 
3840  FLOATOBJ_Set1(&widthRatio);
3841  if (aveWidth && potm)
3842  {
3843  // widthRatio = aveWidth * eM11 / potm->otmTextMetrics.tmAveCharWidth
3844  FLOATOBJ_SetLong(&widthRatio, aveWidth);
3845  FLOATOBJ_Mul(&widthRatio, &eM11);
3846  FLOATOBJ_DivLong(&widthRatio, potm->otmTextMetrics.tmAveCharWidth);
3847  }
3848 
3849  //left = (INT)(ft_face->glyph->metrics.horiBearingX * widthRatio) & -64;
3850  FLOATOBJ_SetLong(&eTemp, ft_face->glyph->metrics.horiBearingX);
3851  FLOATOBJ_Mul(&eTemp, &widthRatio);
3852  left = FLOATOBJ_GetLong(&eTemp) & -64;
3853 
3854  //right = (INT)((ft_face->glyph->metrics.horiBearingX +
3855  // ft_face->glyph->metrics.width) * widthRatio + 63) & -64;
3856  FLOATOBJ_SetLong(&eTemp, ft_face->glyph->metrics.horiBearingX * ft_face->glyph->metrics.width);
3857  FLOATOBJ_Mul(&eTemp, &widthRatio);
3858  FLOATOBJ_AddLong(&eTemp, 63);
3859  right = FLOATOBJ_GetLong(&eTemp) & -64;
3860 
3861  //adv = (INT)((ft_face->glyph->metrics.horiAdvance * widthRatio) + 63) >> 6;
3862  FLOATOBJ_SetLong(&eTemp, ft_face->glyph->metrics.horiAdvance);
3863  FLOATOBJ_Mul(&eTemp, &widthRatio);
3864  FLOATOBJ_AddLong(&eTemp, 63);
3865  adv = FLOATOBJ_GetLong(&eTemp) >> 6;
3866 
3867  lsb = left >> 6;
3868  bbx = (right - left) >> 6;
3869 
3870  DPRINT("Advance = %d, lsb = %d, bbx = %d\n",adv, lsb, bbx);
3871 
3872  IntLockFreeType();
3873 
3874  /* Width scaling transform */
3875  if (!FLOATOBJ_Equal1(&widthRatio))
3876  {
3877  FT_Matrix scaleMat;
3878 
3879  eTemp = widthRatio;
3880  FLOATOBJ_MulLong(&eTemp, 1 << 16);
3881 
3882  scaleMat.xx = FLOATOBJ_GetLong(&eTemp);
3883  scaleMat.xy = 0;
3884  scaleMat.yx = 0;
3885  scaleMat.yy = INT_TO_FIXED(1);
3886  FT_Matrix_Multiply(&scaleMat, &transMat);
3887  needsTransform = TRUE;
3888  }
3889 
3890  /* World transform */
3891  {
3892  FT_Matrix ftmatrix;
3894 
3895  /* Create a freetype matrix, by converting to 16.16 fixpoint format */
3896  FtMatrixFromMx(&ftmatrix, pmx);
3897 
3898  if (memcmp(&ftmatrix, &identityMat, sizeof(identityMat)) != 0)
3899  {
3900  FT_Matrix_Multiply(&ftmatrix, &transMat);
3901  needsTransform = TRUE;
3902  }
3903  }
3904 
3905  /* Rotation transform */
3906  if (orientation)
3907  {
3908  FT_Matrix rotationMat;
3909  DPRINT("Rotation Trans!\n");
3910  IntEscapeMatrix(&rotationMat, orientation);
3911  FT_Matrix_Multiply(&rotationMat, &transMat);
3912  needsTransform = TRUE;
3913  }
3914 
3915  /* Extra transformation specified by caller */
3916  if (pmat2)
3917  {
3918  FT_Matrix extraMat;
3919  DPRINT("MAT2 Matrix Trans!\n");
3920  extraMat.xx = FT_FixedFromFIXED(pmat2->eM11);
3921  extraMat.xy = FT_FixedFromFIXED(pmat2->eM21);
3922  extraMat.yx = FT_FixedFromFIXED(pmat2->eM12);
3923  extraMat.yy = FT_FixedFromFIXED(pmat2->eM22);
3924  FT_Matrix_Multiply(&extraMat, &transMat);
3925  needsTransform = TRUE;
3926  }
3927 
3928  if (potm) ExFreePoolWithTag(potm, GDITAG_TEXT); /* It looks like we are finished with potm ATM. */
3929 
3930  if (!needsTransform)
3931  {
3932  DPRINT("No Need to be Transformed!\n");
3933  top = (ft_face->glyph->metrics.horiBearingY + 63) & -64;
3934  bottom = (ft_face->glyph->metrics.horiBearingY -
3935  ft_face->glyph->metrics.height) & -64;
3936  gm.gmCellIncX = adv;
3937  gm.gmCellIncY = 0;
3938  }
3939  else
3940  {
3941  INT xc, yc;
3942  FT_Vector vec;
3943  for (xc = 0; xc < 2; xc++)
3944  {
3945  for (yc = 0; yc < 2; yc++)
3946  {
3947  vec.x = (ft_face->glyph->metrics.horiBearingX +
3948  xc * ft_face->glyph->metrics.width);
3949  vec.y = ft_face->glyph->metrics.horiBearingY -
3950  yc * ft_face->glyph->metrics.height;
3951  DPRINT("Vec %ld,%ld\n", vec.x, vec.y);
3952  FT_Vector_Transform(&vec, &transMat);
3953  if (xc == 0 && yc == 0)
3954  {
3955  left = right = vec.x;
3956  top = bottom = vec.y;
3957  }
3958  else
3959  {
3960  if (vec.x < left) left = vec.x;
3961  else if (vec.x > right) right = vec.x;
3962  if (vec.y < bottom) bottom = vec.y;
3963  else if (vec.y > top) top = vec.y;
3964  }
3965  }
3966  }
3967  left = left & -64;
3968  right = (right + 63) & -64;
3969  bottom = bottom & -64;
3970  top = (top + 63) & -64;
3971 
3972  DPRINT("Transformed box: (%d,%d - %d,%d)\n", left, top, right, bottom);
3973  vec.x = ft_face->glyph->metrics.horiAdvance;
3974  vec.y = 0;
3975  FT_Vector_Transform(&vec, &transMat);
3976  gm.gmCellIncX = (vec.x+63) >> 6;
3977  gm.gmCellIncY = -((vec.y+63) >> 6);
3978  }
3979  gm.gmBlackBoxX = (right - left) >> 6;
3980  gm.gmBlackBoxY = (top - bottom) >> 6;
3981  gm.gmptGlyphOrigin.x = left >> 6;
3982  gm.gmptGlyphOrigin.y = top >> 6;
3983 
3984  DPRINT("CX %d CY %d BBX %u BBY %u GOX %d GOY %d\n",
3985  gm.gmCellIncX, gm.gmCellIncY,
3986  gm.gmBlackBoxX, gm.gmBlackBoxY,
3988 
3990 
3991 
3992  if (iFormat == GGO_METRICS)
3993  {
3994  DPRINT("GGO_METRICS Exit!\n");
3995  *pgm = gm;
3996  return 1; /* FIXME */
3997  }
3998 
3999  if (ft_face->glyph->format != ft_glyph_format_outline && iFormat != GGO_BITMAP)
4000  {
4001  DPRINT1("Loaded a bitmap\n");
4002  return GDI_ERROR;
4003  }
4004 
4005  switch (iFormat)
4006  {
4007  case GGO_BITMAP:
4008  {
4009  width = gm.gmBlackBoxX;
4010  height = gm.gmBlackBoxY;
4011  pitch = ((width + 31) >> 5) << 2;
4012  needed = pitch * height;
4013 
4014  if (!pvBuf || !cjBuf) break;
4015  if (!needed) return GDI_ERROR; /* empty glyph */
4016  if (needed > cjBuf)
4017  return GDI_ERROR;
4018 
4019  switch (ft_face->glyph->format)
4020  {
4022  {
4023  BYTE *src = ft_face->glyph->bitmap.buffer, *dst = pvBuf;
4024  INT w = min( pitch, (ft_face->glyph->bitmap.width + 7) >> 3 );
4025  INT h = min( height, ft_face->glyph->bitmap.rows );
4026  while (h--)
4027  {
4028  RtlCopyMemory(dst, src, w);
4029  src += ft_face->glyph->bitmap.pitch;
4030  dst += pitch;
4031  }
4032  break;
4033  }
4034 
4036  {
4037  ft_bitmap.width = width;
4038  ft_bitmap.rows = height;
4039  ft_bitmap.pitch = pitch;
4040  ft_bitmap.pixel_mode = FT_PIXEL_MODE_MONO;
4041  ft_bitmap.buffer = pvBuf;
4042 
4043  IntLockFreeType();
4044  if (needsTransform)
4045  {
4046  FT_Outline_Transform(&ft_face->glyph->outline, &transMat);
4047  }
4048  FT_Outline_Translate(&ft_face->glyph->outline, -left, -bottom );
4049  /* Note: FreeType will only set 'black' bits for us. */
4050  RtlZeroMemory(pvBuf, needed);
4051  FT_Outline_Get_Bitmap(g_FreeTypeLibrary, &ft_face->glyph->outline, &ft_bitmap);
4053  break;
4054  }
4055 
4056  default:
4057  DPRINT1("Loaded glyph format %x\n", ft_face->glyph->format);
4058  return GDI_ERROR;
4059  }
4060 
4061  break;
4062  }
4063 
4064  case GGO_GRAY2_BITMAP:
4065  case GGO_GRAY4_BITMAP:
4066  case GGO_GRAY8_BITMAP:
4067  {
4068  unsigned int mult, row, col;
4069  BYTE *start, *ptr;
4070 
4071  width = gm.gmBlackBoxX;
4072  height = gm.gmBlackBoxY;
4073  pitch = (width + 3) / 4 * 4;
4074  needed = pitch * height;
4075 
4076  if (!pvBuf || !cjBuf) break;
4077  if (!needed) return GDI_ERROR; /* empty glyph */
4078  if (needed > cjBuf)
4079  return GDI_ERROR;
4080 
4081  switch (ft_face->glyph->format)
4082  {
4084  {
4085  BYTE *src = ft_face->glyph->bitmap.buffer, *dst = pvBuf;
4086  INT h = min( height, ft_face->glyph->bitmap.rows );
4087  INT x;
4088  while (h--)
4089  {
4090  for (x = 0; (UINT)x < pitch; x++)
4091  {
4092  if (x < ft_face->glyph->bitmap.width)
4093  dst[x] = (src[x / 8] & (1 << ( (7 - (x % 8))))) ? 0xff : 0;
4094  else
4095  dst[x] = 0;
4096  }
4097  src += ft_face->glyph->bitmap.pitch;
4098  dst += pitch;
4099  }
4100  break;
4101  }
4103  {
4104  ft_bitmap.width = width;
4105  ft_bitmap.rows = height;
4106  ft_bitmap.pitch = pitch;
4107  ft_bitmap.pixel_mode = FT_PIXEL_MODE_GRAY;
4108  ft_bitmap.buffer = pvBuf;
4109 
4110  IntLockFreeType();
4111  if (needsTransform)
4112  {
4113  FT_Outline_Transform(&ft_face->glyph->outline, &transMat);
4114  }
4115  FT_Outline_Translate(&ft_face->glyph->outline, -left, -bottom );
4116  RtlZeroMemory(ft_bitmap.buffer, cjBuf);
4117  FT_Outline_Get_Bitmap(g_FreeTypeLibrary, &ft_face->glyph->outline, &ft_bitmap);
4119 
4120  if (iFormat == GGO_GRAY2_BITMAP)
4121  mult = 4;
4122  else if (iFormat == GGO_GRAY4_BITMAP)
4123  mult = 16;
4124  else if (iFormat == GGO_GRAY8_BITMAP)
4125  mult = 64;
4126  else
4127  {
4128  return GDI_ERROR;
4129  }
4130 
4131  start = pvBuf;
4132  for (row = 0; row < height; row++)
4133  {
4134  ptr = start;
4135  for (col = 0; col < width; col++, ptr++)
4136  {
4137  *ptr = (((int)*ptr) * mult + 128) / 256;
4138  }
4139  start += pitch;
4140  }
4141 
4142  break;
4143  }
4144  default:
4145  DPRINT1("Loaded glyph format %x\n", ft_face->glyph->format);
4146  return GDI_ERROR;
4147  }
4148 
4149  break;
4150  }
4151 
4152  case GGO_NATIVE:
4153  {
4154  FT_Outline *outline = &ft_face->glyph->outline;
4155 
4156  if (cjBuf == 0) pvBuf = NULL; /* This is okay, need cjBuf to allocate. */
4157 
4158  IntLockFreeType();
4159  if (needsTransform && pvBuf) FT_Outline_Transform(outline, &transMat);
4160 
4162 
4163  if (!pvBuf || !cjBuf)
4164  {
4166  break;
4167  }
4168  if (needed > cjBuf)
4169  {
4171  return GDI_ERROR;
4172  }
4175  break;
4176  }
4177 
4178  case GGO_BEZIER:
4179  {
4180  FT_Outline *outline = &ft_face->glyph->outline;
4181  if (cjBuf == 0) pvBuf = NULL;
4182 
4183  if (needsTransform && pvBuf)
4184  {
4185  IntLockFreeType();
4186  FT_Outline_Transform(outline, &transMat);
4188  }
4190 
4191  if (!pvBuf || !cjBuf)
4192  break;
4193  if (needed > cjBuf)
4194  return GDI_ERROR;
4195 
4197  break;
4198  }
4199 
4200  default:
4201  DPRINT1("Unsupported format %u\n", iFormat);
4202  return GDI_ERROR;
4203  }
4204 
4205  DPRINT("ftGdiGetGlyphOutline END and needed %lu\n", needed);
4206 
4207  if (gm.gmBlackBoxX == 0)
4208  gm.gmBlackBoxX = 1;
4209  if (gm.gmBlackBoxY == 0)
4210  gm.gmBlackBoxY = 1;
4211 
4212  *pgm = gm;
4213  return needed;
4214 }
#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
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
FLOATL eM11
Definition: winddi.h:1234
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
#define GGO_METRICS
Definition: wingdi.h:847
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
unsigned char pixel_mode
Definition: ftimage.h:268
long y
Definition: polytest.cpp:48
unsigned int rows
Definition: ftimage.h:263
#define error(str)
Definition: mkdosfs.c:1605
long x
Definition: polytest.cpp:48
FT_Pos x
Definition: ftimage.h:76
#define TRUE
Definition: types.h:120
FORCEINLINE VOID TEXTOBJ_UnlockText(PLFONT plfnt)
Definition: text.h:96
#define FLOATOBJ_Set1(fo)
Definition: floatobj.h:120
signed int FT_Int
Definition: fttypes.h:220
#define FLOATOBJ_DivLong(pf, l)
Definition: winddi.h:2829
FT_Glyph_Metrics metrics
Definition: freetype.h:1916
LONG tmAveCharWidth
Definition: wingdi.h:2387
#define ERROR_INVALID_HANDLE
Definition: compat.h: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
unsigned char * buffer
Definition: ftimage.h:266
#define FLOATOBJ_GetLong(pf)
Definition: winddi.h:2817
#define GGO_GRAY4_BITMAP
Definition: wingdi.h:852
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
short gmCellIncY
Definition: wingdi.h:2445
FT_Matrix_Multiply(const FT_Matrix *a, FT_Matrix *b)
Definition: ftcalc.c:661
FORCEINLINE VOID XFORMOBJ_vInit(OUT XFORMOBJ *pxo, IN MATRIX *pmx)
Definition: xformobj.h:21
#define FT_LOAD_DEFAULT
Definition: freetype.h:3008
int32_t INT
Definition: typedefs.h: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:3599
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:2433
LONG lfWidth
Definition: dimm.idl:60
smooth NULL
Definition: ftsmooth.c:416
FT_Library g_FreeTypeLibrary
Definition: freetype.c:55
void DPRINT(...)
Definition: polytest.cpp:61
GLint GLint bottom
Definition: glext.h:7726
FT_Outline_Transform(const FT_Outline *outline, const FT_Matrix *matrix)
Definition: ftoutln.c:711
#define ft_glyph_format_outline
Definition: ftimage.h:732
#define ft_glyph_format_bitmap
Definition: ftimage.h:731
VOID FASTCALL FtMatrixFromMx(FT_Matrix *pmat, PMATRIX pmx)
Definition: freetype.c:752
#define FLOATOBJ_MulLong(pf, l)
Definition: winddi.h:2826
POINT gmptGlyphOrigin
Definition: wingdi.h:2443
FLOAT FLOATOBJ
Definition: winddi.h:677
#define IntUnLockFreeType()
Definition: freetype.c:82
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint left
Definition: glext.h:7726
GLdouble GLdouble right
Definition: glext.h:10859
static unsigned int get_native_glyph_outline(FT_Outline *outline, unsigned int buflen, char *buf)
Definition: freetype.c:3283
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:3356
#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:3717
GLenum src
Definition: glext.h:6340
FT_Bitmap bitmap
Definition: freetype.h:1923
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
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
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:107
static const WCHAR dc[]
FORCEINLINE PMATRIX DC_pmxWorldToDevice(PDC pdc)
Definition: coord.h:98
#define FT_LOAD_NO_BITMAP
Definition: freetype.h:3012
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
FT_Fixed yx
Definition: fttypes.h:388
ENUMLOGFONTEXW elfEnumLogfontEx
Definition: wingdi.h:2778
FT_Fixed yy
Definition: fttypes.h:388
#define INT_TO_FIXED(x)
Definition: ftcalc.h:404
#define FLOATOBJ_Mul(pf, pf1)
Definition: winddi.h:2824
#define GDI_ERROR
Definition: wingdi.h:1308
#define FT_IS_SCALABLE(face)
Definition: freetype.h:1312
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27
struct png_info_def *typedef unsigned char **typedef struct png_info_def *typedef struct png_info_def *typedef struct png_info_def *typedef unsigned char ** row
Definition: typeof.h:78
unsigned int width
Definition: ftimage.h:264
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31

Referenced by NtGdiGetGlyphOutline(), and PATH_ExtTextOut().

◆ ftGdiGetKerningPairs()

DWORD FASTCALL ftGdiGetKerningPairs ( PFONTGDI  ,
DWORD  ,
LPKERNINGPAIR   
)

Definition at line 5655 of file freetype.c.

5658 {
5659  DWORD Count = 0;
5660  INT i = 0;
5661  FT_Face face = Font->SharedFace->Face;
5662 
5663  if (FT_HAS_KERNING(face) && face->charmap->encoding == FT_ENCODING_UNICODE)
5664  {
5665  FT_UInt previous_index = 0, glyph_index = 0;
5666  FT_ULong char_code, char_previous;
5667  FT_Vector delta;
5668 
5669  char_previous = char_code = FT_Get_First_Char(face, &glyph_index);
5670 
5671  IntLockFreeType();
5672 
5673  while (glyph_index)
5674  {
5675  if (previous_index && glyph_index)
5676  {
5677  FT_Get_Kerning(face, previous_index, glyph_index, FT_KERNING_DEFAULT, &delta);
5678 
5679  if (pKerningPair && cPairs)
5680  {
5681  pKerningPair[i].wFirst = char_previous;
5682  pKerningPair[i].wSecond = char_code;
5683  pKerningPair[i].iKernAmount = delta.x;
5684  i++;
5685  if (i == cPairs) break;
5686  }
5687  Count++;
5688  }
5689  previous_index = glyph_index;
5690  char_previous = char_code;
5691  char_code = FT_Get_Next_Char(face, char_code, &glyph_index);
5692  }
5694  }
5695  return Count;
5696 }
FT_Get_Kerning(FT_Face face, FT_UInt left_glyph, FT_UInt right_glyph, FT_UInt kern_mode, FT_Vector *akerning)
Definition: ftobjs.c:3347
unsigned long FT_ULong
Definition: fttypes.h:253
FT_Pos x
Definition: ftimage.h:76
FT_Get_Next_Char(FT_Face face, FT_ULong char_code, FT_UInt *agindex)
Definition: ftobjs.c:3722
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1173
int32_t INT
Definition: typedefs.h:58
#define FT_HAS_KERNING(face)
Definition: freetype.h:1297
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define IntUnLockFreeType()
Definition: freetype.c:82
unsigned long DWORD
Definition: ntddk_ex.h:95
FT_Get_First_Char(FT_Face face, FT_UInt *agindex)
Definition: ftobjs.c:3697
#define IntLockFreeType()
Definition: freetype.c:79
unsigned int FT_UInt
Definition: fttypes.h:231
GLenum GLuint GLint GLenum face
Definition: glext.h:7025

Referenced by GreGetKerningPairs(), and NtGdiGetKerningPairs().

◆ ftGdiGetRasterizerCaps()

BOOL FASTCALL ftGdiGetRasterizerCaps ( LPRASTERIZER_STATUS  )

Definition at line 3108 of file freetype.c.

3109 {
3110  if ( lprs )
3111  {
3112  lprs->nSize = sizeof(RASTERIZER_STATUS);
3113  lprs->wFlags = TT_AVAILABLE | TT_ENABLED;
3114  lprs->nLanguageID = gusLanguageID;
3115  return TRUE;
3116  }
3118  return FALSE;
3119 }
#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 4361 of file freetype.c.

4365 {
4366  PDC_ATTR pdcattr;
4367  UINT Ret = DEFAULT_CHARSET;
4368  INT i;
4369  HFONT hFont;
4370  PTEXTOBJ TextObj;
4371  PFONTGDI FontGdi;
4372  FONTSIGNATURE fs;
4373  TT_OS2 *pOS2;
4374  FT_Face Face;
4375  CHARSETINFO csi;
4376  DWORD cp, fs0;
4377  USHORT usACP, usOEM;
4378 
4379  pdcattr = Dc->pdcattr;
4380  hFont = pdcattr->hlfntNew;
4381  TextObj = RealizeFontInit(hFont);
4382 
4383  if (!TextObj)
4384  {
4386  return Ret;
4387  }
4388  FontGdi = ObjToGDI(TextObj->Font, FONT);
4389  Face = FontGdi->SharedFace->Face;
4390  TEXTOBJ_UnlockText(TextObj);
4391 
4392  memset(&fs, 0, sizeof(FONTSIGNATURE));
4393  IntLockFreeType();
4394  pOS2 = FT_Get_Sfnt_Table(Face, ft_sfnt_os2);
4395  if (NULL != pOS2)
4396  {
4397  fs.fsCsb[0] = pOS2->ulCodePageRange1;
4398  fs.fsCsb[1] = pOS2->ulCodePageRange2;
4399  fs.fsUsb[0] = pOS2->ulUnicodeRange1;
4400  fs.fsUsb[1] = pOS2->ulUnicodeRange2;
4401  fs.fsUsb[2] = pOS2->ulUnicodeRange3;
4402  fs.fsUsb[3] = pOS2->ulUnicodeRange4;
4403  if (pOS2->version == 0)
4404  {
4405  FT_UInt dummy;
4406 
4407  if (FT_Get_First_Char( Face, &dummy ) < 0x100)
4408  fs.fsCsb[0] |= FS_LATIN1;
4409  else
4410  fs.fsCsb[0] |= FS_SYMBOL;
4411  }
4412  }
4413  pOS2 = NULL;
4415  DPRINT("Csb 1=%x 0=%x\n", fs.fsCsb[1],fs.fsCsb[0]);
4416  if (fs.fsCsb[0] == 0)
4417  { /* Let's see if we can find any interesting cmaps */
4418  for (i = 0; i < Face->num_charmaps; i++)
4419  {
4420  switch (Face->charmaps[i]->encoding)
4421  {
4422  case FT_ENCODING_UNICODE:
4423  case FT_ENCODING_APPLE_ROMAN:
4424  fs.fsCsb[0] |= FS_LATIN1;
4425  break;
4426  case FT_ENCODING_MS_SYMBOL:
4427  fs.fsCsb[0] |= FS_SYMBOL;
4428  break;
4429  default:
4430  break;
4431  }
4432  }
4433  }
4434  if (lpSig)
4435  {
4436  RtlCopyMemory(lpSig, &fs, sizeof(FONTSIGNATURE));
4437  }
4438 
4439  RtlGetDefaultCodePage(&usACP, &usOEM);
4440  cp = usACP;
4441 
4443  if (csi.fs.fsCsb[0] & fs.fsCsb[0])
4444  {
4445  DPRINT("Hit 1\n");
4446  Ret = csi.ciCharset;
4447  goto Exit;
4448  }
4449 
4450  for (i = 0; i < MAXTCIINDEX; i++)
4451  {
4452  fs0 = 1L << i;
4453  if (fs.fsCsb[0] & fs0)
4454  {
4455  if (IntTranslateCharsetInfo(&fs0, &csi, TCI_SRCFONTSIG))
4456  {
4457  // *cp = csi.ciACP;
4458  DPRINT("Hit 2\n");
4459  Ret = csi.ciCharset;
4460  goto Exit;
4461  }
4462  else
4463  DPRINT1("TCI failing on %x\n", fs0);
4464  }
4465  }
4466 Exit:
4467  DPRINT("CharSet %u CodePage %u\n", csi.ciCharset, csi.ciACP);
4468  return (MAKELONG(csi.ciACP, csi.ciCharset));
4469 }
FONTSIGNATURE fs
Definition: wingdi.h:1547
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
FT_CharMap * charmaps
Definition: freetype.h:1085
#define ft_sfnt_os2
Definition: tttables.h:631
#define TCI_SRCFONTSIG
Definition: wingdi.h:962
FORCEINLINE VOID TEXTOBJ_UnlockText(PLFONT plfnt)
Definition: text.h:96
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
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
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
FT_ULong ulUnicodeRange1
Definition: tttables.h:401
Definition: text.h:59
HANDLE hlfntNew
Definition: ntgdihdl.h:334
FT_Get_Sfnt_Table(FT_Face face, FT_Sfnt_Tag tag)
Definition: ftobjs.c:4113
UINT ciCharset
Definition: wingdi.h:1545
#define MAKELONG(a, b)
Definition: typedefs.h:249
smooth NULL
Definition: ftsmooth.c:416
FT_UShort version
Definition: tttables.h:382
void DPRINT(...)
Definition: polytest.cpp:61
NTSYSAPI VOID NTAPI RtlGetDefaultCodePage(_Out_ PUSHORT AnsiCodePage, _Out_ PUSHORT OemCodePage)
static BOOLEAN APIENTRY IntTranslateCharsetInfo(PDWORD Src, LPCHARSETINFO Cs, DWORD Flags)
Definition: freetype.c:2069
#define FS_SYMBOL
Definition: wingdi.h:574
static void Exit(void)
Definition: sock.c:1331
#define IntUnLockFreeType()
Definition: freetype.c:82
unsigned long DWORD
Definition: ntddk_ex.h:95
FT_Face Face
Definition: engobjects.h:129
FT_Get_First_Char(FT_Face face, FT_UInt *agindex)
Definition: ftobjs.c:3697
FT_Encoding encoding
Definition: freetype.h:843
static const WCHAR L[]
Definition: oid.c:1250
#define IntLockFreeType()
Definition: freetype.c:79
FT_Int num_charmaps
Definition: freetype.h:1084
FONTOBJ * Font
Definition: text.h:66
DWORD fsCsb[2]
Definition: wingdi.h:1542
FT_ULong ulCodePageRange1
Definition: tttables.h:419
PSHARED_FACE SharedFace
Definition: engobjects.h:142
unsigned short USHORT
Definition: pedump.c:61
PTEXTOBJ FASTCALL RealizeFontInit(HFONT hFont)
Definition: font.c:422
#define fs
Definition: i386-dis.c:435
unsigned int FT_UInt
Definition: fttypes.h:231
unsigned char dummy
Definition: maze.c:118
FT_ULong ulUnicodeRange4
Definition: tttables.h:404
unsigned int UINT
Definition: ndis.h:50
FT_ULong ulCodePageRange2
Definition: tttables.h:420
#define DPRINT1
Definition: precomp.h:8
FT_ULong ulUnicodeRange3
Definition: tttables.h:403
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
#define TCI_SRCCODEPAGE
Definition: wingdi.h:961
#define FS_LATIN1
Definition: wingdi.h:559
POINT cp
Definition: magnifier.c:59
#define ObjToGDI(ClipObj, Type)
Definition: engobjects.h:180
#define memset(x, y, z)
Definition: compat.h:39
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27
FT_ULong ulUnicodeRange2
Definition: tttables.h:402

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

◆ ftGdiGetTextMetricsW()

BOOL FASTCALL ftGdiGetTextMetricsW ( HDC  ,
PTMW_INTERNAL   
)

Definition at line 4542 of file freetype.c.

4545 {
4546  PDC dc;
4547  PDC_ATTR pdcattr;
4548  PTEXTOBJ TextObj;
4549  PFONTGDI FontGDI;
4550  FT_Face Face;
4551  TT_OS2 *pOS2;
4552  TT_HoriHeader *pHori;
4553  FT_WinFNT_HeaderRec Win;
4554  ULONG Error;
4556  LOGFONTW *plf;
4557 
4558  if (!ptmwi)
4559  {
4561  return FALSE;
4562  }
4563  RtlZeroMemory(ptmwi, sizeof(TMW_INTERNAL));
4564 
4565  if (!(dc = DC_LockDc(hDC)))
4566  {
4568  return FALSE;
4569  }
4570  pdcattr = dc->pdcattr;
4571  TextObj = RealizeFontInit(pdcattr->hlfntNew);
4572  if (NULL != TextObj)
4573  {
4574  plf = &TextObj->logfont.elfEnumLogfontEx.elfLogFont;
4575  FontGDI = ObjToGDI(TextObj->Font, FONT);
4576 
4577  Face = FontGDI->SharedFace->Face;
4578 
4579  IntLockFreeType();
4580  Error = IntRequestFontSize(dc, FontGDI, plf->lfWidth, plf->lfHeight);
4583 
4584  if (0 != Error)
4585  {
4586  DPRINT1("Error in setting pixel sizes: %u\n", Error);
4588  }
4589  else
4590  {
4591  FT_Face Face = FontGDI->SharedFace->Face;
4593 
4594  IntLockFreeType();
4595  pOS2 = FT_Get_Sfnt_Table(Face, ft_sfnt_os2);
4596  if (NULL == pOS2)
4597  {
4598  DPRINT1("Can't find OS/2 table - not TT font?\n");
4600  }
4601 
4602  pHori = FT_Get_Sfnt_Table(Face, ft_sfnt_hhea);
4603  if (NULL == pHori)
4604  {
4605  DPRINT1("Can't find HHEA table - not TT font?\n");
4607  }
4608 
4609  Error = FT_Get_WinFNT_Header(Face, &Win);
4610 
4611  if (NT_SUCCESS(Status) || !Error)
4612  {
4613  FillTM(&ptmwi->TextMetric, FontGDI, pOS2, pHori, !Error ? &Win : 0);
4614 
4615  /* FIXME: Fill Diff member */
4616  }
4617 
4619  }
4620  TEXTOBJ_UnlockText(TextObj);
4621  }
4622  else
4623  {
4625  }
4626  DC_UnlockDc(dc);
4627 
4628  if (!NT_SUCCESS(Status))
4629  {
4631  return FALSE;
4632  }
4633  return TRUE;
4634 }
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
FORCEINLINE VOID TEXTOBJ_UnlockText(PLFONT plfnt)
Definition: text.h:96
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
LONG lfHeight
Definition: dimm.idl:59
LONG NTSTATUS
Definition: precomp.h:26
#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:2132
LONG lfWidth
Definition: dimm.idl:60
smooth NULL
Definition: ftsmooth.c:416
#define ft_sfnt_hhea
Definition: tttables.h:632
Definition: polytest.cpp:40
static FT_Error IntRequestFontSize(PDC dc, PFONTGDI FontGDI, LONG lfWidth, LONG lfHeight)
Definition: freetype.c:3481
#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
Status
Definition: gdiplustypes.h:24
#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 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:98
ENUMLOGFONTEXW elfEnumLogfontEx
Definition: wingdi.h:2778
return STATUS_SUCCESS
Definition: btrfs.c:3014
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 5636 of file freetype.c.

5637 {
5638  if (FT_HAS_FIXED_SIZES(Font->SharedFace->Face))
5639  Info->iTechnology = RI_TECH_BITMAP;
5640  else
5641  {
5642  if (FT_IS_SCALABLE(Font->SharedFace->Face))
5643  Info->iTechnology = RI_TECH_SCALABLE;
5644  else
5645  Info->iTechnology = RI_TECH_FIXED;
5646  }
5647  Info->iUniq = Font->FontObj.iUniq;
5648  Info->dwUnknown = -1;
5649  return TRUE;
5650 }
#define RI_TECH_BITMAP
Definition: ntgdityp.h:271
#define TRUE
Definition: types.h:120
struct TraceInfo Info
#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 4474 of file freetype.c.

4475 {
4476  DWORD size = 0;
4477  DWORD num_ranges = 0;
4478  FT_Face face = Font->SharedFace->Face;
4479 
4480  if (face->charmap->encoding == FT_ENCODING_UNICODE)
4481  {
4482  FT_UInt glyph_code = 0;
4483  FT_ULong char_code, char_code_prev;
4484 
4485  char_code_prev = char_code = FT_Get_First_Char(face, &glyph_code);
4486 
4487  DPRINT("Face encoding FT_ENCODING_UNICODE, number of glyphs %ld, first glyph %u, first char %04lx\n",
4488  face->num_glyphs, glyph_code, char_code);
4489 
4490  if (!glyph_code) return 0;
4491 
4492  if (glyphset)
4493  {
4494  glyphset->ranges[0].wcLow = (USHORT)char_code;
4495  glyphset->ranges[0].cGlyphs = 0;
4496  glyphset->cGlyphsSupported = 0;
4497  }
4498 
4499  num_ranges = 1;
4500  while (glyph_code)
4501  {
4502  if (char_code < char_code_prev)
4503  {
4504  DPRINT1("Expected increasing char code from FT_Get_Next_Char\n");
4505  return 0;
4506  }
4507  if (char_code - char_code_prev > 1)
4508  {
4509  num_ranges++;
4510  if (glyphset)
4511  {
4512  glyphset->ranges[num_ranges - 1].wcLow = (USHORT)char_code;
4513  glyphset->ranges[num_ranges - 1].cGlyphs = 1;
4514  glyphset->cGlyphsSupported++;
4515  }
4516  }
4517  else if (glyphset)
4518  {
4519  glyphset->ranges[num_ranges - 1].cGlyphs++;
4520  glyphset->cGlyphsSupported++;
4521  }
4522  char_code_prev = char_code;
4523  char_code = FT_Get_Next_Char(face, char_code, &glyph_code);
4524  }
4525  }
4526  else
4527  DPRINT1("Encoding %i not supported\n", face->charmap->encoding);
4528 
4529  size = sizeof(GLYPHSET) + sizeof(WCRANGE) * (num_ranges - 1);
4530  if (glyphset)
4531  {
4532  glyphset->cbThis = size;
4533  glyphset->cRanges = num_ranges;
4534  glyphset->flAccel = 0;
4535  }
4536  return size;
4537 }
unsigned long FT_ULong
Definition: fttypes.h:253
FT_Get_Next_Char(FT_Face face, FT_ULong char_code, FT_UInt *agindex)
Definition: ftobjs.c:3722
void DPRINT(...)
Definition: polytest.cpp:61
GLsizeiptr size
Definition: glext.h:5919
unsigned long DWORD
Definition: ntddk_ex.h:95
FT_Get_First_Char(FT_Face face, FT_UInt *agindex)
Definition: ftobjs.c:3697
unsigned short USHORT
Definition: pedump.c:61
unsigned int FT_UInt
Definition: fttypes.h:231
#define DPRINT1
Definition: precomp.h:8
GLenum GLuint GLint GLenum face
Definition: glext.h:7025

Referenced by NtGdiGetFontUnicodeRanges().

◆ GreCreateFontIndirectW()

HFONT FASTCALL GreCreateFontIndirectW ( LOGFONTW lplf)

Internal

Definition at line 23 of file font.c.

24 {
25  if (lplf)
26  {
27  ENUMLOGFONTEXDVW Logfont;
28 
29  RtlCopyMemory( &Logfont.elfEnumLogfontEx.elfLogFont, lplf, sizeof(LOGFONTW));
31  sizeof(Logfont.elfEnumLogfontEx.elfFullName));
33  sizeof(Logfont.elfEnumLogfontEx.elfStyle));
35  sizeof(Logfont.elfEnumLogfontEx.elfScript));
36 
37  Logfont.elfDesignVector.dvNumAxes = 0;
38 
39  RtlZeroMemory( &Logfont.elfDesignVector, sizeof(DESIGNVECTOR));
40 
41  return HfontCreate((PENUMLOGFONTEXDVW)&Logfont, 0, 0, 0, NULL );
42  }
43  else return NULL;
44 }
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
WCHAR elfFullName[LF_FULLFACESIZE]
Definition: wingdi.h:2702
DWORD dvNumAxes
Definition: wingdi.h:2768
WCHAR elfStyle[LF_FACESIZE]
Definition: wingdi.h:2703
WCHAR elfScript[LF_FACESIZE]
Definition: wingdi.h:2704
smooth NULL
Definition: ftsmooth.c:416
HFONT APIENTRY HfontCreate(IN PENUMLOGFONTEXDVW pelfw, IN ULONG cjElfw, IN LFTYPE lft, IN FLONG fl, IN PVOID pvCliData)
Definition: font.c:1140
DESIGNVECTOR elfDesignVector
Definition: wingdi.h:2779
LOGFONTW elfLogFont
Definition: wingdi.h:2701
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
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
FORCEINLINE VOID TEXTOBJ_UnlockText(PLFONT plfnt)
Definition: text.h:96
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1173
static WCHAR String[]
Definition: stringtable.c:55
_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
smooth NULL
Definition: ftsmooth.c:416
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
Definition: polytest.cpp:40
static HDC hDC
Definition: 3dtext.c:33
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
PTEXTOBJ FASTCALL RealizeFontInit(HFONT hFont)
Definition: font.c:422
BOOL FASTCALL TextIntGetTextExtentPoint(PDC dc, PTEXTOBJ TextObj, LPCWSTR String, INT Count, ULONG MaxExtent, LPINT Fit, LPINT Dx, LPSIZE Size, FLONG fl)
Definition: freetype.c:4218
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
FORCEINLINE VOID TEXTOBJ_UnlockText(PLFONT plfnt)
Definition: text.h:96
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
#define FALSE
Definition: types.h:117
Definition: text.h:59
unsigned int BOOL
Definition: ntddk_ex.h:94
HANDLE hlfntNew
Definition: ntgdihdl.h:334
smooth NULL
Definition: ftsmooth.c:416
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
LONG cx
Definition: windef.h:334
Definition: polytest.cpp:40
static HDC hDC
Definition: 3dtext.c:33
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
PTEXTOBJ FASTCALL RealizeFontInit(HFONT hFont)
Definition: font.c:422
BOOL FASTCALL TextIntGetTextExtentPoint(PDC dc, PTEXTOBJ TextObj, LPCWSTR String, INT Count, ULONG MaxExtent, LPINT Fit, LPINT Dx, LPSIZE Size, FLONG fl)
Definition: freetype.c:4218
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:4542
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 }
smooth NULL
Definition: ftsmooth.c:416
BOOL APIENTRY GreExtTextOutW(IN HDC hDC, IN INT XStart, IN INT YStart, IN UINT fuOptions, IN OPTIONAL PRECTL lprc, IN LPCWSTR String, IN INT Count, IN OPTIONAL LPINT Dx, IN DWORD dwCodePage)
Definition: freetype.c:6601
HDC hdc
Definition: main.c:9

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

◆ InitFontSupport()

BOOL FASTCALL InitFontSupport ( VOID  )

Definition at line 660 of file freetype.c.

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

Referenced by DriverEntry().

◆ IntCharSetFromCodePage()

BYTE FASTCALL IntCharSetFromCodePage ( UINT  uCodePage)

Definition at line 172 of file freetype.c.

173 {
174  UINT i;
175 
176  if (uCodePage == CP_OEMCP)
177  return OEM_CHARSET;
178 
179  if (uCodePage == CP_MACCP)
180  return MAC_CHARSET;
181 
182  for (i = 0; i < MAXTCIINDEX; ++i)
183  {
184  if (g_FontTci[i].ciACP == 0)
185  continue;
186 
187  if (g_FontTci[i].ciACP == uCodePage)
188  return g_FontTci[i].ciCharset;
189  }
190 
191  return DEFAULT_CHARSET;
192 }
static const CHARSETINFO g_FontTci[MAXTCIINDEX]
Definition: freetype.c:124
#define MAC_CHARSET
Definition: wingdi.h:402
#define DEFAULT_CHARSET
Definition: wingdi.h:383
#define MAXTCIINDEX
Definition: freetype.c:123
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
UINT ciCharset
Definition: wingdi.h:1545
#define OEM_CHARSET
Definition: wingdi.h:399
unsigned int UINT
Definition: ndis.h:50
#define CP_OEMCP
Definition: freetype.c:166
#define CP_MACCP
Definition: freetype.c:167

Referenced by CreateStockFonts().

◆ IntEnableFontRendering()

VOID FASTCALL IntEnableFontRendering ( BOOL  Enable)

Definition at line 1999 of file freetype.c.

2000 {
2002 }
_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 1825 of file freetype.c.

1826 {
1827  HANDLE Ret = NULL;
1829  PFONT_ENTRY_COLL_MEM EntryCollection;
1830  INT FaceCount;
1831 
1833  if (!BufferCopy)
1834  {
1835  *pNumAdded = 0;
1836  return NULL;
1837  }
1838  RtlCopyMemory(BufferCopy, Buffer, dwSize);
1839 
1840  LoadFont.pFileName = NULL;
1841  LoadFont.Memory = SharedMem_Create(BufferCopy, dwSize, FALSE);
1842  LoadFont.Characteristics = FR_PRIVATE | FR_NOT_ENUM;
1843  RtlInitUnicodeString(&LoadFont.RegValueName, NULL);
1844  LoadFont.IsTrueType = FALSE;
1845  LoadFont.PrivateEntry = NULL;
1847 
1848  RtlFreeUnicodeString(&LoadFont.RegValueName);
1849 
1850  /* Release our copy */
1851  IntLockFreeType();
1852  SharedMem_Release(LoadFont.Memory);
1854 
1855  if (FaceCount > 0)
1856  {
1857  EntryCollection = ExAllocatePoolWithTag(PagedPool, sizeof(FONT_ENTRY_COLL_MEM), TAG_FONT);
1858  if (EntryCollection)
1859  {
1861  EntryCollection->Entry = LoadFont.PrivateEntry;
1862  IntLockProcessPrivateFonts(Win32Process);
1863  EntryCollection->Handle = ULongToHandle(++Win32Process->PrivateMemFontHandleCount);
1864  InsertTailList(&Win32Process->PrivateMemFontListHead, &EntryCollection->ListEntry);
1865  IntUnLockProcessPrivateFonts(Win32Process);
1866  Ret = EntryCollection->Handle;
1867  }
1868  }
1869  *pNumAdded = FaceCount;
1870 
1871  return Ret;
1872 }
#define ULongToHandle(h)
Definition: basetsd.h:81
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
UINT PrivateMemFontHandleCount
Definition: win32.h:278
#define IntUnLockProcessPrivateFonts(W32Process)
Definition: text.h:150
#define TAG_FONT
Definition: tags.h:12
#define InsertTailList(ListHead, Entry)
int32_t INT
Definition: typedefs.h:58
FONT_ENTRY_MEM * Entry
Definition: font.h:23
#define FALSE
Definition: types.h:117
smooth NULL
Definition: ftsmooth.c:416
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
PVOID NTAPI PsGetCurrentProcessWin32Process(VOID)
Definition: process.c:1183
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54
#define IntLockProcessPrivateFonts(W32Process)
Definition: text.h:147
static INT FASTCALL IntGdiLoadFontsFromMemory(PGDI_LOAD_FONT pLoadFont, PSHARED_FACE SharedFace, FT_Long FontIndex, INT CharSetIndex)
Definition: freetype.c:1080

Referenced by NtGdiAddFontMemResourceEx().

◆ IntGdiAddFontResource()

INT FASTCALL IntGdiAddFontResource ( PUNICODE_STRING  FileName,
DWORD  Characteristics 
)

Definition at line 1655 of file freetype.c.

1656 {
1657  return IntGdiAddFontResourceEx(FileName, Characteristics, 0);
1658 }
INT FASTCALL IntGdiAddFontResourceEx(PUNICODE_STRING FileName, DWORD Characteristics, DWORD dwFlags)
Definition: freetype.c:1456

Referenced by NtGdiAddFontResourceW().

◆ IntGdiAddFontResourceEx()

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

Definition at line 1456 of file freetype.c.

1458 {
1459  NTSTATUS Status;
1461  PVOID Buffer = NULL;
1464  SIZE_T ViewSize = 0, Length;
1465  LARGE_INTEGER SectionSize;
1468  INT FontCount;
1469  HANDLE KeyHandle;
1470  UNICODE_STRING PathName;
1471  LPWSTR pszBuffer;
1473  static const UNICODE_STRING TrueTypePostfix = RTL_CONSTANT_STRING(L" (TrueType)");
1474  static const UNICODE_STRING DosPathPrefix = RTL_CONSTANT_STRING(L"\\??\\");
1475 
1476  /* Build PathName */
1478  {
1479  Length = DosPathPrefix.Length + FileName->Length + sizeof(UNICODE_NULL);
1481  if (!pszBuffer)
1482  return 0; /* failure */
1483 
1484  RtlInitEmptyUnicodeString(&PathName, pszBuffer, Length);
1485  RtlAppendUnicodeStringToString(&PathName, &DosPathPrefix);
1487  }
1488  else
1489  {
1490  Status = DuplicateUnicodeString(FileName, &PathName);
1491  if (!NT_SUCCESS(Status))
1492  return 0; /* failure */
1493  }
1494 
1495  /* Open the font file */
1498  Status = ZwOpenFile(
1499  &FileHandle,
1502  &Iosb,
1505  if (!NT_SUCCESS(Status))
1506  {
1507  DPRINT1("Could not load font file: %wZ\n", &PathName);
1508  RtlFreeUnicodeString(&PathName);
1509  return 0;
1510  }
1511 
1514  if (!NT_SUCCESS(Status))
1515  {
1516  DPRINT1("ObReferenceObjectByHandle failed.\n");
1518  RtlFreeUnicodeString(&PathName);
1519  return 0;
1520  }
1521 
1522  SectionSize.QuadPart = 0LL;
1525  NULL, &SectionSize, PAGE_READONLY,
1527  if (!NT_SUCCESS(Status))
1528  {
1529  DPRINT1("Could not map file: %wZ\n", &PathName);
1532  RtlFreeUnicodeString(&PathName);
1533  return 0;
1534  }
1536 
1538  if (!NT_SUCCESS(Status))
1539  {
1540  DPRINT1("Could not map file: %wZ\n", &PathName);
1543  RtlFreeUnicodeString(&PathName);
1544  return 0;
1545  }
1546 
1547  LoadFont.pFileName = &PathName;
1549  LoadFont.Characteristics = Characteristics;
1550  RtlInitUnicodeString(&LoadFont.RegValueName, NULL);
1551  LoadFont.IsTrueType = FALSE;
1552  LoadFont.CharSet = DEFAULT_CHARSET;
1553  LoadFont.PrivateEntry = NULL;
1554  FontCount = IntGdiLoadFontsFromMemory(&LoadFont, NULL, -1, -1);
1555 
1556  /* Release our copy */
1557  IntLockFreeType();
1558  SharedMem_Release(LoadFont.Memory);
1560 
1562 
1564 
1565  /* Save the loaded font name into the registry */
1566  if (FontCount > 0 && (dwFlags & AFRX_WRITE_REGISTRY))
1567  {
1568  UNICODE_STRING NewString;
1569  SIZE_T Length;
1570  PWCHAR pszBuffer;
1571  LPCWSTR CharSetName;
1572  if (LoadFont.IsTrueType)
1573  {
1574  /* Append " (TrueType)" */
1575  Length = LoadFont.RegValueName.Length + TrueTypePostfix.Length + sizeof(UNICODE_NULL);
1577  if (pszBuffer)
1578  {
1579  RtlInitEmptyUnicodeString(&NewString, pszBuffer, Length);
1580  NewString.Buffer[0] = UNICODE_NULL;
1581  RtlAppendUnicodeStringToString(&NewString, &LoadFont.RegValueName);
1582  RtlAppendUnicodeStringToString(&NewString, &TrueTypePostfix);
1583  RtlFreeUnicodeString(&LoadFont.RegValueName);
1584  LoadFont.RegValueName = NewString;
1585  }
1586  else
1587  {
1588  // FIXME!
1589  }
1590  }
1591  else if (LoadFont.CharSet != DEFAULT_CHARSET)
1592  {
1593  /* Append " (CharSetName)" */
1594  CharSetName = NameFromCharSet(LoadFont.CharSet);
1595  Length = LoadFont.RegValueName.Length +
1596  (wcslen(CharSetName) + 3) * sizeof(WCHAR) +
1597  sizeof(UNICODE_NULL);
1598 
1600  if (pszBuffer)
1601  {
1602  RtlInitEmptyUnicodeString(&NewString, pszBuffer, Length);
1603  NewString.Buffer[0] = UNICODE_NULL;
1604  RtlAppendUnicodeStringToString(&NewString, &LoadFont.RegValueName);
1605  RtlAppendUnicodeToString(&NewString, L" (");
1606  RtlAppendUnicodeToString(&NewString, CharSetName);
1607  RtlAppendUnicodeToString(&NewString, L")");
1608  RtlFreeUnicodeString(&LoadFont.RegValueName);
1609  LoadFont.RegValueName = NewString;
1610  }
1611  else
1612  {
1613  // FIXME!
1614  }
1615  }
1616 
1619  NULL, NULL);
1620  Status = ZwOpenKey(&KeyHandle, KEY_WRITE, &ObjectAttributes);
1621  if (NT_SUCCESS(Status))
1622  {
1623  SIZE_T DataSize;
1624  LPWSTR pFileName;
1625 
1627  {
1628  pFileName = PathName.Buffer;
1629  }
1630  else
1631  {
1632  pFileName = wcsrchr(PathName.Buffer, L'\\');
1633  }
1634 
1635  if (pFileName)
1636  {
1637  if (!(dwFlags & AFRX_ALTERNATIVE_PATH))
1638  {
1639  pFileName++;
1640  }
1641  DataSize = (wcslen(pFileName) + 1) * sizeof(WCHAR);
1642  ZwSetValueKey(KeyHandle, &LoadFont.RegValueName, 0, REG_SZ,
1643  pFileName, DataSize);
1644  }
1645  ZwClose(KeyHandle);
1646  }
1647  }
1648  RtlFreeUnicodeString(&LoadFont.RegValueName);
1649 
1650  RtlFreeUnicodeString(&PathName);
1651  return FontCount;
1652 }
_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
#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
VOID NTAPI ObDereferenceObject(IN PVOID Object)
Definition: obref.c:375
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_WRITE_REGISTRY
Definition: text.h:104
HANDLE FileHandle
Definition: stats.c:38
NTSTATUS NTAPI ObReferenceObjectByHandle(IN HANDLE Handle, IN ACCESS_MASK DesiredAccess, IN POBJECT_TYPE ObjectType, IN KPROCESSOR_MODE AccessMode, OUT PVOID *Object, OUT POBJECT_HANDLE_INFORMATION HandleInformation OPTIONAL)
Definition: obref.c:496
#define SEC_COMMIT
Definition: mmtypes.h:99
#define AFRX_ALTERNATIVE_PATH
Definition: text.h:105
#define FALSE
Definition: types.h:117
#define UNICODE_NULL
#define FILE_READ_DATA
Definition: nt_native.h:628
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
_Inout_ PFILE_OBJECT FileObject
Definition: cdprocs.h:588
BOOL LoadFont(LPWSTR lpCmdLine)
#define KEY_WRITE
Definition: nt_native.h:1031
NTSTATUS RtlAppendUnicodeToString(IN PUNICODE_STRING Str1, IN PWSTR Str2)
Definition: string_lib.cpp:62
__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:4975
#define IntUnLockFreeType()
Definition: freetype.c:82
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
* PFILE_OBJECT
Definition: iotypes.h:1962
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
NTSYSAPI NTSTATUS NTAPI ZwOpenFile(_Out_ PHANDLE FileHandle, _In_ ACCESS_MASK DesiredAccess, _In_ POBJECT_ATTRIBUTES ObjectAttributes, _Out_ PIO_STATUS_BLOCK IoStatusBlock, _In_ ULONG ShareAccess, _In_ ULONG OpenOptions)
NTSTATUS NTAPI MmMapViewInSystemSpace(IN PVOID SectionObject, OUT PVOID *MappedBase, IN OUT PSIZE_T ViewSize)
Definition: section.c:4847
Status
Definition: gdiplustypes.h:24
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:111
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 PAGE_READONLY
Definition: compat.h:138
#define DPRINT1
Definition: precomp.h:8
static UNICODE_STRING g_FontRegPath
Definition: freetype.c:58
#define FILE_SYNCHRONOUS_IO_NONALERT
Definition: from_kernel.h:31
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID _In_ ULONG_PTR _In_ SIZE_T _Inout_opt_ PLARGE_INTEGER _Inout_ PSIZE_T ViewSize
Definition: mmfuncs.h:404
#define STANDARD_RIGHTS_REQUIRED
Definition: nt_native.h:63
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
static LPCWSTR FASTCALL NameFromCharSet(BYTE CharSet)
Definition: freetype.c:1422
#define AFRX_DOS_DEVICE_PATH
Definition: text.h:106
WCHAR * LPWSTR
Definition: xmlstorage.h:184
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
_In_ NDIS_STATUS _In_ ULONG _In_ USHORT _In_opt_ PVOID _In_ ULONG DataSize
Definition: ndis.h:4751
static NTSTATUS DuplicateUnicodeString(PUNICODE_STRING Source, PUNICODE_STRING Destination)
Definition: freetype.c:881
static INT FASTCALL IntGdiLoadFontsFromMemory(PGDI_LOAD_FONT pLoadFont, PSHARED_FACE SharedFace, FT_Long FontIndex, INT CharSetIndex)
Definition: freetype.c:1080
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 1947 of file freetype.c.

1948 {
1951  PFONT_ENTRY_COLL_MEM EntryCollection;
1952 
1953  DPRINT("IntGdiCleanupPrivateFontsForProcess()\n");
1954  do {
1955  Entry = NULL;
1956  EntryCollection = NULL;
1957 
1958  IntLockProcessPrivateFonts(Win32Process);
1959  if (!IsListEmpty(&Win32Process->PrivateMemFontListHead))
1960  {
1961  Entry = Win32Process->PrivateMemFontListHead.Flink;
1962  EntryCollection = CONTAINING_RECORD(Entry, FONT_ENTRY_COLL_MEM, ListEntry);
1963  UnlinkFontMemCollection(EntryCollection);
1964  }
1965  IntUnLockProcessPrivateFonts(Win32Process);
1966 
1967  if (EntryCollection)
1968  {
1969  IntGdiCleanupMemEntry(EntryCollection->Entry);
1970  ExFreePoolWithTag(EntryCollection, TAG_FONT);
1971  }
1972  else
1973  {
1974  /* No Mem fonts anymore, see if we have any other private fonts left */
1975  Entry = NULL;
1976  IntLockProcessPrivateFonts(Win32Process);
1977  if (!IsListEmpty(&Win32Process->PrivateFontListHead))
1978  {
1979  Entry = RemoveHeadList(&Win32Process->PrivateFontListHead);
1980  }
1981  IntUnLockProcessPrivateFonts(Win32Process);
1982 
1983  if (Entry)
1984  {
1986  }
1987  }
1988 
1989  } while (Entry);
1990 }
#define IntUnLockProcessPrivateFonts(W32Process)
Definition: text.h:150
struct _Entry Entry
Definition: kefuncs.h:627
#define TAG_FONT
Definition: tags.h:12
VOID FASTCALL IntGdiCleanupMemEntry(PFONT_ENTRY_MEM Head)
Definition: freetype.c:1877
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
FONT_ENTRY_MEM * Entry
Definition: font.h:23
smooth NULL
Definition: ftsmooth.c:416
FORCEINLINE PLIST_ENTRY RemoveHeadList(_Inout_ PLIST_ENTRY ListHead)
Definition: rtlfuncs.h:128
void DPRINT(...)
Definition: polytest.cpp:61
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
LIST_ENTRY PrivateMemFontListHead
Definition: win32.h:277
Definition: typedefs.h:119
static VOID FASTCALL UnlinkFontMemCollection(PFONT_ENTRY_COLL_MEM Collection)
Definition: freetype.c:1896
Definition: font.h:19
PVOID NTAPI PsGetCurrentProcessWin32Process(VOID)
Definition: process.c:1183
static __inline VOID FASTCALL CleanupFontEntry(PFONT_ENTRY FontEntry)
Definition: freetype.c:362
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
base of all file and directory entries
Definition: entries.h:82
#define IntLockProcessPrivateFonts(W32Process)
Definition: text.h:147
LIST_ENTRY PrivateFontListHead
Definition: win32.h:276

Referenced by GdiProcessDestroy().

◆ IntGdiGetFontResourceInfo()

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

Definition at line 5368 of file freetype.c.

5373 {
5374  UNICODE_STRING EntryFileName;
5375  POBJECT_NAME_INFORMATION NameInfo1 = NULL, NameInfo2 = NULL;
5376  PLIST_ENTRY ListEntry;
5377  PFONT_ENTRY FontEntry;
5378  ULONG Size, i, Count;
5379  LPBYTE pbBuffer;
5380  BOOL IsEqual;
5381  FONTFAMILYINFO *FamInfo;
5382  const ULONG MaxFamInfo = 64;
5383  const ULONG MAX_FAM_INFO_BYTES = sizeof(FONTFAMILYINFO) * MaxFamInfo;
5384  BOOL bSuccess;
5385  const ULONG NAMEINFO_SIZE = sizeof(OBJECT_NAME_INFORMATION) + MAX_PATH * sizeof(WCHAR);
5386 
5387  DPRINT("IntGdiGetFontResourceInfo: dwType == %lu\n", dwType);
5388 
5389  do
5390  {
5391  /* Create buffer for full path name */
5392  NameInfo1 = ExAllocatePoolWithTag(PagedPool, NAMEINFO_SIZE, TAG_FINF);
5393  if (!NameInfo1)
5394  break;
5395 
5396  /* Get the full path name */
5397  if (!IntGetFullFileName(NameInfo1, NAMEINFO_SIZE, FileName))
5398  break;
5399 
5400  /* Create a buffer for the entries' names */
5401  NameInfo2 = ExAllocatePoolWithTag(PagedPool, NAMEINFO_SIZE, TAG_FINF);
5402  if (!NameInfo2)
5403  break;
5404 
5405  FamInfo = ExAllocatePoolWithTag(PagedPool, MAX_FAM_INFO_BYTES, TAG_FINF);
5406  } while (0);
5407 
5408  if (!NameInfo1 || !NameInfo2 || !FamInfo)
5409  {
5410  if (NameInfo2)
5411  ExFreePoolWithTag(NameInfo2, TAG_FINF);
5412 
5413  if (NameInfo1)
5414  ExFreePoolWithTag(NameInfo1, TAG_FINF);
5415 
5417  return FALSE;
5418  }
5419 
5420  Count = 0;
5421 
5422  /* Try to find the pathname in the global font list */
5424  for (ListEntry = g_FontListHead.Flink; ListEntry != &g_FontListHead;
5425  ListEntry = ListEntry->Flink)
5426  {
5427  FontEntry = CONTAINING_RECORD(ListEntry, FONT_ENTRY, ListEntry);
5428  if (FontEntry->Font->Filename == NULL)
5429  continue;
5430 
5431  RtlInitUnicodeString(&EntryFileName , FontEntry->Font->Filename);
5432  if (!IntGetFullFileName(NameInfo2, NAMEINFO_SIZE, &EntryFileName))
5433  continue;
5434 
5435  if (!RtlEqualUnicodeString(&NameInfo1->Name, &NameInfo2->Name, FALSE))
5436  continue;
5437 
5438  IsEqual = FALSE;
5439  FontFamilyFillInfo(&FamInfo[Count], FontEntry->FaceName.Buffer,
5440  NULL, FontEntry->Font);
5441  for (i = 0; i < Count; ++i)
5442  {
5443  if (EqualFamilyInfo(&FamInfo[i], &FamInfo[Count]))
5444  {
5445  IsEqual = TRUE;
5446  break;
5447  }
5448  }
5449  if (!IsEqual)
5450  {
5451  /* Found */
5452  ++Count;
5453  if (Count >= MaxFamInfo)
5454  break;
5455  }
5456  }
5458 
5459  /* Free the buffers */
5460  ExFreePoolWithTag(NameInfo1, TAG_FINF);
5461  ExFreePoolWithTag(NameInfo2, TAG_FINF);
5462 
5463  if (Count == 0 && dwType != 5)
5464  {
5465  /* Font could not be found in system table
5466  dwType == 5 will still handle this */
5467  ExFreePoolWithTag(FamInfo, TAG_FINF);
5468  return FALSE;
5469  }
5470 
5471  bSuccess = FALSE;
5472  switch (dwType)
5473  {
5474  case 0: /* FIXME: Returns 1 or 2, don't know what this is atm */
5475  Size = sizeof(DWORD);
5476  if (*pdwBytes == 0)
5477  {
5478  *pdwBytes = Size;
5479  bSuccess = TRUE;
5480  }
5481  else if (pBuffer)
5482  {
5483  if (*pdwBytes >= Size)
5484  {
5485  *(DWORD*)pBuffer = Count;
5486  }
5487  *pdwBytes = Size;
5488  bSuccess = TRUE;
5489  }
5490  break;
5491 
5492  case 1: /* copy the font title */
5493  /* calculate the required size */
5494  Size = 0;
5495  for (i = 0; i < Count; ++i)
5496  {
5497  if (i > 0)
5498  Size += 3; /* " & " */
5499  Size += wcslen(FamInfo[i].EnumLogFontEx.elfLogFont.lfFaceName);
5500  if (FamInfo[i].EnumLogFontEx.elfStyle[0] &&
5501  _wcsicmp(FamInfo[i].EnumLogFontEx.elfStyle, L"Regular") != 0)
5502  {
5503  Size += 1 + wcslen(FamInfo[i].EnumLogFontEx.elfStyle);
5504  }
5505  }
5506  Size += 2; /* "\0\0" */
5507  Size *= sizeof(WCHAR);
5508 
5509  if (*pdwBytes == 0)
5510  {
5511  *pdwBytes = Size;
5512  bSuccess = TRUE;
5513  }
5514  else if (pBuffer)
5515  {
5516  if (*pdwBytes >= Size)
5517  {
5518  /* store font title to buffer */
5519  WCHAR *psz = pBuffer;
5520  *psz = 0;
5521  for (i = 0; i < Count; ++i)
5522  {
5523  if (i > 0)
5524  wcscat(psz, L" & ");
5525  IntAddNameFromFamInfo(psz, &FamInfo[i]);
5526  }
5527  psz[wcslen(psz) + 1] = UNICODE_NULL;
5528  *pdwBytes = Size;
5529  bSuccess = TRUE;
5530  }
5531  else
5532  {
5533  *pdwBytes = 1024; /* this is confirmed value */
5534  }
5535  }
5536  break;
5537 
5538  case 2: /* Copy an array of LOGFONTW */
5539  Size = Count * sizeof(LOGFONTW);
5540  if (*pdwBytes == 0)
5541  {
5542  *pdwBytes = Size;
5543  bSuccess = TRUE;
5544  }
5545  else if (pBuffer)
5546  {
5547  if (*pdwBytes >= Size)
5548  {
5549  pbBuffer = (LPBYTE)pBuffer;
5550  for (i = 0; i < Count; ++i)
5551  {
5552  FamInfo[i].EnumLogFontEx.elfLogFont.lfWidth = 0;
5553  RtlCopyMemory(pbBuffer, &FamInfo[i].EnumLogFontEx.elfLogFont, sizeof(LOGFONTW));
5554  pbBuffer += sizeof(LOGFONTW);
5555  }
5556  }
5557  *pdwBytes = Size;
5558  bSuccess = TRUE;
5559  }
5560  else
5561  {
5562  *pdwBytes = 1024; /* this is confirmed value */
5563  }
5564  break;
5565 
5566  case 3:
5567  Size = sizeof(DWORD);
5568  if (*pdwBytes == 0)
5569  {
5570  *pdwBytes = Size;
5571  bSuccess = TRUE;
5572  }
5573  else if (pBuffer)
5574  {
5575  if (*pdwBytes >= Size)
5576  {
5577  /* FIXME: What exactly is copied here? */
5578  *(DWORD*)pBuffer = 1;
5579  }
5580  *pdwBytes = Size;
5581  bSuccess = TRUE;
5582  }
5583  break;
5584 
5585  case 4: /* full file path */
5586  if (FileName->Length >= 4 * sizeof(WCHAR))
5587  {
5588  /* The beginning of FileName is \??\ */
5589  LPWSTR pch = FileName->Buffer + 4;
5590  DWORD Length = FileName->Length - 4 * sizeof(WCHAR);
5591 
5592  Size = Length + sizeof(WCHAR);
5593  if (*pdwBytes == 0)
5594  {
5595  *pdwBytes = Size;
5596  bSuccess = TRUE;
5597  }
5598  else if (pBuffer)
5599  {
5600  if (*pdwBytes >= Size)
5601  {
5603  }
5604  *pdwBytes = Size;
5605  bSuccess = TRUE;
5606  }
5607  }
5608  break;
5609 
5610  case 5: /* Looks like a BOOL that is copied, TRUE, if the font was not found */
5611  Size = sizeof(BOOL);
5612  if (*pdwBytes == 0)
5613  {
5614  *pdwBytes = Size;
5615  bSuccess = TRUE;
5616  }
5617  else if (pBuffer)
5618  {
5619  if (*pdwBytes >= Size)
5620  {
5621  *(BOOL*)pBuffer = Count == 0;
5622  }
5623  *pdwBytes = Size;
5624  bSuccess = TRUE;
5625  }
5626  break;
5627  }
5628  ExFreePoolWithTag(FamInfo, TAG_FINF);
5629 
5630  return bSuccess;
5631 }
static LIST_ENTRY g_FontListHead
Definition: freetype.c:66
#define TAG_FINF
Definition: text.h:3
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
#define TRUE
Definition: types.h:120
static BOOL EqualFamilyInfo(const FONTFAMILYINFO *pInfo1, const FONTFAMILYINFO *pInfo2)
Definition: freetype.c:5334
UNICODE_STRING FaceName
Definition: font.h:8
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1173
UNICODE_STRING Name
Definition: nt_native.h:1270
static BOOL FASTCALL IntGetFullFileName(POBJECT_NAME_INFORMATION NameInfo, ULONG Size, PUNICODE_STRING FileName)
Definition: freetype.c:5291
#define BOOL
Definition: nt_native.h:43
#define DWORD
Definition: nt_native.h:44
static BOOLEAN bSuccess
Definition: drive.cpp:419
#define IntUnLockGlobalFonts()
Definition: freetype.c:73
#define pch(ap)
Definition: match.c:418
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned char * LPBYTE
Definition: typedefs.h: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
smooth NULL
Definition: ftsmooth.c:416
PVOID pBuffer
static VOID IntAddNameFromFamInfo(LPWSTR psz, FONTFAMILYINFO *FamInfo)
Definition: freetype.c:5355
void DPRINT(...)
Definition: polytest.cpp:61
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
Definition: font.h:4
static void FASTCALL FontFamilyFillInfo(PFONTFAMILYINFO Info, LPCWSTR FaceName, LPCWSTR FullName, PFONTGDI FontGDI)
Definition: freetype.c:2798
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
__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
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
static PWSTR PDWORD pdwBytes
Definition: layerapi.c:35
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
static const WCHAR L[]
Definition: oid.c:1250
Definition: typedefs.h:119
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
#define IntLockGlobalFonts()
Definition: freetype.c:70
ENUMLOGFONTEXW EnumLogFontEx
Definition: ntgdibad.h:47
FONTGDI * Font
Definition: font.h:7
struct tagFONTFAMILYINFO FONTFAMILYINFO
_CRTIMP wchar_t *__cdecl wcscat(_Inout_updates_z_(_String_length_(_Dest)+_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
LOGFONTW elfLogFont
Definition: wingdi.h:2701
unsigned int ULONG
Definition: retypes.h:1
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
WCHAR * LPWSTR
Definition: xmlstorage.h:184
NTSYSAPI BOOLEAN NTAPI RtlEqualUnicodeString(PUNICODE_STRING String1, PUNICODE_STRING String2, BOOLEAN CaseInSensitive)
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)

Referenced by NtGdiGetFontResourceInfoInternalW().

◆ IntGdiRemoveFontMemResource()

BOOL FASTCALL IntGdiRemoveFontMemResource ( HANDLE  hMMFont)

Definition at line 1913 of file freetype.c.

1914 {
1916  PFONT_ENTRY_COLL_MEM CurrentEntry;
1917  PFONT_ENTRY_COLL_MEM EntryCollection = NULL;
1919 
1920  IntLockProcessPrivateFonts(Win32Process);
1921  for (Entry = Win32Process->PrivateMemFontListHead.Flink;
1922  Entry != &Win32Process->PrivateMemFontListHead;
1923  Entry = Entry->Flink)
1924  {
1925  CurrentEntry = CONTAINING_RECORD(Entry, FONT_ENTRY_COLL_MEM, ListEntry);
1926 
1927  if (CurrentEntry->Handle == hMMFont)
1928  {
1929  EntryCollection = CurrentEntry;
1930  UnlinkFontMemCollection(CurrentEntry);
1931  break;
1932  }
1933  }
1934  IntUnLockProcessPrivateFonts(Win32Process);
1935 
1936  if (EntryCollection)
1937  {
1938  IntGdiCleanupMemEntry(EntryCollection->Entry);
1939  ExFreePoolWithTag(EntryCollection, TAG_FONT);
1940  return TRUE;
1941  }
1942  return FALSE;
1943 }
#define IntUnLockProcessPrivateFonts(W32Process)
Definition: text.h:150
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:1877
FONT_ENTRY_MEM * Entry
Definition: font.h:23
#define FALSE
Definition: types.h:117
smooth NULL
Definition: ftsmooth.c:416
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
struct _LIST_ENTRY * Flink
Definition: typedefs.h: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:1896
Definition: font.h:19
PVOID NTAPI PsGetCurrentProcessWin32Process(VOID)
Definition: process.c:1183
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
base of all file and directory entries
Definition: entries.h:82
#define IntLockProcessPrivateFonts(W32Process)
Definition: text.h:147

Referenced by NtGdiRemoveFontMemResourceEx().

◆ IntGetCharDimensions()

DWORD FASTCALL IntGetCharDimensions ( HDC  ,
PTEXTMETRICW  ,
PDWORD   
)

Definition at line 329 of file font.c.

330 {
331  PDC pdc;
332  PDC_ATTR pdcattr;
333  PTEXTOBJ TextObj;
334  SIZE sz;
335  TMW_INTERNAL tmwi;
336  BOOL Good;
337 
338  static const WCHAR alphabet[] = {
339  'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q',
340  'r','s','t','u','v','w','x','y','z','A','B','C','D','E','F','G','H',
341  'I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',0};
342 
343  if(!ftGdiGetTextMetricsW(hdc, &tmwi)) return 0;
344 
345  pdc = DC_LockDc(hdc);
346 
347  if (!pdc) return 0;
348 
349  pdcattr = pdc->pdcattr;
350 
351  TextObj = RealizeFontInit(pdcattr->hlfntNew);
352  if ( !TextObj )
353  {
354  DC_UnlockDc(pdc);
355  return 0;
356  }
357  Good = TextIntGetTextExtentPoint(pdc, TextObj, alphabet, 52, 0, NULL, 0, &sz, 0);
358  TEXTOBJ_UnlockText(TextObj);
359  DC_UnlockDc(pdc);
360 
361  if (!Good) return 0;
362  if (ptm) *ptm = tmwi.TextMetric;
363  if (height) *height = tmwi.TextMetric.tmHeight;
364 
365  return (sz.cx / 26 + 1) / 2;
366 }
TEXTMETRICW TextMetric
Definition: ntgdityp.h: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
smooth NULL
Definition: ftsmooth.c:416
LONG cx
Definition: windef.h:334
Definition: polytest.cpp:40
__wchar_t WCHAR
Definition: xmlstorage.h:180
HDC hdc
Definition: main.c:9
BOOL FASTCALL ftGdiGetTextMetricsW(HDC hDC, PTMW_INTERNAL ptmwi)
Definition: freetype.c:4542
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
PTEXTOBJ FASTCALL RealizeFontInit(HFONT hFont)
Definition: font.c:422
LONG tmHeight
Definition: wingdi.h:2382
BOOL FASTCALL TextIntGetTextExtentPoint(PDC dc, PTEXTOBJ TextObj, LPCWSTR String, INT Count, ULONG MaxExtent, LPINT Fit, LPINT Dx, LPSIZE Size, FLONG fl)
Definition: freetype.c:4218

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

◆ IntGetFontLanguageInfo()

DWORD FASTCALL IntGetFontLanguageInfo ( PDC  )

Definition at line 371 of file font.c.

372 {
373  PDC_ATTR pdcattr;
374  FONTSIGNATURE fontsig;
375  static const DWORD GCP_DBCS_MASK=0x003F0000,
376  GCP_DIACRITIC_MASK=0x00000000,
377  FLI_GLYPHS_MASK=0x00000000,
378  GCP_GLYPHSHAPE_MASK=0x00000040,
379  GCP_KASHIDA_MASK=0x00000000,
380  GCP_LIGATE_MASK=0x00000000,
381  GCP_USEKERNING_MASK=0x00000000,
382  GCP_REORDER_MASK=0x00000060;
383 
384  DWORD result=0;
385 
386  ftGdiGetTextCharsetInfo( Dc, &fontsig, 0 );
387 
388  /* We detect each flag we return using a bitmask on the Codepage Bitfields */
389  if( (fontsig.fsCsb[0]&GCP_DBCS_MASK)!=0 )
390  result|=GCP_DBCS;
391 
392  if( (fontsig.fsCsb[0]&GCP_DIACRITIC_MASK)!=0 )
394 
395  if( (fontsig.fsCsb[0]&FLI_GLYPHS_MASK)!=0 )
397 
398  if( (fontsig.fsCsb[0]&GCP_GLYPHSHAPE_MASK)!=0 )
400 
401  if( (fontsig.fsCsb[0]&GCP_KASHIDA_MASK)!=0 )
403 
404  if( (fontsig.fsCsb[0]&GCP_LIGATE_MASK)!=0 )
406 
407  if( (fontsig.fsCsb[0]&GCP_USEKERNING_MASK)!=0 )
409 
410  pdcattr = Dc->pdcattr;
411 
412  /* This might need a test for a HEBREW- or ARABIC_CHARSET as well */
413  if ( pdcattr->flTextAlign & TA_RTLREADING )
414  if( (fontsig.fsCsb[0]&GCP_REORDER_MASK)!=0 )
416 
417  return result;
418 }
#define FLI_GLYPHS
Definition: wingdi.h:845
#define GCP_DIACRITIC
Definition: wingdi.h:830
#define GCP_LIGATE
Definition: wingdi.h:836
#define GCP_KASHIDA
Definition: wingdi.h:835
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD fsCsb[2]
Definition: wingdi.h:1542
#define GCP_GLYPHSHAPE
Definition: wingdi.h:832
FLONG flTextAlign
Definition: ntgdihdl.h:328
#define GCP_REORDER
Definition: wingdi.h:842
#define GCP_DBCS
Definition: wingdi.h:827
#define TA_RTLREADING
Definition: wingdi.h:933
INT FASTCALL ftGdiGetTextCharsetInfo(PDC Dc, LPFONTSIGNATURE lpSig, DWORD dwFlags)
Definition: freetype.c:4361
GLuint64EXT * result
Definition: glext.h:11304
#define GCP_USEKERNING
Definition: wingdi.h:844

Referenced by NtGdiGetDCDword().

◆ IntGetOutlineTextMetrics()

INT FASTCALL IntGetOutlineTextMetrics ( PFONTGDI  ,
UINT  ,
OUTLINETEXTMETRICW  
)

Definition at line 2433 of file freetype.c.

2436 {
2437  TT_OS2 *pOS2;
2438  TT_HoriHeader *pHori;
2439  TT_Postscript *pPost;
2440  FT_Fixed XScale, YScale;
2441  FT_WinFNT_HeaderRec WinFNT;
2442  FT_Error Error;
2443  BYTE *pb;
2444  FONT_NAMES FontNames;
2445  PSHARED_FACE SharedFace = FontGDI->SharedFace;
2447  FT_Face Face = SharedFace->Face;
2448 
2450  {
2451  Cache = &SharedFace->EnglishUS;
2452  }
2453  else
2454  {
2455  Cache = &SharedFace->UserLanguage;
2456  }
2457 
2458  if (Size == 0 && Cache->OutlineRequiredSize > 0)
2459  {
2460  ASSERT(Otm == NULL);
2461  return Cache->OutlineRequiredSize;
2462  }
2463 
2464  IntInitFontNames(&FontNames, SharedFace);
2465  Cache->OutlineRequiredSize = FontNames.OtmSize;
2466 
2467  if (Size == 0)
2468  {
2469  ASSERT(Otm == NULL);
2470  IntFreeFontNames(&FontNames);
2471  return Cache->OutlineRequiredSize;
2472  }
2473 
2474  ASSERT(Otm != NULL);
2475 
2476  if (Size < Cache->OutlineRequiredSize)
2477  {
2478  DPRINT1("Size %u < OutlineRequiredSize %u\n", Size,
2479  Cache->OutlineRequiredSize);
2480  IntFreeFontNames(&FontNames);
2481  return 0; /* failure */
2482  }
2483 
2484  XScale = Face->size->metrics.x_scale;
2485  YScale = Face->size->metrics.y_scale;
2486 
2487  IntLockFreeType();
2488 
2489  pOS2 = FT_Get_Sfnt_Table(Face, FT_SFNT_OS2);
2490  pHori = FT_Get_Sfnt_Table(Face, FT_SFNT_HHEA);
2491  pPost = FT_Get_Sfnt_Table(Face, FT_SFNT_POST); /* We can live with this failing */
2492  Error = FT_Get_WinFNT_Header(Face, &WinFNT);
2493 
2494  if (pOS2 == NULL && Error)
2495  {
2497  DPRINT1("Can't find OS/2 table - not TT font?\n");
2498  IntFreeFontNames(&FontNames);
2499  return 0;
2500  }
2501 
2502  if (pHori == NULL && Error)
2503  {
2505  DPRINT1("Can't find HHEA table - not TT font?\n");
2506  IntFreeFontNames(&FontNames);
2507  return 0;
2508  }
2509 
2510  Otm->otmSize = Cache->OutlineRequiredSize;
2511 
2512  FillTM(&Otm->otmTextMetrics, FontGDI, pOS2, pHori, !Error ? &WinFNT : 0);
2513 
2514  if (!pOS2)
2515  goto skip_os2;
2516 
2517  Otm->otmFiller = 0;
2518  RtlCopyMemory(&Otm->otmPanoseNumber, pOS2->panose, PANOSE_COUNT);
2519  Otm->otmfsSelection = pOS2->fsSelection;
2520  Otm->otmfsType = pOS2->fsType;
2521  Otm->otmsCharSlopeRise = pHori->caret_Slope_Rise;
2522  Otm->otmsCharSlopeRun = pHori->caret_Slope_Run;
2523  Otm->otmItalicAngle = 0; /* POST table */
2524  Otm->otmEMSquare = Face->units_per_EM;
2525 
2526 #define SCALE_X(value) ((FT_MulFix((value), XScale) + 32) >> 6)
2527 #define SCALE_Y(value) ((FT_MulFix((value), YScale) + 32) >> 6)
2528 
2529  Otm->otmAscent = SCALE_Y(pOS2->sTypoAscender);
2530  Otm->otmDescent = SCALE_Y(pOS2->sTypoDescender);
2531  Otm->otmLineGap = SCALE_Y(pOS2->sTypoLineGap);
2532  Otm->otmsCapEmHeight = SCALE_Y(pOS2->sCapHeight);
2533  Otm->otmsXHeight = SCALE_Y(pOS2->sxHeight);
2534  Otm->otmrcFontBox.left = SCALE_X(Face->bbox.xMin);
2535  Otm->otmrcFontBox.right = SCALE_X(Face->bbox.xMax);
2536  Otm->otmrcFontBox.top = SCALE_Y(Face->bbox.yMax);
2537  Otm->otmrcFontBox.bottom = SCALE_Y(Face->bbox.yMin);
2538  Otm->otmMacAscent = Otm->otmTextMetrics.tmAscent;
2539  Otm->otmMacDescent = -Otm->otmTextMetrics.tmDescent;
2540  Otm->otmMacLineGap = Otm->otmLineGap;
2541  Otm->otmusMinimumPPEM = 0; /* TT Header */
2542  Otm->otmptSubscriptSize.x = SCALE_X(pOS2->ySubscriptXSize);
2543  Otm->otmptSubscriptSize.y = SCALE_Y(pOS2->ySubscriptYSize);
2544  Otm->otmptSubscriptOffset.x = SCALE_X(pOS2->ySubscriptXOffset);
2545  Otm->otmptSubscriptOffset.y = SCALE_Y(pOS2->ySubscriptYOffset);
2546  Otm->otmptSuperscriptSize.x = SCALE_X(pOS2->ySuperscriptXSize);
2547  Otm->otmptSuperscriptSize.y = SCALE_Y(pOS2->ySuperscriptYSize);
2548  Otm->otmptSuperscriptOffset.x = SCALE_X(pOS2->ySuperscriptXOffset);
2549  Otm->otmptSuperscriptOffset.y = SCALE_Y(pOS2->ySuperscriptYOffset);
2550  Otm->otmsStrikeoutSize = SCALE_Y(pOS2->yStrikeoutSize);
2551  Otm->otmsStrikeoutPosition = SCALE_Y(pOS2->yStrikeoutPosition);
2552 
2553  if (!pPost)
2554  {
2555  Otm->otmsUnderscoreSize = 0;
2556  Otm->otmsUnderscorePosition = 0;
2557  }
2558  else
2559  {
2560  Otm->otmsUnderscoreSize = SCALE_Y(pPost->underlineThickness);
2561  Otm->otmsUnderscorePosition = SCALE_Y(pPost->underlinePosition);
2562  }
2563 
2564 #undef SCALE_X
2565 #undef SCALE_Y
2566 
2567 skip_os2:
2569 
2570  pb = IntStoreFontNames(&FontNames, Otm);
2571  ASSERT(pb - (BYTE*)Otm == Cache->OutlineRequiredSize);
2572 
2573  IntFreeFontNames(&FontNames);
2574 
2575  return Cache->OutlineRequiredSize;
2576 }
SHARED_FACE_CACHE EnglishUS
Definition: engobjects.h:132
ULONG OtmSize
Definition: freetype.c:2356
FT_Short sxHeight
Definition: tttables.h:424
int FT_Error
Definition: fttypes.h:300
#define PANOSE_COUNT
Definition: wingdi.h:452
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
#define SCALE_X(value)
static __inline void FASTCALL IntInitFontNames(FONT_NAMES *Names, PSHARED_FACE SharedFace)
Definition: freetype.c:2360
static __inline BYTE *FASTCALL IntStoreFontNames(const FONT_NAMES *Names, OUTLINETEXTMETRICW *Otm)
Definition: freetype.c:2396
FT_Get_WinFNT_Header(FT_Face face, FT_WinFNT_HeaderRec *aheader)
Definition: ftwinfnt.c:29
FT_Size size
Definition: freetype.h:1106
Definition: fatfs.h:173
FT_Short sTypoDescender
Definition: tttables.h:412
FT_Fixed y_scale
Definition: freetype.h:1644
FT_Short ySuperscriptXOffset
Definition: tttables.h:393
FT_Short yStrikeoutPosition
Definition: tttables.h:396
FT_Short sCapHeight
Definition: tttables.h:425
FT_Short caret_Slope_Run
Definition: tttables.h:212
FT_UShort units_per_EM
Definition: freetype.h:1094
SHARED_FACE_CACHE UserLanguage
Definition: engobjects.h:133
FT_UShort fsSelection
Definition: tttables.h:408
FT_UShort fsType
Definition: tttables.h:386
static __inline void FASTCALL IntFreeFontNames(FONT_NAMES *Names)
Definition: freetype.c:2420
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:2132
smooth NULL
Definition: ftsmooth.c:416
FT_Pos yMax
Definition: ftimage.h:118
FT_Short ySuperscriptYSize
Definition: tttables.h:392
FT_Short caret_Slope_Rise
Definition: tttables.h:211
FT_Short yStrikeoutSize
Definition: tttables.h:395
FT_Short ySubscriptXOffset
Definition: tttables.h:389
FT_Pos xMin
Definition: ftimage.h:117
FT_Short ySubscriptXSize
Definition: tttables.h:387
FT_Pos xMax
Definition: ftimage.h:118
#define IntUnLockFreeType()
Definition: freetype.c:82
BOOL Error
Definition: chkdsk.c:66
FT_Face Face
Definition: engobjects.h:129
#define LANG_ENGLISH
Definition: nls.h:52
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
FT_Short ySuperscriptXSize
Definition: tttables.h:391
USHORT gusLanguageID
Definition: main.c:29
#define IntLockFreeType()
Definition: freetype.c:79
FT_Size_Metrics metrics
Definition: freetype.h:1677
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
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 DPRINT1
Definition: precomp.h:8
FT_Short ySubscriptYOffset
Definition: tttables.h:390
FT_Short sTypoLineGap
Definition: tttables.h:413
FT_Short ySubscriptYSize
Definition: tttables.h:388
FT_BBox bbox
Definition: freetype.h:1092
FT_Short underlineThickness
Definition: tttables.h:460
FT_Byte panose[10]
Definition: tttables.h:399
#define PRIMARYLANGID(l)
Definition: nls.h:16
FT_Short ySuperscriptYOffset
Definition: tttables.h:394

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

◆ IntIsFontRenderingEnabled()

BOOL FASTCALL IntIsFontRenderingEnabled ( VOID  )

Definition at line 1993 of file freetype.c.

1994 {
1995  return (gpsi->BitsPixel > 8) && g_RenderingEnabled;
1996 }
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 1671 of file freetype.c.

1672 {
1673  NTSTATUS Status;
1674  HANDLE KeyHandle;
1676  KEY_FULL_INFORMATION KeyFullInfo;
1677  ULONG i, Length;
1678  UNICODE_STRING FontTitleW, FileNameW;
1679  SIZE_T InfoSize;
1680  LPBYTE InfoBuffer;
1682  LPWSTR pchPath;
1683  BOOLEAN Success;
1685  INT nFontCount = 0;
1686  DWORD dwFlags;
1687 
1688  /* open registry key */
1691  NULL, NULL);
1692  Status = ZwOpenKey(&KeyHandle, KEY_READ, &ObjectAttributes);
1693  if (!NT_SUCCESS(Status))
1694  {
1695  DPRINT1("ZwOpenKey failed: 0x%08X\n", Status);
1696  return FALSE; /* failure */
1697  }
1698 
1699  /* query count of values */
1700  Status = ZwQueryKey(KeyHandle, KeyFullInformation,
1701  &KeyFullInfo, sizeof(KeyFullInfo), &Length);
1702  if (!NT_SUCCESS(Status))
1703  {
1704  DPRINT1("ZwQueryKey failed: 0x%08X\n", Status);
1705  ZwClose(KeyHandle);
1706  return FALSE; /* failure */
1707  }
1708 
1709  /* allocate buffer */
1710  InfoSize = (MAX_PATH + 256) * sizeof(WCHAR);
1711  InfoBuffer = ExAllocatePoolWithTag(PagedPool, InfoSize, TAG_FONT);
1712  if (!InfoBuffer)
1713  {
1714  DPRINT1("ExAllocatePoolWithTag failed\n");
1715  ZwClose(KeyHandle);
1716  return FALSE;
1717  }
1718 
1719  /* for each value */
1720  for (i = 0; i < KeyFullInfo.Values; ++i)
1721  {
1722  /* get value name */
1723  Status = ZwEnumerateValueKey(KeyHandle, i, KeyValueFullInformation,
1724  InfoBuffer, InfoSize, &Length);
1726  {
1727  /* too short buffer */
1728  ExFreePoolWithTag(InfoBuffer, TAG_FONT);
1729  InfoSize *= 2;
1730  InfoBuffer = ExAllocatePoolWithTag(PagedPool, InfoSize, TAG_FONT);
1731  if (!InfoBuffer)
1732  {
1733  DPRINT1("ExAllocatePoolWithTag failed\n");
1734  break;
1735  }
1736  /* try again */
1737  Status = ZwEnumerateValueKey(KeyHandle, i, KeyValueFullInformation,
1738  InfoBuffer, InfoSize, &Length);
1739  }
1740  if (!NT_SUCCESS(Status))
1741  {
1742  DPRINT1("ZwEnumerateValueKey failed: 0x%08X\n", Status);
1743  break; /* failure */
1744  }
1745 
1746  /* create FontTitleW string */
1747  pInfo = (PKEY_VALUE_FULL_INFORMATION)InfoBuffer;
1748  Length = pInfo->NameLength / sizeof(WCHAR);
1749  pInfo->Name[Length] = UNICODE_NULL; /* truncate */
1750  Success = RtlCreateUnicodeString(&FontTitleW, pInfo->Name);
1751  if (!Success)
1752  {
1754  DPRINT1("RtlCreateUnicodeString failed\n");
1755  break; /* failure */
1756  }
1757 
1758  /* query value */
1759  Status = ZwQueryValueKey(KeyHandle, &FontTitleW, KeyValueFullInformation,
1760  InfoBuffer, InfoSize, &Length);
1762  {
1763  /* too short buffer */
1764  ExFreePoolWithTag(InfoBuffer, TAG_FONT);
1765  InfoSize *= 2;
1766  InfoBuffer = ExAllocatePoolWithTag(PagedPool, InfoSize, TAG_FONT);
1767  if (!InfoBuffer)
1768  {
1769  DPRINT1("ExAllocatePoolWithTag failed\n");
1770  break;
1771  }
1772  /* try again */
1773  Status = ZwQueryValueKey(KeyHandle, &FontTitleW, KeyValueFullInformation,
1774  InfoBuffer, InfoSize, &Length);
1775  }
1776  pInfo = (PKEY_VALUE_FULL_INFORMATION)InfoBuffer;
1777  if (!NT_SUCCESS(Status) || !pInfo->DataLength)
1778  {
1779  DPRINT1("ZwQueryValueKey failed: 0x%08X\n", Status);
1780  RtlFreeUnicodeString(&FontTitleW);
1781  break; /* failure */
1782  }
1783 
1784  /* Build pchPath */
1785  pchPath = (LPWSTR)((PUCHAR)pInfo + pInfo->DataOffset);
1786  Length = pInfo->DataLength / sizeof(WCHAR);
1787  pchPath[Length] = UNICODE_NULL; /* truncate */
1788 
1789  /* Load font(s) without writing registry */
1790  if (PathIsRelativeW(pchPath))
1791  {
1792  dwFlags = 0;
1794  L"\\SystemRoot\\Fonts\\%s", pchPath);
1795  }
1796  else
1797  {
1799  Status = RtlStringCbCopyW(szPath, sizeof(szPath), pchPath);
1800  }
1801 
1802  if (NT_SUCCESS(Status))
1803  {
1804  RtlCreateUnicodeString(&FileNameW, szPath);
1805  nFontCount += IntGdiAddFontResourceEx(&FileNameW, 0, dwFlags);
1806  RtlFreeUnicodeString(&FileNameW);
1807  }
1808 
1809  RtlFreeUnicodeString(&FontTitleW);
1810  }
1811 
1812  /* close now */
1813  ZwClose(KeyHandle);
1814 
1815  /* free memory block */
1816  if (InfoBuffer)
1817  {
1818  ExFreePoolWithTag(InfoBuffer, TAG_FONT);
1819  }
1820 
1821  return (KeyFullInfo.Values != 0 && nFontCount != 0);
1822 }
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
#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 TAG_FONT
Definition: tags.h:12
#define OBJ_KERNEL_HANDLE
Definition: winternl.h:231
int32_t INT
Definition: typedefs.h:58
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
BOOL WINAPI PathIsRelativeW(LPCWSTR lpszPath)
Definition: freetype.c:1661
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned char * LPBYTE
Definition: typedefs.h:53
#define AFRX_ALTERNATIVE_PATH
Definition: text.h:105
#define FALSE
Definition: types.h:117
#define UNICODE_NULL
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
NTSTRSAFEVAPI RtlStringCbPrintfW(_Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest, _In_ size_t cbDest, _In_ _Printf_format_string_ NTSTRSAFE_PCWSTR pszFormat,...)
Definition: ntstrsafe.h:1173
#define MAX_PATH
Definition: compat.h:34
unsigned long DWORD
Definition: ntddk_ex.h:95
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
Status
Definition: gdiplustypes.h:24
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
LPCWSTR szPath
Definition: env.c:35
#define DPRINT1
Definition: precomp.h:8
static UNICODE_STRING g_FontRegPath
Definition: freetype.c:58
unsigned int ULONG
Definition: retypes.h:1
INT FASTCALL IntGdiAddFontResourceEx(PUNICODE_STRING FileName, DWORD Characteristics, DWORD dwFlags)
Definition: freetype.c:1456
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
#define AFRX_DOS_DEVICE_PATH
Definition: text.h:106
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
WCHAR * LPWSTR
Definition: xmlstorage.h:184
struct _KEY_VALUE_FULL_INFORMATION * PKEY_VALUE_FULL_INFORMATION

Referenced by InitFontSupport().

◆ IntLoadSystemFonts()

VOID FASTCALL IntLoadSystemFonts ( VOID  )

Definition at line 943 of file freetype.c.

944 {
946  UNICODE_STRING Directory, FileName, TempString;
948  HANDLE hDirectory;
949  BYTE *DirInfoBuffer;
951  BOOLEAN bRestartScan = TRUE;
953  INT i;
954  static UNICODE_STRING SearchPatterns[] =
955  {
956  RTL_CONSTANT_STRING(L"*.ttf"),
957  RTL_CONSTANT_STRING(L"*.ttc"),
958  RTL_CONSTANT_STRING(L"*.otf"),
959  RTL_CONSTANT_STRING(L"*.otc"),
960  RTL_CONSTANT_STRING(L"*.fon"),
961  RTL_CONSTANT_STRING(L"*.fnt")
962  };
963 
964  RtlInitUnicodeString(&Directory, L"\\SystemRoot\\Fonts\\");
965 
968  &Directory,
970  NULL,
971  NULL);
972 
973  Status = ZwOpenFile(
974  &hDirectory,
977  &Iosb,
980 
981  if (NT_SUCCESS(Status))
982  {
983  for (i = 0; i < _countof(SearchPatterns); ++i)
984  {
985  DirInfoBuffer = ExAllocatePoolWithTag(PagedPool, 0x4000, TAG_FONT);
986  if (DirInfoBuffer == NULL)
987  {
988  ZwClose(hDirectory);
989  return;
990  }
991 
993  if (FileName.Buffer == NULL)
994  {
995  ExFreePoolWithTag(DirInfoBuffer, TAG_FONT);
996  ZwClose(hDirectory);
997  return;
998  }
999  FileName.Length = 0;
1000  FileName.MaximumLength = MAX_PATH * sizeof(WCHAR);
1001 
1002  while (1)
1003  {
1004  Status = ZwQueryDirectoryFile(
1005  hDirectory,
1006  NULL,
1007  NULL,
1008  NULL,
1009  &Iosb,
1010  DirInfoBuffer,
1011  0x4000,
1013  FALSE,
1014  &SearchPatterns[i],
1015  bRestartScan);
1016 
1018  {
1019  break;
1020  }
1021 
1022  DirInfo = (PFILE_DIRECTORY_INFORMATION)DirInfoBuffer;
1023  while (1)
1024  {
1025  TempString.Buffer = DirInfo->FileName;
1026  TempString.Length =
1027  TempString.MaximumLength = DirInfo->FileNameLength;
1031  if (DirInfo->NextEntryOffset == 0)
1032  break;
1033  DirInfo = (PFILE_DIRECTORY_INFORMATION)((ULONG_PTR)DirInfo + DirInfo->NextEntryOffset);
1034  }
1035 
1036  bRestartScan = FALSE;
1037  }
1038 
1040  ExFreePoolWithTag(DirInfoBuffer, TAG_FONT);
1041  }
1042  ZwClose(hDirectory);
1043  }
1044 }
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
#define 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 AFRX_WRITE_REGISTRY
Definition: text.h:104
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define FALSE
Definition: types.h:117
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
#define FILE_LIST_DIRECTORY
Definition: nt_native.h:629
__wchar_t WCHAR
Definition: xmlstorage.h:180
return Iosb
Definition: create.c: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)
Status
Definition: gdiplustypes.h:24
#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
struct _FileName FileName
Definition: fatprocs.h:893
NTSYSAPI NTSTATUS NTAPI RtlAppendUnicodeStringToString(PUNICODE_STRING Destination, PUNICODE_STRING Source)
#define FILE_SYNCHRONOUS_IO_NONALERT
Definition: from_kernel.h:31
base for all directory entries
Definition: entries.h:138
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
INT FASTCALL IntGdiAddFontResourceEx(PUNICODE_STRING FileName, DWORD Characteristics, DWORD dwFlags)
Definition: freetype.c:1456
#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:3872
WCHAR FileName[ANYSIZE_ARRAY]
Definition: winternl.h:524
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14

Referenced by InitFontSupport().

◆ RealizeFontInit()

PTEXTOBJ FASTCALL RealizeFontInit ( HFONT  )

Definition at line 422 of file font.c.

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

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

2028 {
2029  PLFONT plfont;
2030  LOGFONTW *plf;
2031 
2032  ASSERT(lf);
2033  plfont = LFONT_AllocFontWithHandle();
2034  if (!plfont)
2035  {
2036  return STATUS_NO_MEMORY;
2037  }
2038 
2039  ExInitializePushLock(&plfont->lock);
2040  *NewFont = plfont->BaseObject.hHmgr;
2041  plf = &plfont->logfont.elfEnumLogfontEx.elfLogFont;
2042  RtlCopyMemory(plf, lf, sizeof(LOGFONTW));
2043  if (lf->lfEscapement != lf->lfOrientation)
2044  {
2045  /* This should really depend on whether GM_ADVANCED is set */
2046  plf->lfOrientation = plf->lfEscapement;
2047  }
2048  LFONT_UnlockFont(plfont);
2049 
2050  return STATUS_SUCCESS;
2051 }
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
#define LFONT_AllocFontWithHandle()
Definition: text.h:76
LONG lfEscapement
Definition: dimm.idl:61
#define LFONT_UnlockFont(plfnt)
Definition: text.h:79
Definition: text.h:59
LONG lfOrientation
Definition: dimm.idl:62
HGDIOBJ hHmgr(VOID)
Definition: baseobj.hpp:95
#define ExInitializePushLock
Definition: ex.h:999
BASEOBJECT BaseObject
Definition: text.h:63
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
ENUMLOGFONTEXDVW logfont
Definition: text.h:70
EX_PUSH_LOCK lock
Definition: text.h:71
#define STATUS_NO_MEMORY
Definition: ntstatus.h:260
LOGFONTW elfLogFont
Definition: wingdi.h:2701
ENUMLOGFONTEXW elfEnumLogfontEx
Definition: wingdi.h:2778
return STATUS_SUCCESS
Definition: btrfs.c:3014

Referenced by CreateStockFonts(), and UserDrawCaptionText().

◆ TextIntGetTextExtentPoint()

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

Definition at line 4218 of file freetype.c.

4227 {
4228  PFONTGDI FontGDI;
4229  FT_Face face;
4230  FT_GlyphSlot glyph;
4231  FT_BitmapGlyph realglyph;
4232  INT error, glyph_index, i, previous;
4233  ULONGLONG TotalWidth64 = 0;
4234  BOOL use_kerning;
4235  FT_Render_Mode RenderMode;
4236  BOOLEAN Render;
4237  PMATRIX pmxWorldToDevice;
4238  LOGFONTW *plf;
4239  BOOL EmuBold, EmuItalic;
4240  LONG ascender, descender;
4241 
4242  FontGDI = ObjToGDI(TextObj->Font, FONT);
4243 
4244  face = FontGDI->SharedFace->Face;
4245  if (NULL != Fit)
4246  {
4247  *Fit = 0;
4248  }
4249 
4250  IntLockFreeType();
4251 
4252  TextIntUpdateSize(dc, TextObj, FontGDI, FALSE);
4253 
4254  plf = &TextObj->logfont.elfEnumLogfontEx.elfLogFont;
4255  EmuBold = EMUBOLD_NEEDED(FontGDI->OriginalWeight, plf->lfWeight);
4256  EmuItalic = (plf->lfItalic && !FontGDI->OriginalItalic);
4257 
4258  Render = IntIsFontRenderingEnabled();
4259  if (Render)
4260  RenderMode = IntGetFontRenderMode(plf);
4261  else
4262  RenderMode = FT_RENDER_MODE_MONO;
4263 
4264  /* Get the DC's world-to-device transformation matrix */
4265  pmxWorldToDevice = DC_pmxWorldToDevice(dc);
4266  FtSetCoordinateTransform(face, pmxWorldToDevice);
4267 
4268  use_kerning = FT_HAS_KERNING(face);
4269  previous = 0;
4270 
4271  for (i = 0; i < Count; i++)
4272  {
4273  glyph_index = get_glyph_index_flagged(face, *String, GTEF_INDICES, fl);
4274 
4275  if (EmuBold || EmuItalic)
4276  realglyph = NULL;
4277  else
4278  realglyph = ftGdiGlyphCacheGet(face, glyph_index, plf->lfHeight,
4279  RenderMode, pmxWorldToDevice);
4280 
4281  if (EmuBold || EmuItalic || !realglyph)
4282  {
4283  if (EmuItalic)
4284  error = FT_Load_Glyph(face, glyph_index, FT_LOAD_NO_BITMAP);
4285  else
4286  error = FT_Load_Glyph(face, glyph_index, FT_LOAD_DEFAULT);
4287  if (error)
4288  {
4289  DPRINT1("WARNING: Failed to load and render glyph! [index: %d]\n", glyph_index);
4290  break;
4291  }
4292 
4293  glyph = face->glyph;
4294  if (EmuBold || EmuItalic)
4295  {
4296  if (EmuBold)
4297  FT_GlyphSlot_Embolden(glyph);
4298  if (EmuItalic)
4299  FT_GlyphSlot_Oblique(glyph);
4300  realglyph = ftGdiGlyphSet(face, glyph, RenderMode);
4301  }
4302  else
4303  {
4304  realglyph = ftGdiGlyphCacheSet(face,
4305  glyph_index,
4306  plf->lfHeight,
4307  pmxWorldToDevice,
4308  glyph,
4309  RenderMode);
4310  }
4311 
4312  if (!realglyph)
4313  {
4314  DPRINT1("Failed to render glyph! [index: %d]\n", glyph_index);
4315  break;
4316  }
4317  }
4318 
4319  /* Retrieve kerning distance */
4320  if (use_kerning && previous && glyph_index)
4321  {
4322  FT_Vector delta;
4323  FT_Get_Kerning(face, previous, glyph_index, 0, &delta);
4324  TotalWidth64 += delta.x;
4325  }
4326 
4327  TotalWidth64 += realglyph->root.advance.x >> 10;
4328 
4329  if (((TotalWidth64 + 32) >> 6) <= MaxExtent && NULL != Fit)
4330  {
4331  *Fit = i + 1;
4332  }
4333  if (NULL != Dx)
4334  {
4335  Dx[i] = (TotalWidth64 + 32) >> 6;
4336  }
4337 
4338  /* Bold and italic do not use the cache */
4339  if (EmuBold || EmuItalic)
4340  {
4341  FT_Done_Glyph((FT_Glyph)realglyph);
4342  }
4343 
4344  previous = glyph_index;
4345  String++;
4346  }
4347  ASSERT(FontGDI->Magic == FONTGDI_MAGIC);
4348  ascender = FontGDI->tmAscent; /* Units above baseline */
4349  descender = FontGDI->tmDescent; /* Units below baseline */
4351 
4352  Size->cx = (TotalWidth64 + 32) >> 6;
4353  Size->cy = ascender + descender;
4354 
4355  return TRUE;
4356 }
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
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1173
static WCHAR String[]
Definition: stringtable.c:55
#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:3171
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
_In_ FLONG fl
Definition: winddi.h:1279
LONG tmDescent
Definition: engobjects.h:160
#define FALSE
Definition: types.h:117
BOOL FASTCALL TextIntUpdateSize(PDC dc, PTEXTOBJ TextObj, PFONTGDI FontGDI, BOOL bDoLock)
Definition: freetype.c:3599
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
FT_Load_Glyph(FT_Face face, FT_UInt glyph_index, FT_Int32 load_flags)
Definition: ftobjs.c:760
FT_BEGIN_HEADER FT_GlyphSlot_Embolden(FT_GlyphSlot slot)
Definition: ftsynth.c:90
BYTE OriginalItalic
Definition: engobjects.h:153
unsigned char BOOLEAN
FT_GlyphSlot_Oblique(FT_GlyphSlot slot)
Definition: ftsynth.c:48
smooth NULL
Definition: ftsmooth.c:416
FT_GlyphRec root
Definition: ftglyph.h:162
uint64_t ULONGLONG
Definition: typedefs.h: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
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
VOID FtSetCoordinateTransform(FT_Face face, PMATRIX pmx)
Definition: freetype.c:775
BOOL FASTCALL IntIsFontRenderingEnabled(VOID)
Definition: freetype.c:1993
#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:3717
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
FT_BitmapGlyph APIENTRY ftGdiGlyphCacheSet(FT_Face Face, INT GlyphIndex, INT Height, PMATRIX pmx, FT_GlyphSlot GlyphSlot, FT_Render_Mode RenderMode)
Definition: freetype.c:3212
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:3134
#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:2005
#define FONTGDI_MAGIC
Definition: engobjects.h:167
#define ObjToGDI(ClipObj, Type)
Definition: engobjects.h:180
static const WCHAR dc[]
FORCEINLINE PMATRIX DC_pmxWorldToDevice(PDC pdc)
Definition: coord.h:98
#define EMUBOLD_NEEDED(original, request)
Definition: freetype.c:45
#define FT_LOAD_NO_BITMAP
Definition: freetype.h:3012
LONG lfWeight
Definition: dimm.idl:63
FT_Done_Glyph(FT_Glyph glyph)
Definition: ftglyph.c:633
#define GTEF_INDICES
Definition: ntgdityp.h: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 5177 of file freetype.c.

5178 {
5180  PTEXTOBJ TextObj;
5181  PPROCESSINFO Win32Process;
5182  ULONG MatchPenalty;
5183  LOGFONTW *pLogFont;
5184  LOGFONTW SubstitutedLogFont;
5185 
5186  if (!pTextObj)
5187  {
5188  TextObj = TEXTOBJ_LockText(FontHandle);
5189  if (NULL == TextObj)
5190  {
5191  return STATUS_INVALID_HANDLE;
5192  }
5193 
5194  if (TextObj->fl & TEXTOBJECT_INIT)
5195  {
5196  TEXTOBJ_UnlockText(TextObj);
5197  return STATUS_SUCCESS;
5198  }
5199  }
5200  else
5201  {
5202  TextObj = pTextObj;
5203  }
5204 
5205  pLogFont = &TextObj->logfont.elfEnumLogfontEx.elfLogFont;
5206 
5207  /* substitute */
5208  SubstitutedLogFont = *pLogFont;
5209  DPRINT("Font '%S,%u' is substituted by: ", pLogFont->lfFaceName, pLogFont->lfCharSet);
5210  SubstituteFontRecurse(&SubstitutedLogFont);
5211  DPRINT("'%S,%u'.\n", SubstitutedLogFont.lfFaceName, SubstitutedLogFont.lfCharSet);
5212 
5213  MatchPenalty = 0xFFFFFFFF;
5214  TextObj->Font = NULL;
5215 
5216  Win32Process = PsGetCurrentProcessWin32Process();
5217 
5218  /* Search private fonts */
5219  IntLockProcessPrivateFonts(Win32Process);
5220  FindBestFontFromList(&TextObj->Font, &MatchPenalty, &SubstitutedLogFont,
5221  &Win32Process->PrivateFontListHead);
5222  IntUnLockProcessPrivateFonts(Win32Process);
5223 
5224  /* Search system fonts */
5226  FindBestFontFromList(&TextObj->Font, &MatchPenalty, &SubstitutedLogFont,
5227  &g_FontListHead);
5229 
5230  if (NULL == TextObj->Font)
5231  {
5232  DPRINT1("Request font %S not found, no fonts loaded at all\n",
5233  pLogFont->lfFaceName);
5235  }
5236  else
5237  {
5239  PFONTGDI FontGdi = ObjToGDI(TextObj->Font, FONT);
5240  PSHARED_FACE SharedFace = FontGdi->SharedFace;
5241 
5242  IntLockFreeType();
5243  IntRequestFontSize(NULL, FontGdi, pLogFont->lfWidth, pLogFont->lfHeight);
5245 
5246  TextObj->TextFace[0] = UNICODE_NULL;
5247  if (MatchFontNames(SharedFace, SubstitutedLogFont.lfFaceName))
5248  {
5249  RtlStringCchCopyW(TextObj->TextFace, _countof(TextObj->TextFace), pLogFont->lfFaceName);
5250  }
5251  else
5252  {
5255  if (NT_SUCCESS(Status))
5256  {
5257  /* truncated copy */
5258  IntUnicodeStringToBuffer(TextObj->TextFace, sizeof(TextObj->TextFace), &Name);
5260  }
5261  }
5262 
5263  // Need hdev, when freetype is loaded need to create DEVOBJ for
5264  // Consumer and Producer.
5265  TextObj->Font->iUniq = 1; // Now it can be cached.
5266  IntFontType(FontGdi);
5267  FontGdi->flType = TextObj->Font->flFontType;
5268  FontGdi->RequestUnderline = pLogFont->lfUnderline ? 0xFF : 0;
5269  FontGdi->RequestStrikeOut = pLogFont->lfStrikeOut ? 0xFF : 0;
5270  FontGdi->RequestItalic = pLogFont->lfItalic ? 0xFF : 0;
5271  if (pLogFont->lfWeight !=