Commit 092edd81 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

usp10: Implement ScriptString_pSize.

parent 029d244e
...@@ -897,7 +897,7 @@ static void test_ScriptCacheGetHeight(HDC hdc) ...@@ -897,7 +897,7 @@ static void test_ScriptCacheGetHeight(HDC hdc)
{ {
HRESULT hr; HRESULT hr;
SCRIPT_CACHE sc = NULL; SCRIPT_CACHE sc = NULL;
long height; LONG height;
hr = ScriptCacheGetHeight(NULL, NULL, NULL); hr = ScriptCacheGetHeight(NULL, NULL, NULL);
ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got 0x%08x\n", hr); ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got 0x%08x\n", hr);
......
...@@ -703,6 +703,7 @@ HRESULT WINAPI ScriptStringFree(SCRIPT_STRING_ANALYSIS *pssa) ...@@ -703,6 +703,7 @@ HRESULT WINAPI ScriptStringFree(SCRIPT_STRING_ANALYSIS *pssa)
HeapFree(GetProcessHeap(), 0, analysis->glyphs); HeapFree(GetProcessHeap(), 0, analysis->glyphs);
HeapFree(GetProcessHeap(), 0, analysis->pItem); HeapFree(GetProcessHeap(), 0, analysis->pItem);
HeapFree(GetProcessHeap(), 0, analysis->sz);
HeapFree(GetProcessHeap(), 0, analysis); HeapFree(GetProcessHeap(), 0, analysis);
if(invalid) if(invalid)
...@@ -1248,7 +1249,7 @@ HRESULT WINAPI ScriptTextOut(const HDC hdc, SCRIPT_CACHE *psc, int x, int y, UIN ...@@ -1248,7 +1249,7 @@ HRESULT WINAPI ScriptTextOut(const HDC hdc, SCRIPT_CACHE *psc, int x, int y, UIN
* Success: S_OK * Success: S_OK
* Failure: Non-zero HRESULT value. * 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; HDC phdc;
Scriptcache *pScriptcache; Scriptcache *pScriptcache;
...@@ -1388,3 +1389,50 @@ HRESULT WINAPI ScriptStringValidate(SCRIPT_STRING_ANALYSIS ssa) ...@@ -1388,3 +1389,50 @@ HRESULT WINAPI ScriptStringValidate(SCRIPT_STRING_ANALYSIS ssa)
FIXME("(%p): stub\n", ssa); FIXME("(%p): stub\n", ssa);
return S_OK; 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;
}
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
@ stdcall ScriptStringValidate(ptr) @ stdcall ScriptStringValidate(ptr)
@ stdcall ScriptStringXtoCP(ptr long ptr ptr) @ stdcall ScriptStringXtoCP(ptr long ptr ptr)
@ stub ScriptString_pLogAttr @ stub ScriptString_pLogAttr
@ stub ScriptString_pSize @ stdcall ScriptString_pSize(ptr)
@ stub ScriptString_pcOutChars @ stub ScriptString_pcOutChars
@ stdcall ScriptTextOut(ptr ptr long long long ptr ptr ptr long ptr long ptr ptr ptr) @ 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) @ stdcall ScriptXtoCP(long long long ptr ptr ptr ptr ptr ptr)
......
...@@ -245,7 +245,7 @@ HRESULT WINAPI ScriptShape(HDC hdc, SCRIPT_CACHE *psc, const WCHAR *pwcChars, in ...@@ -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, 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 ); 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 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, 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); 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, HRESULT WINAPI ScriptXtoCP(int iX, int cChars, int cGlyphs, const WORD *pwLogClust, const SCRIPT_VISATTR *psva,
......
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