From 6628efed8a6f1c7480e0be01f57d6e1375278dcb Mon Sep 17 00:00:00 2001 From: Pete Favelle Date: Sat, 18 Jan 2025 10:51:22 +0000 Subject: [PATCH] Don't include the spacing after the final letter when measuring text --- libraries/bitmap_fonts/bitmap_fonts.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libraries/bitmap_fonts/bitmap_fonts.cpp b/libraries/bitmap_fonts/bitmap_fonts.cpp index 0eb1cc6f0..7c45ed638 100644 --- a/libraries/bitmap_fonts/bitmap_fonts.cpp +++ b/libraries/bitmap_fonts/bitmap_fonts.cpp @@ -39,6 +39,12 @@ namespace bitmap { text_width += letter_spacing * scale; codepage = unicode_sorta::PAGE_195; // Reset back to default } + + // Do not include the spacing on the final character + if (text_width>0) { + text_width -= letter_spacing * scale; + } + return text_width; } @@ -230,4 +236,4 @@ namespace bitmap { i = next_break += 1; } } -} \ No newline at end of file +}