[Bug 48260] New: DrawText with len -1 returns a different height under WINE than in Windows

WineHQ Bugzilla wine-bugs at winehq.org
Tue Dec 10 09:11:48 CST 2019


https://bugs.winehq.org/show_bug.cgi?id=48260

            Bug ID: 48260
           Summary: DrawText with len -1 returns a different height under
                    WINE than in Windows
           Product: Wine
           Version: 3.6
          Hardware: x86
                OS: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: gdi32
          Assignee: wine-bugs at winehq.org
          Reporter: ryampolsky at yahoo.com
      Distribution: ---

The following 2 lines of code return different values for 'height' on WINE and
Windows when p points to a null string, but the differences are different.

height = DrawText(hDC, p, -1, &rc, dt_options|DT_WORDBREAK|DT_NOPREFIX);
height = DrawText(hDC, p, strlen(p), &rc,
dt_options|DT_WORDBREAK|DT_NOPREFIX);

On Windows, the first case (length -1 : telling Windows to calculate the string
length) returns a height of 1.
On WINE it returns a height of 14 - i.e. the height of an actual row of text
using the currently selected font.

On both Windows and WINE, the second case (where I pass in the length of 0)
returns a height of 0.

I don't know why Windows doesn't return a 0 height for a null string when you
pass in a -1 length, but both Windows and WINE do this.  Except that WINE
returns the height of a row of text, and Windows returns 1 pixel - which ends
up producing no visible different in my code - where this issue shows up.

I changed my code to pass in the length instead of counting on -1 to get
Windows to do it, but I guess any difference between Windows and WINE is a
'bug', huh?

-- 
Do not reply to this email, post in Bugzilla using the
above URL to reply.
You are receiving this mail because:
You are watching all bug changes.



More information about the wine-bugs mailing list