gdi32: Implement GetCharWidthInfo().

Signed-off-by: Akihiro Sagawa <sagawa.aki@gmail.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Akihiro Sagawa 2019-04-09 10:32:59 +01:00 committed by Alexandre Julliard
parent 5698bb29a3
commit 1128587fd2
16 changed files with 87 additions and 2 deletions

View File

@ -430,6 +430,7 @@ const struct gdi_dc_funcs dib_driver =
NULL, /* pGetCharABCWidths */
NULL, /* pGetCharABCWidthsI */
NULL, /* pGetCharWidth */
NULL, /* pGetCharWidthInfo */
NULL, /* pGetDeviceCaps */
NULL, /* pGetDeviceGammaRamp */
NULL, /* pGetFontData */
@ -1052,6 +1053,7 @@ static const struct gdi_dc_funcs window_driver =
NULL, /* pGetCharABCWidths */
NULL, /* pGetCharABCWidthsI */
NULL, /* pGetCharWidth */
NULL, /* pGetCharWidthInfo */
NULL, /* pGetDeviceCaps */
NULL, /* pGetDeviceGammaRamp */
NULL, /* pGetFontData */

View File

@ -310,6 +310,11 @@ static BOOL nulldrv_GetCharWidth( PHYSDEV dev, UINT first, UINT last, INT *buffe
return FALSE;
}
static BOOL nulldrv_GetCharWidthInfo( PHYSDEV dev, void *info )
{
return FALSE;
}
static INT nulldrv_GetDeviceCaps( PHYSDEV dev, INT cap )
{
int bpp;
@ -756,6 +761,7 @@ const struct gdi_dc_funcs null_driver =
nulldrv_GetCharABCWidths, /* pGetCharABCWidths */
nulldrv_GetCharABCWidthsI, /* pGetCharABCWidthsI */
nulldrv_GetCharWidth, /* pGetCharWidth */
nulldrv_GetCharWidthInfo, /* pGetCharWidthInfo */
nulldrv_GetDeviceCaps, /* pGetDeviceCaps */
nulldrv_GetDeviceGammaRamp, /* pGetDeviceGammaRamp */
nulldrv_GetFontData, /* pGetFontData */

View File

@ -860,6 +860,7 @@ static const struct gdi_dc_funcs emfpath_driver =
NULL, /* pGetCharABCWidths */
NULL, /* pGetCharABCWidthsI */
NULL, /* pGetCharWidth */
NULL, /* pGetCharWidthInfo */
NULL, /* pGetDeviceCaps */
NULL, /* pGetDeviceGammaRamp */
NULL, /* pGetFontData */

View File

@ -73,6 +73,7 @@ static const struct gdi_dc_funcs emfdrv_driver =
NULL, /* pGetCharABCWidths */
NULL, /* pGetCharABCWidthsI */
NULL, /* pGetCharWidth */
NULL, /* pGetCharWidthInfo */
EMFDRV_GetDeviceCaps, /* pGetDeviceCaps */
NULL, /* pGetDeviceGammaRamp */
NULL, /* pGetFontData */

View File

@ -3968,3 +3968,27 @@ BOOL WINAPI GdiRealizationInfo(HDC hdc, struct realization_info *info)
return ret;
}
/*************************************************************
* GetCharWidthInfo (GDI32.@)
*
*/
BOOL WINAPI GetCharWidthInfo(HDC hdc, struct char_width_info *info)
{
PHYSDEV dev;
BOOL ret;
DC *dc;
dc = get_dc_ptr(hdc);
if (!dc) return FALSE;
dev = GET_DC_PHYSDEV( dc, pGetCharWidthInfo );
ret = dev->funcs->pGetCharWidthInfo( dev, info );
if (ret)
{
info->lsb = width_to_LP( dc, info->lsb );
info->rsb = width_to_LP( dc, info->rsb );
}
release_dc_ptr(dc);
return ret;
}

View File

@ -8417,6 +8417,40 @@ static BOOL freetype_GetCharWidth( PHYSDEV dev, UINT firstChar, UINT lastChar, L
return TRUE;
}
/*************************************************************
* freetype_GetCharWidthInfo
*/
static BOOL freetype_GetCharWidthInfo( PHYSDEV dev, void* ptr )
{
struct freetype_physdev *physdev = get_freetype_dev( dev );
struct char_width_info *info = ptr;
TT_HoriHeader *pHori;
if (!physdev->font)
{
dev = GET_NEXT_PHYSDEV( dev, pGetCharWidthInfo );
return dev->funcs->pGetCharWidthInfo( dev, ptr );
}
TRACE("%p, %p\n", physdev->font, info);
if (FT_IS_SCALABLE(physdev->font->ft_face) &&
(pHori = pFT_Get_Sfnt_Table(physdev->font->ft_face, ft_sfnt_hhea)))
{
FT_Fixed em_scale;
em_scale = MulDiv(physdev->font->ppem, 1 << 16,
physdev->font->ft_face->units_per_EM);
info->lsb = (SHORT)pFT_MulFix(pHori->min_Left_Side_Bearing, em_scale);
info->rsb = (SHORT)pFT_MulFix(pHori->min_Right_Side_Bearing, em_scale);
}
else
info->lsb = info->rsb = 0;
info->unk = 0;
return TRUE;
}
/*************************************************************
* freetype_GetCharABCWidths
*/
@ -9112,6 +9146,7 @@ static const struct gdi_dc_funcs freetype_funcs =
freetype_GetCharABCWidths, /* pGetCharABCWidths */
freetype_GetCharABCWidthsI, /* pGetCharABCWidthsI */
freetype_GetCharWidth, /* pGetCharWidth */
freetype_GetCharWidthInfo, /* pGetCharWidthInfo */
NULL, /* pGetDeviceCaps */
NULL, /* pGetDeviceGammaRamp */
freetype_GetFontData, /* pGetFontData */

