usp10 2/3: Implement ScriptStringOut
Jeff L
lats at yless4u.com.au
Wed Oct 11 16:07:01 CDT 2006
This function takes the results of ScriptStringAnalysis and creates
output for ExtTextOut by way ScriptTextOut.
All documentation has been written by me.
Jeff Latimer
Changelog:
This patch adds the ScriptStringOut function.
-------------- next part --------------
>From 462090eff855b8d1f5729fdedbd9ba0fe1332832 Mon Sep 17 00:00:00 2001
From: Jeff Latimer <lats at yless4u.com.au>
Date: Wed, 11 Oct 2006 20:29:24 +1000
Subject: [PATCH] Implement ScriptStringOut
---
dlls/usp10/tests/usp10.c | 4 +-
dlls/usp10/usp10.c | 79 ++++++++++++++++++++++++++++++++++++++++++++--
2 files changed, 76 insertions(+), 7 deletions(-)
diff --git a/dlls/usp10/tests/usp10.c b/dlls/usp10/tests/usp10.c
index 0c32bd0..a97f45a 100644
--- a/dlls/usp10/tests/usp10.c
+++ b/dlls/usp10/tests/usp10.c
@@ -674,9 +674,7 @@ static void test_ScriptString(void)
if (hr == 0)
{
hr = ScriptStringOut(pssa, iX, iY, uOptions, &prc, iMinSel, iMaxSel,fDisabled);
- todo_wine {
- ok(hr == S_OK, "ScriptStringOut should return S_OK not %08x\n", hr);
- }
+ ok(hr == S_OK, "ScriptStringOut should return S_OK not %08x\n", hr);
hr = ScriptStringFree(&pssa);
ok(hr == S_OK, "ScriptStringFree should return S_OK not %08x\n", hr);
}
diff --git a/dlls/usp10/usp10.c b/dlls/usp10/usp10.c
index b814cb2..f50b226 100644
--- a/dlls/usp10/usp10.c
+++ b/dlls/usp10/usp10.c
@@ -674,14 +674,85 @@ HRESULT WINAPI ScriptStringOut(SCRIPT_ST
int iMinSel,
int iMaxSel,
BOOL fDisabled)
+/******************************************************************************
+ *
+ * This function takes the output of ScriptStringAnalyse and joins the segments
+ * of glyphs and passes the resulting string to ScriptTextOut. ScriptStringOut
+ * only processes glyphs.
+ *
+ * Parameters:
+ * ssa [I] buffer to hold the analysed string components
+ * iX [I] X axis displacement for output
+ * iY [I] Y axis displacement for output
+ * uOptions [I] flags controling output processing
+ * prc [I] rectangle coordinates
+ * iMinSel [I] starting pos for substringing output string
+ * iMaxSel [I] ending pos for substringing output string
+ * fDisabled [I] controls text highlighting
+ */
+
{
- FIXME("(%p,%d,%d,0x%1x,%p,%d,%d,%d): stub\n",
+ string_analysis *analysis;
+ WORD *OutGlyphs;
+ 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; /* map ptr to string_analysis struct */
+
+ TRACE("num_Glyphs %d num_Items %d a.eScript %08x OutGlyphs %p iX %d, iY %d\n",
+ analysis->num_Glyphs, analysis->num_Items,
+ analysis->s_Item[0].a.eScript,
+ analysis->script_blk->OutGlyphs, iX, iY);
+
+ /*
+ * Get storage for the output buffer
+ */
+ OutGlyphs = HeapAlloc( GetProcessHeap(), 0, sizeof(WCHAR) * analysis->num_Glyphs + 200 );
+ /*
+ * ScriptStringOut only processes glyphs hence set ETO_GLYPH_INDEX
+ */
+ uOptions |= ETO_GLYPH_INDEX;
+ analysis->s_Item[0].a.fNoGlyphIndex = FALSE; /* say that we have glyphs */
+
+ /*
+ * Copy the string items into the output buffer
+ */
+ cnt = 0;
+ for (item = 0; item < analysis->num_Items; item++)
+ {
+ memcpy(&OutGlyphs[cnt], analysis->script_blk[item].OutGlyphs,
+ sizeof(WCHAR) * analysis->script_blk[item].Glyphs);
+
+ TRACE("Glyphs %d ", analysis->script_blk[item].Glyphs);
+ for (x = 0; x < analysis->script_blk[item].Glyphs; x ++)
+ TRACE("%04x", OutGlyphs[x]);
+ TRACE("\n");
+ TRACE(" ");
+ for (x = 0; x < analysis->script_blk[item].Glyphs; x ++)
+ TRACE("%04x", analysis->script_blk[item].OutGlyphs[x]);
+ TRACE("\n");
+
+ cnt += analysis->script_blk[item].Glyphs; /* point to the end of the copied text */
}
- return E_NOTIMPL;
+ hr = ScriptTextOut(analysis->hdc, &analysis->sc, iX, iY, uOptions, prc,
+ &analysis->s_Item->a, NULL, 0,
+ OutGlyphs, analysis->num_Glyphs,
+ analysis->script_blk->Advance, NULL,
+ analysis->script_blk->Goffset);
+ TRACE("ScriptTextOut hr=%08lx\n", hr);
+
+ /*
+ * Free the output buffer
+ */
+ HeapFree(GetProcessHeap(), 0, OutGlyphs);
+
+ return hr;
}
/***********************************************************************
--
1.4.1
More information about the wine-patches
mailing list