usp10 2/3: Implement ScriptStringOut

Jeff L lats at yless4u.com.au
Thu Sep 21 06:24:37 CDT 2006


This function takes the results of ScriptStringAnalysis and creates 
output for ExtTextOut by way ScriptTextOut.

Jeff Latimer

Changelog:
This pact adds the ScriptStringOut function.


-------------- next part --------------
>From cd979ec0237b3294964f7833006682ead589e0ef Mon Sep 17 00:00:00 2001
From: Jeff Latimer <lats at yless4u.com.au>
Date: Wed, 20 Sep 2006 22:36:06 +1000
Subject: [PATCH] Implement ScriptStringOut
---
 dlls/usp10/tests/usp10.c |    2 +-
 dlls/usp10/usp10.c       |   45 ++++++++++++++++++++++++++++++++++++++++-----
 2 files changed, 41 insertions(+), 6 deletions(-)

diff --git a/dlls/usp10/tests/usp10.c b/dlls/usp10/tests/usp10.c
index c8c60f1..44aa472 100644
--- a/dlls/usp10/tests/usp10.c
+++ b/dlls/usp10/tests/usp10.c
@@ -673,7 +673,7 @@ static void test_ScriptString(void)
     if  (hr == 0)
     {
         hr = ScriptStringOut(pssa, iX, iY, uOptions, &prc, iMinSel, iMaxSel,fDisabled);
-        ok(hr == E_NOTIMPL, "ScriptStringOut Stub should return E_NOTIMPL not %08lx\n", hr);
+        ok(hr == S_OK, "ScriptStringOut should return S_OK not %08lx\n", hr);
         hr = ScriptStringFree(&pssa);
         ok(hr == S_OK, "ScriptStringFree should return S_OK not %08lx\n", hr);
     }
diff --git a/dlls/usp10/usp10.c b/dlls/usp10/usp10.c
index 3318259..e8fbe4f 100644
--- a/dlls/usp10/usp10.c
+++ b/dlls/usp10/usp10.c
@@ -582,13 +582,48 @@ HRESULT WINAPI ScriptStringOut(SCRIPT_ST
                                int iMaxSel, 
                                BOOL fDisabled)
 {
-    FIXME("(%p,%d,%d,0x%1x,%p,%d,%d,%d): stub\n",
+    string_analysis *analysis;
+    SCRIPT_CACHE psc = NULL;
+    WCHAR *pwOutGlyphs;
+    int   item, cnt, x;
+    HRESULT hr;
+
+    TRACE("(%p,%d,%d,0x%1x,%p,%d,%d,%d)\n",
          ssa, iX, iY, uOptions, prc, iMinSel, iMaxSel, fDisabled);
-    if  (!ssa) {
-        return E_INVALIDARG;
+    print_ssa(ssa);
+    analysis = ssa;
+    TRACE("cMaxGlyphs %d cItems %d a.eScript %08x pwGlyphsOut %p iX %d, iY %d\n", 
+         analysis->cMaxGlyphs, analysis->cItems, 
+         analysis->pItem[0].a.eScript, 
+         analysis->script_blk->pwOutGlyphs, iX, iY);
+    pwOutGlyphs = HeapAlloc( GetProcessHeap(), 0, 
+                             sizeof(WCHAR)*analysis->cMaxGlyphs+200 );
+    cnt = 0;
+    analysis->pItem[0].a.fNoGlyphIndex = FALSE;
+    uOptions |= ETO_GLYPH_INDEX;
+    for (item = 0; item < analysis->cItems; item++)
+    {
+        memcpy((WCHAR*)&pwOutGlyphs[cnt], 
+              (WCHAR *)analysis->script_blk[item].pwOutGlyphs, 
+              sizeof(WCHAR)*analysis->script_blk[item].cGlyphs);
+        TRACE("cGlyphs %d\n", analysis->script_blk[item].cGlyphs);
+        for (x = 0; x < analysis->script_blk[item].cGlyphs; x ++)
+            TRACE("%04x", pwOutGlyphs[x]);
+        TRACE("\n");
+        for (x = 0; x < analysis->script_blk[item].cGlyphs; x ++)
+            TRACE("%04x", analysis->script_blk[item].pwOutGlyphs[x]);
+        cnt += analysis->script_blk[item].cGlyphs;
     }
-
-    return E_NOTIMPL;
+    hr = ScriptTextOut(analysis->hdc, &psc, iX, iY, uOptions, (RECT*) prc, 
+                       &analysis->pItem->a, NULL, 0,
+                       (WCHAR*) pwOutGlyphs, analysis->cMaxGlyphs, 
+                       analysis->script_blk->piAdvance, NULL, 
+                       analysis->script_blk->pGoffset);
+    TRACE("ScriptTextOut hr=%08lx\n", hr);
+    HeapFree(GetProcessHeap(), 0, pwOutGlyphs);
+    ScriptFreeCache(&psc);
+    print_ssa((SCRIPT_STRING_ANALYSIS*)analysis);
+    return hr;
 }
 
 /***********************************************************************
-- 
1.4.1



More information about the wine-patches mailing list