From 83201ca4dddf934905c1265359a66c85380f1f4b Mon Sep 17 00:00:00 2001 From: "Mr.Blinky" <4971163+MrBlinky@users.noreply.github.com> Date: Sat, 27 Jun 2020 01:40:29 +0200 Subject: [PATCH] update TinyFont lib --- .../libraries/Arduboy-TinyFont/keywords.txt | 2 +- .../libraries/Arduboy-TinyFont/src/Tinyfont.cpp | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/board-package-source/libraries/Arduboy-TinyFont/keywords.txt b/board-package-source/libraries/Arduboy-TinyFont/keywords.txt index c7744a4..ae8e944 100644 --- a/board-package-source/libraries/Arduboy-TinyFont/keywords.txt +++ b/board-package-source/libraries/Arduboy-TinyFont/keywords.txt @@ -1,4 +1,4 @@ -https://github.com/yinkou/Arduboy-TinyFont +# https://github.com/yinkou/Arduboy-TinyFont ####################################### # Datatypes (KEYWORD1) diff --git a/board-package-source/libraries/Arduboy-TinyFont/src/Tinyfont.cpp b/board-package-source/libraries/Arduboy-TinyFont/src/Tinyfont.cpp index 80a8e8d..9b1a29f 100644 --- a/board-package-source/libraries/Arduboy-TinyFont/src/Tinyfont.cpp +++ b/board-package-source/libraries/Arduboy-TinyFont/src/Tinyfont.cpp @@ -20,6 +20,7 @@ Tinyfont::Tinyfont(uint8_t *screenBuffer, int16_t width, int16_t height){ } size_t Tinyfont::write(uint8_t c) { + // check \n if(c == '\n'){ cursorX = baseX; // cr cursorY += lineHeight; // lf @@ -28,11 +29,6 @@ size_t Tinyfont::write(uint8_t c) { else if(c == '\t'){ cursorX += TINYFONT_WIDTH + 5; } - // check \n - else if (c == '\n') { - cursorX = baseX; - cursorY += lineHeight; - } else{ // draw char printChar(c, cursorX, cursorY); @@ -48,7 +44,7 @@ void Tinyfont::printChar(char c, int16_t x, int16_t y) return; // check if char is available - if (((uint8_t) c) < 32 || ((uint8_t) c) > 255) c = (char)127; + if (((uint8_t) c) < 32 || ((uint8_t) c) > 127) c = (char)127; uint8_t cval = ((uint8_t) c) - 32;