gdi32: Remove from the GetTextExtentExPoint entry points parameters that can't be handled by the driver.

This commit is contained in:
Alexandre Julliard 2012-12-18 17:52:37 +01:00
parent 1c2f23cf2f
commit bbf3e8621a
6 changed files with 28 additions and 79 deletions

View File

@ -423,14 +423,12 @@ static UINT nulldrv_GetTextCharsetInfo( PHYSDEV dev, LPFONTSIGNATURE fs, DWORD f
return DEFAULT_CHARSET; return DEFAULT_CHARSET;
} }
static BOOL nulldrv_GetTextExtentExPoint( PHYSDEV dev, LPCWSTR str, INT count, INT max_ext, static BOOL nulldrv_GetTextExtentExPoint( PHYSDEV dev, LPCWSTR str, INT count, INT *dx )
INT *fit, INT *dx, SIZE *size )
{ {
return FALSE; return FALSE;
} }
static BOOL nulldrv_GetTextExtentExPointI( PHYSDEV dev, const WORD *indices, INT count, INT max_ext, static BOOL nulldrv_GetTextExtentExPointI( PHYSDEV dev, const WORD *indices, INT count, INT *dx )
INT *fit, INT *dx, SIZE *size )
{ {
return FALSE; return FALSE;
} }

View File

