Ticket #723 (new defect)

Opened 16 months ago

Last modified 7 months ago

[PATCH] Multiline centered text

Reported by: fcxSanya Owned by:
Priority: Should Have Milestone: Backlog
Component: Core engine Keywords:
Cc:

Description

Currently text centered by the first line position, so if there is multiple lines, each line will have the same indention as the first one instead of be centered individually.

Attachments

Multiline_centered_text.diff (16.6 KB) - added by fcxSanya 16 months ago.
multiline-center-2.patch (1.9 KB) - added by Philip 16 months ago.
alternative approach (incomplete)

Change History

Changed 16 months ago by fcxSanya

comment:1 Changed 16 months ago by fcxSanya

  • Keywords review added

Attached patch should fix this issue and should allow to properly display multiline centered text.

comment:2 Changed 16 months ago by Philip

I get some minor compiler errors:

../../../source/gui/IGUITextOwner.cpp:123: error: ‘>>’ should be ‘> >’ within a nested template argument list
../../../source/gui/CGUI.cpp:977: error: no matching function for call to ‘min(unsigned int&, size_t)’

On the main menu, if I click the WFG logo in the bottom-left corner it pops up an "About 0 A.D." box. The "0" icon in the centered title bar is incorrectly aligned - presumably something is wrong with the sprite code but I can't tell what...

This seems like a pretty large change to the code - is it really all necessary just to get centered text? I've tried hacking up a much simpler patch to CGUI::DrawText to center all text, which looks like it basically works. Am I missing problems with this approach? (That patch needs some more work to support left-aligned and right-aligned text but that doesn't look hard.)

Changed 16 months ago by Philip

alternative approach (incomplete)

comment:3 Changed 7 months ago by historic_bruno

  • Keywords review removed
  • Summary changed from Multiline centered text to [PATCH] Multiline centered text
Note: See TracTickets for help on using tickets.