From fca83b0915fd1087ea775496a383cfeb34e369bd Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Tue, 16 Feb 2016 00:59:25 +0300 Subject: [PATCH] dwrite: Use itemizer hint to reset invisible run glyph count. Signed-off-by: Nikolay Sivov Signed-off-by: Alexandre Julliard --- dlls/dwrite/layout.c | 7 +++---- dlls/dwrite/tests/layout.c | 11 +++++------ 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/dlls/dwrite/layout.c b/dlls/dwrite/layout.c index 164ac48b511..fbe1eaa3627 100644 --- a/dlls/dwrite/layout.c +++ b/dlls/dwrite/layout.c @@ -965,10 +965,9 @@ static HRESULT layout_compute_runs(struct dwrite_textlayout *layout) run->run.glyphAdvances = run->advances; run->run.glyphOffsets = run->offsets; - /* Special treatment of control script, shaping code adds normal glyphs for it, - with non-zero advances, and layout code exposes those as zero width clusters, - so we have to do it manually. */ - if (run->sa.script == Script_Common) + /* Special treatment for runs that don't produce visual output, shaping code adds normal glyphs for them, + with valid cluster map and potentially with non-zero advances; layout code exposes those as zero width clusters. */ + if (run->sa.shapes == DWRITE_SCRIPT_SHAPES_NO_VISUAL) run->run.glyphCount = 0; else run->run.glyphCount = run->glyphcount; diff --git a/dlls/dwrite/tests/layout.c b/dlls/dwrite/tests/layout.c index a6da5328dd1..0fe915170c5 100644 --- a/dlls/dwrite/tests/layout.c +++ b/dlls/dwrite/tests/layout.c @@ -33,7 +33,6 @@ static const WCHAR tahomaW[] = {'T','a','h','o','m','a',0}; static const WCHAR enusW[] = {'e','n','-','u','s',0}; static DWRITE_SCRIPT_ANALYSIS g_sa; -static DWRITE_SCRIPT_ANALYSIS g_control_sa; /* test IDWriteTextAnalysisSink */ static HRESULT WINAPI analysissink_QueryInterface(IDWriteTextAnalysisSink *iface, REFIID riid, void **obj) @@ -513,7 +512,9 @@ static HRESULT WINAPI testrenderer_DrawGlyphRun(IDWriteTextRenderer *iface, /* see what's reported for control codes runs */ get_script_analysis(descr->string, descr->stringLength, &sa); - if (sa.script == g_control_sa.script) { + if (sa.shapes == DWRITE_SCRIPT_SHAPES_NO_VISUAL) { + UINT32 i; + /* glyphs are not reported at all for control code runs */ ok(run->glyphCount == 0, "got %u\n", run->glyphCount); ok(run->glyphAdvances != NULL, "advances array %p\n", run->glyphAdvances); @@ -523,6 +524,8 @@ static HRESULT WINAPI testrenderer_DrawGlyphRun(IDWriteTextRenderer *iface, ok(descr->string != NULL, "got string %p\n", descr->string); ok(descr->stringLength > 0, "got string length %u\n", descr->stringLength); ok(descr->clusterMap != NULL, "clustermap %p\n", descr->clusterMap); + for (i = 0; i < descr->stringLength; i++) + ok(descr->clusterMap[i] == i, "got %u\n", descr->clusterMap[i]); } entry.kind = DRAW_GLYPHRUN; @@ -4852,7 +4855,6 @@ todo_wine START_TEST(layout) { - static const WCHAR ctrlstrW[] = {0x202a,0}; IDWriteFactory *factory; if (!(factory = create_factory())) { @@ -4860,9 +4862,6 @@ START_TEST(layout) return; } - /* actual script ids are not fixed */ - get_script_analysis(ctrlstrW, 1, &g_control_sa); - init_call_sequences(sequences, NUM_CALL_SEQUENCES); init_call_sequences(expected_seq, 1); -- 2.11.4.GIT