Alexandre Julliard : gdi32: Implement GetTextExtentExPointI as a standard driver entry point.
Alexandre Julliard
julliard at winehq.org
Wed Oct 26 12:35:46 CDT 2011
Module: wine
Branch: master
Commit: a2de6a8766e1b28288f18983741ffd35d502fcdf
URL: http://source.winehq.org/git/wine.git/?a=commit;h=a2de6a8766e1b28288f18983741ffd35d502fcdf
Author: Alexandre Julliard <julliard at winehq.org>
Date: Thu Oct 20 17:03:17 2011 +0200
gdi32: Implement GetTextExtentExPointI as a standard driver entry point.
---
dlls/gdi32/font.c | 22 +++++++---------------
dlls/gdi32/freetype.c | 31 +++++++++++++++----------------
dlls/gdi32/gdi_private.h | 1 -
3 files changed, 22 insertions(+), 32 deletions(-)
diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c
index 38ad477..98529db 100644
--- a/dlls/gdi32/font.c
+++ b/dlls/gdi32/font.c
@@ -945,7 +945,8 @@ BOOL WINAPI GetTextExtentPoint32W(
BOOL WINAPI GetTextExtentExPointI( HDC hdc, const WORD *indices, INT count, INT max_ext,
LPINT nfit, LPINT dxs, LPSIZE size )
{
- BOOL ret = FALSE;
+ PHYSDEV dev;
+ BOOL ret;
DC *dc;
if (count < 0) return FALSE;
@@ -953,20 +954,11 @@ BOOL WINAPI GetTextExtentExPointI( HDC hdc, const WORD *indices, INT count, INT
dc = get_dc_ptr( hdc );
if (!dc) return FALSE;
- if(dc->gdiFont)
- {
- ret = WineEngGetTextExtentExPointI(dc->gdiFont, indices, count, max_ext, nfit, dxs, size);
- size->cx = abs(INTERNAL_XDSTOWS(dc, size->cx));
- size->cy = abs(INTERNAL_YDSTOWS(dc, size->cy));
- size->cx += count * dc->charExtra;
- }
- else
- {
- PHYSDEV physdev = GET_DC_PHYSDEV( dc, pGetTextExtentExPoint );
- FIXME("calling GetTextExtentExPoint\n");
- ret = physdev->funcs->pGetTextExtentExPoint( physdev, indices, count, max_ext, nfit, dxs, size );
- }
-
+ dev = GET_DC_PHYSDEV( dc, pGetTextExtentExPointI );
+ ret = dev->funcs->pGetTextExtentExPointI( dev, indices, count, max_ext, nfit, dxs, size );
+ size->cx = abs(INTERNAL_XDSTOWS(dc, size->cx));
+ size->cy = abs(INTERNAL_YDSTOWS(dc, size->cy));
+ size->cx += count * dc->charExtra;
release_dc_ptr( dc );
TRACE("(%p %p %d %p): returning %d x %d\n",
diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c
index 31f52b8..7ca7262 100644
--- a/dlls/gdi32/freetype.c
+++ b/dlls/gdi32/freetype.c
@@ -6501,30 +6501,36 @@ static BOOL freetype_GetTextExtentExPoint( PHYSDEV dev, LPCWSTR wstr, INT count,
}
/*************************************************************
- * WineEngGetTextExtentExPointI
- *
+ * freetype_GetTextExtentExPointI
*/
-BOOL WineEngGetTextExtentExPointI(GdiFont *font, const WORD *indices, INT count,
- INT max_ext, LPINT pnfit, LPINT dxs, LPSIZE size)
+static BOOL freetype_GetTextExtentExPointI( PHYSDEV dev, const WORD *indices, INT count,
+ INT max_ext, LPINT pnfit, LPINT dxs, LPSIZE size )
{
static const MAT2 identity = { {0,1},{0,0},{0,0},{0,1} };
INT idx;
INT nfit = 0, ext;
GLYPHMETRICS gm;
TEXTMETRICW tm;
+ struct freetype_physdev *physdev = get_freetype_dev( dev );
+
+ if (!physdev->font)
+ {
+ dev = GET_NEXT_PHYSDEV( dev, pGetTextExtentExPointI );
+ return dev->funcs->pGetTextExtentExPointI( dev, indices, count, max_ext, pnfit, dxs, size );
+ }
- TRACE("%p, %p, %d, %d, %p\n", font, indices, count, max_ext, size);
+ TRACE("%p, %p, %d, %d, %p\n", physdev->font, indices, count, max_ext, size);
GDI_CheckNotLock();
EnterCriticalSection( &freetype_cs );
size->cx = 0;
- get_text_metrics(font, &tm);
+ get_text_metrics(physdev->font, &tm);
size->cy = tm.tmHeight;
for(idx = 0; idx < count; idx++) {
- get_glyph_outline(font, indices[idx], GGO_METRICS | GGO_GLYPH_INDEX, &gm, 0, NULL, &identity);
- size->cx += FONT_GM(font,indices[idx])->adv;
+ get_glyph_outline(physdev->font, indices[idx], GGO_METRICS | GGO_GLYPH_INDEX, &gm, 0, NULL, &identity);
+ size->cx += FONT_GM(physdev->font,indices[idx])->adv;
ext = size->cx;
if (! pnfit || ext <= max_ext) {
++nfit;
@@ -7131,7 +7137,7 @@ static const struct gdi_dc_funcs freetype_funcs =
NULL, /* pGetSystemPaletteEntries */
freetype_GetTextCharsetInfo, /* pGetTextCharsetInfo */
freetype_GetTextExtentExPoint, /* pGetTextExtentExPoint */
- NULL, /* pGetTextExtentExPointI */
+ freetype_GetTextExtentExPointI, /* pGetTextExtentExPointI */
NULL, /* pGetTextFace */
freetype_GetTextMetrics, /* pGetTextMetrics */
NULL, /* pIntersectClipRect */
@@ -7221,13 +7227,6 @@ BOOL WineEngDestroyFontInstance(HFONT hfont)
return FALSE;
}
-BOOL WineEngGetTextExtentExPointI(GdiFont *font, const WORD *indices, INT count,
- INT max_ext, LPINT nfit, LPINT dx, LPSIZE size)
-{
- ERR("called but we don't have FreeType\n");
- return FALSE;
-}
-
DWORD WineEngGetFontData(GdiFont *font, DWORD table, DWORD offset, LPVOID buf,
DWORD cbData)
{
diff --git a/dlls/gdi32/gdi_private.h b/dlls/gdi32/gdi_private.h
index 365d158..ee7aacf 100644
--- a/dlls/gdi32/gdi_private.h
+++ b/dlls/gdi32/gdi_private.h
@@ -294,7 +294,6 @@ extern HANDLE WineEngAddFontMemResourceEx(PVOID, DWORD, PVOID, LPDWORD) DECLSPEC
extern BOOL WineEngDestroyFontInstance(HFONT handle) DECLSPEC_HIDDEN;
extern DWORD WineEngGetFontData(GdiFont*, DWORD, DWORD, LPVOID, DWORD) DECLSPEC_HIDDEN;
extern BOOL WineEngGetLinkedHFont(DC *dc, WCHAR c, HFONT *new_hfont, UINT *glyph) DECLSPEC_HIDDEN;
-extern BOOL WineEngGetTextExtentExPointI(GdiFont*, const WORD *, INT, INT, LPINT, LPINT, LPSIZE) DECLSPEC_HIDDEN;
extern INT WineEngGetTextFace(GdiFont*, INT, LPWSTR) DECLSPEC_HIDDEN;
extern BOOL WineEngFontIsLinked(GdiFont*) DECLSPEC_HIDDEN;
extern BOOL WineEngInit(void) DECLSPEC_HIDDEN;
More information about the wine-cvs
mailing list