ReactOS  0.4.14-dev-1286-g61a54ae
text.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _STRGDI
 
struct  _LFONT
 

Macros

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

Typedefs

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

Functions

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

Macro Definition Documentation

◆ AFRX_ALTERNATIVE_PATH

#define AFRX_ALTERNATIVE_PATH   0x2

Definition at line 105 of file text.h.

◆ AFRX_DOS_DEVICE_PATH

#define AFRX_DOS_DEVICE_PATH   0x4

Definition at line 106 of file text.h.

◆ AFRX_WRITE_REGISTRY

#define AFRX_WRITE_REGISTRY   0x1

Definition at line 104 of file text.h.

◆ IntLockProcessPrivateFonts

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

Definition at line 147 of file text.h.

◆ IntUnLockProcessPrivateFonts

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

Definition at line 150 of file text.h.

◆ LFONT_AllocFontWithHandle

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

Definition at line 76 of file text.h.

◆ LFONT_ShareLockFont

Definition at line 77 of file text.h.

◆ LFONT_ShareUnlockFont

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

Definition at line 78 of file text.h.

◆ LFONT_UnlockFont

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

Definition at line 79 of file text.h.

◆ TAG_FINF

#define TAG_FINF   'FNIF'

Definition at line 3 of file text.h.

◆ TEXTOBJECT_INIT

#define TEXTOBJECT_INIT   0x00010000

Definition at line 56 of file text.h.

◆ TO_ALL_PTRS_VALID

#define TO_ALL_PTRS_VALID   0x0002

Definition at line 8 of file text.h.

◆ TO_ALLOC_FACENAME

#define TO_ALLOC_FACENAME   0x0800

Definition at line 18 of file text.h.

◆ TO_BITMAPS

#define TO_BITMAPS   0x0200

Definition at line 16 of file text.h.

◆ TO_ESC_NOT_ORIENT

#define TO_ESC_NOT_ORIENT   0x0008

Definition at line 10 of file text.h.

◆ TO_HIGHRESTEXT

#define TO_HIGHRESTEXT   0x0100

Definition at line 15 of file text.h.

◆ TO_MEM_ALLOCATED

#define TO_MEM_ALLOCATED   0x0001

Definition at line 7 of file text.h.

◆ TO_PARTITION_INIT

#define TO_PARTITION_INIT   0x0400

Definition at line 17 of file text.h.

◆ TO_PWSZ_ALLOCATED

#define TO_PWSZ_ALLOCATED   0x0010

Definition at line 11 of file text.h.

◆ TO_SYS_PARTITION

#define TO_SYS_PARTITION   0x1000

Definition at line 19 of file text.h.

◆ TO_VALID

#define TO_VALID   0x0004

Definition at line 9 of file text.h.

◆ TSIM_STRIKEOUT

#define TSIM_STRIKEOUT   0x0080

Definition at line 14 of file text.h.

◆ TSIM_UNDERLINE1

#define TSIM_UNDERLINE1   0x0020

Definition at line 12 of file text.h.

◆ TSIM_UNDERLINE2

#define TSIM_UNDERLINE2   0x0040

Definition at line 13 of file text.h.

Typedef Documentation

◆ LFONT

typedef struct _LFONT LFONT

◆ PLFONT

typedef struct _LFONT * PLFONT

◆ PSTRGDI

typedef struct _STRGDI * PSTRGDI

◆ PTEXTOBJ

typedef struct _LFONT * PTEXTOBJ

◆ STRGDI

◆ TEXTOBJ

Function Documentation

◆ FontGetObject()

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

Definition at line 293 of file font.c.

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

Referenced by GreGetObject().

◆ ftGdiGetFontData()

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

Definition at line 4632 of file freetype.c.

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

Referenced by NtGdiGetFontData().

◆ ftGdiGetGlyphOutline()

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

Definition at line 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  *pgm = gm;
4207  return needed;
4208 }
#define abs(i)
Definition: fconv.c:206
int FT_Error
Definition: fttypes.h:300
GLint GLint GLsizei width
Definition: gl.h:1546
FT_Pos y
Definition: ftimage.h:77
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
FLOATL eM11
Definition: winddi.h:1234
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
#define GGO_METRICS
Definition: wingdi.h:847
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
unsigned char pixel_mode
Definition: ftimage.h:268
long y
Definition: polytest.cpp:48
unsigned int rows
Definition: ftimage.h:263
#define error(str)
Definition: mkdosfs.c:1605
long x
Definition: polytest.cpp:48
FT_Pos x
Definition: ftimage.h:76
FORCEINLINE VOID TEXTOBJ_UnlockText(PLFONT plfnt)
Definition: text.h:96
#define FLOATOBJ_Set1(fo)
Definition: floatobj.h:120
signed int FT_Int
Definition: fttypes.h:220
#define FLOATOBJ_DivLong(pf, l)
Definition: winddi.h:2829
FT_Glyph_Metrics metrics
Definition: freetype.h:1916
LONG tmAveCharWidth
Definition: wingdi.h:2387
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
#define FT_LOAD_NO_HINTING
Definition: freetype.h:3010
static __inline FT_Fixed FT_FixedFromFIXED(FIXED f)
Definition: freetype.c:382
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
unsigned char * buffer
Definition: ftimage.h:266
#define FLOATOBJ_GetLong(pf)
Definition: winddi.h:2817
#define GGO_GRAY4_BITMAP
Definition: wingdi.h:852
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
short gmCellIncY
Definition: wingdi.h:2445
FT_Matrix_Multiply(const FT_Matrix *a, FT_Matrix *b)
Definition: ftcalc.c:661
FORCEINLINE VOID XFORMOBJ_vInit(OUT XFORMOBJ *pxo, IN MATRIX *pmx)
Definition: xformobj.h:21
#define FT_LOAD_DEFAULT
Definition: freetype.h:3008
int32_t INT
Definition: typedefs.h:57
HFONT hFont
Definition: main.c:53
#define GGO_BITMAP
Definition: wingdi.h:848
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
FT_Outline_Get_Bitmap(FT_Library library, FT_Outline *outline, const FT_Bitmap *abitmap)
Definition: ftoutln.c:661
#define GGO_GRAY8_BITMAP
Definition: wingdi.h:853
#define GGO_BEZIER
Definition: wingdi.h:850
#define FLOATOBJ_SetFloat(pf, f)
Definition: winddi.h:2814
FT_Fixed xx
Definition: fttypes.h:387
BOOL FASTCALL TextIntUpdateSize(PDC dc, PTEXTOBJ TextObj, PFONTGDI FontGDI, BOOL bDoLock)
Definition: freetype.c: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
unsigned char BYTE
Definition: mem.h:68
static FT_UInt FASTCALL get_glyph_index_flagged(FT_Face face, FT_ULong code, DWORD indexed_flag, DWORD flags)
Definition: freetype.c: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:359
Definition: mesh.c:5329
ENUMLOGFONTEXDVW logfont
Definition: text.h:70
short gmCellIncX
Definition: wingdi.h:2444
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
_In_ SIZEL _In_ ULONG iFormat
Definition: winddi.h:3467
FT_GlyphSlot glyph
Definition: freetype.h:1105
#define FLOATOBJ_SetLong(pf, l)
Definition: winddi.h:2815
FT_Glyph_Format format
Definition: freetype.h:1921
FONTOBJ * Font
Definition: text.h:66
VOID FASTCALL IntEscapeMatrix(FT_Matrix *pmat, LONG lfEscapement)
Definition: freetype.c:739
FT_Vector_Transform(FT_Vector *vec, const FT_Matrix *matrix)
Definition: ftoutln.c:688
#define GDITAG_TEXT
Definition: tags.h:171
PSHARED_FACE SharedFace
Definition: engobjects.h:142
PTEXTOBJ FASTCALL RealizeFontInit(HFONT hFont)
Definition: font.c:422
unsigned int FT_UInt
Definition: fttypes.h:231
GLuint start
Definition: gl.h:1545
FT_Fixed xy
Definition: fttypes.h:387
GLenum GLenum dst
Definition: glext.h:6340
UINT gmBlackBoxY
Definition: wingdi.h:2442
#define min(a, b)
Definition: monoChain.cc:55
#define GGO_GRAY2_BITMAP
Definition: wingdi.h:851
unsigned int UINT
Definition: ndis.h:50
TEXTMETRICW otmTextMetrics
Definition: wingdi.h:2513
#define FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH
Definition: freetype.h:3017
int pitch
Definition: ftimage.h:265
#define DPRINT1
Definition: precomp.h:8
static const FT_Matrix identityMat
Definition: freetype.c:50
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
FT_Outline_Translate(const FT_Outline *outline, FT_Pos xOffset, FT_Pos yOffset)
Definition: ftoutln.c:528
LOGFONTW elfLogFont
Definition: wingdi.h:2701
UINT gmBlackBoxX
Definition: wingdi.h:2441
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
#define ObjToGDI(ClipObj, Type)
Definition: engobjects.h:180
#define FLOATOBJ_Equal1(pf)
Definition: floatobj.h:107
static const WCHAR dc[]
FORCEINLINE PMATRIX DC_pmxWorldToDevice(PDC pdc)
Definition: coord.h:98
#define FT_LOAD_NO_BITMAP
Definition: freetype.h:3012
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
FT_Fixed yx
Definition: fttypes.h:388
ENUMLOGFONTEXW elfEnumLogfontEx
Definition: wingdi.h:2778
FT_Fixed yy
Definition: fttypes.h:388
#define INT_TO_FIXED(x)
Definition: ftcalc.h:404
#define FLOATOBJ_Mul(pf, pf1)
Definition: winddi.h:2824
#define GDI_ERROR
Definition: wingdi.h:1308
#define FT_IS_SCALABLE(face)
Definition: freetype.h:1312
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27
struct png_info_def *typedef unsigned char **typedef struct png_info_def *typedef struct png_info_def *typedef struct png_info_def *typedef unsigned char ** row
Definition: typeof.h:78
unsigned int width
Definition: ftimage.h:264
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31

Referenced by NtGdiGetGlyphOutline(), and PATH_ExtTextOut().

◆ ftGdiGetKerningPairs()

DWORD FASTCALL ftGdiGetKerningPairs ( PFONTGDI  ,
DWORD  ,
LPKERNINGPAIR   
)

Definition at line 5649 of file freetype.c.

