[scintilla:bugs] #2179 Win32: ListBoxX::GetDesiredRect should use correct technology to measure width

1 view
Skip to first unread message

mberchtold

unread,
May 31, 2020, 4:30:14 AM5/31/20
to scintill...@googlegroups.com

[bugs:#2179] Win32: ListBoxX::GetDesiredRect should use correct technology to measure width

Status: open
Group: Bug
Created: Sun May 31, 2020 08:30 AM UTC by mberchtold
Last Updated: Sun May 31, 2020 08:30 AM UTC
Owner: nobody

In ListBoxX::GetDesiredRect, GDI (GetTextExtentPoint32) is always used to measure the text width. This should depend on the technology class member. If it is not SCWIN_TECH_GDI, then D2D should be used. This would be consistent with the code in ListBoxX::Draw. Right now the text is measure width GDI but drawn with D2D. The text width might be incorrect as D2D and GDI (may) use different text render implementations.
The text measurement implementation for D2D can be taken from SurfaceD2D::WidthText.


Sent from sourceforge.net because scintill...@googlegroups.com is subscribed to https://sourceforge.net/p/scintilla/bugs/

To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/scintilla/admin/bugs/options. Or, if this is a mailing list, you can unsubscribe from the mailing list.

Zufu Liu

unread,
May 31, 2020, 4:35:56 AM5/31/20
to scintill...@googlegroups.com

test is drawn with GDI, not D2D.

if (unicodeMode) {
    const TextWide tbuf(text, unicodeMode);
    ::DrawTextW(pDrawItem->hDC, tbuf.buffer, tbuf.tlen, &rcText, DT_NOPREFIX | DT_END_ELLIPSIS | DT_SINGLELINE | DT_NOCLIP);
} else {
    ::DrawTextA(pDrawItem->hDC, text, len, &rcText, DT_NOPREFIX | DT_END_ELLIPSIS | DT_SINGLELINE | DT_NOCLIP);
}

mberchtold

unread,
May 31, 2020, 4:40:08 AM5/31/20
to scintill...@googlegroups.com

Correct. But the image is drawn with D2D. I think everything should be measured/drawn with D2D if the technlogy is set to D2D.


[bugs:#2179] Win32: ListBoxX::GetDesiredRect should use correct technology to measure width

Status: open
Group: Bug
Created: Sun May 31, 2020 08:30 AM UTC by mberchtold

Last Updated: Sun May 31, 2020 08:35 AM UTC
Owner: nobody

Neil Hodgson

unread,
May 31, 2020, 6:48:53 PM5/31/20
to scintill...@googlegroups.com

Using DirectWrite for drawing and measuring the text in lists would be reasonable.


[bugs:#2179] Win32: ListBoxX::GetDesiredRect should use correct technology to measure width

Status: open
Group: Bug
Created: Sun May 31, 2020 08:30 AM UTC by mberchtold

Last Updated: Sun May 31, 2020 08:40 AM UTC
Owner: nobody

Zufu Liu

unread,
Apr 7, 2026, 8:24:21 AMApr 7
to scintill...@googlegroups.com
  • labels: --> Scintilla, win32, directwrite
  • status: open --> closed-fixed
  • Comment:

Fixed in v5.5.6.


[bugs:#2179] Win32: ListBoxX::GetDesiredRect should use correct technology to measure width

Status: closed-fixed
Group: Bug
Labels: Scintilla win32 directwrite

Created: Sun May 31, 2020 08:30 AM UTC by mberchtold

Last Updated: Sun May 31, 2020 10:48 PM UTC
Owner: nobody

Reply all
Reply to author
Forward
0 new messages