Skip to content

Commit

Permalink
Merge pull request #846 from pimoroni/patch-bitmap-fixed-space
Browse files Browse the repository at this point in the history
Bitmap Fonts: Fixed-width space for #765.
  • Loading branch information
Gadgetoid committed Sep 15, 2023
2 parents 36f3e3a + 93525a4 commit 8eac60a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion libraries/bitmap_fonts/bitmap_fonts.cpp
Expand Up @@ -152,6 +152,9 @@ namespace bitmap {
uint32_t line_offset = 0; // line (if wrapping) offset
unicode_sorta::codepage_t codepage = unicode_sorta::PAGE_195;

int32_t space_width = measure_character(font, ' ', scale, codepage, fixed_width);
space_width += letter_spacing * scale;

size_t i = 0;
while(i < t.length()) {
// find length of current word
Expand Down Expand Up @@ -201,7 +204,7 @@ namespace bitmap {
line_offset += (font->height + 1) * scale;
char_offset = 0;
} else if (t[j] == ' ') { // Space
char_offset += font->widths[0] * scale;
char_offset += space_width;
} else {
switch(rotation) {
case 0:
Expand Down

0 comments on commit 8eac60a

Please sign in to comment.