View File

@ -251,7 +251,7 @@
@ stdcall GetCharWidthFloatA(long long long ptr)
@ stdcall GetCharWidthFloatW(long long long ptr)
@ stdcall GetCharWidthI(ptr long long ptr ptr)
# @ stub GetCharWidthInfo
@ stdcall GetCharWidthInfo(ptr ptr)
@ stdcall GetCharWidthW(long long long long) GetCharWidth32W
@ stub GetCharWidthWOW
@ stdcall GetCharacterPlacementA(long str long long ptr long)

View File

@ -294,6 +294,14 @@ struct font_realization_info
WORD simulations; /* 0 bit - bold simulation, 1 bit - oblique simulation */
};
/* Undocumented structure filled in by GetCharWidthInfo */
struct char_width_info
{
INT lsb; /* minimum left side bearing */
INT rsb; /* minimum right side bearing */
INT unk; /* unknown */
};
extern INT WineEngAddFontResourceEx(LPCWSTR, DWORD, PVOID) DECLSPEC_HIDDEN;
extern HANDLE WineEngAddFontMemResourceEx(PVOID, DWORD, PVOID, LPDWORD) DECLSPEC_HIDDEN;
extern BOOL WineEngCreateScalableFontResource(DWORD, LPCWSTR, LPCWSTR, LPCWSTR) DECLSPEC_HIDDEN;

View File

@ -136,6 +136,7 @@ static const struct gdi_dc_funcs MFDRV_Funcs =
NULL, /* pGetCharABCWidths */
NULL, /* pGetCharABCWidthsI */
NULL, /* pGetCharWidth */
NULL, /* pGetCharWidthInfo */
MFDRV_GetDeviceCaps, /* pGetDeviceCaps */
NULL, /* pGetDeviceGammaRamp */
NULL, /* pGetFontData */

View File

@ -2158,6 +2158,7 @@ const struct gdi_dc_funcs path_driver =
NULL, /* pGetCharABCWidths */
NULL, /* pGetCharABCWidthsI */
NULL, /* pGetCharWidth */
NULL, /* pGetCharWidthInfo */
NULL, /* pGetDeviceCaps */
NULL, /* pGetDeviceGammaRamp */
NULL, /* pGetFontData */

View File

@ -321,6 +321,7 @@ static const struct gdi_dc_funcs android_drv_funcs =
NULL, /* pGetCharABCWidths */
NULL, /* pGetCharABCWidthsI */
NULL, /* pGetCharWidth */
NULL, /* pGetCharWidthInfo */
NULL, /* pGetDeviceCaps */
NULL, /* pGetDeviceGammaRamp */
NULL, /* pGetFontData */

View File

@ -300,6 +300,7 @@ static const struct gdi_dc_funcs macdrv_funcs =
NULL, /* pGetCharABCWidths */
NULL, /* pGetCharABCWidthsI */
NULL, /* pGetCharWidth */
NULL, /* pGetCharWidthInfo */
macdrv_GetDeviceCaps, /* pGetDeviceCaps */
macdrv_GetDeviceGammaRamp, /* pGetDeviceGammaRamp */
NULL, /* pGetFontData */

View File

@ -818,6 +818,7 @@ static const struct gdi_dc_funcs psdrv_funcs =
NULL, /* pGetCharABCWidths */
NULL, /* pGetCharABCWidthsI */
PSDRV_GetCharWidth, /* pGetCharWidth */
NULL, /* pGetCharWidthInfo */
PSDRV_GetDeviceCaps, /* pGetDeviceCaps */
NULL, /* pGetDeviceGammaRamp */
NULL, /* pGetFontData */

View File

@ -381,6 +381,7 @@ static const struct gdi_dc_funcs x11drv_funcs =
NULL, /* pGetCharABCWidths */
NULL, /* pGetCharABCWidthsI */
NULL, /* pGetCharWidth */
NULL, /* pGetCharWidthInfo */
X11DRV_GetDeviceCaps, /* pGetDeviceCaps */
X11DRV_GetDeviceGammaRamp, /* pGetDeviceGammaRamp */
NULL, /* pGetFontData */

View File

@ -2194,6 +2194,7 @@ static const struct gdi_dc_funcs xrender_funcs =
NULL, /* pGetCharABCWidths */
NULL, /* pGetCharABCWidthsI */
NULL, /* pGetCharWidth */
NULL, /* pGetCharWidthInfo */
NULL, /* pGetDeviceCaps */
NULL, /* pGetDeviceGammaRamp */
NULL, /* pGetFontData */

View File

@ -102,6 +102,7 @@ struct gdi_dc_funcs
BOOL (*pGetCharABCWidths)(PHYSDEV,UINT,UINT,LPABC);
BOOL (*pGetCharABCWidthsI)(PHYSDEV,UINT,UINT,WORD*,LPABC);
BOOL (*pGetCharWidth)(PHYSDEV,UINT,UINT,LPINT);
BOOL (*pGetCharWidthInfo)(PHYSDEV,void*);
INT (*pGetDeviceCaps)(PHYSDEV,INT);
BOOL (*pGetDeviceGammaRamp)(PHYSDEV,LPVOID);
DWORD (*pGetFontData)(PHYSDEV,DWORD,DWORD,LPVOID,DWORD);
@ -199,7 +200,7 @@ struct gdi_dc_funcs
};
/* increment this when you change the DC function table */
#define WINE_GDI_DRIVER_VERSION 48
#define WINE_GDI_DRIVER_VERSION 49
#define GDI_PRIORITY_NULL_DRV 0 /* null driver */
#define GDI_PRIORITY_FONT_DRV 100 /* any font driver */