Hans Leidekker : gdi32: Implement GetTextExtentExPointI.
Alexandre Julliard
julliard at winehq.org
Mon Dec 3 09:18:01 CST 2007
Module: wine
Branch: master
Commit: 8487c2dd2a959cc80c0cc23ffbc67c977efbe2e8
URL: http://source.winehq.org/git/wine.git/?a=commit;h=8487c2dd2a959cc80c0cc23ffbc67c977efbe2e8
Author: Hans Leidekker <hans at it.vu.nl>
Date: Sun Dec 2 21:06:01 2007 +0100
gdi32: Implement GetTextExtentExPointI.
---
dlls/gdi32/font.c | 46 ++++++++++++++++++++++++++++++++++++----------
dlls/gdi32/freetype.c | 27 +++++++++++++++++++--------
dlls/gdi32/gdi32.spec | 2 +-
dlls/gdi32/gdi_private.h | 2 +-
4 files changed, 57 insertions(+), 20 deletions(-)
diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c
index 1b80df1..1a179d5 100644
--- a/dlls/gdi32/font.c
+++ b/dlls/gdi32/font.c
@@ -1144,34 +1144,40 @@ BOOL WINAPI GetTextExtentPoint32W(
}
/***********************************************************************
- * GetTextExtentPointI [GDI32.@]
+ * GetTextExtentExPointI [GDI32.@]
*
* Computes width and height of the array of glyph indices.
*
+ * PARAMS
+ * hdc [I] Handle of device context.
+ * indices [I] Glyph index array.
+ * count [I] Number of glyphs in array.
+ * max_ext [I] Maximum width in glyphs.
+ * nfit [O] Maximum number of characters.
+ * dxs [O] Partial string widths.
+ * size [O] Returned string size.
+ *
* RETURNS
* Success: TRUE
* Failure: FALSE
*/
-BOOL WINAPI GetTextExtentPointI(
- HDC hdc, /* [in] Handle of device context */
- const WORD *indices, /* [in] Address of glyph index array */
- INT count, /* [in] Number of glyphs in array */
- LPSIZE size) /* [out] Address of structure for string size */
+BOOL WINAPI GetTextExtentExPointI( HDC hdc, const WORD *indices, INT count, INT max_ext,
+ LPINT nfit, LPINT dxs, LPSIZE size )
{
BOOL ret = FALSE;
DC * dc = DC_GetDCPtr( hdc );
if (!dc) return FALSE;
if(dc->gdiFont) {
- ret = WineEngGetTextExtentPointI(dc->gdiFont, indices, count, size);
- size->cx = abs(INTERNAL_XDSTOWS(dc, size->cx));
- size->cy = abs(INTERNAL_YDSTOWS(dc, size->cy));
+ 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 if(dc->funcs->pGetTextExtentExPoint) {
FIXME("calling GetTextExtentExPoint\n");
ret = dc->funcs->pGetTextExtentExPoint( dc->physDev, (LPCWSTR)indices,
- count, 0, NULL, NULL, size );
+ count, max_ext, nfit, dxs, size );
}
DC_ReleaseDCPtr( dc );
@@ -1181,6 +1187,26 @@ BOOL WINAPI GetTextExtentPointI(
return ret;
}
+/***********************************************************************
+ * GetTextExtentPointI [GDI32.@]
+ *
+ * Computes width and height of the array of glyph indices.
+ *
+ * PARAMS
+ * hdc [I] Handle of device context.
+ * indices [I] Glyph index array.
+ * count [I] Number of glyphs in array.
+ * size [O] Returned string size.
+ *
+ * RETURNS
+ * Success: TRUE
+ * Failure: FALSE
+ */
+BOOL WINAPI GetTextExtentPointI( HDC hdc, const WORD *indices, INT count, LPSIZE size )
+{
+ return GetTextExtentExPointI( hdc, indices, count, 0, NULL, NULL, size );
+}
+
/***********************************************************************
* GetTextExtentPointA (GDI32.@)
diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c
index a79f41d..e9fb663 100644
--- a/dlls/gdi32/freetype.c
+++ b/dlls/gdi32/freetype.c
@@ -4580,17 +4580,18 @@ BOOL WineEngGetTextExtentExPoint(GdiFont *font, LPCWSTR wstr, INT count,
}
/*************************************************************
- * WineEngGetTextExtentPointI
+ * WineEngGetTextExtentExPointI
*
*/
-BOOL WineEngGetTextExtentPointI(GdiFont *font, const WORD *indices, INT count,
- LPSIZE size)
+BOOL WineEngGetTextExtentExPointI(GdiFont *font, const WORD *indices, INT count,
+ INT max_ext, LPINT pnfit, LPINT dxs, LPSIZE size)
{
INT idx;
+ INT nfit = 0, ext;
GLYPHMETRICS gm;
TEXTMETRICW tm;
- TRACE("%p, %p, %d, %p\n", font, indices, count, size);
+ TRACE("%p, %p, %d, %d, %p\n", font, indices, count, max_ext, size);
size->cx = 0;
WineEngGetTextMetrics(font, &tm);
@@ -4600,9 +4601,19 @@ BOOL WineEngGetTextExtentPointI(GdiFont *font, const WORD *indices, INT count,
WineEngGetGlyphOutline(font, indices[idx],
GGO_METRICS | GGO_GLYPH_INDEX, &gm, 0, NULL,
NULL);
- size->cx += FONT_GM(font,indices[idx])->adv;
+ size->cx += FONT_GM(font,indices[idx])->adv;
+ ext = size->cx;
+ if (! pnfit || ext <= max_ext) {
+ ++nfit;
+ if (dxs)
+ dxs[idx] = ext;
+ }
}
- TRACE("return %d,%d\n", size->cx, size->cy);
+
+ if (pnfit)
+ *pnfit = nfit;
+
+ TRACE("return %d, %d, %d\n", size->cx, size->cy, nfit);
return TRUE;
}
@@ -5129,8 +5140,8 @@ BOOL WineEngGetTextExtentExPoint(GdiFont *font, LPCWSTR wstr, INT count,
return FALSE;
}
-BOOL WineEngGetTextExtentPointI(GdiFont *font, const WORD *indices, INT count,
- LPSIZE size)
+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;
diff --git a/dlls/gdi32/gdi32.spec b/dlls/gdi32/gdi32.spec
index 025dd25..c04bba7 100644
--- a/dlls/gdi32/gdi32.spec
+++ b/dlls/gdi32/gdi32.spec
@@ -332,7 +332,7 @@
@ stdcall GetTextCharsetInfo(long ptr long)
@ stdcall GetTextColor(long)
@ stdcall GetTextExtentExPointA(long str long long ptr ptr ptr)
-# @ stub GetTextExtentExPointI
+@ stdcall GetTextExtentExPointI(long ptr long long ptr ptr ptr)
@ stdcall GetTextExtentExPointW(long wstr long long ptr ptr ptr)
# @ stub GetTextExtentExPointWPri
@ stdcall GetTextExtentPoint32A(long str long ptr)
diff --git a/dlls/gdi32/gdi_private.h b/dlls/gdi32/gdi_private.h
index 3e49642..21cf577 100644
--- a/dlls/gdi32/gdi_private.h
+++ b/dlls/gdi32/gdi_private.h
@@ -444,7 +444,7 @@ extern BOOL WineEngGetLinkedHFont(DC *dc, WCHAR c, HFONT *new_hfont, UINT *glyph
extern UINT WineEngGetOutlineTextMetrics(GdiFont*, UINT, LPOUTLINETEXTMETRICW) DECLSPEC_HIDDEN;
extern UINT WineEngGetTextCharsetInfo(GdiFont *font, LPFONTSIGNATURE fs, DWORD flags) DECLSPEC_HIDDEN;
extern BOOL WineEngGetTextExtentExPoint(GdiFont*, LPCWSTR, INT, INT, LPINT, LPINT, LPSIZE) DECLSPEC_HIDDEN;
-extern BOOL WineEngGetTextExtentPointI(GdiFont*, const WORD *, INT, LPSIZE) 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 WineEngGetTextMetrics(GdiFont*, LPTEXTMETRICW) DECLSPEC_HIDDEN;
extern BOOL WineEngFontIsLinked(GdiFont*) DECLSPEC_HIDDEN;
More information about the wine-cvs
mailing list