Commit 5c1c7a65 authored by Alexandre Julliard's avatar Alexandre Julliard

gdi32: Implement GetCharWidthW as a standard driver entry point.

parent 6ad9eb80
...@@ -1612,23 +1612,19 @@ BOOL WINAPI GetCharWidth32W( HDC hdc, UINT firstChar, UINT lastChar, ...@@ -1612,23 +1612,19 @@ BOOL WINAPI GetCharWidth32W( HDC hdc, UINT firstChar, UINT lastChar,
{ {
UINT i; UINT i;
BOOL ret; BOOL ret;
PHYSDEV dev;
DC * dc = get_dc_ptr( hdc ); DC * dc = get_dc_ptr( hdc );
if (!dc) return FALSE; if (!dc) return FALSE;
if (dc->gdiFont) dev = GET_DC_PHYSDEV( dc, pGetCharWidth );
ret = WineEngGetCharWidth( dc->gdiFont, firstChar, lastChar, buffer ); ret = dev->funcs->pGetCharWidth( dev, firstChar, lastChar, buffer );
else
{
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pGetCharWidth );
ret = physdev->funcs->pGetCharWidth( physdev, firstChar, lastChar, buffer);
}
if (ret) if (ret)
{ {
/* convert device units to logical */ /* convert device units to logical */
for( i = firstChar; i <= lastChar; i++, buffer++ ) for( i = firstChar; i <= lastChar; i++, buffer++ )
*buffer = INTERNAL_XDSTOWS(dc, *buffer); *buffer = INTERNAL_XDSTOWS(dc, *buffer);
ret = TRUE;
} }
release_dc_ptr( dc ); release_dc_ptr( dc );
return ret; return ret;
......
...@@ -6309,24 +6309,29 @@ static BOOL get_glyph_index_linked(GdiFont *font, UINT c, GdiFont **linked_font, ...@@ -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, static BOOL freetype_GetCharWidth( PHYSDEV dev, UINT firstChar, UINT lastChar, LPINT buffer )
LPINT buffer)
{ {
static const MAT2 identity = { {0,1},{0,0},{0,0},{0,1} }; static const MAT2 identity = { {0,1},{0,0},{0,0},{0,1} };
UINT c; UINT c;
GLYPHMETRICS gm; GLYPHMETRICS gm;
FT_UInt glyph_index; FT_UInt glyph_index;
GdiFont *linked_font; 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(); GDI_CheckNotLock();
EnterCriticalSection( &freetype_cs ); EnterCriticalSection( &freetype_cs );
for(c = firstChar; c <= lastChar; c++) { 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, WineEngGetGlyphOutline(linked_font, glyph_index, GGO_METRICS | GGO_GLYPH_INDEX,
&gm, 0, NULL, &identity); &gm, 0, NULL, &identity);
buffer[c - firstChar] = FONT_GM(linked_font,glyph_index)->adv; buffer[c - firstChar] = FONT_GM(linked_font,glyph_index)->adv;
...@@ -7076,7 +7081,7 @@ static const struct gdi_dc_funcs freetype_funcs = ...@@ -7076,7 +7081,7 @@ static const struct gdi_dc_funcs freetype_funcs =
NULL, /* pFlattenPath */ NULL, /* pFlattenPath */
NULL, /* pFrameRgn */ NULL, /* pFrameRgn */
NULL, /* pGdiComment */ NULL, /* pGdiComment */
NULL, /* pGetCharWidth */ freetype_GetCharWidth, /* pGetCharWidth */
NULL, /* pGetDeviceCaps */ NULL, /* pGetDeviceCaps */
NULL, /* pGetDeviceGammaRamp */ NULL, /* pGetDeviceGammaRamp */
NULL, /* pGetICMProfile */ NULL, /* pGetICMProfile */
...@@ -7206,13 +7211,6 @@ UINT WineEngGetOutlineTextMetrics(GdiFont *font, UINT cbSize, ...@@ -7206,13 +7211,6 @@ UINT WineEngGetOutlineTextMetrics(GdiFont *font, UINT cbSize,
return 0; 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, BOOL WineEngGetCharABCWidths(GdiFont *font, UINT firstChar, UINT lastChar,
LPABC buffer) LPABC buffer)
{ {
......
...@@ -299,7 +299,6 @@ extern BOOL WineEngGetCharABCWidthsFloat(GdiFont *font, UINT firstChar, ...@@ -299,7 +299,6 @@ extern BOOL WineEngGetCharABCWidthsFloat(GdiFont *font, UINT firstChar,
UINT lastChar, LPABCFLOAT buffer) DECLSPEC_HIDDEN; UINT lastChar, LPABCFLOAT buffer) DECLSPEC_HIDDEN;
extern BOOL WineEngGetCharABCWidthsI(GdiFont *font, UINT firstChar, extern BOOL WineEngGetCharABCWidthsI(GdiFont *font, UINT firstChar,
UINT count, LPWORD pgi, LPABC buffer) DECLSPEC_HIDDEN; 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 WineEngGetFontData(GdiFont*, DWORD, DWORD, LPVOID, DWORD) DECLSPEC_HIDDEN;
extern DWORD WineEngGetFontUnicodeRanges(GdiFont *, LPGLYPHSET) DECLSPEC_HIDDEN; extern DWORD WineEngGetFontUnicodeRanges(GdiFont *, LPGLYPHSET) DECLSPEC_HIDDEN;
extern DWORD WineEngGetGlyphIndices(GdiFont *font, LPCWSTR lpstr, INT count, extern DWORD WineEngGetGlyphIndices(GdiFont *font, LPCWSTR lpstr, INT count,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment