Hans Leidekker : usp10: Implement ScriptString_pSize.
Alexandre Julliard
julliard at wine.codeweavers.com
Sun Dec 24 09:37:57 CST 2006
Module: wine
Branch: master
Commit: 092edd81e653b2be20e65f5d2af8458ec7b01701
URL: http://source.winehq.org/git/wine.git/?a=commit;h=092edd81e653b2be20e65f5d2af8458ec7b01701
Author: Hans Leidekker <hans at it.vu.nl>
Date: Sat Dec 23 11:07:55 2006 +0100
usp10: Implement ScriptString_pSize.
---
dlls/usp10/tests/usp10.c | 2 +-
dlls/usp10/usp10.c | 50 +++++++++++++++++++++++++++++++++++++++++++++-
dlls/usp10/usp10.spec | 2 +-
include/usp10.h | 2 +-
4 files changed, 52 insertions(+), 4 deletions(-)
diff --git a/dlls/usp10/tests/usp10.c b/dlls/usp10/tests/usp10.c
index b291301..d637aeb 100644
--- a/dlls/usp10/tests/usp10.c
+++ b/dlls/usp10/tests/usp10.c
@@ -897,7 +897,7 @@ static void test_ScriptCacheGetHeight(HD
{
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);
diff --git a/dlls/usp10/usp10.c b/dlls/usp10/usp10.c
index 448153f..85fc82d 100644
--- a/dlls/usp10/usp10.c
+++ b/dlls/usp10/usp10.c
@@ -703,6 +703,7 @@ HRESULT WINAPI ScriptStringFree(SCRIPT_S
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 h
* 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(SCRI
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;
+}
diff --git a/dlls/usp10/usp10.spec b/dlls/usp10/usp10.spec
index 56fd85b..73ea447 100644
--- a/dlls/usp10/usp10.spec
+++ b/dlls/usp10/usp10.spec
@@ -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)
diff --git a/include/usp10.h b/include/usp10.h
index 9b997c4..6dc7584 100644
--- a/include/usp10.h
+++ b/include/usp10.h
@@ -245,7 +245,7 @@ HRESULT WINAPI ScriptShape(HDC hdc, SCRI
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,
More information about the wine-cvs
mailing list