ReactOS  0.4.13-dev-257-gfabbd7c
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 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)
 
VOID FASTCALL IntGdiCleanupPrivateFontsForProcess (VOID)
 
INT FASTCALL IntGdiAddFontResource (PUNICODE_STRING FileName, DWORD Characteristics)
 
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

◆ IntLockProcessPrivateFonts

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

Definition at line 140 of file text.h.

◆ IntUnLockProcessPrivateFonts

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

Definition at line 143 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:2747
NTSTATUS FASTCALL TextIntRealizeFont(HFONT FontHandle, PTEXTOBJ pTextObj)
Definition: freetype.c:4875
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:2758
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 4321 of file freetype.c.

4327 {
4329  FT_Face Face = FontGdi->SharedFace->Face;
4330 
4331  IntLockFreeType();
4332 
4333  if (FT_IS_SFNT(Face))
4334  {
4335  if (Table)
4336  Table = Table >> 24 | Table << 24 | (Table >> 8 & 0xFF00) |
4337  (Table << 8 & 0xFF0000);
4338 
4339  if (!Buffer) Size = 0;
4340 
4341  if (Buffer && Size)
4342  {
4343  FT_Error Error;
4344  FT_ULong Needed = 0;
4345 
4346  Error = FT_Load_Sfnt_Table(Face, Table, Offset, NULL, &Needed);
4347 
4348  if ( !Error && Needed < Size) Size = Needed;
4349  }
4350  if (!FT_Load_Sfnt_Table(Face, Table, Offset, Buffer, &Size))
4351  Result = Size;
4352  }
4353 
4355 
4356  return Result;
4357 }
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:81
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:78
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
#define GDI_ERROR
Definition: wingdi.h:1291

Referenced by NtGdiGetFontData().

◆ ftGdiGetGlyphOutline()

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

Definition at line 3450 of file freetype.c.

