usp10: Implement ScriptString_pSize.

This commit is contained in:
Hans Leidekker 2006-12-23 11:07:55 +01:00 committed by Alexandre Julliard
parent 029d244ea9
commit 092edd81e6
4 changed files with 52 additions and 4 deletions

View File

@ -897,7 +897,7 @@ static void test_ScriptCacheGetHeight(HDC hdc)
{
HRESULT hr;
SCRIPT_CACHE sc = NULL;
long height;
LONG height;
hr = ScriptCacheGetHeight(NULL, NULL, NULL);
ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got 0x%08x\n", hr);

View File

@ -703,6 +703,7 @@ HRESULT WINAPI ScriptStringFree(SCRIPT_STRING_ANALYSIS *pssa)
HeapFree(GetProcessHeap(), 0, analysis->glyphs);
HeapFree(GetProcessHeap(), 0, analysis->pItem);
HeapFree(GetProcessHeap(), 0, analysis->sz);
HeapFree(GetProcessHeap(), 0, analysis);
if(invalid)
@ -1248,7 +1249,7 @@ HRESULT WINAPI ScriptTextOut(const HDC hdc, SCRIPT_CACHE *psc, int x, int y, UIN
* Success: S_OK
* Failure: Non-zero HRESULT value.
*/
HRESULT WINAPI ScriptCacheGetHeight(HDC hdc, SCRIPT_CACHE *psc, long *height)
HRESULT WINAPI ScriptCacheGetHeight(HDC hdc, SCRIPT_CACHE *psc, LONG *height)
{
HDC phdc;
Scriptcache *pScriptcache;
@ -1388,3 +1389,50 @@ HRESULT WINAPI ScriptStringValidate(SCRIPT_STRING_ANALYSIS ssa)
FIXME("(%p): stub\n", ssa);
return S_OK;
}
/***********************************************************************
* ScriptString_pSize (USP10.@)
*
* Retrieve width and height of an analysed string.
*
* PARAMS
* ssa [I] string analysis.
*
* RETURNS
* Success: Pointer to a SIZE structure.
* Failure: NULL
*/
const SIZE * WINAPI ScriptString_pSize(SCRIPT_STRING_ANALYSIS ssa)
{
unsigned int i, j;
StringAnalysis *analysis = ssa;
TEXTMETRICW metric;
TRACE("(%p)\n", ssa);
if (!analysis) return NULL;
if (!analysis->sz)
{
if (!(analysis->sz = HeapAlloc(GetProcessHeap(), 0, sizeof(SIZE))))
return NULL;
/* FIXME: These values should be calculated at a more
* appropriate place so that we can just pass cached
* values here.
*/
if (!GetTextMetricsW(analysis->hdc, &metric))
{
HeapFree(GetProcessHeap(), 0, analysis->sz);
analysis->sz = NULL;
return NULL;
}
analysis->sz->cy = metric.tmHeight;
analysis->sz->cx = 0;
for (i = 0; i < analysis->numItems; i++)
for (j = 0; j < analysis->glyphs[i].numGlyphs; j++)
analysis->sz->cx += analysis->glyphs[i].piAdvance[j];
}
return analysis->sz;
}

View File

@ -26,7 +26,7 @@
@ stdcall ScriptStringValidate(ptr)
@ stdcall ScriptStringXtoCP(ptr long ptr ptr)
@ stub ScriptString_pLogAttr
@ stub ScriptString_pSize
@ stdcall ScriptString_pSize(ptr)
@ stub ScriptString_pcOutChars
@ stdcall ScriptTextOut(ptr ptr long long long ptr ptr ptr long ptr long ptr ptr ptr)
@ stdcall ScriptXtoCP(long long long ptr ptr ptr ptr ptr ptr)

View File

@ -245,7 +245,7 @@ HRESULT WINAPI ScriptShape(HDC hdc, SCRIPT_CACHE *psc, const WCHAR *pwcChars, in
HRESULT WINAPI ScriptPlace(HDC hdc, SCRIPT_CACHE *psc, const WORD *pwGlyphs, int cGlyphs, const SCRIPT_VISATTR *psva,
SCRIPT_ANALYSIS *psa, int *piAdvance, GOFFSET *pGoffset, ABC *pABC );
HRESULT WINAPI ScriptBreak(const WCHAR *pwcChars, int cChars, const SCRIPT_ANALYSIS *psa, SCRIPT_LOGATTR *psla);
HRESULT WINAPI ScriptCacheGetHeight(HDC hdc, SCRIPT_CACHE *psc, long *tmHeight);
HRESULT WINAPI ScriptCacheGetHeight(HDC hdc, SCRIPT_CACHE *psc, LONG *tmHeight);
HRESULT WINAPI ScriptCPtoX(int iCP, BOOL fTrailing, int cChars, int cGlyphs, const WORD *pwLogClust, const SCRIPT_VISATTR *psva,
const int *piAdvance, const SCRIPT_ANALYSIS *psa, int *piX);
HRESULT WINAPI ScriptXtoCP(int iX, int cChars, int cGlyphs, const WORD *pwLogClust, const SCRIPT_VISATTR *psva,