Rendered text width does not seems to work for monospace fonts #2118
-
Hi, I'm trying to use a variation of the Inter font where Front with Tabular number enabled Sadly, the computed rendered text width does not seems to take the monospaced character width into accounts, making alignments with Is there any way to achieve sprite.loadFont(InterSemiBold32pt);
sprite.createSprite(100, 32);
sprite.fillSprite(TFT_BLACK);
sprite.setTextColor(TFT_WHITE);
sprite.setTextDatum(BR_DATUM);
static char str[10];
for(int i = 0; i < 10; i++) {
sprintf(str, "%02d", i);
int width = sprite.drawString(str, 100 - 5, 32);
Serial.print(i);
Serial.print(": ");
Serial.println(width);
} Output :
I've added the font Regards |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Try drawNumber(..) as that has an "anti-jiggle" feature. |
Beta Was this translation helpful? Give feedback.
-
I will consider this further and add as a TODO. |
Beta Was this translation helpful? Give feedback.
Try drawNumber(..) as that has an "anti-jiggle" feature.