mirror of
https://github.com/reactos/reactos.git
synced 2025-04-25 08:00:24 +00:00
- Add IntGetCharDimensions and text metrics for win32k server info.
svn path=/trunk/; revision=38317
This commit is contained in:
parent
4349cee957
commit
9b5914abf0
3 changed files with 52 additions and 3 deletions
|
@ -106,6 +106,7 @@ 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 LPRECT,
|
||||
IN LPWSTR, IN INT, IN OPTIONAL LPINT, IN DWORD);
|
||||
DWORD FASTCALL IntGetCharDimensions(HDC, PTEXTMETRICW, PDWORD);
|
||||
|
||||
#define IntLockProcessPrivateFonts(W32Process) \
|
||||
ExEnterCriticalRegionAndAcquireFastMutexUnsafe(&W32Process->PrivateFontListLock)
|
||||
|
|
|
@ -294,6 +294,7 @@ IntGetWindowStationObject(PWINSTATION_OBJECT Object)
|
|||
BOOL FASTCALL
|
||||
co_IntInitializeDesktopGraphics(VOID)
|
||||
{
|
||||
TEXTMETRICW tmw;
|
||||
UNICODE_STRING DriverName = RTL_CONSTANT_STRING(L"DISPLAY");
|
||||
if (! IntCreatePrimarySurface())
|
||||
{
|
||||
|
@ -316,9 +317,13 @@ co_IntInitializeDesktopGraphics(VOID)
|
|||
IntGdiSetDCOwnerEx( hSystemBM, GDI_OBJ_HMGR_PUBLIC, FALSE);
|
||||
|
||||
// FIXME! Move these to a update routine.
|
||||
gpsi->Planes = NtGdiGetDeviceCaps(ScreenDeviceContext, PLANES);
|
||||
gpsi->BitsPixel = NtGdiGetDeviceCaps(ScreenDeviceContext, BITSPIXEL);
|
||||
gpsi->BitCount = gpsi->Planes * gpsi->BitsPixel;
|
||||
gpsi->Planes = NtGdiGetDeviceCaps(ScreenDeviceContext, PLANES);
|
||||
gpsi->BitsPixel = NtGdiGetDeviceCaps(ScreenDeviceContext, BITSPIXEL);
|
||||
gpsi->BitCount = gpsi->Planes * gpsi->BitsPixel;
|
||||
gpsi->dmLogPixels = NtGdiGetDeviceCaps(ScreenDeviceContext, LOGPIXELSY);
|
||||
// Font is realized and this dc was previously set to internal DC_ATTR.
|
||||
gpsi->cxSysFontChar = IntGetCharDimensions(hSystemBM, &tmw, &gpsi->cySysFontChar);
|
||||
gpsi->tmSysFont = tmw;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -54,6 +54,49 @@ FontGetObject(PTEXTOBJ TFont, INT Count, PVOID Buffer)
|
|||
return Count;
|
||||
}
|
||||
|
||||
DWORD
|
||||
FASTCALL
|
||||
IntGetCharDimensions(HDC hdc, PTEXTMETRICW ptm, PDWORD height)
|
||||
{
|
||||
PDC pdc;
|
||||
PDC_ATTR pDc_Attr;
|
||||
PTEXTOBJ TextObj;
|
||||
SIZE sz;
|
||||
TMW_INTERNAL tmwi;
|
||||
BOOL Good;
|
||||
|
||||
static const WCHAR alphabet[] = {
|
||||
'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q',
|
||||
'r','s','t','u','v','w','x','y','z','A','B','C','D','E','F','G','H',
|
||||
'I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',0};
|
||||
|
||||
if(!ftGdiGetTextMetricsW(hdc, &tmwi)) return 0;
|
||||
|
||||
pdc = DC_LockDc(hdc);
|
||||
|
||||
if (!pdc) return 0;
|
||||
|
||||
pDc_Attr = pdc->pDc_Attr;
|
||||
if(!pDc_Attr) pDc_Attr = &pdc->Dc_Attr;
|
||||
|
||||
TextObj = RealizeFontInit(pDc_Attr->hlfntNew);
|
||||
if ( !TextObj )
|
||||
{
|
||||
DC_UnlockDc(pdc);
|
||||
return 0;
|
||||
}
|
||||
Good = TextIntGetTextExtentPoint(pdc, TextObj, alphabet, 52, 0, NULL, 0, &sz);
|
||||
TEXTOBJ_UnlockText(TextObj);
|
||||
DC_UnlockDc(pdc);
|
||||
|
||||
if (!Good) return 0;
|
||||
if (ptm) *ptm = tmwi.TextMetric;
|
||||
if (height) *height = tmwi.TextMetric.tmHeight;
|
||||
|
||||
return (sz.cx / 26 + 1) / 2;
|
||||
}
|
||||
|
||||
|
||||
DWORD
|
||||
FASTCALL
|
||||
IntGetFontLanguageInfo(PDC Dc)
|
||||
|
|
Loading…
Reference in a new issue