3459 {
3460  PDC_ATTR pdcattr;
3461  PTEXTOBJ TextObj;
3462  PFONTGDI FontGDI;
3463  HFONT hFont = 0;
3464  GLYPHMETRICS gm;
3465  ULONG Size;
3466  FT_Face ft_face;
3467  FT_UInt glyph_index;
3468  DWORD width, height, pitch, needed = 0;
3469  FT_Bitmap ft_bitmap;
3470  FT_Error error;
3471  INT left, right, top = 0, bottom = 0;
3473  FLOAT eM11, widthRatio = 1.0;
3474  FT_Matrix transMat = identityMat;
3475  BOOL needsTransform = FALSE;
3476  INT orientation;
3477  LONG aveWidth;
3478  INT adv, lsb, bbx; /* These three hold to widths of the unrotated chars */
3479  OUTLINETEXTMETRICW *potm;
3480  XFORM xForm;
3481  LOGFONTW *plf;
3482 
3483  DPRINT("%u, %08x, %p, %08lx, %p, %p\n", wch, iFormat, pgm,
3484  cjBuf, pvBuf, pmat2);
3485 
3486  pdcattr = dc->pdcattr;
3487 
3488  MatrixS2XForm(&xForm, &dc->pdcattr->mxWorldToDevice);
3489  eM11 = xForm.eM11;
3490 
3491  hFont = pdcattr->hlfntNew;
3492  TextObj = RealizeFontInit(hFont);
3493 
3494  if (!TextObj)
3495  {
3497  return GDI_ERROR;
3498  }
3499  FontGDI = ObjToGDI(TextObj->Font, FONT);
3500  ft_face = FontGDI->SharedFace->Face;
3501 
3502  plf = &TextObj->logfont.elfEnumLogfontEx.elfLogFont;
3503  aveWidth = FT_IS_SCALABLE(ft_face) ? abs(plf->lfWidth) : 0;
3504  orientation = FT_IS_SCALABLE(ft_face) ? plf->lfOrientation : 0;
3505 
3506  Size = IntGetOutlineTextMetrics(FontGDI, 0, NULL);
3508  if (!potm)
3509  {
3511  TEXTOBJ_UnlockText(TextObj);
3512  return GDI_ERROR;
3513  }
3514  Size = IntGetOutlineTextMetrics(FontGDI, Size, potm);
3515  if (!Size)
3516  {
3517  /* FIXME: last error? */
3519  TEXTOBJ_UnlockText(TextObj);
3520  return GDI_ERROR;
3521  }
3522 
3523  IntLockFreeType();
3524  TextIntUpdateSize(dc, TextObj, FontGDI, FALSE);
3526 
3527  TEXTOBJ_UnlockText(TextObj);
3528 
3529  glyph_index = get_glyph_index_flagged(ft_face, wch, GGO_GLYPH_INDEX, iFormat);
3531 
3532  if (orientation || (iFormat != GGO_METRICS && iFormat != GGO_BITMAP) || aveWidth || pmat2)
3533  load_flags |= FT_LOAD_NO_BITMAP;
3534 
3535  if (iFormat & GGO_UNHINTED)
3536  {
3537  load_flags |= FT_LOAD_NO_HINTING;
3538  iFormat &= ~GGO_UNHINTED;
3539  }
3540 
3541  error = FT_Load_Glyph(ft_face, glyph_index, load_flags);
3542  if (error)
3543  {
3544  DPRINT1("WARNING: Failed to load and render glyph! [index: %u]\n", glyph_index);
3546  if (potm) ExFreePoolWithTag(potm, GDITAG_TEXT);
3547  return GDI_ERROR;
3548  }
3550 
3551  if (aveWidth && potm)
3552  {
3553  widthRatio = (FLOAT)aveWidth * eM11 /
3555  }
3556 
3557  left = (INT)(ft_face->glyph->metrics.horiBearingX * widthRatio) & -64;
3558  right = (INT)((ft_face->glyph->metrics.horiBearingX +
3559  ft_face->glyph->metrics.width) * widthRatio + 63) & -64;
3560 
3561  adv = (INT)((ft_face->glyph->metrics.horiAdvance * widthRatio) + 63) >> 6;
3562  lsb = left >> 6;
3563  bbx = (right - left) >> 6;
3564 
3565  DPRINT("Advance = %d, lsb = %d, bbx = %d\n",adv, lsb, bbx);
3566 
3567  IntLockFreeType();
3568 
3569  /* Width scaling transform */
3570  if (widthRatio != 1.0)
3571  {
3572  FT_Matrix scaleMat;
3573  scaleMat.xx = FT_FixedFromFloat(widthRatio);
3574  scaleMat.xy = 0;
3575  scaleMat.yx = 0;
3576  scaleMat.yy = FT_FixedFromFloat(1.0);
3577 
3578  FT_Matrix_Multiply(&scaleMat, &transMat);
3579  needsTransform = TRUE;
3580  }
3581 
3582  /* World transform */
3583  {
3584  FT_Matrix ftmatrix;
3586 
3587  /* Create a freetype matrix, by converting to 16.16 fixpoint format */
3588  FtMatrixFromMx(&ftmatrix, pmx);
3589 
3590  if (memcmp(&ftmatrix, &identityMat, sizeof(identityMat)) != 0)
3591  {
3592  FT_Matrix_Multiply(&ftmatrix, &transMat);
3593  needsTransform = TRUE;
3594  }
3595  }
3596 
3597  /* Rotation transform */
3598  if (orientation)
3599  {
3600  FT_Matrix rotationMat;
3601  DPRINT("Rotation Trans!\n");
3602  IntEscapeMatrix(&rotationMat, orientation);
3603  FT_Matrix_Multiply(&rotationMat, &transMat);
3604  needsTransform = TRUE;
3605  }
3606 
3607  /* Extra transformation specified by caller */
3608  if (pmat2)
3609  {
3610  FT_Matrix extraMat;
3611  DPRINT("MAT2 Matrix Trans!\n");
3612  extraMat.xx = FT_FixedFromFIXED(pmat2->eM11);
3613  extraMat.xy = FT_FixedFromFIXED(pmat2->eM21);
3614  extraMat.yx = FT_FixedFromFIXED(pmat2->eM12);
3615  extraMat.yy = FT_FixedFromFIXED(pmat2->eM22);
3616  FT_Matrix_Multiply(&extraMat, &transMat);
3617  needsTransform = TRUE;
3618  }
3619 
3620  if (potm) ExFreePoolWithTag(potm, GDITAG_TEXT); /* It looks like we are finished with potm ATM. */
3621 
3622  if (!needsTransform)
3623  {
3624  DPRINT("No Need to be Transformed!\n");
3625  top = (ft_face->glyph->metrics.horiBearingY + 63) & -64;
3626  bottom = (ft_face->glyph->metrics.horiBearingY -
3627  ft_face->glyph->metrics.height) & -64;
3628  gm.gmCellIncX = adv;
3629  gm.gmCellIncY = 0;
3630  }
3631  else
3632  {
3633  INT xc, yc;
3634  FT_Vector vec;
3635  for (xc = 0; xc < 2; xc++)
3636  {
3637  for (yc = 0; yc < 2; yc++)
3638  {
3639  vec.x = (ft_face->glyph->metrics.horiBearingX +
3640  xc * ft_face->glyph->metrics.width);
3641  vec.y = ft_face->glyph->metrics.horiBearingY -
3642  yc * ft_face->glyph->metrics.height;
3643  DPRINT("Vec %ld,%ld\n", vec.x, vec.y);
3644  FT_Vector_Transform(&vec, &transMat);
3645  if (xc == 0 && yc == 0)
3646  {
3647  left = right = vec.x;
3648  top = bottom = vec.y;
3649  }
3650  else
3651  {
3652  if (vec.x < left) left = vec.x;
3653  else if (vec.x > right) right = vec.x;
3654  if (vec.y < bottom) bottom = vec.y;
3655  else if (vec.y > top) top = vec.y;
3656  }
3657  }
3658  }
3659  left = left & -64;
3660  right = (right + 63) & -64;
3661  bottom = bottom & -64;
3662  top = (top + 63) & -64;
3663 
3664  DPRINT("Transformed box: (%d,%d - %d,%d)\n", left, top, right, bottom);
3665  vec.x = ft_face->glyph->metrics.horiAdvance;
3666  vec.y = 0;
3667  FT_Vector_Transform(&vec, &transMat);
3668  gm.gmCellIncX = (vec.x+63) >> 6;
3669  gm.gmCellIncY = -((vec.y+63) >> 6);
3670  }
3671  gm.gmBlackBoxX = (right - left) >> 6;
3672  gm.gmBlackBoxY = (top - bottom) >> 6;
3673  gm.gmptGlyphOrigin.x = left >> 6;
3674  gm.gmptGlyphOrigin.y = top >> 6;
3675 
3676  DPRINT("CX %d CY %d BBX %u BBY %u GOX %d GOY %d\n",
3677  gm.gmCellIncX, gm.gmCellIncY,
3678  gm.gmBlackBoxX, gm.gmBlackBoxY,
3680 
3682 
3683 
3684  if (iFormat == GGO_METRICS)
3685  {
3686  DPRINT("GGO_METRICS Exit!\n");
3687  *pgm = gm;
3688  return 1; /* FIXME */
3689  }
3690 
3691  if (ft_face->glyph->format != ft_glyph_format_outline && iFormat != GGO_BITMAP)
3692  {
3693  DPRINT1("Loaded a bitmap\n");
3694  return GDI_ERROR;
3695  }
3696 
3697  switch (iFormat)
3698  {
3699  case GGO_BITMAP:
3700  {
3701  width = gm.gmBlackBoxX;
3702  height = gm.gmBlackBoxY;
3703  pitch = ((width + 31) >> 5) << 2;
3704  needed = pitch * height;
3705 
3706  if (!pvBuf || !cjBuf) break;
3707  if (!needed) return GDI_ERROR; /* empty glyph */
3708  if (needed > cjBuf)
3709  return GDI_ERROR;
3710 
3711  switch (ft_face->glyph->format)
3712  {
3714  {
3715  BYTE *src = ft_face->glyph->bitmap.buffer, *dst = pvBuf;
3716  INT w = min( pitch, (ft_face->glyph->bitmap.width + 7) >> 3 );
3717  INT h = min( height, ft_face->glyph->bitmap.rows );
3718  while (h--)
3719  {
3720  RtlCopyMemory(dst, src, w);
3721  src += ft_face->glyph->bitmap.pitch;
3722  dst += pitch;
3723  }
3724  break;
3725  }
3726 
3728  {
3729  ft_bitmap.width = width;
3730  ft_bitmap.rows = height;
3731  ft_bitmap.pitch = pitch;
3732  ft_bitmap.pixel_mode = FT_PIXEL_MODE_MONO;
3733  ft_bitmap.buffer = pvBuf;
3734 
3735  IntLockFreeType();
3736  if (needsTransform)
3737  {
3738  FT_Outline_Transform(&ft_face->glyph->outline, &transMat);
3739  }
3740  FT_Outline_Translate(&ft_face->glyph->outline, -left, -bottom );
3741  /* Note: FreeType will only set 'black' bits for us. */
3742  RtlZeroMemory(pvBuf, needed);
3743  FT_Outline_Get_Bitmap(g_FreeTypeLibrary, &ft_face->glyph->outline, &ft_bitmap);
3745  break;
3746  }
3747 
3748  default:
3749  DPRINT1("Loaded glyph format %x\n", ft_face->glyph->format);
3750  return GDI_ERROR;
3751  }
3752 
3753  break;
3754  }
3755 
3756  case GGO_GRAY2_BITMAP:
3757  case GGO_GRAY4_BITMAP:
3758  case GGO_GRAY8_BITMAP:
3759  {
3760  unsigned int mult, row, col;
3761  BYTE *start, *ptr;
3762 
3763  width = gm.gmBlackBoxX;
3764  height = gm.gmBlackBoxY;
3765  pitch = (width + 3) / 4 * 4;
3766  needed = pitch * height;
3767 
3768  if (!pvBuf || !cjBuf) break;
3769  if (!needed) return GDI_ERROR; /* empty glyph */
3770  if (needed > cjBuf)
3771  return GDI_ERROR;
3772 
3773  switch (ft_face->glyph->format)
3774  {
3776  {
3777  BYTE *src = ft_face->glyph->bitmap.buffer, *dst = pvBuf;
3778  INT h = min( height, ft_face->glyph->bitmap.rows );
3779  INT x;
3780  while (h--)
3781  {
3782  for (x = 0; (UINT)x < pitch; x++)
3783  {
3784  if (x < ft_face->glyph->bitmap.width)
3785  dst[x] = (src[x / 8] & (1 << ( (7 - (x % 8))))) ? 0xff : 0;
3786  else
3787  dst[x] = 0;
3788  }
3789  src += ft_face->glyph->bitmap.pitch;
3790  dst += pitch;
3791  }
3792  break;
3793  }
3795  {
3796  ft_bitmap.width = width;
3797  ft_bitmap.rows = height;
3798  ft_bitmap.pitch = pitch;
3799  ft_bitmap.pixel_mode = FT_PIXEL_MODE_GRAY;
3800  ft_bitmap.buffer = pvBuf;
3801 
3802  IntLockFreeType();
3803  if (needsTransform)
3804  {
3805  FT_Outline_Transform(&ft_face->glyph->outline, &transMat);
3806  }
3807  FT_Outline_Translate(&ft_face->glyph->outline, -left, -bottom );
3808  RtlZeroMemory(ft_bitmap.buffer, cjBuf);
3809  FT_Outline_Get_Bitmap(g_FreeTypeLibrary, &ft_face->glyph->outline, &ft_bitmap);
3811 
3812  if (iFormat == GGO_GRAY2_BITMAP)
3813  mult = 4;
3814  else if (iFormat == GGO_GRAY4_BITMAP)
3815  mult = 16;
3816  else if (iFormat == GGO_GRAY8_BITMAP)
3817  mult = 64;
3818  else
3819  {
3820  return GDI_ERROR;
3821  }
3822 
3823  start = pvBuf;
3824  for (row = 0; row < height; row++)
3825  {
3826  ptr = start;
3827  for (col = 0; col < width; col++, ptr++)
3828  {
3829  *ptr = (((int)*ptr) * mult + 128) / 256;
3830  }
3831  start += pitch;
3832  }
3833 
3834  break;
3835  }
3836  default:
3837  DPRINT1("Loaded glyph format %x\n", ft_face->glyph->format);
3838  return GDI_ERROR;
3839  }
3840 
3841  break;
3842  }
3843 
3844  case GGO_NATIVE:
3845  {
3846  FT_Outline *outline = &ft_face->glyph->outline;
3847 
3848  if (cjBuf == 0) pvBuf = NULL; /* This is okay, need cjBuf to allocate. */
3849 
3850  IntLockFreeType();
3851  if (needsTransform && pvBuf) FT_Outline_Transform(outline, &transMat);
3852 
3854 
3855  if (!pvBuf || !cjBuf)
3856  {
3858  break;
3859  }
3860  if (needed > cjBuf)
3861  {
3863  return GDI_ERROR;
3864  }
3867  break;
3868  }
3869 
3870  case GGO_BEZIER:
3871  {
3872  FT_Outline *outline = &ft_face->glyph->outline;
3873  if (cjBuf == 0) pvBuf = NULL;
3874 
3875  if (needsTransform && pvBuf)
3876  {
3877  IntLockFreeType();
3878  FT_Outline_Transform(outline, &transMat);
3880  }
3882 
3883  if (!pvBuf || !cjBuf)
3884  break;
3885  if (needed > cjBuf)
3886  return GDI_ERROR;
3887 
3889  break;
3890  }
3891 
3892  default:
3893  DPRINT1("Unsupported format %u\n", iFormat);
3894  return GDI_ERROR;
3895  }
3896 
3897  DPRINT("ftGdiGetGlyphOutline END and needed %lu\n", needed);
3898  *pgm = gm;
3899  return needed;
3900 }
#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)
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
#define FLOAT
Definition: i386-dis.c:516
long x
Definition: polytest.cpp:48
FT_Pos x
Definition: ftimage.h:76
FORCEINLINE VOID TEXTOBJ_UnlockText(PLFONT plfnt)
Definition: text.h:96
signed int FT_Int
Definition: fttypes.h:220
FT_Glyph_Metrics metrics
Definition: freetype.h:1916
LONG tmAveCharWidth
Definition: wingdi.h:2366
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
#define INT
Definition: polytest.cpp:20
#define FT_LOAD_NO_HINTING
Definition: freetype.h:3010
static __inline FT_Fixed FT_FixedFromFIXED(FIXED f)
Definition: freetype.c:366
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
unsigned char * buffer
Definition: ftimage.h:266
#define GGO_GRAY4_BITMAP
Definition: wingdi.h:852
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
HDC dc
Definition: cylfrac.c:34
short gmCellIncY
Definition: wingdi.h:2424
FT_Matrix_Multiply(const FT_Matrix *a, FT_Matrix *b)
Definition: ftcalc.c:661
#define FT_LOAD_DEFAULT
Definition: freetype.h:3008
int32_t INT
Definition: typedefs.h:56
HFONT hFont
Definition: main.c:53
#define GGO_BITMAP
Definition: wingdi.h:848
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
FT_Outline_Get_Bitmap(FT_Library library, FT_Outline *outline, const FT_Bitmap *abitmap)
Definition: ftoutln.c:661
#define GGO_GRAY8_BITMAP
Definition: wingdi.h:853
#define GGO_BEZIER
Definition: wingdi.h:850
FT_Fixed xx
Definition: fttypes.h:387
BOOL FASTCALL TextIntUpdateSize(PDC dc, PTEXTOBJ TextObj, PFONTGDI FontGDI, BOOL bDoLock)
Definition: freetype.c:3328
Definition: text.h:59
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
LONG lfOrientation
Definition: dimm.idl:62
HANDLE hlfntNew
Definition: ntgdihdl.h:327
static PVOID ptr
Definition: dispmode.c:27
#define GGO_NATIVE
Definition: wingdi.h:849
INT FASTCALL IntGetOutlineTextMetrics(PFONTGDI FontGDI, UINT Size, OUTLINETEXTMETRICW *Otm)
Definition: freetype.c:2152
LONG lfWidth
Definition: dimm.idl:60
smooth NULL
Definition: ftsmooth.c:416
FT_Library g_FreeTypeLibrary
Definition: freetype.c:51
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
static __inline FT_Fixed FT_FixedFromFloat(FLOAT f)
Definition: freetype.c:355
#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:732
POINT gmptGlyphOrigin
Definition: wingdi.h:2422
#define IntUnLockFreeType()
Definition: freetype.c:81
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:3014
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
#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:3087
FLOAT eM11
Definition: wingdi.h:1699
#define IntLockFreeType()
Definition: freetype.c:78
#define MatrixS2XForm(x, m)
Definition: coord.h:21
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:3430
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:2423
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
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:719
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:2421
#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:2492
#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:46
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:2680
UINT gmBlackBoxX
Definition: wingdi.h:2420
float FLOAT
Definition: typedefs.h:67
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
#define ObjToGDI(ClipObj, Type)
Definition: engobjects.h:180
FORCEINLINE PMATRIX DC_pmxWorldToDevice(PDC pdc)
Definition: coord.h:98
#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:2757
FT_Fixed yy
Definition: fttypes.h:388
FORCEINLINE VOID FASTCALL FtSetCoordinateTransform(FT_Face face, PMATRIX pmx)
Definition: freetype.c:755
#define GDI_ERROR
Definition: wingdi.h:1291
#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 5361 of file freetype.c.

5364 {
5365  DWORD Count = 0;
5366  INT i = 0;
5367  FT_Face face = Font->SharedFace->Face;
5368 
5369  if (FT_HAS_KERNING(face) && face->charmap->encoding == FT_ENCODING_UNICODE)
5370  {
5371  FT_UInt previous_index = 0, glyph_index = 0;
5372  FT_ULong char_code, char_previous;
5373  FT_Vector delta;
5374 
5375  char_previous = char_code = FT_Get_First_Char(face, &glyph_index);
5376 
5377  IntLockFreeType();
5378 
5379  while (glyph_index)
5380  {
5381  if (previous_index && glyph_index)
5382  {
5383  FT_Get_Kerning(face, previous_index, glyph_index, FT_KERNING_DEFAULT, &delta);
5384 
5385  if (pKerningPair && cPairs)
5386  {
5387  pKerningPair[i].wFirst = char_previous;
5388  pKerningPair[i].wSecond = char_code;
5389  pKerningPair[i].iKernAmount = delta.x;
5390  i++;
5391  if (i == cPairs) break;
5392  }
5393  Count++;
5394  }
5395  previous_index = glyph_index;
5396  char_previous = char_code;
5397  char_code = FT_Get_Next_Char(face, char_code, &glyph_index);
5398  }
5400  }
5401  return Count;
5402 }
FT_Get_Kerning(FT_Face face, FT_UInt left_glyph, FT_UInt right_glyph, FT_UInt kern_mode, FT_Vector *akerning)
Definition: ftobjs.c:3347
unsigned long FT_ULong
Definition: fttypes.h:253
FT_Pos x
Definition: ftimage.h:76
FT_Get_Next_Char(FT_Face face, FT_ULong char_code, FT_UInt *agindex)
Definition: ftobjs.c:3722
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1015
int32_t INT
Definition: typedefs.h:56
#define FT_HAS_KERNING(face)
Definition: freetype.h:1297
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define IntUnLockFreeType()
Definition: freetype.c:81
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:78
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 2839 of file freetype.c.

2840 {
2841  if ( lprs )
2842  {
2843  lprs->nSize = sizeof(RASTERIZER_STATUS);
2844  lprs->wFlags = TT_AVAILABLE | TT_ENABLED;
2845  lprs->nLanguageID = gusLanguageID;
2846  return TRUE;
2847  }
2849  return FALSE;
2850 }
#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
SHORT 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 4044 of file freetype.c.

4048 {
4049  PDC_ATTR pdcattr;
4050  UINT Ret = DEFAULT_CHARSET;
4051  INT i;
4052  HFONT hFont;
4053  PTEXTOBJ TextObj;
4054  PFONTGDI FontGdi;
4055  FONTSIGNATURE fs;
4056  TT_OS2 *pOS2;
4057  FT_Face Face;
4058  CHARSETINFO csi;
4059  DWORD cp, fs0;
4060  USHORT usACP, usOEM;
4061 
4062  pdcattr = Dc->pdcattr;
4063  hFont = pdcattr->hlfntNew;
4064  TextObj = RealizeFontInit(hFont);
4065 
4066  if (!TextObj)
4067  {
4069  return Ret;
4070  }
4071  FontGdi = ObjToGDI(TextObj->Font, FONT);
4072  Face = FontGdi->SharedFace->Face;
4073  TEXTOBJ_UnlockText(TextObj);
4074 
4075  memset(&fs, 0, sizeof(FONTSIGNATURE));
4076  IntLockFreeType();
4077  pOS2 = FT_Get_Sfnt_Table(Face, ft_sfnt_os2);
4078  if (NULL != pOS2)
4079  {
4080  fs.fsCsb[0] = pOS2->ulCodePageRange1;
4081  fs.fsCsb[1] = pOS2->ulCodePageRange2;
4082  fs.fsUsb[0] = pOS2->ulUnicodeRange1;
4083  fs.fsUsb[1] = pOS2->ulUnicodeRange2;
4084  fs.fsUsb[2] = pOS2->ulUnicodeRange3;
4085  fs.fsUsb[3] = pOS2->ulUnicodeRange4;
4086  if (pOS2->version == 0)
4087  {
4088  FT_UInt dummy;
4089 
4090  if (FT_Get_First_Char( Face, &dummy ) < 0x100)
4091  fs.fsCsb[0] |= FS_LATIN1;
4092  else
4093  fs.fsCsb[0] |= FS_SYMBOL;
4094  }
4095  }
4096  pOS2 = NULL;
4098  DPRINT("Csb 1=%x 0=%x\n", fs.fsCsb[1],fs.fsCsb[0]);
4099  if (fs.fsCsb[0] == 0)
4100  { /* Let's see if we can find any interesting cmaps */
4101  for (i = 0; i < Face->num_charmaps; i++)
4102  {
4103  switch (Face->charmaps[i]->encoding)
4104  {
4105  case FT_ENCODING_UNICODE:
4106  case FT_ENCODING_APPLE_ROMAN:
4107  fs.fsCsb[0] |= FS_LATIN1;
4108  break;
4109  case FT_ENCODING_MS_SYMBOL:
4110  fs.fsCsb[0] |= FS_SYMBOL;
4111  break;
4112  default:
4113  break;
4114  }
4115  }
4116  }
4117  if (lpSig)
4118  {
4119  RtlCopyMemory(lpSig, &fs, sizeof(FONTSIGNATURE));
4120  }
4121 
4122  RtlGetDefaultCodePage(&usACP, &usOEM);
4123  cp = usACP;
4124 
4126  if (csi.fs.fsCsb[0] & fs.fsCsb[0])
4127  {
4128  DPRINT("Hit 1\n");
4129  Ret = csi.ciCharset;
4130  goto Exit;
4131  }
4132 
4133  for (i = 0; i < MAXTCIINDEX; i++)
4134  {
4135  fs0 = 1L << i;
4136  if (fs.fsCsb[0] & fs0)
4137  {
4138  if (IntTranslateCharsetInfo(&fs0, &csi, TCI_SRCFONTSIG))
4139  {
4140  // *cp = csi.ciACP;
4141  DPRINT("Hit 2\n");
4142  Ret = csi.ciCharset;
4143  goto Exit;
4144  }
4145  else
4146  DPRINT1("TCI failing on %x\n", fs0);
4147  }
4148  }
4149 Exit:
4150  DPRINT("CharSet %u CodePage %u\n", csi.ciCharset, csi.ciACP);
4151  return (MAKELONG(csi.ciACP, csi.ciCharset));
4152 }
FONTSIGNATURE fs
Definition: wingdi.h:1526
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
FT_CharMap * charmaps
Definition: freetype.h:1085
#define ft_sfnt_os2
Definition: tttables.h:631
#define TCI_SRCFONTSIG
Definition: wingdi.h:962
FORCEINLINE VOID TEXTOBJ_UnlockText(PLFONT plfnt)
Definition: text.h:96
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
Definition: fs.h:235
#define DEFAULT_CHARSET
Definition: wingdi.h:383
int32_t INT
Definition: typedefs.h:56
#define MAXTCIINDEX
Definition: freetype.c:122
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:327
FT_Get_Sfnt_Table(FT_Face face, FT_Sfnt_Tag tag)
Definition: ftobjs.c:4113
UINT ciCharset
Definition: wingdi.h:1524
#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:1753
#define FS_SYMBOL
Definition: wingdi.h:574
static void Exit(void)
Definition: sock.c:1331
#define IntUnLockFreeType()
Definition: freetype.c:81
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:78
FT_Int num_charmaps
Definition: freetype.h:1084
FONTOBJ * Font
Definition: text.h:66
DWORD fsCsb[2]
Definition: wingdi.h:1521
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:61
#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 4225 of file freetype.c.

4228 {
4229  PDC dc;
4230  PDC_ATTR pdcattr;
4231  PTEXTOBJ TextObj;
4232  PFONTGDI FontGDI;
4233  FT_Face Face;
4234  TT_OS2 *pOS2;
4235  TT_HoriHeader *pHori;
4236  FT_WinFNT_HeaderRec Win;
4237  ULONG Error;
4239  LOGFONTW *plf;
4240 
4241  if (!ptmwi)
4242  {
4244  return FALSE;
4245  }
4246 
4247  if (!(dc = DC_LockDc(hDC)))
4248  {
4250  return FALSE;
4251  }
4252  pdcattr = dc->pdcattr;
4253  TextObj = RealizeFontInit(pdcattr->hlfntNew);
4254  if (NULL != TextObj)
4255  {
4256  plf = &TextObj->logfont.elfEnumLogfontEx.elfLogFont;
4257  FontGDI = ObjToGDI(TextObj->Font, FONT);
4258 
4259  Face = FontGDI->SharedFace->Face;
4260 
4261  IntLockFreeType();
4262  Error = IntRequestFontSize(dc, FontGDI, plf->lfWidth, plf->lfHeight);
4265 
4266  if (0 != Error)
4267  {
4268  DPRINT1("Error in setting pixel sizes: %u\n", Error);
4270  }
4271  else
4272  {
4273  FT_Face Face = FontGDI->SharedFace->Face;
4275 
4276  IntLockFreeType();
4277  pOS2 = FT_Get_Sfnt_Table(Face, ft_sfnt_os2);
4278  if (NULL == pOS2)
4279  {
4280  DPRINT1("Can't find OS/2 table - not TT font?\n");
4282  }
4283 
4284  pHori = FT_Get_Sfnt_Table(Face, ft_sfnt_hhea);
4285  if (NULL == pHori)
4286  {
4287  DPRINT1("Can't find HHEA table - not TT font?\n");
4289  }
4290 
4291  Error = FT_Get_WinFNT_Header(Face, &Win);
4292 
4293  if (NT_SUCCESS(Status))
4294  {
4295  FillTM(&ptmwi->TextMetric, FontGDI, pOS2, pHori, !Error ? &Win : 0);
4296 
4297  /* FIXME: Fill Diff member */
4298  RtlZeroMemory(&ptmwi->Diff, sizeof(ptmwi->Diff));
4299  }
4300 
4302  }
4303  TEXTOBJ_UnlockText(TextObj);
4304  }
4305  else
4306  {
4308  }
4309  DC_UnlockDc(dc);
4310 
4311  if (!NT_SUCCESS(Status))
4312  {
4314  return FALSE;
4315  }
4316  return TRUE;
4317 }
#define TRUE
Definition: types.h:120
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
FT_Get_WinFNT_Header(FT_Face face, FT_WinFNT_HeaderRec *aheader)
Definition: ftwinfnt.c:29
#define ft_sfnt_os2
Definition: tttables.h:631
FORCEINLINE VOID TEXTOBJ_UnlockText(PLFONT plfnt)
Definition: text.h:96
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
LONG lfHeight
Definition: dimm.idl:59
LONG NTSTATUS
Definition: precomp.h:26
HDC dc
Definition: cylfrac.c:34
#define STATUS_INVALID_HANDLE
Definition: ntstatus.h:231
#define STATUS_INTERNAL_ERROR
Definition: ntstatus.h:451
Definition: text.h:59
HANDLE hlfntNew
Definition: ntgdihdl.h:327
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:2058
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:3212
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define IntUnLockFreeType()
Definition: freetype.c:81
BOOL Error
Definition: chkdsk.c:66
FT_Face Face
Definition: engobjects.h:129
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define IntLockFreeType()
Definition: freetype.c:78
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:2680
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
#define ObjToGDI(ClipObj, Type)
Definition: engobjects.h:180
FORCEINLINE PMATRIX DC_pmxWorldToDevice(PDC pdc)
Definition: coord.h:98
ENUMLOGFONTEXW elfEnumLogfontEx
Definition: wingdi.h:2757
FORCEINLINE VOID FASTCALL FtSetCoordinateTransform(FT_Face face, PMATRIX pmx)
Definition: freetype.c:755
return STATUS_SUCCESS
Definition: btrfs.c:2745
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 5342 of file freetype.c.

5343 {
5344  if (FT_HAS_FIXED_SIZES(Font->SharedFace->Face))
5345  Info->iTechnology = RI_TECH_BITMAP;
5346  else
5347  {
5348  if (FT_IS_SCALABLE(Font->SharedFace->Face))
5349  Info->iTechnology = RI_TECH_SCALABLE;
5350  else
5351  Info->iTechnology = RI_TECH_FIXED;
5352  }
5353  Info->iUniq = Font->FontObj.iUniq;
5354  Info->dwUnknown = -1;
5355  return TRUE;
5356 }
#define TRUE
Definition: types.h:120
#define RI_TECH_BITMAP
Definition: ntgdityp.h:265
struct TraceInfo Info
#define RI_TECH_SCALABLE
Definition: ntgdityp.h:267
#define FT_HAS_FIXED_SIZES(face)
Definition: freetype.h:1361
#define RI_TECH_FIXED
Definition: ntgdityp.h:266
#define FT_IS_SCALABLE(face)
Definition: freetype.h:1312

Referenced by NtGdiGetRealizationInfo().

◆ ftGetFontUnicodeRanges()

DWORD FASTCALL ftGetFontUnicodeRanges ( PFONTGDI  ,
PGLYPHSET   
)

Definition at line 4157 of file freetype.c.

4158 {
4159  DWORD size = 0;
4160  DWORD num_ranges = 0;
4161  FT_Face face = Font->SharedFace->Face;
4162 
4163  if (face->charmap->encoding == FT_ENCODING_UNICODE)
4164  {
4165  FT_UInt glyph_code = 0;
4166  FT_ULong char_code, char_code_prev;
4167 
4168  char_code_prev = char_code = FT_Get_First_Char(face, &glyph_code);
4169 
4170  DPRINT("Face encoding FT_ENCODING_UNICODE, number of glyphs %ld, first glyph %u, first char %04lx\n",
4171  face->num_glyphs, glyph_code, char_code);
4172 
4173  if (!glyph_code) return 0;
4174 
4175  if (glyphset)
4176  {
4177  glyphset->ranges[0].wcLow = (USHORT)char_code;
4178  glyphset->ranges[0].cGlyphs = 0;
4179  glyphset->cGlyphsSupported = 0;
4180  }
4181 
4182  num_ranges = 1;
4183  while (glyph_code)
4184  {
4185  if (char_code < char_code_prev)
4186  {
4187  DPRINT1("Expected increasing char code from FT_Get_Next_Char\n");
4188  return 0;
4189  }
4190  if (char_code - char_code_prev > 1)
4191  {
4192  num_ranges++;
4193  if (glyphset)
4194  {
4195  glyphset->ranges[num_ranges - 1].wcLow = (USHORT)char_code;
4196  glyphset->ranges[num_ranges - 1].cGlyphs = 1;
4197  glyphset->cGlyphsSupported++;
4198  }
4199  }
4200  else if (glyphset)
4201  {
4202  glyphset->ranges[num_ranges - 1].cGlyphs++;
4203  glyphset->cGlyphsSupported++;
4204  }
4205  char_code_prev = char_code;
4206  char_code = FT_Get_Next_Char(face, char_code, &glyph_code);
4207  }
4208  }
4209  else
4210  DPRINT1("Encoding %i not supported\n", face->charmap->encoding);
4211 
4212  size = sizeof(GLYPHSET) + sizeof(WCRANGE) * (num_ranges - 1);
4213  if (glyphset)
4214  {
4215  glyphset->cbThis = size;
4216  glyphset->cRanges = num_ranges;
4217  glyphset->flAccel = 0;
4218  }
4219  return size;
4220 }
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:2681
DWORD dvNumAxes
Definition: wingdi.h:2747
WCHAR elfStyle[LF_FACESIZE]
Definition: wingdi.h:2682
WCHAR elfScript[LF_FACESIZE]
Definition: wingdi.h:2683
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:1135
DESIGNVECTOR elfDesignVector
Definition: wingdi.h:2758
LOGFONTW elfLogFont
Definition: wingdi.h:2680
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
ENUMLOGFONTEXW elfEnumLogfontEx
Definition: wingdi.h:2757

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:327
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:3904
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:327
smooth NULL
Definition: ftsmooth.c:416
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
LONG cx
Definition: windef.h:319
Definition: polytest.cpp:40
static HDC hDC
Definition: 3dtext.c:33
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
PTEXTOBJ FASTCALL RealizeFontInit(HFONT hFont)
Definition: font.c:422
BOOL FASTCALL TextIntGetTextExtentPoint(PDC dc, PTEXTOBJ TextObj, LPCWSTR String, INT Count, ULONG MaxExtent, LPINT Fit, LPINT Dx, LPSIZE Size, FLONG fl)
Definition: freetype.c:3904
LONG cy
Definition: windef.h:320
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27

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

◆ GreGetTextMetricsW()

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

Definition at line 151 of file text.c.

154 {
155  TMW_INTERNAL tmwi;
156  if (!ftGdiGetTextMetricsW(hdc, &tmwi)) return FALSE;
157  *lptm = tmwi.TextMetric;
158  return TRUE;
159 }
TEXTMETRICW TextMetric
Definition: ntgdityp.h:364
#define TRUE
Definition: types.h:120
HDC hdc
Definition: main.c:9
BOOL FASTCALL ftGdiGetTextMetricsW(HDC hDC, PTMW_INTERNAL ptmwi)
Definition: freetype.c:4225
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:6331
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 648 of file freetype.c.

649 {
650  ULONG ulError;
651 
655  /* Fast Mutexes must be allocated from non paged pool */
657  if (g_FontListLock == NULL)
658  {
659  return FALSE;
660  }
661 
664  if (g_FreeTypeLock == NULL)
665  {
666  return FALSE;
667  }
669 
671  if (ulError)
672  {
673  DPRINT1("FT_Init_FreeType failed with error code 0x%x\n", ulError);
674  return FALSE;
675  }
676 
678  IntLoadFontSubstList(&g_FontSubstListHead);
679 
680 #if DBG
681  DumpFontInfo(TRUE);
682 #endif
683 
684  return TRUE;
685 }
static LIST_ENTRY g_FontListHead
Definition: freetype.c:65
#define TRUE
Definition: types.h:120
static UINT g_FontCacheNumEntries
Definition: freetype.c:93
FT_Init_FreeType(FT_Library *alibrary)
Definition: ftinit.c:320
smooth NULL
Definition: ftsmooth.c:416
FT_Library g_FreeTypeLibrary
Definition: freetype.c:51
static PFAST_MUTEX g_FontListLock
Definition: freetype.c:66
FAST_MUTEX
Definition: extypes.h:17
FORCEINLINE VOID ExInitializeFastMutex(_Out_ PFAST_MUTEX FastMutex)
Definition: exfuncs.h:274
VOID FASTCALL IntLoadSystemFonts(VOID)
Definition: freetype.c:883
static LIST_ENTRY g_FontCacheListHead
Definition: freetype.c:92
#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:498
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
static PFAST_MUTEX g_FreeTypeLock
Definition: freetype.c:63
#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 171 of file freetype.c.

172 {
173  UINT i;
174 
175  if (uCodePage == CP_OEMCP)
176  return OEM_CHARSET;
177 
178  if (uCodePage == CP_MACCP)
179  return MAC_CHARSET;
180 
181  for (i = 0; i < MAXTCIINDEX; ++i)
182  {
183  if (g_FontTci[i].ciACP == 0)
184  continue;
185 
186  if (g_FontTci[i].ciACP == uCodePage)
187  return g_FontTci[i].ciCharset;
188  }
189 
190  return DEFAULT_CHARSET;
191 }
static const CHARSETINFO g_FontTci[MAXTCIINDEX]
Definition: freetype.c:123
#define MAC_CHARSET
Definition: wingdi.h:402
#define DEFAULT_CHARSET
Definition: wingdi.h:383
#define MAXTCIINDEX
Definition: freetype.c:122
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:1524
#define OEM_CHARSET
Definition: wingdi.h:399
unsigned int UINT
Definition: ndis.h:50
#define CP_OEMCP
Definition: freetype.c:165
#define CP_MACCP
Definition: freetype.c:166

Referenced by CreateStockFonts().

◆ IntEnableFontRendering()

VOID FASTCALL IntEnableFontRendering ( BOOL  Enable)

Definition at line 1683 of file freetype.c.

1684 {
1686 }
_In_ ULONGLONG _In_ ULONGLONG _In_ BOOLEAN Enable
Definition: ntddpcm.h:140
static BOOL g_RenderingEnabled
Definition: freetype.c:67

◆ IntGdiAddFontMemResource()

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

Definition at line 1494 of file freetype.c.

1495 {
1497  FONT_ENTRY_COLL_MEM* EntryCollection;
1498  INT FaceCount;
1499  HANDLE Ret = 0;
1500 
1502 
1503  if (!BufferCopy)
1504  {
1505  *pNumAdded = 0;
1506  return NULL;
1507  }
1508  memcpy(BufferCopy, Buffer, dwSize);
1509 
1510  LoadFont.pFileName = NULL;
1511  LoadFont.Memory = SharedMem_Create(BufferCopy, dwSize, FALSE);
1512  LoadFont.Characteristics = FR_PRIVATE | FR_NOT_ENUM;
1513  RtlInitUnicodeString(&LoadFont.RegValueName, NULL);
1514  LoadFont.IsTrueType = FALSE;
1515  LoadFont.PrivateEntry = NULL;
1517 
1518  RtlFreeUnicodeString(&LoadFont.RegValueName);
1519 
1520  /* Release our copy */
1521  IntLockFreeType();
1522  SharedMem_Release(LoadFont.Memory);
1524 
1525  if (FaceCount > 0)
1526  {
1527  EntryCollection = ExAllocatePoolWithTag(PagedPool, sizeof(FONT_ENTRY_COLL_MEM), TAG_FONT);
1528  if (EntryCollection)
1529  {
1531  EntryCollection->Entry = LoadFont.PrivateEntry;
1532  IntLockProcessPrivateFonts(Win32Process);
1533  EntryCollection->Handle = ULongToHandle(++Win32Process->PrivateMemFontHandleCount);
1534  InsertTailList(&Win32Process->PrivateMemFontListHead, &EntryCollection->ListEntry);
1535  IntUnLockProcessPrivateFonts(Win32Process);
1536  Ret = EntryCollection->Handle;
1537  }
1538  }
1539  *pNumAdded = FaceCount;
1540 
1541  return Ret;
1542 }
#define ULongToHandle(h)
Definition: basetsd.h:81
UINT PrivateMemFontHandleCount
Definition: win32.h:277
#define IntUnLockProcessPrivateFonts(W32Process)
Definition: text.h:143
#define TAG_FONT
Definition: tags.h:12
#define InsertTailList(ListHead, Entry)
int32_t INT
Definition: typedefs.h:56
FONT_ENTRY_MEM * Entry
Definition: font.h:23
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
BOOL LoadFont(LPWSTR lpCmdLine)
HANDLE Handle
Definition: font.h:22
LIST_ENTRY PrivateMemFontListHead
Definition: win32.h:276
LIST_ENTRY ListEntry
Definition: font.h:21
#define IntUnLockFreeType()
Definition: freetype.c:81
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define IntLockFreeType()
Definition: freetype.c:78
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static PSHARED_MEM SharedMem_Create(PBYTE Buffer, ULONG BufferSize, BOOL IsMapping)
Definition: freetype.c:232
Definition: font.h:19
static void SharedMem_Release(PSHARED_MEM Ptr)
Definition: freetype.c:289
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:140
static INT FASTCALL IntGdiLoadFontsFromMemory(PGDI_LOAD_FONT pLoadFont, PSHARED_FACE SharedFace, FT_Long FontIndex, INT CharSetIndex)
Definition: freetype.c:1046

Referenced by NtGdiAddFontMemResourceEx().

◆ IntGdiAddFontResource()

INT FASTCALL IntGdiAddFontResource ( PUNICODE_STRING  FileName,
DWORD  Characteristics 
)

Definition at line 1382 of file freetype.c.

1383 {
1384  NTSTATUS Status;
1386  PVOID Buffer = NULL;
1389  SIZE_T ViewSize = 0;
1390  LARGE_INTEGER SectionSize;
1393  INT FontCount;
1394  HANDLE KeyHandle;
1395  static const UNICODE_STRING TrueTypePostfix = RTL_CONSTANT_STRING(L" (TrueType)");
1396 
1397  /* Open the font file */
1399  Status = ZwOpenFile(
1400  &FileHandle,
1403  &Iosb,
1406  if (!NT_SUCCESS(Status))
1407  {
1408  DPRINT("Could not load font file: %wZ\n", FileName);
1409  return 0;
1410  }
1411 
1412  SectionSize.QuadPart = 0LL;
1414  NULL, &SectionSize, PAGE_READONLY,
1416  if (!NT_SUCCESS(Status))
1417  {
1418  DPRINT("Could not map file: %wZ\n", FileName);
1420  return 0;
1421  }
1423 
1425  if (!NT_SUCCESS(Status))
1426  {
1427  DPRINT("Could not map file: %wZ\n", FileName);
1429  return 0;
1430  }
1431 
1432  LoadFont.pFileName = FileName;
1434  LoadFont.Characteristics = Characteristics;
1435  RtlInitUnicodeString(&LoadFont.RegValueName, NULL);
1436  LoadFont.IsTrueType = FALSE;
1437  LoadFont.PrivateEntry = NULL;
1438  FontCount = IntGdiLoadFontsFromMemory(&LoadFont, NULL, -1, -1);
1439 
1441 
1442  /* Release our copy */
1443  IntLockFreeType();
1444  SharedMem_Release(LoadFont.Memory);
1446 
1447  if (FontCount > 0)
1448  {
1449  if (LoadFont.IsTrueType)
1450  {
1451  /* append " (TrueType)" */
1452  UNICODE_STRING NewString;
1453  USHORT Length;
1454 
1455  Length = LoadFont.RegValueName.Length + TrueTypePostfix.Length;
1456  NewString.Length = 0;
1457  NewString.MaximumLength = Length + sizeof(WCHAR);
1459  NewString.MaximumLength,
1460  TAG_USTR);
1461  NewString.Buffer[0] = UNICODE_NULL;
1462 
1463  RtlAppendUnicodeStringToString(&NewString, &LoadFont.RegValueName);
1464  RtlAppendUnicodeStringToString(&NewString, &TrueTypePostfix);
1465  RtlFreeUnicodeString(&LoadFont.RegValueName);
1466  LoadFont.RegValueName = NewString;
1467  }
1468 
1469  /* registry */
1472  NULL, NULL);
1473  Status = ZwOpenKey(&KeyHandle, KEY_WRITE, &ObjectAttributes);
1474  if (NT_SUCCESS(Status))
1475  {
1476  SIZE_T DataSize;
1477  LPWSTR pFileName = wcsrchr(FileName->Buffer, L'\\');
1478  if (pFileName)
1479  {
1480  pFileName++;
1481  DataSize = (wcslen(pFileName) + 1) * sizeof(WCHAR);
1482  ZwSetValueKey(KeyHandle, &LoadFont.RegValueName, 0, REG_SZ,
1483  pFileName, DataSize);
1484  }
1485  ZwClose(KeyHandle);
1486  }
1487  }
1488  RtlFreeUnicodeString(&LoadFont.RegValueName);
1489 
1490  return FontCount;
1491 }
_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:72
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
Definition: ndis.h:4711
USHORT MaximumLength
Definition: env_spec_w32.h:370
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
LONG NTSTATUS
Definition: precomp.h:26
VOID NTAPI ObDereferenceObject(IN PVOID Object)
Definition: obref.c:375
int32_t INT
Definition: typedefs.h:56
#define FILE_SHARE_READ
Definition: compat.h:125
HANDLE FileHandle
Definition: stats.c:38
#define SECTION_ALL_ACCESS
Definition: nt_native.h:1293
#define SEC_COMMIT
Definition: mmtypes.h:99
#define UNICODE_NULL
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
_Check_return_ _CRTIMP _CONST_RETURN wchar_t *__cdecl wcsrchr(_In_z_ const wchar_t *_Str, _In_ wchar_t _Ch)
Definition: bufpool.h:45
BOOL LoadFont(LPWSTR lpCmdLine)
#define KEY_WRITE
Definition: nt_native.h:1031
__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:4973
#define IntUnLockFreeType()
Definition: freetype.c:81
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
NTSYSAPI 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:4845
static const WCHAR L[]
Definition: oid.c:1250
#define IntLockFreeType()
Definition: freetype.c:78
static PSHARED_MEM SharedMem_Create(PBYTE Buffer, ULONG BufferSize, BOOL IsMapping)
Definition: freetype.c:232
#define SYNCHRONIZE
Definition: nt_native.h:61
#define TAG_USTR
Definition: libsupp.c:111
Status
Definition: gdiplustypes.h:24
ULONG_PTR SIZE_T
Definition: typedefs.h:78
struct _FileName FileName
Definition: fatprocs.h:884
static void SharedMem_Release(PSHARED_MEM Ptr)
Definition: freetype.c:289
unsigned short USHORT
Definition: pedump.c:61
NTSYSAPI NTSTATUS NTAPI RtlAppendUnicodeStringToString(PUNICODE_STRING Destination, PUNICODE_STRING Source)
#define PAGE_READONLY
Definition: compat.h:127
static UNICODE_STRING g_FontRegPath
Definition: freetype.c:57
#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
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define OBJ_KERNEL_HANDLE
Definition: winternl.h:231
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
_In_ NDIS_STATUS _In_ ULONG _In_ USHORT _In_opt_ PVOID _In_ ULONG DataSize
Definition: ndis.h:4751
static INT FASTCALL IntGdiLoadFontsFromMemory(PGDI_LOAD_FONT pLoadFont, PSHARED_FACE SharedFace, FT_Long FontIndex, INT CharSetIndex)
Definition: freetype.c:1046
LONGLONG QuadPart
Definition: typedefs.h:112
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14
#define REG_SZ
Definition: layer.c:22

