fix TextAlign::TEXT_ALIGN_CENTER drawing
Closed, ResolvedPublic

Description

The text drawing with TextAlign::TEXT_ALIGN_CENTER somehow doesn't work well currently.

Short words like "FPS" or "WB" get centred correctly.

But longer words like "D. Gain" don't and get drawn like with TextAlign::TEXT_ALIGN_LEFT so something with the textwidth/blockwidth calculation seems to be off.

sebastian triaged this task as Normal priority.
sebastian updated the task description. (Show Details)Apr 13 2020, 2:59 PM

The respective code line is https://github.com/apertus-open-source-cinema/AXIOM-Remote/blob/dev/Firmware/UI/Painter.cpp#L448

I suspect either textPixelWidth or textblockwidth get calculated wrong (and end up being 0).

Please check latest commit in the repo, it has a debug overlay now, which currently is only implemented for DrawText() and DrawIcon():

I fixed the problem, should I create a PR?

Excellent!

Yes please!

sebastian closed this task as Resolved.Apr 15 2020, 2:43 PM

Wonderful!

Just compiled and flashed it: