I have a Teensy LC driving a 1.5" OLED display using SPI. I am using the "u8g2_font_fub14_tr" font. Everything is working great except for one thing. I want to perfectly center (on the display) 3 lines of characters. As an example, one line has one of the 16 cardinal compass points ("N", "sSE" etc). My question is... is there any way to determine the total pixel width of anyone of the 16 different character values so I can determine the 'starting point' such that the characters will center?
Look at getStrWidth() in u8g2reference · olikraus/u8g2 Wiki · GitHub
Most libraries have a function for determining the width of a string.
David, Thanks! I swear I looked at entries in that file a dozen times and just never saw "getStrWidth". Just ran a test using it. Bingo. Now I am off to incorporate it into all 3 lines. Thanks for taking the time to respond.