Opened 6 years ago

Closed 3 months ago

#9686 closed defect (fixed)

wxDC::DrawRotatedText() doesn't work with multi-line string

Reported by: wojdyr Owned by: vadz
Priority: normal Milestone:
Component: wxMSW Version: dev-latest
Keywords: wxDC DrawRotatedText rotated text multi line Cc:
Blocked By: Blocking:
Patch: yes

Description

wxMSW: RotatedText() handles "\n", but DrawRotatedText() doesn't

wxGTK: both functions can handle "\n".

Attachments (3)

draw-rotated-text.patch download (4.2 KB) - added by awi 3 months ago.
Patch to allow DrawRotatedText displaying rotated multi line texts.
draw-text-test.patch download (1.3 KB) - added by awi 3 months ago.
Patch to minimal sample with simple tests.
rotated-text.png download (7.6 KB) - added by awi 3 months ago.
Sample results.

Download all attachments as: .zip

Change History (6)

Changed 3 months ago by awi

Patch to allow DrawRotatedText displaying rotated multi line texts.

Changed 3 months ago by awi

Patch to minimal sample with simple tests.

Changed 3 months ago by awi

Sample results.

comment:1 Changed 3 months ago by awi

  • Keywords DrawRotatedText rotated text multi line added
  • Patch set
  • Version changed from stable-latest to dev-latest

Currently, DrawRotatedText draws multi line text properly only if angle of rotation is 0.
Attached patch extends its functionality and allows drawing multi line text also for non zero angle (screenshot of sample output attached).
MSW doesn't provide any API to do this directly, so it is necessary to draw text line by line.

comment:2 Changed 3 months ago by vadz

  • Owner set to vadz
  • Status changed from new to accepted

Thanks, I'm applying this (with some small simplifications) except for the 8192 length check: AFAICS this is only for Win9x and could be greater for recent Windows systems (not that it really counts, of course...).

BTW, using wxFONTSIZE_MEDIUM as wxFont ctor size parameter is incorrect, it is just 0 while the size is supposed to be the size in points. Somehow it does work under MSW, but doesn't work at all in wxGTK.

comment:3 Changed 3 months ago by VZ

  • Resolution set to fixed
  • Status changed from accepted to closed

(In [75750]) Support multiline strings in wxDC::DrawRotatedText() in wxMSW.

The native API doesn't support this, so do it by splitting the string into
lines manually.

Closes #9686.

Note: See TracTickets for help on using tickets.