5652 {
5653  DWORD Count = 0;
5654  INT i = 0;
5655  FT_Face face = Font->SharedFace->Face;
5656 
5657  if (FT_HAS_KERNING(face) && face->charmap->encoding == FT_ENCODING_UNICODE)
5658  {
5659  FT_UInt previous_index = 0, glyph_index = 0;
5660  FT_ULong char_code, char_previous;
5661  FT_Vector delta;
5662 
5663  char_previous = char_code = FT_Get_First_Char(face, &glyph_index);
5664 
5665  IntLockFreeType();
5666 
5667  while (glyph_index)
5668  {
5669  if (previous_index && glyph_index)
5670  {
5671  FT_Get_Kerning(face, previous_index, glyph_index, FT_KERNING_DEFAULT, &delta);
5672 
5673  if (pKerningPair && cPairs)
5674  {
5675  pKerningPair[i].wFirst = char_previous;
5676  pKerningPair[i].wSecond = char_code;
5677  pKerningPair[i].iKernAmount = delta.x;
5678  i++;
5679  if (i == cPairs) break;
5680  }
5681  Count++;
5682  }
5683  previous_index = glyph_index;
5684  char_previous = char_code;
5685  char_code = FT_Get_Next_Char(face, char_code, &glyph_index);
5686  }
5688  }
5689  return Count;
5690 }
FT_Get_Kerning(FT_Face face, FT_UInt left_glyph, FT_UInt right_glyph, FT_UInt kern_mode, FT_Vector *akerning)
Definition: ftobjs.c:3347
unsigned long FT_ULong
Definition: fttypes.h:253
FT_Pos x
Definition: ftimage.h:76
FT_Get_Next_Char(FT_Face face, FT_ULong char_code, FT_UInt *agindex)
Definition: ftobjs.c:3722
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1015
int32_t INT
Definition: typedefs.h:57
#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:91
#define TRUE
Definition: types.h:120
struct _RASTERIZER_STATUS RASTERIZER_STATUS
#define TT_AVAILABLE
Definition: wingdi.h:887
USHORT gusLanguageID
Definition: main.c:29
#define TT_ENABLED
Definition: wingdi.h:888
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27

Referenced by NtGdiGetRasterizerCaps().

◆ ftGdiGetTextCharsetInfo()

INT FASTCALL ftGdiGetTextCharsetInfo ( PDC  ,
PFONTSIGNATURE  ,
DWORD   
)

Definition at line 4355 of file freetype.c.

4359 {
4360  PDC_ATTR pdcattr;
4361  UINT Ret = DEFAULT_CHARSET;
4362  INT i;
4363  HFONT hFont;
4364  PTEXTOBJ TextObj;
4365  PFONTGDI FontGdi;
4366  FONTSIGNATURE fs;
4367  TT_OS2 *pOS2;
4368  FT_Face Face;
4369  CHARSETINFO csi;
4370  DWORD cp, fs0;
4371  USHORT usACP, usOEM;
4372 
4373  pdcattr = Dc->pdcattr;
4374  hFont = pdcattr->hlfntNew;
4375  TextObj = RealizeFontInit(hFont);
4376 
4377  if (!TextObj)
4378  {
4380  return Ret;
4381  }
4382  FontGdi = ObjToGDI(TextObj->Font, FONT);
4383  Face = FontGdi->SharedFace->Face;
4384  TEXTOBJ_UnlockText(TextObj);
4385 
4386  memset(&fs, 0, sizeof(FONTSIGNATURE));
4387  IntLockFreeType();
4388  pOS2 = FT_Get_Sfnt_Table(Face, ft_sfnt_os2);
4389  if (NULL != pOS2)
4390  {
4391  fs.fsCsb[0] = pOS2->ulCodePageRange1;
4392  fs.fsCsb[1] = pOS2->ulCodePageRange2;
4393  fs.fsUsb[0] = pOS2->ulUnicodeRange1;
4394  fs.fsUsb[1] = pOS2->ulUnicodeRange2;
4395  fs.fsUsb[2] = pOS2->ulUnicodeRange3;
4396  fs.fsUsb[3] = pOS2->ulUnicodeRange4;
4397  if (pOS2->version == 0)
4398  {
4399  FT_UInt dummy;
4400 
4401  if (FT_Get_First_Char( Face, &dummy ) < 0x100)
4402  fs.fsCsb[0] |= FS_LATIN1;
4403  else
4404  fs.fsCsb[0] |= FS_SYMBOL;
4405  }
4406  }
4407  pOS2 = NULL;
4409  DPRINT("Csb 1=%x 0=%x\n", fs.fsCsb[1],fs.fsCsb[0]);
4410  if (fs.fsCsb[0] == 0)
4411  { /* Let's see if we can find any interesting cmaps */
4412  for (i = 0; i < Face->num_charmaps; i++)
4413  {
4414  switch (Face->charmaps[i]->encoding)
4415  {
4416  case FT_ENCODING_UNICODE:
4417  case FT_ENCODING_APPLE_ROMAN:
4418  fs.fsCsb[0] |= FS_LATIN1;
4419  break;
4420  case FT_ENCODING_MS_SYMBOL:
4421  fs.fsCsb[0] |= FS_SYMBOL;
4422  break;
4423  default:
4424  break;
4425  }
4426  }
4427  }
4428  if (lpSig)
4429  {
4430  RtlCopyMemory(lpSig, &fs, sizeof(FONTSIGNATURE));
4431  }
4432 
4433  RtlGetDefaultCodePage(&usACP, &usOEM);
4434  cp = usACP;
4435 
4437  if (csi.fs.fsCsb[0] & fs.fsCsb[0])
4438  {
4439  DPRINT("Hit 1\n");
4440  Ret = csi.ciCharset;
4441  goto Exit;
4442  }
4443 
4444  for (i = 0; i < MAXTCIINDEX; i++)
4445  {
4446  fs0 = 1L << i;
4447  if (fs.fsCsb[0] & fs0)
4448  {
4449  if (IntTranslateCharsetInfo(&fs0, &csi, TCI_SRCFONTSIG))
4450  {
4451  // *cp = csi.ciACP;
4452  DPRINT("Hit 2\n");
4453  Ret = csi.ciCharset;
4454  goto Exit;
4455  }
4456  else
4457  DPRINT1("TCI failing on %x\n", fs0);
4458  }
4459  }
4460 Exit:
4461  DPRINT("CharSet %u CodePage %u\n", csi.ciCharset, csi.ciACP);
4462  return (MAKELONG(csi.ciACP, csi.ciCharset));
4463 }
FONTSIGNATURE fs
Definition: wingdi.h:1547
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
FT_CharMap * charmaps
Definition: freetype.h:1085
#define ft_sfnt_os2
Definition: tttables.h:631
#define TCI_SRCFONTSIG
Definition: wingdi.h:962
FORCEINLINE VOID TEXTOBJ_UnlockText(PLFONT plfnt)
Definition: text.h:96
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
Definition: fs.h:235
#define DEFAULT_CHARSET
Definition: wingdi.h:383
int32_t INT
Definition: typedefs.h:57
#define MAXTCIINDEX
Definition: freetype.c:123
HFONT hFont
Definition: main.c:53
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
FT_ULong ulUnicodeRange1
Definition: tttables.h:401
Definition: text.h:59
HANDLE hlfntNew
Definition: ntgdihdl.h:334
FT_Get_Sfnt_Table(FT_Face face, FT_Sfnt_Tag tag)
Definition: ftobjs.c:4113
UINT ciCharset
Definition: wingdi.h:1545
#define MAKELONG(a, b)
Definition: typedefs.h:248
smooth NULL
Definition: ftsmooth.c:416
FT_UShort version
Definition: tttables.h:382
void DPRINT(...)
Definition: polytest.cpp:61
NTSYSAPI VOID NTAPI RtlGetDefaultCodePage(_Out_ PUSHORT AnsiCodePage, _Out_ PUSHORT OemCodePage)
static BOOLEAN APIENTRY IntTranslateCharsetInfo(PDWORD Src, LPCHARSETINFO Cs, DWORD Flags)
Definition: freetype.c: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 4536 of file freetype.c.

