From: Akihiro Sagawa sagawa.aki@gmail.com
Signed-off-by: Akihiro Sagawa sagawa.aki@gmail.com Signed-off-by: Huw Davies huw@codeweavers.com --- dlls/gdi32/dibdrv/dc.c | 2 ++ dlls/gdi32/driver.c | 6 ++++++ dlls/gdi32/enhmfdrv/dc.c | 1 + dlls/gdi32/enhmfdrv/init.c | 1 + dlls/gdi32/font.c | 24 ++++++++++++++++++++++++ dlls/gdi32/freetype.c | 35 +++++++++++++++++++++++++++++++++++ dlls/gdi32/gdi32.spec | 2 +- dlls/gdi32/gdi_private.h | 8 ++++++++ dlls/gdi32/mfdrv/init.c | 1 + dlls/gdi32/path.c | 1 + dlls/wineandroid.drv/init.c | 1 + dlls/winemac.drv/gdi.c | 1 + dlls/wineps.drv/init.c | 1 + dlls/winex11.drv/init.c | 1 + dlls/winex11.drv/xrender.c | 1 + include/wine/gdi_driver.h | 3 ++- 16 files changed, 87 insertions(+), 2 deletions(-)
diff --git a/dlls/gdi32/dibdrv/dc.c b/dlls/gdi32/dibdrv/dc.c index 3456002171..a3f84bd688 100644 --- a/dlls/gdi32/dibdrv/dc.c +++ b/dlls/gdi32/dibdrv/dc.c @@ -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 */ diff --git a/dlls/gdi32/driver.c b/dlls/gdi32/driver.c index 054d7cf418..88f49a03b6 100644 --- a/dlls/gdi32/driver.c +++ b/dlls/gdi32/driver.c @@ -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 */ diff --git a/dlls/gdi32/enhmfdrv/dc.c b/dlls/gdi32/enhmfdrv/dc.c index 305f052c0a..960d1b295c 100644 --- a/dlls/gdi32/enhmfdrv/dc.c +++ b/dlls/gdi32/enhmfdrv/dc.c @@ -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 */ diff --git a/dlls/gdi32/enhmfdrv/init.c b/dlls/gdi32/enhmfdrv/init.c index 51133705a5..1cd838ab8e 100644 --- a/dlls/gdi32/enhmfdrv/init.c +++ b/dlls/gdi32/enhmfdrv/init.c @@ -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 */ diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c index b3d67ff624..633fb10116 100644 --- a/dlls/gdi32/font.c +++ b/dlls/gdi32/font.c @@ -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; +} diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c index 352a86653a..703dc3a997 100644 --- a/dlls/gdi32/freetype.c +++ b/dlls/gdi32/freetype.c @@ -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 */ diff --git a/dlls/gdi32/gdi32.spec b/dlls/gdi32/gdi32.spec index 6e8f0285f4..2d158e0f1b 100644 --- a/dlls/gdi32/gdi32.spec +++ b/dlls/gdi32/gdi32.spec @@ -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) diff --git a/dlls/gdi32/gdi_private.h b/dlls/gdi32/gdi_private.h index 01473dd7e2..fc3961bd70 100644 --- a/dlls/gdi32/gdi_private.h +++ b/dlls/gdi32/gdi_private.h @@ -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; diff --git a/dlls/gdi32/mfdrv/init.c b/dlls/gdi32/mfdrv/init.c index d766d025e5..4ef509a89f 100644 --- a/dlls/gdi32/mfdrv/init.c +++ b/dlls/gdi32/mfdrv/init.c @@ -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 */ diff --git a/dlls/gdi32/path.c b/dlls/gdi32/path.c index 402b082f4c..8cf86ccb2e 100644 --- a/dlls/gdi32/path.c +++ b/dlls/gdi32/path.c @@ -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 */ diff --git a/dlls/wineandroid.drv/init.c b/dlls/wineandroid.drv/init.c index b5c85eea83..7a2945c80f 100644 --- a/dlls/wineandroid.drv/init.c +++ b/dlls/wineandroid.drv/init.c @@ -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 */ diff --git a/dlls/winemac.drv/gdi.c b/dlls/winemac.drv/gdi.c index 40478fdb86..7156a3c3a8 100644 --- a/dlls/winemac.drv/gdi.c +++ b/dlls/winemac.drv/gdi.c @@ -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 */ diff --git a/dlls/wineps.drv/init.c b/dlls/wineps.drv/init.c index 8a1353cedf..0dff6cc868 100644 --- a/dlls/wineps.drv/init.c +++ b/dlls/wineps.drv/init.c @@ -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 */ diff --git a/dlls/winex11.drv/init.c b/dlls/winex11.drv/init.c index 326873314c..20710cc0c9 100644 --- a/dlls/winex11.drv/init.c +++ b/dlls/winex11.drv/init.c @@ -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 */ diff --git a/dlls/winex11.drv/xrender.c b/dlls/winex11.drv/xrender.c index 8350bad548..61729ecf29 100644 --- a/dlls/winex11.drv/xrender.c +++ b/dlls/winex11.drv/xrender.c @@ -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 */ diff --git a/include/wine/gdi_driver.h b/include/wine/gdi_driver.h index 4693235cae..d3e5bcefb4 100644 --- a/include/wine/gdi_driver.h +++ b/include/wine/gdi_driver.h @@ -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 */