Referenced by IntLoadSystemFonts(), and NtGdiAddFontResourceW().

◆ IntGdiCleanupPrivateFontsForProcess()

VOID FASTCALL IntGdiCleanupPrivateFontsForProcess ( VOID  )

Definition at line 1631 of file freetype.c.

1632 {
1635  PFONT_ENTRY_COLL_MEM EntryCollection;
1636 
1637  DPRINT("IntGdiCleanupPrivateFontsForProcess()\n");
1638  do {
1639  Entry = NULL;
1640  EntryCollection = NULL;
1641 
1642  IntLockProcessPrivateFonts(Win32Process);
1643  if (!IsListEmpty(&Win32Process->PrivateMemFontListHead))
1644  {
1645  Entry = Win32Process->PrivateMemFontListHead.Flink;
1646  EntryCollection = CONTAINING_RECORD(Entry, FONT_ENTRY_COLL_MEM, ListEntry);
1647  UnlinkFontMemCollection(EntryCollection);
1648  }
1649  IntUnLockProcessPrivateFonts(Win32Process);
1650 
1651  if (EntryCollection)
1652  {
1653  IntGdiCleanupMemEntry(EntryCollection->Entry);
1654  ExFreePoolWithTag(EntryCollection, TAG_FONT);
1655  }
1656  else
1657  {
1658  /* No Mem fonts anymore, see if we have any other private fonts left */
1659  Entry = NULL;
1660  IntLockProcessPrivateFonts(Win32Process);
1661  if (!IsListEmpty(&Win32Process->PrivateFontListHead))
1662  {
1663  Entry = RemoveHeadList(&Win32Process->PrivateFontListHead);
1664  }
1665  IntUnLockProcessPrivateFonts(Win32Process);
1666 
1667  if (Entry)
1668  {
1670  }
1671  }
1672 
1673  } while (Entry);
1674 }
#define IntUnLockProcessPrivateFonts(W32Process)
Definition: text.h:143
struct _Entry Entry
Definition: kefuncs.h:640
#define TAG_FONT
Definition: tags.h:12
VOID FASTCALL IntGdiCleanupMemEntry(PFONT_ENTRY_MEM Head)
Definition: freetype.c:1561
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
FONT_ENTRY_MEM * Entry
Definition: font.h:23
smooth NULL
Definition: ftsmooth.c:416
FORCEINLINE PLIST_ENTRY RemoveHeadList(_Inout_ PLIST_ENTRY ListHead)
Definition: rtlfuncs.h:128
void DPRINT(...)
Definition: polytest.cpp:61
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
LIST_ENTRY PrivateMemFontListHead
Definition: win32.h:276
static VOID FASTCALL CleanupFontEntry(PFONT_ENTRY FontEntry)
Definition: freetype.c:1547
Definition: typedefs.h:117
static VOID FASTCALL UnlinkFontMemCollection(PFONT_ENTRY_COLL_MEM Collection)
Definition: freetype.c:1580
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:140
LIST_ENTRY PrivateFontListHead
Definition: win32.h:275