4539 {
4540  PDC dc;
4541  PDC_ATTR pdcattr;
4542  PTEXTOBJ TextObj;
4543  PFONTGDI FontGDI;
4544  FT_Face Face;
4545  TT_OS2 *pOS2;
4546  TT_HoriHeader *pHori;
4547  FT_WinFNT_HeaderRec Win;
4548  ULONG Error;
4550  LOGFONTW *plf;
4551 
4552  if (!ptmwi)
4553  {
4555  return FALSE;
4556  }
4557 
4558  if (!(dc = DC_LockDc(hDC)))
4559  {
4561  return FALSE;
4562  }
4563  pdcattr = dc->pdcattr;
4564  TextObj = RealizeFontInit(pdcattr->hlfntNew);
4565  if (NULL != TextObj)
4566  {
4567  plf = &TextObj->logfont.elfEnumLogfontEx.elfLogFont;
4568  FontGDI = ObjToGDI(TextObj->Font, FONT);
4569 
4570  Face = FontGDI->SharedFace->Face;
4571 
4572  IntLockFreeType();
4573  Error = IntRequestFontSize(dc, FontGDI, plf->lfWidth, plf->lfHeight);
4576 
4577  if (0 != Error)
4578  {
4579  DPRINT1("Error in setting pixel sizes: %u\n", Error);
4581  }
4582  else
4583  {
4584  FT_Face Face = FontGDI->SharedFace->Face;
4586 
4587  IntLockFreeType();
4588  pOS2 = FT_Get_Sfnt_Table(Face, ft_sfnt_os2);
4589  if (NULL == pOS2)
4590  {
4591  DPRINT1("Can't find OS/2 table - not TT font?\n");
4593  }
4594 
4595  pHori = FT_Get_Sfnt_Table(Face, ft_sfnt_hhea);
4596  if (NULL == pHori)
4597  {
4598  DPRINT1("Can't find HHEA table - not TT font?\n");
4600  }
4601 
4602  Error = FT_Get_WinFNT_Header(Face, &Win);
4603 
4604  if (NT_SUCCESS(Status) || !Error)
4605  {
4606  FillTM(&ptmwi->TextMetric, FontGDI, pOS2, pHori, !Error ? &Win : 0);
4607 
4608  /* FIXME: Fill Diff member */
4609  RtlZeroMemory(&ptmwi->Diff, sizeof(ptmwi->Diff));
4610  }
4611 
4613  }
4614  TEXTOBJ_UnlockText(TextObj);
4615  }
4616  else
4617  {
4619  }
4620  DC_UnlockDc(dc);
4621 
4622  if (!NT_SUCCESS(Status))
4623  {
4625  return FALSE;
4626  }
4627  return TRUE;
4628 }
#define TRUE
Definition: types.h:120
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
FT_Get_WinFNT_Header(FT_Face face, FT_WinFNT_HeaderRec *aheader)
Definition: ftwinfnt.c:29
#define ft_sfnt_os2
Definition: tttables.h:631
FORCEINLINE VOID TEXTOBJ_UnlockText(PLFONT plfnt)
Definition: text.h:96
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
LONG lfHeight
Definition: dimm.idl:59
LONG NTSTATUS
Definition: precomp.h:26
#define STATUS_INVALID_HANDLE
Definition: ntstatus.h:231
#define STATUS_INTERNAL_ERROR
Definition: ntstatus.h:451
Definition: text.h:59
HANDLE hlfntNew
Definition: ntgdihdl.h:334
FT_Get_Sfnt_Table(FT_Face face, FT_Sfnt_Tag tag)
Definition: ftobjs.c:4113
static void FASTCALL FillTM(TEXTMETRICW *TM, PFONTGDI FontGDI, TT_OS2 *pOS2, TT_HoriHeader *pHori, FT_WinFNT_HeaderRec *pFNT)
Definition: freetype.c: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
#define IntLockFreeType()
Definition: freetype.c:79
VOID FASTCALL SetLastNtError(NTSTATUS Status)
Definition: error.c:36
ENUMLOGFONTEXDVW logfont
Definition: text.h:70
Status
Definition: gdiplustypes.h:24
static HDC hDC
Definition: 3dtext.c:33
FONTOBJ * Font
Definition: text.h:66
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
PSHARED_FACE SharedFace
Definition: engobjects.h:142
PTEXTOBJ FASTCALL RealizeFontInit(HFONT hFont)
Definition: font.c:422
#define DPRINT1
Definition: precomp.h:8
LOGFONTW elfLogFont
Definition: wingdi.h:2701
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
#define ObjToGDI(ClipObj, Type)
Definition: engobjects.h:180
static const WCHAR dc[]
FORCEINLINE PMATRIX DC_pmxWorldToDevice(PDC pdc)
Definition: coord.h:98
ENUMLOGFONTEXW elfEnumLogfontEx
Definition: wingdi.h:2778
return STATUS_SUCCESS
Definition: btrfs.c:2938
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27

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

