https://bugs.winehq.org/show_bug.cgi?id=53552
Bug ID: 53552 Summary: Line width calculation failure in WineMono.Tests.System.Windows.Media.TextFormatting.Tex tFormatterTest.NewlineCharacterCollapsibleTest Product: Wine Version: 7.14 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: dwrite Assignee: wine-bugs@winehq.org Reporter: conmanx360@gmail.com Distribution: ---
Somewhere between the release of Wine Mono 7.3.0 and Wine 7.14 the WineMono.Tests.System.Windows.Media.TextFormatting.TextFormatterTest.NewlineCharacterCollapsibleTest test began failing with:
1) NewlineCharacterCollapsibleTest (WineMono.Tests.System.Windows.Media.TextFormatting.TextFormatterTest.NewlineCharacterCollapsibleTest) line.Width Expected: 206.31333333333333d But was: 302.31333333333333d
I'm assuming this is dwrite related, but I could be wrong on that.
https://bugs.winehq.org/show_bug.cgi?id=53552
--- Comment #1 from Nikolay Sivov bunglehead@gmail.com --- Bisecting limited to dlls/dwrite path would be helpful.
https://bugs.winehq.org/show_bug.cgi?id=53552
Esme Povirk madewokherd@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- URL| |https://dl.winehq.org/wine/ | |wine-mono/7.3.0/wine-mono-7 | |.3.0-tests.zip Regression SHA1| |dcb8094a37afb7bf505d4377158 | |a5e0ce25bcd7c CC| |madewokherd@gmail.com Keywords| |download, source, testcase
--- Comment #2 from Esme Povirk madewokherd@gmail.com --- dcb8094a37afb7bf505d4377158a5e0ce25bcd7c is the first bad commit commit dcb8094a37afb7bf505d4377158a5e0ce25bcd7c Author: Nikolay Sivov nsivov@codeweavers.com Date: Mon Jul 25 12:34:58 2022 +0300
dwrite: Use u32-reads for AnalyzeScript().
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com
dlls/dwrite/analyzer.c | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-)
https://bugs.winehq.org/show_bug.cgi?id=53552
Esme Povirk madewokherd@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |regression
https://bugs.winehq.org/show_bug.cgi?id=53552
--- Comment #3 from Nikolay Sivov bunglehead@gmail.com --- Thanks, I'll take a look, unless you're already looking.
https://bugs.winehq.org/show_bug.cgi?id=53552
--- Comment #4 from Nikolay Sivov bunglehead@gmail.com --- Going just by plain text search I see this test namespace in net_4_x_PresentationCore_test.dll. How do I run just PresentationCore tests, or maybe even just NewlineCharacterCollapsibleTest?
https://bugs.winehq.org/show_bug.cgi?id=53552
--- Comment #5 from Esme Povirk madewokherd@gmail.com --- $ wine run-tests.exe WineMono.Tests.System.Windows.Media.TextFormatting.TextFormatterTest:NewlineCharacterCollapsibleTest
https://bugs.winehq.org/show_bug.cgi?id=53552
--- Comment #6 from Nikolay Sivov bunglehead@gmail.com --- Bisect results do not look right to me. I rebuilt at its parent (7fd01cf7dd1), and still get failures like this:
1) NewlineCharacterCollapsibleTest (WineMono.Tests.System.Windows.Media.TextFormatting.TextFormatterTest.NewlineCharacterCollapsibleTest) line.Height Expected: 147.18666666666667d But was: 153.60000000000002d
Running with current Wine I noticed that the only text that's passed to AnalyzeScript is "test\n", so position 0, length 5. Then no layout or fallback methods are used, only shaping with GetGlyphs/GetGlyphPlacements. I checked that "test\n" produces single span of 5 character in Latin script.
Do we end up using Liberation Sans font for this test? Maybe that's what changed. Maybe we should bundle some specific version of it, and adjust accordingly.
https://bugs.winehq.org/show_bug.cgi?id=53552
--- Comment #7 from Esme Povirk madewokherd@gmail.com --- I didn't limit my bisect to dwrite, and the last 2 tests had different results for me, so it seems unlikely that I messed that up.
https://bugs.winehq.org/show_bug.cgi?id=53552
--- Comment #8 from Esme Povirk madewokherd@gmail.com --- I went back and confirmed the result by retesting that commit and its parent.
https://bugs.winehq.org/show_bug.cgi?id=53552
--- Comment #9 from Esme Povirk madewokherd@gmail.com --- What I'm not able to test is: does the code in Wine Mono work correctly with native dwrite?
https://bugs.winehq.org/show_bug.cgi?id=53552
--- Comment #10 from Esme Povirk madewokherd@gmail.com --- I get a failure in Width as Connor did, not in Height, so the part that's failing for you works for me.
It does appear to be using Arial here. Maybe you don't have the Arial font and that's causing the fallback to Liberation Sans?
https://bugs.winehq.org/show_bug.cgi?id=53552
--- Comment #11 from Nikolay Sivov bunglehead@gmail.com --- Yes, I can see the same failure with exact same numbers now, after installing corefonts.
The issue I believe is in GetTextAtPosition() in our wpf, specifically this line:
--- text = IntPtr.Add(segment.ptr, (int)(position - segment.start)); ---
As far as I can tell this only works correctly if position == segment.start. I will have to multiply offset by 2 to get correct WCHAR pointers.
The change in dwrite made it so one extra call is happening now with non-zero position, that wasn't there before. It might now happen on Windows, so testing there might be not productive. Still, we should fix this offset.
Output from some extra logging, simply reading through all valid positions, where you can see single byte shifts happening:
--- 012c:err:dwrite:analyze_script hr = 0, position 0, text L"test\n", length 5 012c:err:dwrite:analyze_script hr = 0, position 1, text L"\6500\7300\7400\0a00", length 4 012c:err:dwrite:analyze_script hr = 0, position 2, text L"est", length 3 012c:err:dwrite:analyze_script hr = 0, position 3, text L"\7300\7400", length 2 012c:err:dwrite:analyze_script hr = 0, position 4, text L"s", length 1 ---
https://bugs.winehq.org/show_bug.cgi?id=53552
--- Comment #12 from Nikolay Sivov bunglehead@gmail.com --- (In reply to Nikolay Sivov from comment #11)
I will have to multiply offset by 2 to get correct WCHAR pointers.
It* will have to multiply..
https://bugs.winehq.org/show_bug.cgi?id=53552
--- Comment #13 from Nikolay Sivov bunglehead@gmail.com --- Posted the fix here https://github.com/madewokherd/wpf/pull/7.
https://bugs.winehq.org/show_bug.cgi?id=53552
Esme Povirk madewokherd@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Component|dwrite |mscoree
https://bugs.winehq.org/show_bug.cgi?id=53552
--- Comment #14 from Esme Povirk madewokherd@gmail.com --- Thanks, merged. Will update the bug when the patch makes its way into a Wine Mono release in Winehq.
https://bugs.winehq.org/show_bug.cgi?id=53552
--- Comment #15 from Nikolay Sivov bunglehead@gmail.com --- Great, thank you.
https://bugs.winehq.org/show_bug.cgi?id=53552
Nikolay Sivov bunglehead@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED Fixed by SHA1| |4493b10d17ecff23f483ed48612 | |7a123e90b3cc2 Status|UNCONFIRMED |RESOLVED
--- Comment #16 from Nikolay Sivov bunglehead@gmail.com --- This is now fixed with wine-mono 7.4.0, https://source.winehq.org/git/wine.git/commit/4493b10d17ecff23f483ed486127a1....
https://bugs.winehq.org/show_bug.cgi?id=53552
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #17 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 7.20.