Referenced by GdiProcessDestroy().

◆ IntGdiGetFontResourceInfo()

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

Definition at line 5074 of file freetype.c.

5079 {
5080  UNICODE_STRING EntryFileName;
5081  POBJECT_NAME_INFORMATION NameInfo1 = NULL, NameInfo2 = NULL;
5082  PLIST_ENTRY ListEntry;
5083  PFONT_ENTRY FontEntry;
5084  ULONG Size, i, Count;
5085  LPBYTE pbBuffer;
5086  BOOL IsEqual;
5087  FONTFAMILYINFO *FamInfo;
5088  const ULONG MaxFamInfo = 64;
5089  const ULONG MAX_FAM_INFO_BYTES = sizeof(FONTFAMILYINFO) * MaxFamInfo;
5090  BOOL bSuccess;
5091  const ULONG NAMEINFO_SIZE = sizeof(OBJECT_NAME_INFORMATION) + MAX_PATH * sizeof(WCHAR);
5092 
5093  DPRINT("IntGdiGetFontResourceInfo: dwType == %lu\n", dwType);
5094 
5095  do
5096  {
5097  /* Create buffer for full path name */
5098  NameInfo1 = ExAllocatePoolWithTag(PagedPool, NAMEINFO_SIZE, TAG_FINF);
5099  if (!NameInfo1)
5100  break;
5101 
5102  /* Get the full path name */
5103  if (!IntGetFullFileName(NameInfo1, NAMEINFO_SIZE, FileName))
5104  break;
5105 
5106  /* Create a buffer for the entries' names */
5107  NameInfo2 = ExAllocatePoolWithTag(PagedPool, NAMEINFO_SIZE, TAG_FINF);
5108  if (!NameInfo2)
5109  break;
5110 
5111  FamInfo = ExAllocatePoolWithTag(PagedPool, MAX_FAM_INFO_BYTES, TAG_FINF);
5112  } while (0);
5113 
5114  if (!NameInfo1 || !NameInfo2 || !FamInfo)
5115  {
5116  if (NameInfo2)
5117  ExFreePoolWithTag(NameInfo2, TAG_FINF);
5118 
5119  if (NameInfo1)
5120  ExFreePoolWithTag(NameInfo1, TAG_FINF);
5121 
5123  return FALSE;
5124  }
5125 
5126  Count = 0;
5127 
5128  /* Try to find the pathname in the global font list */
5130  for (ListEntry = g_FontListHead.Flink; ListEntry != &g_FontListHead;
5131  ListEntry = ListEntry->Flink)
5132  {
5133  FontEntry = CONTAINING_RECORD(ListEntry, FONT_ENTRY, ListEntry);
5134  if (FontEntry->Font->Filename == NULL)
5135  continue;
5136 
5137  RtlInitUnicodeString(&EntryFileName , FontEntry->Font->Filename);
5138  if (!IntGetFullFileName(NameInfo2, NAMEINFO_SIZE, &EntryFileName))
5139  continue;
5140 
5141  if (!RtlEqualUnicodeString(&NameInfo1->Name, &NameInfo2->Name, FALSE))
5142  continue;
5143 
5144  IsEqual = FALSE;
5145  FontFamilyFillInfo(&FamInfo[Count], FontEntry->FaceName.Buffer,
5146  NULL, FontEntry->Font);
5147  for (i = 0; i < Count; ++i)
5148  {
5149  if (EqualFamilyInfo(&FamInfo[i], &FamInfo[Count]))
5150  {
5151  IsEqual = TRUE;
5152  break;
5153  }
5154  }
5155  if (!IsEqual)
5156  {
5157  /* Found */
5158  ++Count;
5159  if (Count >= MaxFamInfo)
5160  break;
5161  }
5162  }
5164 
5165  /* Free the buffers */
5166  ExFreePoolWithTag(NameInfo1, TAG_FINF);
5167  ExFreePoolWithTag(NameInfo2, TAG_FINF);
5168 
5169  if (Count == 0 && dwType != 5)
5170  {
5171  /* Font could not be found in system table
5172  dwType == 5 will still handle this */
5173  ExFreePoolWithTag(FamInfo, TAG_FINF);
5174  return FALSE;
5175  }
5176 
5177  bSuccess = FALSE;
5178  switch (dwType)
5179  {
5180  case 0: /* FIXME: Returns 1 or 2, don't know what this is atm */
5181  Size = sizeof(DWORD);
5182  if (*pdwBytes == 0)
5183  {
5184  *pdwBytes = Size;
5185  bSuccess = TRUE;
5186  }
5187  else if (pBuffer)
5188  {
5189  if (*pdwBytes >= Size)
5190  {
5191  *(DWORD*)pBuffer = Count;
5192  }
5193  *pdwBytes = Size;
5194  bSuccess = TRUE;
5195  }
5196  break;
5197 
5198  case 1: /* copy the font title */
5199  /* calculate the required size */
5200  Size = 0;
5201  for (i = 0; i < Count; ++i)
5202  {
5203  if (i > 0)
5204  Size += 3; /* " & " */
5205  Size += wcslen(FamInfo[i].EnumLogFontEx.elfLogFont.lfFaceName);
5206  if (FamInfo[i].EnumLogFontEx.elfStyle[0] &&
5207  _wcsicmp(FamInfo[i].EnumLogFontEx.elfStyle, L"Regular") != 0)
5208  {
5209  Size += 1 + wcslen(FamInfo[i].EnumLogFontEx.elfStyle);
5210  }
5211  }
5212  Size += 2; /* "\0\0" */
5213  Size *= sizeof(WCHAR);
5214 
5215  if (*pdwBytes == 0)
5216  {
5217  *pdwBytes = Size;
5218  bSuccess = TRUE;
5219  }
5220  else if (pBuffer)
5221  {
5222  if (*pdwBytes >= Size)
5223  {
5224  /* store font title to buffer */
5225  WCHAR *psz = pBuffer;
5226  *psz = 0;
5227  for (i = 0; i < Count; ++i)
5228  {
5229  if (i > 0)
5230  wcscat(psz, L" & ");
5231  IntAddNameFromFamInfo(psz, &FamInfo[i]);
5232  }
5233  psz[wcslen(psz) + 1] = UNICODE_NULL;
5234  *pdwBytes = Size;
5235  bSuccess = TRUE;
5236  }
5237  else
5238  {
5239  *pdwBytes = 1024; /* this is confirmed value */
5240  }
5241  }
5242  break;
5243 
5244  case 2: /* Copy an array of LOGFONTW */
5245  Size = Count * sizeof(LOGFONTW);
5246  if (*pdwBytes == 0)
5247  {
5248  *pdwBytes = Size;
5249  bSuccess = TRUE;
5250  }
5251  else if (pBuffer)
5252  {
5253  if (*pdwBytes >= Size)
5254  {
5255  pbBuffer = (LPBYTE)pBuffer;
5256  for (i = 0; i < Count; ++i)
5257  {
5258  FamInfo[i].EnumLogFontEx.elfLogFont.lfWidth = 0;
5259  RtlCopyMemory(pbBuffer, &FamInfo[i].EnumLogFontEx.elfLogFont, sizeof(LOGFONTW));
5260  pbBuffer += sizeof(LOGFONTW);
5261  }
5262  }
5263  *pdwBytes = Size;
5264  bSuccess = TRUE;
5265  }
5266  else
5267  {
5268  *pdwBytes = 1024; /* this is confirmed value */
5269  }
5270  break;
5271 
5272  case 3:
5273  Size = sizeof(DWORD);
5274  if (*pdwBytes == 0)
5275  {
5276  *pdwBytes = Size;
5277  bSuccess = TRUE;
5278  }
5279  else if (pBuffer)
5280  {
5281  if (*pdwBytes >= Size)
5282  {
5283  /* FIXME: What exactly is copied here? */
5284  *(DWORD*)pBuffer = 1;
5285  }
5286  *pdwBytes = Size;
5287  bSuccess = TRUE;
5288  }
5289  break;
5290 
5291  case 4: /* full file path */
5292  if (FileName->Length >= 4 * sizeof(WCHAR))
5293  {
5294  /* The beginning of FileName is \??\ */
5295  LPWSTR pch = FileName->Buffer + 4;
5296  DWORD Length = FileName->Length - 4 * sizeof(WCHAR);
5297 
5298  Size = Length + sizeof(WCHAR);
5299  if (*pdwBytes == 0)
5300  {
5301  *pdwBytes = Size;
5302  bSuccess = TRUE;
5303  }
5304  else if (pBuffer)
5305  {
5306  if (*pdwBytes >= Size)
5307  {
5309  }
5310  *pdwBytes = Size;
5311  bSuccess = TRUE;
5312  }
5313  }
5314  break;
5315 
5316  case 5: /* Looks like a BOOL that is copied, TRUE, if the font was not found */
5317  Size = sizeof(BOOL);
5318  if (*pdwBytes == 0)
5319  {
5320  *pdwBytes = Size;
5321  bSuccess = TRUE;
5322  }
5323  else if (pBuffer)
5324  {
5325  if (*pdwBytes >= Size)
5326  {
5327  *(BOOL*)pBuffer = Count == 0;
5328  }
5329  *pdwBytes = Size;
5330  bSuccess = TRUE;
5331  }
5332  break;
5333  }
5334  ExFreePoolWithTag(FamInfo, TAG_FINF);
5335 
5336  return bSuccess;
5337 }
static LIST_ENTRY g_FontListHead
Definition: freetype.c:65
#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:5040
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:4997
#define BOOL
Definition: nt_native.h:43
#define DWORD
Definition: nt_native.h:44
static BOOLEAN bSuccess
Definition: drive.cpp:417
#define IntUnLockGlobalFonts()
Definition: freetype.c:72
#define pch(ap)
Definition: match.c:418
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned char * LPBYTE
Definition: typedefs.h:52
#define UNICODE_NULL
unsigned int BOOL
Definition: ntddk_ex.h:94
LPWSTR Filename
Definition: engobjects.h:148
struct _OBJECT_NAME_INFORMATION OBJECT_NAME_INFORMATION
LONG lfWidth
Definition: dimm.idl:60
smooth NULL
Definition: ftsmooth.c:416
PVOID pBuffer
static VOID IntAddNameFromFamInfo(LPWSTR psz, FONTFAMILYINFO *FamInfo)
Definition: freetype.c:5061
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:2529
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
__wchar_t WCHAR
Definition: xmlstorage.h:180
struct tagLOGFONTW LOGFONTW
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
static PWSTR PDWORD pdwBytes
Definition: layerapi.c:34
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
static const WCHAR L[]
Definition: oid.c:1250
Definition: typedefs.h:117
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
#define IntLockGlobalFonts()
Definition: freetype.c:69
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:2680
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 1597 of file freetype.c.