◆ ftGdiRealizationInfo()

BOOL FASTCALL ftGdiRealizationInfo ( PFONTGDI  ,
PREALIZATION_INFO   
)

Definition at line 5630 of file freetype.c.

5631 {
5632  if (FT_HAS_FIXED_SIZES(Font->SharedFace->Face))
5633  Info->iTechnology = RI_TECH_BITMAP;
5634  else
5635  {
5636  if (FT_IS_SCALABLE(Font->SharedFace->Face))
5637  Info->iTechnology = RI_TECH_SCALABLE;
5638  else
5639  Info->iTechnology = RI_TECH_FIXED;
5640  }
5641  Info->iUniq = Font->FontObj.iUniq;
5642  Info->dwUnknown = -1;
5643  return TRUE;
5644 }
#define TRUE
Definition: types.h:120
#define RI_TECH_BITMAP
Definition: ntgdityp.h:270
struct TraceInfo Info
#define RI_TECH_SCALABLE
Definition: ntgdityp.h:272
#define FT_HAS_FIXED_SIZES(face)
Definition: freetype.h:1361
#define RI_TECH_FIXED
Definition: ntgdityp.h:271
#define FT_IS_SCALABLE(face)
Definition: freetype.h:1312

Referenced by NtGdiGetRealizationInfo().

◆ ftGetFontUnicodeRanges()

DWORD FASTCALL ftGetFontUnicodeRanges ( PFONTGDI  ,
PGLYPHSET   
)

Definition at line 4468 of file freetype.c.

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

Referenced by NtGdiGetFontUnicodeRanges().

◆ GreCreateFontIndirectW()

HFONT FASTCALL GreCreateFontIndirectW ( LOGFONTW lplf)

Internal

Definition at line 23 of file font.c.

24 {
25  if (lplf)
26  {
27  ENUMLOGFONTEXDVW Logfont;
28 
29  RtlCopyMemory( &Logfont.elfEnumLogfontEx.elfLogFont, lplf, sizeof(LOGFONTW));
31  sizeof(Logfont.elfEnumLogfontEx.elfFullName));
33  sizeof(Logfont.elfEnumLogfontEx.elfStyle));
35  sizeof(Logfont.elfEnumLogfontEx.elfScript));
36 
37  Logfont.elfDesignVector.dvNumAxes = 0;
38 
39  RtlZeroMemory( &Logfont.elfDesignVector, sizeof(DESIGNVECTOR));
40 
41  return HfontCreate((PENUMLOGFONTEXDVW)&Logfont, 0, 0, 0, NULL );
42  }
43  else return NULL;
44 }
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
WCHAR elfFullName[LF_FULLFACESIZE]
Definition: wingdi.h:2702
DWORD dvNumAxes
Definition: wingdi.h:2768
WCHAR elfStyle[LF_FACESIZE]
Definition: wingdi.h:2703
WCHAR elfScript[LF_FACESIZE]
Definition: wingdi.h:2704
smooth NULL
Definition: ftsmooth.c:416
HFONT APIENTRY HfontCreate(IN PENUMLOGFONTEXDVW pelfw, IN ULONG cjElfw, IN LFTYPE lft, IN FLONG fl, IN PVOID pvCliData)
Definition: font.c:1139
DESIGNVECTOR elfDesignVector
Definition: wingdi.h:2779
LOGFONTW elfLogFont
Definition: wingdi.h:2701
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
ENUMLOGFONTEXW elfEnumLogfontEx
Definition: wingdi.h:2778

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

◆ GreExtTextOutW()

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

◆ GreGetTextExtentExW()

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

Definition at line 93 of file text.c.

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

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

◆ GreGetTextExtentW()

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

Definition at line 36 of file text.c.

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

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

◆ GreGetTextMetricsW()

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

Definition at line 151 of file text.c.

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

Referenced by DrawTextExWorker().

◆ GreTextOutW()

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

Functions

Definition at line 19 of file text.c.

25 {
26  return GreExtTextOutW(hdc, nXStart, nYStart, 0, NULL, lpString, cchString, NULL, 0);
27 }
smooth NULL
Definition: ftsmooth.c:416
BOOL APIENTRY GreExtTextOutW(IN HDC hDC, IN INT XStart, IN INT YStart, IN UINT fuOptions, IN OPTIONAL PRECTL lprc, IN LPCWSTR String, IN INT Count, IN OPTIONAL LPINT Dx, IN DWORD dwCodePage)
Definition: freetype.c:6595
HDC hdc
Definition: main.c:9

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

◆ InitFontSupport()

BOOL FASTCALL InitFontSupport ( VOID  )

Definition at line 660 of file freetype.c.

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

Referenced by DriverEntry().

