olikraus / u8glib

Arduino Monochrom Graphics Library for LCDs and OLEDs
https://github.com/olikraus/u8glib/wiki
Other
1.24k stars 313 forks source link

right align text #467

Closed waspinator closed 6 years ago

waspinator commented 6 years ago

How would I alight text to the right? For example if I had the numbers, "1", "12", and "123", the default behavior is to display them from the left:

1
12
123

Instead, I'd like to display them the other way around:

  1
 12
123
olikraus commented 6 years ago

hmm, this is more a programming question, i guess. You could use a monospaced font together with sprintf() If i remember correctly char buf[10]; sprintf(buf, "%3d", 1); will put "1" into the buffer, which could be drawn by the u8glib procedures

waspinator commented 6 years ago

okay, thanks I'll try that. I thought maybe the library had an option for aligning text.