1598 {
1600  PFONT_ENTRY_COLL_MEM CurrentEntry;
1601  PFONT_ENTRY_COLL_MEM EntryCollection = NULL;
1603 
1604  IntLockProcessPrivateFonts(Win32Process);
1605  for (Entry = Win32Process->PrivateMemFontListHead.Flink;
1606  Entry != &Win32Process->PrivateMemFontListHead;
1607  Entry = Entry->Flink)
1608  {
1609  CurrentEntry = CONTAINING_RECORD(Entry, FONT_ENTRY_COLL_MEM, ListEntry);
1610 
1611  if (CurrentEntry->Handle == hMMFont)
1612  {
1613  EntryCollection = CurrentEntry;
1614  UnlinkFontMemCollection(CurrentEntry);
1615  break;
1616  }
1617  }
1618  IntUnLockProcessPrivateFonts(Win32Process);
1619 
1620  if (EntryCollection)
1621  {
1622  IntGdiCleanupMemEntry(EntryCollection->Entry);
1623  ExFreePoolWithTag(EntryCollection, TAG_FONT);
1624  return TRUE;
1625  }
1626  return FALSE;
1627 }
#define TRUE
Definition: types.h:120
#define IntUnLockProcessPrivateFonts(W32Process)
Definition: text.h:143
struct _Entry Entry
Definition: kefuncs.h:640
#define TAG_FONT
Definition: tags.h:12
VOID FASTCALL IntGdiCleanupMemEntry(PFONT_ENTRY_MEM Head)
Definition: freetype.c:1561
FONT_ENTRY_MEM * Entry
Definition: font.h:23
smooth NULL
Definition: ftsmooth.c:416
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
HANDLE Handle
Definition: font.h:22
LIST_ENTRY PrivateMemFontListHead
Definition: win32.h:276
Definition: typedefs.h:117
static VOID FASTCALL UnlinkFontMemCollection(PFONT_ENTRY_COLL_MEM Collection)
Definition: freetype.c:1580
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:140

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:364
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:327
smooth NULL
Definition: ftsmooth.c:416
LONG cx
Definition: windef.h:319
Definition: polytest.cpp:40
__wchar_t WCHAR
Definition: xmlstorage.h:180
HDC hdc
Definition: main.c:9
BOOL FASTCALL ftGdiGetTextMetricsW(HDC hDC, PTMW_INTERNAL ptmwi)
Definition: freetype.c:4225
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:2361
BOOL FASTCALL TextIntGetTextExtentPoint(PDC dc, PTEXTOBJ TextObj, LPCWSTR String, INT Count, ULONG MaxExtent, LPINT Fit, LPINT Dx, LPSIZE Size, FLONG fl)
Definition: freetype.c:3904

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:1521
#define GCP_GLYPHSHAPE
Definition: wingdi.h:832
FLONG flTextAlign
Definition: ntgdihdl.h:321
#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:4044
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 2152 of file freetype.c.