◆ IntCharSetFromCodePage()

BYTE FASTCALL IntCharSetFromCodePage ( UINT  uCodePage)

Definition at line 172 of file freetype.c.

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

Referenced by CreateStockFonts().

◆ IntEnableFontRendering()

VOID FASTCALL IntEnableFontRendering ( BOOL  Enable)

Definition at line 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:57
FONT_ENTRY_MEM * Entry
Definition: font.h:23
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 TRUE
Definition: types.h:120
#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
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:55
#define DEFAULT_CHARSET
Definition: wingdi.h:383
#define OBJ_KERNEL_HANDLE
Definition: winternl.h:231
int32_t INT
Definition: typedefs.h:57
#define FILE_SHARE_READ
Definition: compat.h:125
#define AFRX_WRITE_REGISTRY
Definition: text.h:104
HANDLE FileHandle
Definition: stats.c:38
NTSTATUS NTAPI ObReferenceObjectByHandle(IN HANDLE Handle, IN ACCESS_MASK DesiredAccess, IN POBJECT_TYPE ObjectType, IN KPROCESSOR_MODE AccessMode, OUT PVOID *Object, OUT POBJECT_HANDLE_INFORMATION HandleInformation OPTIONAL)
Definition: obref.c:496
#define SEC_COMMIT
Definition: mmtypes.h:99
#define AFRX_ALTERNATIVE_PATH
Definition: text.h:105
#define UNICODE_NULL
#define FILE_READ_DATA
Definition: nt_native.h:628
smooth NULL
Definition: ftsmooth.c:416
_Check_return_ _CRTIMP _CONST_RETURN wchar_t *__cdecl wcsrchr(_In_z_ const wchar_t *_Str, _In_ wchar_t _Ch)
Definition: bufpool.h:45
_Inout_ PFILE_OBJECT FileObject
Definition: cdprocs.h:593
BOOL LoadFont(LPWSTR lpCmdLine)
#define KEY_WRITE
Definition: nt_native.h:1031
NTSTATUS RtlAppendUnicodeToString(IN PUNICODE_STRING Str1, IN PWSTR Str2)
Definition: string_lib.cpp:62
__wchar_t WCHAR
Definition: xmlstorage.h:180
return Iosb
Definition: create.c:4426
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
NTSTATUS NTAPI MmCreateSection(OUT PVOID *Section, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, IN PLARGE_INTEGER MaximumSize, IN ULONG SectionPageProtection, IN ULONG AllocationAttributes, IN HANDLE FileHandle OPTIONAL, IN PFILE_OBJECT FileObject OPTIONAL)
Definition: section.c:4975
#define IntUnLockFreeType()
Definition: freetype.c:82
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
* PFILE_OBJECT
Definition: iotypes.h:1955
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
NTSYSAPI NTSTATUS NTAPI ZwOpenFile(_Out_ PHANDLE FileHandle, _In_ ACCESS_MASK DesiredAccess, _In_ POBJECT_ATTRIBUTES ObjectAttributes, _Out_ PIO_STATUS_BLOCK IoStatusBlock, _In_ ULONG ShareAccess, _In_ ULONG OpenOptions)
NTSTATUS NTAPI MmMapViewInSystemSpace(IN PVOID SectionObject, OUT PVOID *MappedBase, IN OUT PSIZE_T ViewSize)
Definition: section.c:4847
static const WCHAR L[]
Definition: oid.c:1250
#define IntLockFreeType()
Definition: freetype.c:79
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define SECTION_MAP_READ
Definition: compat.h:128
static PSHARED_MEM SharedMem_Create(PBYTE Buffer, ULONG BufferSize, BOOL IsMapping)
Definition: freetype.c:233
#define SYNCHRONIZE
Definition: nt_native.h:61
#define TAG_USTR
Definition: libsupp.c:111
Status
Definition: gdiplustypes.h:24
ULONG_PTR SIZE_T
Definition: typedefs.h:79
static void SharedMem_Release(PSHARED_MEM Ptr)
Definition: freetype.c:290
NTSYSAPI NTSTATUS NTAPI RtlAppendUnicodeStringToString(PUNICODE_STRING Destination, PUNICODE_STRING Source)
#define PAGE_READONLY
Definition: compat.h:127
#define DPRINT1
Definition: precomp.h:8
static UNICODE_STRING g_FontRegPath
Definition: freetype.c:58
#define FILE_SYNCHRONOUS_IO_NONALERT
Definition: from_kernel.h:31
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID _In_ ULONG_PTR _In_ SIZE_T _Inout_opt_ PLARGE_INTEGER _Inout_ PSIZE_T ViewSize
Definition: mmfuncs.h:404
#define STANDARD_RIGHTS_REQUIRED
Definition: nt_native.h:63
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
static LPCWSTR FASTCALL NameFromCharSet(BYTE CharSet)
Definition: freetype.c: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:113
#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:120
LIST_ENTRY PrivateMemFontListHead
Definition: win32.h:277
Definition: typedefs.h:118
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 5362 of file freetype.c.

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

Referenced by NtGdiGetFontResourceInfoInternalW().

◆ IntGdiRemoveFontMemResource()

BOOL FASTCALL IntGdiRemoveFontMemResource ( HANDLE  hMMFont)

