gdi32: Implement GetCharWidthW as a standard driver entry point.

This commit is contained in:
Alexandre Julliard 2011-10-19 13:38:10 +02:00
parent 6ad9eb805c
commit 5c1c7a6576
3 changed files with 16 additions and 23 deletions

View File

@ -1612,23 +1612,19 @@ BOOL WINAPI GetCharWidth32W( HDC hdc, UINT firstChar, UINT lastChar,
{
UINT i;
BOOL ret;
PHYSDEV dev;
DC * dc = get_dc_ptr( hdc );
if (!dc) return FALSE;
if (dc->gdiFont)
ret = WineEngGetCharWidth( dc->gdiFont, firstChar, lastChar, buffer );
else
{
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pGetCharWidth );
ret = physdev->funcs->pGetCharWidth( physdev, firstChar, lastChar, buffer);
}
dev = GET_DC_PHYSDEV( dc, pGetCharWidth );
ret = dev->funcs->pGetCharWidth( dev, firstChar, lastChar, buffer );
if (ret)
{
/* convert device units to logical */
for( i = firstChar; i <= lastChar; i++, buffer++ )
*buffer = INTERNAL_XDSTOWS(dc, *buffer);
ret = TRUE;
}
release_dc_ptr( dc );
return ret;

View File

@ -6309,24 +6309,29 @@ static BOOL get_glyph_index_linked(GdiFont *font, UINT c, GdiFont **linked_font,
}
/*************************************************************
* WineEngGetCharWidth
*
* freetype_GetCharWidth
*/
BOOL WineEngGetCharWidth(GdiFont *font, UINT firstChar, UINT lastChar,
LPINT buffer)
static BOOL freetype_GetCharWidth( PHYSDEV dev, UINT firstChar, UINT lastChar, LPINT buffer )
{
static const MAT2 identity = { {0,1},{0,0},{0,0},{0,1} };
UINT c;
GLYPHMETRICS gm;
FT_UInt glyph_index;
GdiFont *linked_font;
struct freetype_physdev *physdev = get_freetype_dev( dev );
TRACE("%p, %d, %d, %p\n", font, firstChar, lastChar, buffer);
if (!physdev->font)
{
dev = GET_NEXT_PHYSDEV( dev, pGetCharWidth );
return dev->funcs->pGetCharWidth( dev, firstChar, lastChar, buffer );
}
TRACE("%p, %d, %d, %p\n", physdev->font, firstChar, lastChar, buffer);
GDI_CheckNotLock();
EnterCriticalSection( &freetype_cs );
for(c = firstChar; c <= lastChar; c++) {
get_glyph_index_linked(font, c, &linked_font, &glyph_index);
get_glyph_index_linked(physdev->font, c, &linked_font, &glyph_index);
WineEngGetGlyphOutline(linked_font, glyph_index, GGO_METRICS | GGO_GLYPH_INDEX,
&gm, 0, NULL, &identity);
buffer[c - firstChar] = FONT_GM(linked_font,glyph_index)->adv;
@ -7076,7 +7081,7 @@ static const struct gdi_dc_funcs freetype_funcs =
NULL, /* pFlattenPath */
NULL, /* pFrameRgn */
NULL, /* pGdiComment */
NULL, /* pGetCharWidth */
freetype_GetCharWidth, /* pGetCharWidth */
NULL, /* pGetDeviceCaps */
NULL, /* pGetDeviceGammaRamp */
NULL, /* pGetICMProfile */
@ -7206,13 +7211,6 @@ UINT WineEngGetOutlineTextMetrics(GdiFont *font, UINT cbSize,
return 0;
}
BOOL WineEngGetCharWidth(GdiFont *font, UINT firstChar, UINT lastChar,
LPINT buffer)
{
ERR("called but we don't have FreeType\n");
return FALSE;
}
BOOL WineEngGetCharABCWidths(GdiFont *font, UINT firstChar, UINT lastChar,
LPABC buffer)
{

View File

@ -299,7 +299,6 @@ extern BOOL WineEngGetCharABCWidthsFloat(GdiFont *font, UINT firstChar,
UINT lastChar, LPABCFLOAT buffer) DECLSPEC_HIDDEN;
extern BOOL WineEngGetCharABCWidthsI(GdiFont *font, UINT firstChar,
UINT count, LPWORD pgi, LPABC buffer) DECLSPEC_HIDDEN;
extern BOOL WineEngGetCharWidth(GdiFont*, UINT, UINT, LPINT) DECLSPEC_HIDDEN;
extern DWORD WineEngGetFontData(GdiFont*, DWORD, DWORD, LPVOID, DWORD) DECLSPEC_HIDDEN;
extern DWORD WineEngGetFontUnicodeRanges(GdiFont *, LPGLYPHSET) DECLSPEC_HIDDEN;
extern DWORD WineEngGetGlyphIndices(GdiFont *font, LPCWSTR lpstr, INT count,