Commit 8487c2dd authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

gdi32: Implement GetTextExtentExPointI.

parent 7a4e3a10
......@@ -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.@)
......
......@@ -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;
......
......@@ -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)
......
......@@ -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;
......
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