Definition at line 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 TRUE
Definition: types.h:120
#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
FONT_ENTRY_MEM * Entry
Definition: font.h:23
smooth NULL
Definition: ftsmooth.c:416
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
struct _LIST_ENTRY * Flink
Definition: typedefs.h:120
HANDLE Handle
Definition: font.h:22
LIST_ENTRY PrivateMemFontListHead
Definition: win32.h:277
Definition: typedefs.h:118
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:369
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
FORCEINLINE VOID TEXTOBJ_UnlockText(PLFONT plfnt)
Definition: text.h:96
Definition: text.h:59
unsigned int BOOL
Definition: ntddk_ex.h:94
HANDLE hlfntNew
Definition: ntgdihdl.h:334
smooth NULL
Definition: ftsmooth.c:416
LONG cx
Definition: windef.h:334
Definition: polytest.cpp:40
__wchar_t WCHAR
Definition: xmlstorage.h:180
HDC hdc
Definition: main.c:9
BOOL FASTCALL ftGdiGetTextMetricsW(HDC hDC, PTMW_INTERNAL ptmwi)
Definition: freetype.c:4536
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:4212

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:4355
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
unsigned char BYTE
Definition: mem.h:68
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
signed long FT_Fixed
Definition: fttypes.h:288
FT_Fixed x_scale
Definition: freetype.h:1643
FT_Short underlinePosition
Definition: tttables.h:459
FT_Short sTypoAscender
Definition: tttables.h:411
FT_Pos yMin
Definition: ftimage.h:117
#define DPRINT1
Definition: precomp.h:8
FT_Short ySubscriptYOffset
Definition: tttables.h:390
FT_Short sTypoLineGap
Definition: tttables.h:413
FT_Short ySubscriptYSize
Definition: tttables.h:388
FT_BBox bbox
Definition: freetype.h:1092
FT_Short underlineThickness
Definition: tttables.h:460
FT_Byte panose[10]
Definition: tttables.h:399
#define PRIMARYLANGID(l)
Definition: nls.h:16
FT_Short ySuperscriptYOffset
Definition: tttables.h:394

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

◆ IntIsFontRenderingEnabled()

BOOL FASTCALL IntIsFontRenderingEnabled ( VOID  )

Definition at line 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:57
#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 UNICODE_NULL
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
NTSTRSAFEVAPI RtlStringCbPrintfW(_Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest, _In_ size_t cbDest, _In_ _Printf_format_string_ NTSTRSAFE_PCWSTR pszFormat,...)
Definition: ntstrsafe.h:1173
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
static const WCHAR L[]
Definition: oid.c:1250
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
Status
Definition: gdiplustypes.h:24
ULONG_PTR SIZE_T
Definition: typedefs.h:79
#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 TRUE
Definition: types.h:120
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
USHORT MaximumLength
Definition: env_spec_w32.h:370
struct _FILE_DIRECTORY_INFORMATION * PFILE_DIRECTORY_INFORMATION
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:57
#define FILE_SHARE_READ
Definition: compat.h:125
NTSYSAPI VOID NTAPI RtlCopyUnicodeString(PUNICODE_STRING DestinationString, PUNICODE_STRING SourceString)
uint32_t ULONG_PTR
Definition: typedefs.h:64
#define AFRX_WRITE_REGISTRY
Definition: text.h:104
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
#define FILE_LIST_DIRECTORY
Definition: nt_native.h:629
__wchar_t WCHAR
Definition: xmlstorage.h:180
return Iosb
Definition: create.c:4426
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_NO_MORE_FILES
Definition: udferr_usr.h:128
#define _countof(array)
Definition: sndvol32.h:68
#define MAX_PATH
Definition: compat.h:26
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
NTSYSAPI NTSTATUS NTAPI ZwOpenFile(_Out_ PHANDLE FileHandle, _In_ ACCESS_MASK DesiredAccess, _In_ POBJECT_ATTRIBUTES ObjectAttributes, _Out_ PIO_STATUS_BLOCK IoStatusBlock, _In_ ULONG ShareAccess, _In_ ULONG OpenOptions)
#define FILE_SHARE_DELETE
Definition: nt_native.h:682
static const WCHAR L[]
Definition: oid.c:1250
unsigned char BYTE
Definition: mem.h:68
#define SYNCHRONIZE
Definition: nt_native.h:61
Status
Definition: gdiplustypes.h:24
struct _FileName FileName
Definition: fatprocs.h:884
NTSYSAPI NTSTATUS NTAPI RtlAppendUnicodeStringToString(PUNICODE_STRING Destination, PUNICODE_STRING Source)
#define FILE_SYNCHRONOUS_IO_NONALERT
Definition: from_kernel.h:31
base for all directory entries
Definition: entries.h:138
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
INT FASTCALL IntGdiAddFontResourceEx(PUNICODE_STRING FileName, DWORD Characteristics, DWORD dwFlags)
Definition: freetype.c: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:3781
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:5171
Definition: text.h:59
FLONG fl
Definition: text.h:65
smooth NULL
Definition: ftsmooth.c:416
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Status
Definition: gdiplustypes.h:24
return STATUS_SUCCESS
Definition: btrfs.c:2938

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

◆ TextIntCreateFontIndirect()

NTSTATUS FASTCALL TextIntCreateFontIndirect ( CONST LPLOGFONTW  lf,
HFONT NewFont 
)

Definition at line 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:246
LOGFONTW elfLogFont
Definition: wingdi.h:2701
ENUMLOGFONTEXW elfEnumLogfontEx
Definition: wingdi.h:2778
return STATUS_SUCCESS
Definition: btrfs.c:2938

Referenced by CreateStockFonts(), and UserDrawCaptionText().

◆ TextIntGetTextExtentPoint()

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

Definition at line 4212 of file freetype.c.