2155 {
2156  TT_OS2 *pOS2;
2157  TT_HoriHeader *pHori;
2158  TT_Postscript *pPost;
2159  FT_Fixed XScale, YScale;
2160  FT_WinFNT_HeaderRec WinFNT;
2161  FT_Error Error;
2162  BYTE *pb;
2163  FONT_NAMES FontNames;
2164  PSHARED_FACE SharedFace = FontGDI->SharedFace;
2166  FT_Face Face = SharedFace->Face;
2167 
2169  {
2170  Cache = &SharedFace->EnglishUS;
2171  }
2172  else
2173  {
2174  Cache = &SharedFace->UserLanguage;
2175  }
2176 
2177  if (Cache->OutlineRequiredSize && Size < Cache->OutlineRequiredSize)
2178  {
2179  return Cache->OutlineRequiredSize;
2180  }
2181 
2182  IntInitFontNames(&FontNames, SharedFace);
2183 
2184  if (!Cache->OutlineRequiredSize)
2185  {
2186  Cache->OutlineRequiredSize = FontNames.OtmSize;
2187  }
2188 
2189  if (Size < Cache->OutlineRequiredSize)
2190  {
2191  IntFreeFontNames(&FontNames);
2192  return Cache->OutlineRequiredSize;
2193  }
2194 
2195  XScale = Face->size->metrics.x_scale;
2196  YScale = Face->size->metrics.y_scale;
2197 
2198  IntLockFreeType();
2199 
2200  pOS2 = FT_Get_Sfnt_Table(Face, FT_SFNT_OS2);
2201  if (NULL == pOS2)
2202  {
2204  DPRINT1("Can't find OS/2 table - not TT font?\n");
2205  IntFreeFontNames(&FontNames);
2206  return 0;
2207  }
2208 
2209  pHori = FT_Get_Sfnt_Table(Face, FT_SFNT_HHEA);
2210  if (NULL == pHori)
2211  {
2213  DPRINT1("Can't find HHEA table - not TT font?\n");
2214  IntFreeFontNames(&FontNames);
2215  return 0;
2216  }
2217 
2218  pPost = FT_Get_Sfnt_Table(Face, FT_SFNT_POST); /* We can live with this failing */
2219 
2220  Error = FT_Get_WinFNT_Header(Face, &WinFNT);
2221 
2222  Otm->otmSize = Cache->OutlineRequiredSize;
2223 
2224  FillTM(&Otm->otmTextMetrics, FontGDI, pOS2, pHori, !Error ? &WinFNT : 0);
2225 
2226  Otm->otmFiller = 0;
2227  RtlCopyMemory(&Otm->otmPanoseNumber, pOS2->panose, PANOSE_COUNT);
2228  Otm->otmfsSelection = pOS2->fsSelection;
2229  Otm->otmfsType = pOS2->fsType;
2230  Otm->otmsCharSlopeRise = pHori->caret_Slope_Rise;
2231  Otm->otmsCharSlopeRun = pHori->caret_Slope_Run;
2232  Otm->otmItalicAngle = 0; /* POST table */
2233  Otm->otmEMSquare = Face->units_per_EM;
2234 
2235 #define SCALE_X(value) ((FT_MulFix((value), XScale) + 32) >> 6)
2236 #define SCALE_Y(value) ((FT_MulFix((value), YScale) + 32) >> 6)
2237 
2238  Otm->otmAscent = SCALE_Y(pOS2->sTypoAscender);
2239  Otm->otmDescent = SCALE_Y(pOS2->sTypoDescender);
2240  Otm->otmLineGap = SCALE_Y(pOS2->sTypoLineGap);
2241  Otm->otmsCapEmHeight = SCALE_Y(pOS2->sCapHeight);
2242  Otm->otmsXHeight = SCALE_Y(pOS2->sxHeight);
2243  Otm->otmrcFontBox.left = SCALE_X(Face->bbox.xMin);
2244  Otm->otmrcFontBox.right = SCALE_X(Face->bbox.xMax);
2245  Otm->otmrcFontBox.top = SCALE_Y(Face->bbox.yMax);
2246  Otm->otmrcFontBox.bottom = SCALE_Y(Face->bbox.yMin);
2247  Otm->otmMacAscent = Otm->otmTextMetrics.tmAscent;
2248  Otm->otmMacDescent = -Otm->otmTextMetrics.tmDescent;
2249  Otm->otmMacLineGap = Otm->otmLineGap;
2250  Otm->otmusMinimumPPEM = 0; /* TT Header */
2251  Otm->otmptSubscriptSize.x = SCALE_X(pOS2->ySubscriptXSize);
2252  Otm->otmptSubscriptSize.y = SCALE_Y(pOS2->ySubscriptYSize);
2253  Otm->otmptSubscriptOffset.x = SCALE_X(pOS2->ySubscriptXOffset);
2254  Otm->otmptSubscriptOffset.y = SCALE_Y(pOS2->ySubscriptYOffset);
2255  Otm->otmptSuperscriptSize.x = SCALE_X(pOS2->ySuperscriptXSize);
2256  Otm->otmptSuperscriptSize.y = SCALE_Y(pOS2->ySuperscriptYSize);
2257  Otm->otmptSuperscriptOffset.x = SCALE_X(pOS2->ySuperscriptXOffset);
2258  Otm->otmptSuperscriptOffset.y = SCALE_Y(pOS2->ySuperscriptYOffset);
2259  Otm->otmsStrikeoutSize = SCALE_Y(pOS2->yStrikeoutSize);
2260  Otm->otmsStrikeoutPosition = SCALE_Y(pOS2->yStrikeoutPosition);
2261 
2262  if (!pPost)
2263  {
2264  Otm->otmsUnderscoreSize = 0;
2265  Otm->otmsUnderscorePosition = 0;
2266  }
2267  else
2268  {
2269  Otm->otmsUnderscoreSize = SCALE_Y(pPost->underlineThickness);
2270  Otm->otmsUnderscorePosition = SCALE_Y(pPost->underlinePosition);
2271  }
2272 
2273 #undef SCALE_X
2274 #undef SCALE_Y
2275 
2277 
2278  pb = IntStoreFontNames(&FontNames, Otm);
2279  ASSERT(pb - (BYTE*)Otm == Cache->OutlineRequiredSize);
2280 
2281  IntFreeFontNames(&FontNames);
2282 
2283  return Cache->OutlineRequiredSize;
2284 }
SHARED_FACE_CACHE EnglishUS
Definition: engobjects.h:132
ULONG OtmSize
Definition: freetype.c:2075
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:2079
static __inline BYTE *FASTCALL IntStoreFontNames(const FONT_NAMES *Names, OUTLINETEXTMETRICW *Otm)
Definition: freetype.c:2115
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:2139
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:2058
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:81
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
#define IntLockFreeType()
Definition: freetype.c:78
FT_Size_Metrics metrics
Definition: freetype.h:1677
unsigned char BYTE
Definition: mem.h:68
SHORT gusLanguageID
Definition: main.c:29
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 1677 of file freetype.c.

1678 {
1679  return (gpsi->BitsPixel > 8) && g_RenderingEnabled;
1680 }
PSERVERINFO gpsi
Definition: main.c:27
static BOOL g_RenderingEnabled
Definition: freetype.c:67

Referenced by IntExtTextOutW(), and TextIntGetTextExtentPoint().

◆ IntLoadSystemFonts()

VOID FASTCALL IntLoadSystemFonts ( VOID  )

Definition at line 883 of file freetype.c.

884 {
886  UNICODE_STRING Directory, FileName, TempString;
888  HANDLE hDirectory;
889  BYTE *DirInfoBuffer;
891  BOOLEAN bRestartScan = TRUE;
893  INT i;
894  static UNICODE_STRING SearchPatterns[] =
895  {
896  RTL_CONSTANT_STRING(L"*.ttf"),
897  RTL_CONSTANT_STRING(L"*.ttc"),
898  RTL_CONSTANT_STRING(L"*.otf"),
899  RTL_CONSTANT_STRING(L"*.otc"),
900  RTL_CONSTANT_STRING(L"*.fon"),
901  RTL_CONSTANT_STRING(L"*.fnt")
902  };
903 
904  RtlInitUnicodeString(&Directory, L"\\SystemRoot\\Fonts\\");
905 
908  &Directory,
910  NULL,
911  NULL);
912 
913  Status = ZwOpenFile(
914  &hDirectory,
917  &Iosb,
920 
921  if (NT_SUCCESS(Status))
922  {
923  for (i = 0; i < _countof(SearchPatterns); ++i)
924  {
925  DirInfoBuffer = ExAllocatePoolWithTag(PagedPool, 0x4000, TAG_FONT);
926  if (DirInfoBuffer == NULL)
927  {
928  ZwClose(hDirectory);
929  return;
930  }
931 
933  if (FileName.Buffer == NULL)
934  {
935  ExFreePoolWithTag(DirInfoBuffer, TAG_FONT);
936  ZwClose(hDirectory);
937  return;
938  }
939  FileName.Length = 0;
940  FileName.MaximumLength = MAX_PATH * sizeof(WCHAR);
941 
942  while (1)
943  {
944  Status = ZwQueryDirectoryFile(
945  hDirectory,
946  NULL,
947  NULL,
948  NULL,
949  &Iosb,
950  DirInfoBuffer,
951  0x4000,
953  FALSE,
954  &SearchPatterns[i],
955  bRestartScan);
956 
958  {
959  break;
960  }
961 
962  DirInfo = (PFILE_DIRECTORY_INFORMATION)DirInfoBuffer;
963  while (1)
964  {
965  TempString.Buffer = DirInfo->FileName;
966  TempString.Length =
967  TempString.MaximumLength = DirInfo->FileNameLength;
971  if (DirInfo->NextEntryOffset == 0)
972  break;
973  DirInfo = (PFILE_DIRECTORY_INFORMATION)((ULONG_PTR)DirInfo + DirInfo->NextEntryOffset);
974  }
975 
976  bRestartScan = FALSE;
977  }
978 
980  ExFreePoolWithTag(DirInfoBuffer, TAG_FONT);
981  }
982  ZwClose(hDirectory);
983  }
984 }
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
#define TRUE
Definition: types.h:120
USHORT MaximumLength
Definition: env_spec_w32.h:370
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
#define FILE_DIRECTORY_FILE
Definition: constants.h:491
#define _countof(array)
Definition: fontsub.cpp:30
LONG NTSTATUS
Definition: precomp.h:26
struct _FILE_DIRECTORY_INFORMATION * PFILE_DIRECTORY_INFORMATION
#define TAG_FONT
Definition: tags.h:12
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
int32_t INT
Definition: typedefs.h:56
#define FILE_SHARE_READ
Definition: compat.h:125
NTSYSAPI VOID NTAPI RtlCopyUnicodeString(PUNICODE_STRING DestinationString, PUNICODE_STRING SourceString)
uint32_t ULONG_PTR
Definition: typedefs.h:63
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
#define FILE_LIST_DIRECTORY
Definition: nt_native.h:629
__wchar_t WCHAR
Definition: xmlstorage.h:180
return Iosb
Definition: create.c:4426
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_NO_MORE_FILES
Definition: udferr_usr.h:128
#define MAX_PATH
Definition: compat.h:26
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
NTSYSAPI NTSTATUS NTAPI ZwOpenFile(_Out_ PHANDLE FileHandle, _In_ ACCESS_MASK DesiredAccess, _In_ POBJECT_ATTRIBUTES ObjectAttributes, _Out_ PIO_STATUS_BLOCK IoStatusBlock, _In_ ULONG ShareAccess, _In_ ULONG OpenOptions)
#define FILE_SHARE_DELETE
Definition: nt_native.h:682
static const WCHAR L[]
Definition: oid.c:1250
unsigned char BYTE
Definition: mem.h:68
#define SYNCHRONIZE
Definition: nt_native.h:61
INT FASTCALL IntGdiAddFontResource(PUNICODE_STRING FileName, DWORD Characteristics)
Definition: freetype.c:1382
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)
#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:3718
WCHAR FileName[ANYSIZE_ARRAY]
Definition: winternl.h:524
#define OBJ_KERNEL_HANDLE
Definition: winternl.h:231
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14