@ -320,7 +320,7 @@ static BOOL get_char_positions( DC *dc, const WCHAR *str, INT count, INT *dx, SI
dev = GET_DC_PHYSDEV( dc, pGetTextMetrics ); dev = GET_DC_PHYSDEV( dc, pGetTextMetrics );
dev->funcs->pGetTextMetrics( dev, &tm ); dev->funcs->pGetTextMetrics( dev, &tm );
if (!dev->funcs->pGetTextExtentExPoint( dev, str, count, 0, NULL, dx, size )) return FALSE; if (!dev->funcs->pGetTextExtentExPoint( dev, str, count, dx )) return FALSE;
if (dc->breakExtra || dc->breakRem) if (dc->breakExtra || dc->breakRem)
{ {
@ -357,7 +357,7 @@ static BOOL get_char_positions_indices( DC *dc, const WORD *indices, INT count,
dev = GET_DC_PHYSDEV( dc, pGetTextMetrics ); dev = GET_DC_PHYSDEV( dc, pGetTextMetrics );
dev->funcs->pGetTextMetrics( dev, &tm ); dev->funcs->pGetTextMetrics( dev, &tm );
if (!dev->funcs->pGetTextExtentExPointI( dev, indices, count, 0, NULL, dx, size )) return FALSE; if (!dev->funcs->pGetTextExtentExPointI( dev, indices, count, dx )) return FALSE;
if (dc->breakExtra || dc->breakRem) if (dc->breakExtra || dc->breakRem)
{ {

View File

@ -7134,97 +7134,67 @@ static BOOL freetype_GetCharABCWidthsI( PHYSDEV dev, UINT firstChar, UINT count,
/************************************************************* /*************************************************************
* freetype_GetTextExtentExPoint * freetype_GetTextExtentExPoint
*/ */
static BOOL freetype_GetTextExtentExPoint( PHYSDEV dev, LPCWSTR wstr, INT count, static BOOL freetype_GetTextExtentExPoint( PHYSDEV dev, LPCWSTR wstr, INT count, LPINT dxs )
INT max_ext, LPINT pnfit, LPINT dxs, LPSIZE size)
{ {
static const MAT2 identity = { {0,1},{0,0},{0,0},{0,1} }; static const MAT2 identity = { {0,1},{0,0},{0,0},{0,1} };
INT idx; INT idx, pos;
INT nfit = 0, ext;
ABC abc; ABC abc;
GLYPHMETRICS gm; GLYPHMETRICS gm;
TEXTMETRICW tm;
struct freetype_physdev *physdev = get_freetype_dev( dev ); struct freetype_physdev *physdev = get_freetype_dev( dev );
if (!physdev->font) if (!physdev->font)
{ {
dev = GET_NEXT_PHYSDEV( dev, pGetTextExtentExPoint ); dev = GET_NEXT_PHYSDEV( dev, pGetTextExtentExPoint );
return dev->funcs->pGetTextExtentExPoint( dev, wstr, count, max_ext, pnfit, dxs, size ); return dev->funcs->pGetTextExtentExPoint( dev, wstr, count, dxs );
} }
TRACE("%p, %s, %d, %d, %p\n", physdev->font, debugstr_wn(wstr, count), count, max_ext, size); TRACE("%p, %s, %d\n", physdev->font, debugstr_wn(wstr, count), count);
GDI_CheckNotLock(); GDI_CheckNotLock();
EnterCriticalSection( &freetype_cs ); EnterCriticalSection( &freetype_cs );
size->cx = 0; for (idx = pos = 0; idx < count; idx++)
get_text_metrics( physdev->font, &tm ); {
size->cy = tm.tmHeight;
for(idx = 0; idx < count; idx++) {
get_glyph_outline( physdev->font, wstr[idx], GGO_METRICS, &gm, &abc, 0, NULL, &identity ); get_glyph_outline( physdev->font, wstr[idx], GGO_METRICS, &gm, &abc, 0, NULL, &identity );
size->cx += abc.abcA + abc.abcB + abc.abcC; pos += abc.abcA + abc.abcB + abc.abcC;
ext = size->cx; dxs[idx] = pos;
if (! pnfit || ext <= max_ext) {
++nfit;
if (dxs)
dxs[idx] = ext;
}
} }
if (pnfit)
*pnfit = nfit;
LeaveCriticalSection( &freetype_cs ); LeaveCriticalSection( &freetype_cs );
TRACE("return %d, %d, %d\n", size->cx, size->cy, nfit);
return TRUE; return TRUE;
} }
/************************************************************* /*************************************************************
* freetype_GetTextExtentExPointI * freetype_GetTextExtentExPointI
*/ */
static BOOL freetype_GetTextExtentExPointI( PHYSDEV dev, const WORD *indices, INT count, static BOOL freetype_GetTextExtentExPointI( PHYSDEV dev, const WORD *indices, INT count, LPINT dxs )
INT max_ext, LPINT pnfit, LPINT dxs, LPSIZE size )
{ {
static const MAT2 identity = { {0,1},{0,0},{0,0},{0,1} }; static const MAT2 identity = { {0,1},{0,0},{0,0},{0,1} };
INT idx; INT idx, pos;
INT nfit = 0, ext;
ABC abc; ABC abc;
GLYPHMETRICS gm; GLYPHMETRICS gm;
TEXTMETRICW tm;
struct freetype_physdev *physdev = get_freetype_dev( dev ); struct freetype_physdev *physdev = get_freetype_dev( dev );
if (!physdev->font) if (!physdev->font)
{ {
dev = GET_NEXT_PHYSDEV( dev, pGetTextExtentExPointI ); dev = GET_NEXT_PHYSDEV( dev, pGetTextExtentExPointI );
return dev->funcs->pGetTextExtentExPointI( dev, indices, count, max_ext, pnfit, dxs, size ); return dev->funcs->pGetTextExtentExPointI( dev, indices, count, dxs );
} }
TRACE("%p, %p, %d, %d, %p\n", physdev->font, indices, count, max_ext, size); TRACE("%p, %p, %d\n", physdev->font, indices, count);
GDI_CheckNotLock(); GDI_CheckNotLock();
EnterCriticalSection( &freetype_cs ); EnterCriticalSection( &freetype_cs );
size->cx = 0; for (idx = pos = 0; idx < count; idx++)
get_text_metrics(physdev->font, &tm); {
size->cy = tm.tmHeight;
for(idx = 0; idx < count; idx++) {
get_glyph_outline( physdev->font, indices[idx], GGO_METRICS | GGO_GLYPH_INDEX, get_glyph_outline( physdev->font, indices[idx], GGO_METRICS | GGO_GLYPH_INDEX,
&gm, &abc, 0, NULL, &identity ); &gm, &abc, 0, NULL, &identity );
size->cx += abc.abcA + abc.abcB + abc.abcC; pos += abc.abcA + abc.abcB + abc.abcC;
ext = size->cx; dxs[idx] = pos;
if (! pnfit || ext <= max_ext) {
++nfit;
if (dxs)
dxs[idx] = ext;
}
} }
if (pnfit)
*pnfit = nfit;
LeaveCriticalSection( &freetype_cs ); LeaveCriticalSection( &freetype_cs );
TRACE("return %d, %d, %d\n", size->cx, size->cy, nfit);
return TRUE; return TRUE;
} }

View File

@ -317,43 +317,25 @@ const AFMMETRICS *PSDRV_UVMetrics(LONG UV, const AFM *afm)
/*********************************************************************** /***********************************************************************
* PSDRV_GetTextExtentExPoint * PSDRV_GetTextExtentExPoint
*/ */
BOOL PSDRV_GetTextExtentExPoint(PHYSDEV dev, LPCWSTR str, INT count, BOOL PSDRV_GetTextExtentExPoint(PHYSDEV dev, LPCWSTR str, INT count, LPINT alpDx)
INT maxExt, LPINT lpnFit, LPINT alpDx, LPSIZE size)
{ {
PSDRV_PDEVICE *physDev = get_psdrv_dev( dev ); PSDRV_PDEVICE *physDev = get_psdrv_dev( dev );
int nfit = 0;
int i; int i;
float width = 0.0; float width = 0.0;
float scale;
if (physDev->font.fontloc == Download) if (physDev->font.fontloc == Download)
{ {
dev = GET_NEXT_PHYSDEV( dev, pGetTextExtentExPoint ); dev = GET_NEXT_PHYSDEV( dev, pGetTextExtentExPoint );
return dev->funcs->pGetTextExtentExPoint( dev, str, count, maxExt, lpnFit, alpDx, size ); return dev->funcs->pGetTextExtentExPoint( dev, str, count, alpDx );
} }
TRACE("%s %i\n", debugstr_wn(str, count), count); TRACE("%s %i\n", debugstr_wn(str, count), count);
scale = physDev->font.fontinfo.Builtin.scale; for (i = 0; i < count; ++i)
for (i = 0; i < count && str[i] != '\0'; ++i)
{ {
float scaled_width;
width += PSDRV_UVMetrics(str[i], physDev->font.fontinfo.Builtin.afm)->WX; width += PSDRV_UVMetrics(str[i], physDev->font.fontinfo.Builtin.afm)->WX;
scaled_width = width * scale; alpDx[i] = width * physDev->font.fontinfo.Builtin.scale;
if (alpDx)
alpDx[i] = scaled_width;
if (scaled_width <= maxExt)
++nfit;
} }
size->cx = width * physDev->font.fontinfo.Builtin.scale;
size->cy = physDev->font.fontinfo.Builtin.tm.tmHeight;
if (lpnFit)
*lpnFit = nfit;
TRACE("cx=%i cy=%i\n", size->cx, size->cy);
return TRUE; return TRUE;
} }

View File

@ -425,8 +425,7 @@ extern BOOL PSDRV_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags,
const RECT *lprect, LPCWSTR str, UINT count, const INT *lpDx ) DECLSPEC_HIDDEN; const RECT *lprect, LPCWSTR str, UINT count, const INT *lpDx ) DECLSPEC_HIDDEN;
extern BOOL PSDRV_FillPath( PHYSDEV dev ) DECLSPEC_HIDDEN; extern BOOL PSDRV_FillPath( PHYSDEV dev ) DECLSPEC_HIDDEN;
extern BOOL PSDRV_GetCharWidth(PHYSDEV dev, UINT firstChar, UINT lastChar, LPINT buffer) DECLSPEC_HIDDEN; extern BOOL PSDRV_GetCharWidth(PHYSDEV dev, UINT firstChar, UINT lastChar, LPINT buffer) DECLSPEC_HIDDEN;
extern BOOL PSDRV_GetTextExtentExPoint(PHYSDEV dev, LPCWSTR str, INT count, extern BOOL PSDRV_GetTextExtentExPoint(PHYSDEV dev, LPCWSTR str, INT count, LPINT alpDx) DECLSPEC_HIDDEN;
INT maxExt, LPINT lpnFit, LPINT alpDx, LPSIZE size) DECLSPEC_HIDDEN;
extern BOOL PSDRV_GetTextMetrics(PHYSDEV dev, TEXTMETRICW *metrics) DECLSPEC_HIDDEN; extern BOOL PSDRV_GetTextMetrics(PHYSDEV dev, TEXTMETRICW *metrics) DECLSPEC_HIDDEN;
extern BOOL PSDRV_LineTo(PHYSDEV dev, INT x, INT y) DECLSPEC_HIDDEN; extern BOOL PSDRV_LineTo(PHYSDEV dev, INT x, INT y) DECLSPEC_HIDDEN;
extern BOOL PSDRV_PaintRgn( PHYSDEV dev, HRGN hrgn ) DECLSPEC_HIDDEN; extern BOOL PSDRV_PaintRgn( PHYSDEV dev, HRGN hrgn ) DECLSPEC_HIDDEN;

View File

@ -116,8 +116,8 @@ struct gdi_dc_funcs
COLORREF (*pGetPixel)(PHYSDEV,INT,INT); COLORREF (*pGetPixel)(PHYSDEV,INT,INT);
UINT (*pGetSystemPaletteEntries)(PHYSDEV,UINT,UINT,LPPALETTEENTRY); UINT (*pGetSystemPaletteEntries)(PHYSDEV,UINT,UINT,LPPALETTEENTRY);
UINT (*pGetTextCharsetInfo)(PHYSDEV,LPFONTSIGNATURE,DWORD); UINT (*pGetTextCharsetInfo)(PHYSDEV,LPFONTSIGNATURE,DWORD);
BOOL (*pGetTextExtentExPoint)(PHYSDEV,LPCWSTR,INT,INT,LPINT,LPINT,LPSIZE); BOOL (*pGetTextExtentExPoint)(PHYSDEV,LPCWSTR,INT,LPINT);
BOOL (*pGetTextExtentExPointI)(PHYSDEV,const WORD*,INT,INT,LPINT,LPINT,LPSIZE); BOOL (*pGetTextExtentExPointI)(PHYSDEV,const WORD*,INT,LPINT);
INT (*pGetTextFace)(PHYSDEV,INT,LPWSTR); INT (*pGetTextFace)(PHYSDEV,INT,LPWSTR);
BOOL (*pGetTextMetrics)(PHYSDEV,TEXTMETRICW*); BOOL (*pGetTextMetrics)(PHYSDEV,TEXTMETRICW*);
BOOL (*pGradientFill)(PHYSDEV,TRIVERTEX*,ULONG,void*,ULONG,ULONG); BOOL (*pGradientFill)(PHYSDEV,TRIVERTEX*,ULONG,void*,ULONG,ULONG);
@ -197,7 +197,7 @@ struct gdi_dc_funcs
}; };
/* increment this when you change the DC function table */ /* increment this when you change the DC function table */
#define WINE_GDI_DRIVER_VERSION 45 #define WINE_GDI_DRIVER_VERSION 46
#define GDI_PRIORITY_NULL_DRV 0 /* null driver */ #define GDI_PRIORITY_NULL_DRV 0 /* null driver */
#define GDI_PRIORITY_FONT_DRV 100 /* any font driver */ #define GDI_PRIORITY_FONT_DRV 100 /* any font driver */