4221 {
4222  PFONTGDI FontGDI;
4223  FT_Face face;
4224  FT_GlyphSlot glyph;
4225  FT_BitmapGlyph realglyph;
4226  INT error, glyph_index, i, previous;
4227  ULONGLONG TotalWidth64 = 0;
4228  BOOL use_kerning;
4229  FT_Render_Mode RenderMode;
4230  BOOLEAN Render;
4231  PMATRIX pmxWorldToDevice;
4232  LOGFONTW *plf;
4233  BOOL EmuBold, EmuItalic;
4234  LONG ascender, descender;
4235 
4236  FontGDI = ObjToGDI(TextObj->Font, FONT);
4237 
4238  face = FontGDI->SharedFace->Face;
4239  if (NULL != Fit)
4240  {
4241  *Fit = 0;
4242  }
4243 
4244  IntLockFreeType();
4245 
4246  TextIntUpdateSize(dc, TextObj, FontGDI, FALSE);
4247 
4248  plf = &TextObj->logfont.elfEnumLogfontEx.elfLogFont;
4249  EmuBold = EMUBOLD_NEEDED(FontGDI->OriginalWeight, plf->lfWeight);
4250  EmuItalic = (plf->lfItalic && !FontGDI->OriginalItalic);
4251 
4252  Render = IntIsFontRenderingEnabled();
4253  if (Render)
4254  RenderMode = IntGetFontRenderMode(plf);
4255  else
4256  RenderMode = FT_RENDER_MODE_MONO;
4257 
4258  /* Get the DC's world-to-device transformation matrix */
4259  pmxWorldToDevice = DC_pmxWorldToDevice(dc);
4260  FtSetCoordinateTransform(face, pmxWorldToDevice);
4261 
4262  use_kerning = FT_HAS_KERNING(face);
4263  previous = 0;
4264 
4265  for (i = 0; i < Count; i++)
4266  {
4267  glyph_index = get_glyph_index_flagged(face, *String, GTEF_INDICES, fl);
4268 
4269  if (EmuBold || EmuItalic)
4270  realglyph = NULL;
4271  else
4272  realglyph = ftGdiGlyphCacheGet(face, glyph_index, plf->lfHeight,
4273  RenderMode, pmxWorldToDevice);
4274 
4275  if (EmuBold || EmuItalic || !realglyph)
4276  {
4277  if (EmuItalic)
4278  error = FT_Load_Glyph(face, glyph_index, FT_LOAD_NO_BITMAP);
4279  else
4280  error = FT_Load_Glyph(face, glyph_index, FT_LOAD_DEFAULT);
4281  if (error)
4282  {
4283  DPRINT1("WARNING: Failed to load and render glyph! [index: %d]\n", glyph_index);
4284  break;
4285  }
4286 
4287  glyph = face->glyph;
4288  if (EmuBold || EmuItalic)
4289  {
4290  if (EmuBold)
4291  FT_GlyphSlot_Embolden(glyph);
4292  if (EmuItalic)
4293  FT_GlyphSlot_Oblique(glyph);
4294  realglyph = ftGdiGlyphSet(face, glyph, RenderMode);
4295  }
4296  else
4297  {
4298  realglyph = ftGdiGlyphCacheSet(face,
4299  glyph_index,
4300  plf->lfHeight,
4301  pmxWorldToDevice,
4302  glyph,
4303  RenderMode);
4304  }
4305 
4306  if (!realglyph)
4307  {
4308  DPRINT1("Failed to render glyph! [index: %d]\n", glyph_index);
4309  break;
4310  }
4311  }
4312 
4313  /* Retrieve kerning distance */
4314  if (use_kerning && previous && glyph_index)
4315  {
4316  FT_Vector delta;
4317  FT_Get_Kerning(face, previous, glyph_index, 0, &delta);
4318  TotalWidth64 += delta.x;
4319  }
4320 
4321  TotalWidth64 += realglyph->root.advance.x >> 10;
4322 
4323  if (((TotalWidth64 + 32) >> 6) <= MaxExtent && NULL != Fit)
4324  {
4325  *Fit = i + 1;
4326  }
4327  if (NULL != Dx)
4328  {
4329  Dx[i] = (TotalWidth64 + 32) >> 6;
4330  }
4331 
4332  /* Bold and italic do not use the cache */
4333  if (EmuBold || EmuItalic)
4334  {
4335  FT_Done_Glyph((FT_Glyph)realglyph);
4336  }
4337 
4338  previous = glyph_index;
4339  String++;
4340  }
4341  ASSERT(FontGDI->Magic == FONTGDI_MAGIC);
4342  ascender = FontGDI->tmAscent; /* Units above baseline */
4343  descender = FontGDI->tmDescent; /* Units below baseline */
4345 
4346  Size->cx = (TotalWidth64 + 32) >> 6;
4347  Size->cy = ascender + descender;
4348 
4349  return TRUE;
4350 }
FT_Get_Kerning(FT_Face face, FT_UInt left_glyph, FT_UInt right_glyph, FT_UInt kern_mode, FT_Vector *akerning)
Definition: ftobjs.c:3347
LONG tmAscent
Definition: engobjects.h:159
#define TRUE
Definition: types.h:120
#define error(str)
Definition: mkdosfs.c:1605
FT_Pos x
Definition: ftimage.h:76
enum FT_Render_Mode_ FT_Render_Mode
LONG lfHeight
Definition: dimm.idl:59
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1015
static WCHAR String[]
Definition: stringtable.c:55
#define FT_LOAD_DEFAULT
Definition: freetype.h:3008
int32_t INT
Definition: typedefs.h:57
#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
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:66
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:359
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:212
GLenum GLuint GLint GLenum face
Definition: glext.h:7025

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

◆ TextIntRealizeFont()

NTSTATUS FASTCALL TextIntRealizeFont ( HFONT  ,
PTEXTOBJ   
)

Definition at line 5171 of file freetype.c.

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