diff --git a/dlls/usp10/usp10.c b/dlls/usp10/usp10.c index abd9c897ad0..aa394498867 100644 --- a/dlls/usp10/usp10.c +++ b/dlls/usp10/usp10.c @@ -652,3 +652,48 @@ HRESULT WINAPI ScriptTextOut(const HDC hdc, SCRIPT_CACHE *psc, int x, int y, UIN return hr; } } + +/*********************************************************************** + * ScriptCacheGetHeight (USP10.@) + * + * Retrieve the height of the font in the cache. + * + * PARAMS + * hdc [I] Device context. + * psc [I/O] Opaque pointer to a script cache. + * height [O] Receives font height. + * + * RETURNS + * Success: S_OK + * Failure: Non-zero HRESULT value. + */ +HRESULT WINAPI ScriptCacheGetHeight(HDC hdc, SCRIPT_CACHE *psc, long *height) +{ + HDC phdc; + Scriptcache *pScriptcache; + TEXTMETRICW metric; + + TRACE("(%p, %p, %p)\n", hdc, psc, height); + + if (!psc || !height) + return E_INVALIDARG; + + if (!hdc) return E_PENDING; + + if (!*psc) { + pScriptcache = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(Scriptcache)); + pScriptcache->hdc = hdc; + phdc = hdc; + *psc = pScriptcache; + } else { + pScriptcache = *psc; + phdc = pScriptcache->hdc; + } + + /* FIXME: get this from the cache */ + if (!GetTextMetricsW(phdc, &metric)) + return E_INVALIDARG; + + *height = metric.tmHeight; + return S_OK; +} diff --git a/dlls/usp10/usp10.spec b/dlls/usp10/usp10.spec index c4e47fc055e..3d0e1ceb402 100644 --- a/dlls/usp10/usp10.spec +++ b/dlls/usp10/usp10.spec @@ -3,7 +3,7 @@ @ stub ScriptApplyLogicalWidth @ stdcall ScriptBreak(ptr long ptr ptr) @ stdcall ScriptCPtoX(long long long long ptr ptr ptr ptr ptr) -@ stub ScriptCacheGetHeight +@ stdcall ScriptCacheGetHeight(ptr ptr ptr) @ stdcall ScriptFreeCache(ptr) @ stdcall ScriptGetCMap(ptr ptr ptr long long ptr) @ stdcall ScriptGetFontProperties(long ptr ptr)