Referenced by InitFontSupport().

◆ RealizeFontInit()

PTEXTOBJ FASTCALL RealizeFontInit ( HFONT  )

Definition at line 422 of file font.c.

423 {
425  PTEXTOBJ pTextObj;
426 
427  pTextObj = TEXTOBJ_LockText(hFont);
428 
429  if ( pTextObj && !(pTextObj->fl & TEXTOBJECT_INIT))
430  {
431  Status = TextIntRealizeFont(hFont, pTextObj);
432  if (!NT_SUCCESS(Status))
433  {
434  TEXTOBJ_UnlockText(pTextObj);
435  return NULL;
436  }
437  }
438  return pTextObj;
439 }
FORCEINLINE VOID TEXTOBJ_UnlockText(PLFONT plfnt)
Definition: text.h:96
LONG NTSTATUS
Definition: precomp.h:26
FORCEINLINE PTEXTOBJ TEXTOBJ_LockText(HFONT hfont)
Definition: text.h:83
#define TEXTOBJECT_INIT
Definition: text.h:56
HFONT hFont
Definition: main.c:53
NTSTATUS FASTCALL TextIntRealizeFont(HFONT FontHandle, PTEXTOBJ pTextObj)
Definition: freetype.c:4875
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:2745

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

1712 {
1713  PLFONT plfont;
1714  LOGFONTW *plf;
1715 
1716  ASSERT(lf);
1717  plfont = LFONT_AllocFontWithHandle();
1718  if (!plfont)
1719  {
1720  return STATUS_NO_MEMORY;
1721  }
1722 
1723  ExInitializePushLock(&plfont->lock);
1724  *NewFont = plfont->BaseObject.hHmgr;
1725  plf = &plfont->logfont.elfEnumLogfontEx.elfLogFont;
1726  RtlCopyMemory(plf, lf, sizeof(LOGFONTW));
1727  if (lf->lfEscapement != lf->lfOrientation)
1728  {
1729  /* This should really depend on whether GM_ADVANCED is set */
1730  plf->lfOrientation = plf->lfEscapement;
1731  }
1732  LFONT_UnlockFont(plfont);
1733 
1734  return STATUS_SUCCESS;
1735 }
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:2680
ENUMLOGFONTEXW elfEnumLogfontEx
Definition: wingdi.h:2757
return STATUS_SUCCESS
Definition: btrfs.c:2745

Referenced by CreateStockFonts(), and UserDrawCaptionText().

◆ TextIntGetTextExtentPoint()

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

Definition at line 3904 of file freetype.c.

3913 {
3914  PFONTGDI FontGDI;
3915  FT_Face face;
3916  FT_GlyphSlot glyph;
3917  FT_BitmapGlyph realglyph;
3918  INT error, glyph_index, i, previous;
3919  ULONGLONG TotalWidth64 = 0;
3920  BOOL use_kerning;
3921  FT_Render_Mode RenderMode;
3922  BOOLEAN Render;
3923  PMATRIX pmxWorldToDevice;
3924  LOGFONTW *plf;
3925  BOOL EmuBold, EmuItalic;
3926  LONG ascender, descender;
3927 
3928  FontGDI = ObjToGDI(TextObj->Font, FONT);
3929 
3930  face = FontGDI->SharedFace->Face;
3931  if (NULL != Fit)
3932  {
3933  *Fit = 0;
3934  }
3935 
3936  IntLockFreeType();
3937 
3938  TextIntUpdateSize(dc, TextObj, FontGDI, FALSE);
3939 
3940  plf = &TextObj->logfont.elfEnumLogfontEx.elfLogFont;
3941  EmuBold = (plf->lfWeight >= FW_BOLD && FontGDI->OriginalWeight <= FW_NORMAL);
3942  EmuItalic = (plf->lfItalic && !FontGDI->OriginalItalic);
3943 
3944  Render = IntIsFontRenderingEnabled();
3945  if (Render)
3946  RenderMode = IntGetFontRenderMode(plf);
3947  else
3948  RenderMode = FT_RENDER_MODE_MONO;
3949 
3950  /* Get the DC's world-to-device transformation matrix */
3951  pmxWorldToDevice = DC_pmxWorldToDevice(dc);
3952  FtSetCoordinateTransform(face, pmxWorldToDevice);
3953 
3954  use_kerning = FT_HAS_KERNING(face);
3955  previous = 0;
3956 
3957  for (i = 0; i < Count; i++)
3958  {
3959  glyph_index = get_glyph_index_flagged(face, *String, GTEF_INDICES, fl);
3960 
3961  if (EmuBold || EmuItalic)
3962  realglyph = NULL;
3963  else
3964  realglyph = ftGdiGlyphCacheGet(face, glyph_index, plf->lfHeight,
3965  RenderMode, pmxWorldToDevice);
3966 
3967  if (EmuBold || EmuItalic || !realglyph)
3968  {
3969  error = FT_Load_Glyph(face, glyph_index, FT_LOAD_DEFAULT);
3970  if (error)
3971  {
3972  DPRINT1("WARNING: Failed to load and render glyph! [index: %d]\n", glyph_index);
3973  break;
3974  }
3975 
3976  glyph = face->glyph;
3977  if (EmuBold || EmuItalic)
3978  {
3979  if (EmuBold)
3980  FT_GlyphSlot_Embolden(glyph);
3981  if (EmuItalic)
3982  FT_GlyphSlot_Oblique(glyph);
3983  realglyph = ftGdiGlyphSet(face, glyph, RenderMode);
3984  }
3985  else
3986  {
3987  realglyph = ftGdiGlyphCacheSet(face,
3988  glyph_index,
3989  plf->lfHeight,
3990  pmxWorldToDevice,
3991  glyph,
3992  RenderMode);
3993  }
3994 
3995  if (!realglyph)
3996  {
3997  DPRINT1("Failed to render glyph! [index: %d]\n", glyph_index);
3998  break;
3999  }
4000  }
4001 
4002  /* Retrieve kerning distance */
4003  if (use_kerning && previous && glyph_index)
4004  {
4005  FT_Vector delta;
4006  FT_Get_Kerning(face, previous, glyph_index, 0, &delta);
4007  TotalWidth64 += delta.x;
4008  }
4009 
4010  TotalWidth64 += realglyph->root.advance.x >> 10;
4011 
4012  if (((TotalWidth64 + 32) >> 6) <= MaxExtent && NULL != Fit)
4013  {
4014  *Fit = i + 1;
4015  }
4016  if (NULL != Dx)
4017  {
4018  Dx[i] = (TotalWidth64 + 32) >> 6;
4019  }
4020 
4021  /* Bold and italic do not use the cache */
4022  if (EmuBold || EmuItalic)
4023  {
4024  FT_Done_Glyph((FT_Glyph)realglyph);
4025  }
4026 
4027  previous = glyph_index;
4028  String++;
4029  }
4030  ASSERT(FontGDI->Magic == FONTGDI_MAGIC);
4031  ascender = FontGDI->tmAscent; /* Units above baseline */
4032  descender = FontGDI->tmDescent; /* Units below baseline */
4034 
4035  Size->cx = (TotalWidth64 + 32) >> 6;
4036  Size->cy = ascender + descender;
4037 
4038  return TRUE;
4039 }
FT_Get_Kerning(FT_Face face, FT_UInt left_glyph, FT_UInt right_glyph, FT_UInt kern_mode, FT_Vector *akerning)
Definition: ftobjs.c:3347
LONG tmAscent
Definition: engobjects.h:159
#define TRUE
Definition: types.h:120
#define error(str)
Definition: mkdosfs.c:1605
FT_Pos x
Definition: ftimage.h:76
enum FT_Render_Mode_ FT_Render_Mode
LONG lfHeight
Definition: dimm.idl:59
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1015
HDC dc
Definition: cylfrac.c:34
static WCHAR String[]
Definition: stringtable.c:55
WORD face[3]
Definition: mesh.c:4747
#define FT_LOAD_DEFAULT
Definition: freetype.h:3008
int32_t INT
Definition: typedefs.h:56
#define FT_HAS_KERNING(face)
Definition: freetype.h:1297
FT_BitmapGlyph APIENTRY ftGdiGlyphSet(FT_Face Face, FT_GlyphSlot GlyphSlot, FT_Render_Mode RenderMode)
Definition: freetype.c:2902
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:3328
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
FT_Load_Glyph(FT_Face face, FT_UInt glyph_index, FT_Int32 load_flags)
Definition: ftobjs.c:760
FT_BEGIN_HEADER FT_GlyphSlot_Embolden(FT_GlyphSlot slot)
Definition: ftsynth.c:90
BYTE OriginalItalic
Definition: engobjects.h:153
unsigned char BOOLEAN
FT_GlyphSlot_Oblique(FT_GlyphSlot slot)
Definition: ftsynth.c:48
smooth NULL
Definition: ftsmooth.c:416
FT_GlyphRec root
Definition: ftglyph.h:162
uint64_t ULONGLONG
Definition: typedefs.h:65
LONG OriginalWeight
Definition: engobjects.h:154
#define IntUnLockFreeType()
Definition: freetype.c:81
FT_Face Face
Definition: engobjects.h:129
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
BOOL FASTCALL IntIsFontRenderingEnabled(VOID)
Definition: freetype.c:1677
#define IntLockFreeType()
Definition: freetype.c:78
static FT_UInt FASTCALL get_glyph_index_flagged(FT_Face face, FT_ULong code, DWORD indexed_flag, DWORD flags)
Definition: freetype.c:3430
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
#define FW_BOLD
Definition: wingdi.h:377
FT_BitmapGlyph APIENTRY ftGdiGlyphCacheSet(FT_Face Face, INT GlyphIndex, INT Height, PMATRIX pmx, FT_GlyphSlot GlyphSlot, FT_Render_Mode RenderMode)
Definition: freetype.c:2943
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:2865
#define FW_NORMAL
Definition: wingdi.h:372
#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:1689
#define FONTGDI_MAGIC
Definition: engobjects.h:167
#define ObjToGDI(ClipObj, Type)
Definition: engobjects.h:180
FORCEINLINE PMATRIX DC_pmxWorldToDevice(PDC pdc)
Definition: coord.h:98
LONG lfWeight
Definition: dimm.idl:63
FORCEINLINE VOID FASTCALL FtSetCoordinateTransform(FT_Face face, PMATRIX pmx)
Definition: freetype.c:755
FT_Done_Glyph(FT_Glyph glyph)
Definition: ftglyph.c:633
#define GTEF_INDICES
Definition: ntgdityp.h:210
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 4875 of file freetype.c.

4876 {
4878  PTEXTOBJ TextObj;
4879  PPROCESSINFO Win32Process;
4880  ULONG MatchPenalty;
4881  LOGFONTW *pLogFont;
4882  LOGFONTW SubstitutedLogFont;
4883  FT_Face Face;
4884 
4885  if (!pTextObj)
4886  {
4887  TextObj = TEXTOBJ_LockText(FontHandle);
4888  if (NULL == TextObj)
4889  {
4890  return STATUS_INVALID_HANDLE;
4891  }
4892 
4893  if (TextObj->fl & TEXTOBJECT_INIT)
4894  {
4895  TEXTOBJ_UnlockText(TextObj);
4896  return STATUS_SUCCESS;
4897  }
4898  }
4899  else
4900  {
4901  TextObj = pTextObj;
4902  }
4903 
4904  pLogFont = &TextObj->logfont.elfEnumLogfontEx.elfLogFont;
4905 
4906  /* substitute */
4907  SubstitutedLogFont = *pLogFont;
4908  DPRINT("Font '%S,%u' is substituted by: ", pLogFont->lfFaceName, pLogFont->lfCharSet);
4909  SubstituteFontRecurse(&SubstitutedLogFont);
4910  DPRINT("'%S,%u'.\n", SubstitutedLogFont.lfFaceName, SubstitutedLogFont.lfCharSet);
4911 
4912  MatchPenalty = 0xFFFFFFFF;
4913  TextObj->Font = NULL;
4914 
4915  Win32Process = PsGetCurrentProcessWin32Process();
4916 
4917  /* Search private fonts */
4918  IntLockProcessPrivateFonts(Win32Process);
4919  FindBestFontFromList(&TextObj->Font, &MatchPenalty, &SubstitutedLogFont,
4920  &Win32Process->PrivateFontListHead);
4921  IntUnLockProcessPrivateFonts(Win32Process);
4922 
4923  /* Search system fonts */
4925  FindBestFontFromList(&TextObj->Font, &MatchPenalty, &SubstitutedLogFont,
4926  &g_FontListHead);
4928 
4929  if (NULL == TextObj->Font)
4930  {
4931  DPRINT1("Request font %S not found, no fonts loaded at all\n",
4932  pLogFont->lfFaceName);
4934  }
4935  else
4936  {
4938  PFONTGDI FontGdi = ObjToGDI(TextObj->Font, FONT);
4939  PSHARED_FACE SharedFace = FontGdi->SharedFace;
4940 
4941  IntLockFreeType();
4942  IntRequestFontSize(NULL, FontGdi, pLogFont->lfWidth, pLogFont->lfHeight);
4944 
4945  TextObj->TextFace[0] = UNICODE_NULL;
4946  if (MatchFontNames(SharedFace, SubstitutedLogFont.lfFaceName))
4947  {
4948  RtlStringCchCopyW(TextObj->TextFace, _countof(TextObj->TextFace), pLogFont->lfFaceName);
4949  }
4950  else
4951  {
4954  if (NT_SUCCESS(Status))
4955  {
4956  /* truncated copy */
4957  IntUnicodeStringToBuffer(TextObj->TextFace, sizeof(TextObj->TextFace), &Name);
4959  }
4960  }
4961 
4962  // Need hdev, when freetype is loaded need to create DEVOBJ for
4963  // Consumer and Producer.
4964  TextObj->Font->iUniq = 1; // Now it can be cached.
4965  IntFontType(FontGdi);
4966  FontGdi->flType = TextObj->Font->flFontType;
4967  FontGdi->RequestUnderline = pLogFont->lfUnderline ? 0xFF : 0;
4968  FontGdi->RequestStrikeOut = pLogFont->lfStrikeOut ? 0xFF : 0;
4969  FontGdi->RequestItalic = pLogFont->lfItalic ? 0xFF : 0;
4970  if (pLogFont->lfWeight != FW_DONTCARE)
4971  FontGdi->RequestWeight = pLogFont->lfWeight;
4972  else
4973  FontGdi->RequestWeight = FW_NORMAL;
4974 
4975  Face = FontGdi->SharedFace->Face;
4976 
4977  //FontGdi->OriginalWeight = WeightFromStyle(Face->style_name);
4978 
4979  if (!FontGdi->OriginalItalic)
4980  FontGdi->OriginalItalic = ItalicFromStyle(Face->style_name);
4981 
4982  TextObj->fl |= TEXTOBJECT_INIT;
4984  }
4985 
4986  if (!pTextObj) TEXTOBJ_UnlockText(TextObj);
4987 
4988  ASSERT((NT_SUCCESS(Status) ^ (NULL == TextObj->Font)) != 0);
4989 
4990  return Status;
4991 }
static LIST_ENTRY g_FontListHead
Definition: freetype.c:65
#define IntUnLockProcessPrivateFonts(W32Process)
Definition: text.h:143
static NTSTATUS IntGetFontLocalizedName(PUNICODE_STRING pNameW, PSHARED_FACE SharedFace, FT_UShort NameID, FT_UShort LangID)
Definition: freetype.c:2369
FORCEINLINE VOID TEXTOBJ_UnlockText(PLFONT plfnt)
Definition: text.h:96
#define _countof(array)
Definition: fontsub.cpp:30
LONG lfHeight
Definition: dimm.idl:59
LONG NTSTATUS
Definition: precomp.h:26
BYTE lfCharSet
Definition: dimm.idl:67
FORCEINLINE PTEXTOBJ TEXTOBJ_LockText(HFONT hfont)
Definition: text.h:83
static VOID IntUnicodeStringToBuffer(LPWSTR pszBuffer, USHORT cbBuffer, const UNICODE_STRING *pString)
Definition: freetype.c:829
#define TEXTOBJECT_INIT
Definition: text.h:56
#define IntUnLockGlobalFonts()
Definition: freetype.c:72
#define STATUS_INVALID_HANDLE
Definition: ntstatus.h:231
FLONG flType
Definition: engobjects.h:139
BYTE RequestStrikeOut
Definition: engobjects.h:150
#define UNICODE_NULL
Definition: text.h:59
FLONG fl
Definition: text.h:65
struct NameRec_ * Name
Definition: cdprocs.h:464
BYTE OriginalItalic
Definition: engobjects.h:153
LONG lfWidth
Definition: dimm.idl:60
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
FLONG flFontType
Definition: winddi.h:765
#define STATUS_NOT_FOUND
Definition: shellext.h:67
static FT_Error IntRequestFontSize(PDC dc, PFONTGDI FontGDI, LONG lfWidth, LONG lfHeight)
Definition: freetype.c:3212
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
static BOOL MatchFontNames(PSHARED_FACE SharedFace, LPCWSTR lfFaceName)
Definition: freetype.c:4855
#define IntUnLockFreeType()
Definition: freetype.c:81
static BOOL SubstituteFontRecurse(LOGFONTW *pLogFont)
Definition: freetype.c:844
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
FT_Face Face
Definition: engobjects.h:129
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define IntLockFreeType()
Definition: freetype.c:78
SHORT gusLanguageID
Definition: main.c:29
#define IntLockGlobalFonts()
Definition: freetype.c:69
ENUMLOGFONTEXDVW logfont
Definition: text.h:70
Status
Definition: gdiplustypes.h:24
BYTE RequestUnderline
Definition: engobjects.h:149
#define FW_DONTCARE
Definition: wingdi.h:367
FONTOBJ * Font
Definition: text.h:66
NTSTRSAFEAPI RtlStringCchCopyW(_Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest, _In_ size_t cchDest, _In_ NTSTRSAFE_PCWSTR pszSrc)
Definition: ntstrsafe.h:135
PSHARED_FACE SharedFace
Definition: engobjects.h:142
BYTE lfStrikeOut
Definition: dimm.idl:66
WCHAR TextFace[LF_FACESIZE]
Definition: text.h:67
BYTE lfItalic
Definition: dimm.idl:64
LONG RequestWeight
Definition: engobjects.h:152
PVOID NTAPI PsGetCurrentProcessWin32Process(VOID)
Definition: process.c:1183
static BYTE ItalicFromStyle(const char *style_name)
Definition: freetype.c:987
FT_String * style_name
Definition: freetype.h:1079
#define FW_NORMAL
Definition: wingdi.h:372
#define DPRINT1
Definition: precomp.h:8
static VOID FASTCALL IntFontType(PFONTGDI Font)
Definition: freetype.c:4792
ULONG iUniq
Definition: winddi.h:762
LOGFONTW elfLogFont
Definition: wingdi.h:2680
BYTE RequestItalic
Definition: engobjects.h:151
WCHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:72
unsigned int ULONG
Definition: retypes.h:1
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define ObjToGDI(ClipObj, Type)
Definition: engobjects.h:180
LONG lfWeight
Definition: dimm.idl:63
ENUMLOGFONTEXW elfEnumLogfontEx
Definition: wingdi.h:2757
#define TT_NAME_ID_FONT_FAMILY
Definition: font.c:3536
return STATUS_SUCCESS
Definition: btrfs.c:2745
BYTE lfUnderline
Definition: dimm.idl:65
static __inline VOID FindBestFontFromList(FONTOBJ **FontObj, ULONG *MatchPenalty, const LOGFONTW *LogFont, const PLIST_ENTRY Head)
Definition: freetype.c:4724
#define IntLockProcessPrivateFonts(W32Process)
Definition: text.h:140
LIST_ENTRY PrivateFontListHead
Definition: win32.h:275

Referenced by DC_hSelectFont(), DC_InitHack(), FontGetObject(), and RealizeFontInit().

◆ TextIntUpdateSize()

BOOL FASTCALL TextIntUpdateSize ( PDC  ,
PTEXTOBJ  ,
PFONTGDI  ,
BOOL   
)

Definition at line 3328 of file freetype.c.

3332 {
3333  FT_Face face;
3334  INT error, n;
3335  FT_CharMap charmap, found;
3336  LOGFONTW *plf;
3337 
3338  if (bDoLock)
3339  IntLockFreeType();
3340 
3341  face = FontGDI->SharedFace->Face;
3342  if (face->charmap == NULL)
3343  {
3344  DPRINT("WARNING: No charmap selected!\n");
3345  DPRINT("This font face has %d charmaps\n", face->num_charmaps);
3346 
3347  found = NULL;
3348  for (n = 0; n < face->num_charmaps; n++)
3349  {
3350  charmap = face->charmaps[n];
3351  if (charmap->encoding == FT_ENCODING_UNICODE)
3352  {
3353  found = charmap;
3354  break;
3355  }
3356  }
3357  if (!found)
3358  {
3359  for (n = 0; n < face->num_charmaps; n++)
3360  {
3361  charmap = face->charmaps[n];
3362  if (charmap->encoding == FT_ENCODING_MS_SYMBOL)
3363  {
3364  found = charmap;
3365  break;
3366  }
3367  }
3368  }
3369  if (!found)
3370  {
3371  DPRINT1("WARNING: Could not find desired charmap!\n");
3372  }
3373  else
3374  {
3375  DPRINT("Found charmap encoding: %i\n", found->encoding);
3376  error = FT_Set_Charmap(face, found);
3377  if (error)
3378  {
3379  DPRINT1("WARNING: Could not set the charmap!\n");
3380  }
3381  }
3382  }
3383 
3384  plf = &TextObj->logfont.elfEnumLogfontEx.elfLogFont;
3385 
3386  error = IntRequestFontSize(dc, FontGDI, plf->lfWidth, plf->lfHeight);
3387 
3388  if (bDoLock)
3390 
3391  if (error)
3392  {
3393  DPRINT1("Error in setting pixel sizes: %d\n", error);
3394  return FALSE;
3395  }
3396 
3397  return TRUE;
3398 }
#define TRUE
Definition: types.h:120
#define error(str)
Definition: mkdosfs.c:1605
LONG lfHeight
Definition: dimm.idl:59
GLdouble n
Definition: glext.h:7729
HDC dc
Definition: cylfrac.c:34
WORD face[3]
Definition: mesh.c:4747
int32_t INT
Definition: typedefs.h:56
LONG lfWidth
Definition: dimm.idl:60
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
static FT_Error IntRequestFontSize(PDC dc, PFONTGDI FontGDI, LONG lfWidth, LONG lfHeight)
Definition: freetype.c:3212
#define IntUnLockFreeType()
Definition: freetype.c:81
FT_Encoding encoding
Definition: freetype.h:843
#define IntLockFreeType()
Definition: freetype.c:78
FT_Set_Charmap(FT_Face face, FT_CharMap charmap)
Definition: ftobjs.c:3499
#define DPRINT1
Definition: precomp.h:8
GLenum GLuint GLint GLenum face
Definition: glext.h:7025

Referenced by ftGdiGetGlyphOutline(), IntExtTextOutW(), NtGdiGetOutlineTextMetricsInternalW(), and TextIntGetTextExtentPoint().

◆ TEXTOBJ_LockText()

FORCEINLINE PTEXTOBJ TEXTOBJ_LockText ( HFONT  hfont)

Definition at line 83 of file text.h.

84 {
86  if (plfnt != 0)
87  {
90  }
91  return plfnt;
92 }
FORCEINLINE VOID ExAcquirePushLockExclusive(PEX_PUSH_LOCK PushLock)
Definition: ex.h:1022
Definition: text.h:59
static HFONT hfont
#define KeEnterCriticalRegion()
Definition: ke_x.h:83
EX_PUSH_LOCK lock
Definition: text.h:71
#define LFONT_ShareLockFont(hfont)
Definition: text.h:77

Referenced by RealizeFontInit(), and TextIntRealizeFont().

◆ TEXTOBJ_UnlockText()