From a341b58d0ab6710b6caed70e455f64a95a847541 Mon Sep 17 00:00:00 2001 From: igors48 Date: Sun, 26 Jun 2022 12:18:06 +0300 Subject: [PATCH] #100 custom fonts done 2 --- src/apps/clock/clockAppSetDateTile.cpp | 2 +- src/apps/clock/clockAppSetTimeTile.cpp | 2 +- src/apps/clock/clockAppTile.cpp | 12 +- src/apps/step/stepAppTile.cpp | 2 +- src/core/component/buttonComponent.cpp | 4 +- src/core/watch/{fonts.hpp => mediumFont.hpp} | 0 src/core/watch/smallFont.hpp | 199 +++++++++++++++++++ src/core/watch/tft.cpp | 14 +- src/core/watch/tft.hpp | 3 +- 9 files changed, 221 insertions(+), 17 deletions(-) rename src/core/watch/{fonts.hpp => mediumFont.hpp} (100%) create mode 100644 src/core/watch/smallFont.hpp diff --git a/src/apps/clock/clockAppSetDateTile.cpp b/src/apps/clock/clockAppSetDateTile.cpp index 83dfbeb..852ec8a 100644 --- a/src/apps/clock/clockAppSetDateTile.cpp +++ b/src/apps/clock/clockAppSetDateTile.cpp @@ -66,7 +66,7 @@ Component* createClockAppSetDateTile(ClockAppApi *clockAppApi, Factory *factory) day = 15; month = 6; - TextState* title = (factory->createTextStateRef)(2, 1, COLOR_INFORMATION, provideTitle); + TextState* title = (factory->createTextStateRef)(SMALL_FONT, 0, COLOR_INFORMATION, provideTitle); TextState* dayMonth = (factory->createTextStateRef)(7, 1, COLOR_INTERACTION, provideDayMonthState); ButtonComponentState* setButtonState = (factory->createButtonStateRef)(SET, EG_ONCE, setDate); ButtonComponentState* resetButtonState = (factory->createButtonStateRef)(RESET, EG_ONCE, resetDate); diff --git a/src/apps/clock/clockAppSetTimeTile.cpp b/src/apps/clock/clockAppSetTimeTile.cpp index 43bcfb8..0fd4598 100644 --- a/src/apps/clock/clockAppSetTimeTile.cpp +++ b/src/apps/clock/clockAppSetTimeTile.cpp @@ -66,7 +66,7 @@ Component* createClockAppSetTimeTile(ClockAppApi *clockAppApi, Factory *factory) hour = 12; minute = 30; - TextState* title = (factory->createTextStateRef)(2, 1, COLOR_INFORMATION, provideTitle); + TextState* title = (factory->createTextStateRef)(SMALL_FONT, 0, COLOR_INFORMATION, provideTitle); TextState* hourMinute = (factory->createTextStateRef)(7, 1, COLOR_INTERACTION, provideHourMinuteState); ButtonComponentState* setButtonState = (factory->createButtonStateRef)(SET, EG_ONCE, setTime); ButtonComponentState* resetButtonState = (factory->createButtonStateRef)(RESET, EG_ONCE, resetTime); diff --git a/src/apps/clock/clockAppTile.cpp b/src/apps/clock/clockAppTile.cpp index 2b60a79..87f3ca5 100644 --- a/src/apps/clock/clockAppTile.cpp +++ b/src/apps/clock/clockAppTile.cpp @@ -143,12 +143,12 @@ Component *createClockAppTile(ClockAppApi *clockAppApi, Factory *factory) hourMinute = (factory->createTextStateRef)(7, 1, COLOR_INFORMATION, provideHourMinuteState); second = (factory->createTextStateRef)(7, 1, COLOR_INFORMATION, provideSecondState); - battery = (factory->createTextStateRef)(MIDDLE_FONT, 0, COLOR_INFORMATION, provideBatteryState); - dateState = (factory->createTextStateRef)(MIDDLE_FONT, 0, COLOR_ATTENTION, provideDateState); - stepCounter = (factory->createTextStateRef)(MIDDLE_FONT, 0, COLOR_INFORMATION, provideStepCounterState); - wakeUpReason = (factory->createTextStateRef)(1, 2, COLOR_INTERACTION, provideWakeUpReason); - timeToSleep = (factory->createTextStateRef)(1, 2, COLOR_INTERACTION, provideTimeToSleep); - nextWakeUp = (factory->createTextStateRef)(1, 2, COLOR_INTERACTION, provideNextWakeUp); + battery = (factory->createTextStateRef)(MEDIUM_FONT, 0, COLOR_INFORMATION, provideBatteryState); + dateState = (factory->createTextStateRef)(MEDIUM_FONT, 0, COLOR_ATTENTION, provideDateState); + stepCounter = (factory->createTextStateRef)(MEDIUM_FONT, 0, COLOR_INFORMATION, provideStepCounterState); + wakeUpReason = (factory->createTextStateRef)(SMALL_FONT, 0, COLOR_INTERACTION, provideWakeUpReason); + timeToSleep = (factory->createTextStateRef)(SMALL_FONT, 0, COLOR_INTERACTION, provideTimeToSleep); + nextWakeUp = (factory->createTextStateRef)(SMALL_FONT, 0, COLOR_INTERACTION, provideNextWakeUp); Component *hourMinuteText = (factory->createTextComponentRef)(12, 50, 140, 48, hourMinute); hourMinuteText->render = hourMinuteComponentRender; diff --git a/src/apps/step/stepAppTile.cpp b/src/apps/step/stepAppTile.cpp index 2e9ad49..5ede329 100644 --- a/src/apps/step/stepAppTile.cpp +++ b/src/apps/step/stepAppTile.cpp @@ -66,7 +66,7 @@ Component* createStepAppTile(StepAppApi* stepAppApi, Factory *factory) { api = stepAppApi; - stepCounter = (factory->createTextStateRef)(MIDDLE_FONT, 0, COLOR_ATTENTION, provideStepCounterState); + stepCounter = (factory->createTextStateRef)(MEDIUM_FONT, 0, COLOR_ATTENTION, provideStepCounterState); resetButtonState = (factory->createButtonStateRef)(RESET, EG_ONCE, reset); stepCounterComponent = (factory->createTextComponentRef)(55, 120, 50, 50, stepCounter); diff --git a/src/core/component/buttonComponent.cpp b/src/core/component/buttonComponent.cpp index 278afe2..ac1f8ae 100644 --- a/src/core/component/buttonComponent.cpp +++ b/src/core/component/buttonComponent.cpp @@ -125,8 +125,8 @@ void buttonRender(Component *component, bool forced, TftApi *tftApi) rectColor = COLOR_BUTTON_BACK_DISABLED; } (tftApi->fillRoundRect)(component->x, component->y, component->w, component->h, 4, rectColor); // todo make radius a parameter or const - (tftApi->setTextSize)(2); - (tftApi->setTextFont)(1); + (tftApi->setTextSize)(0); + (tftApi->setTextFont)(SMALL_FONT); (tftApi->setTextColor)(COLOR_BUTTON_TEXT, rectColor); (tftApi->drawString)(state->title, component->x + 4, component->y + 4); } diff --git a/src/core/watch/fonts.hpp b/src/core/watch/mediumFont.hpp similarity index 100% rename from src/core/watch/fonts.hpp rename to src/core/watch/mediumFont.hpp diff --git a/src/core/watch/smallFont.hpp b/src/core/watch/smallFont.hpp new file mode 100644 index 0000000..369b03b --- /dev/null +++ b/src/core/watch/smallFont.hpp @@ -0,0 +1,199 @@ +// Created by http://oleddisplay.squix.ch/ Consider a donation +// In case of problems make sure that you are using the font file with the correct version! +const uint8_t Roboto_Condensed_Bold_16Bitmaps[] PROGMEM = { + + // Bitmap Data: + 0x00, // ' ' + 0xDB,0x6D,0xB6,0xC3,0x60, // '!' + 0xDB,0x6D,0x34, // '"' + 0x16,0x0B,0x05,0x0F,0xE3,0x41,0xA0,0xB1,0xFC,0x2C,0x14,0x0A,0x0D,0x00, // '#' + 0x10,0x21,0xE7,0xEC,0xD9,0xB8,0x38,0x3C,0x1B,0x36,0x6F,0xCF,0x0C,0x18, // '$' + 0xE0,0x59,0x2D,0x16,0x8E,0x80,0x40,0x40,0x2E,0x2D,0x16,0x93,0x40,0xE0, // '%' + 0x38,0x0F,0x06,0x61,0x90,0x3C,0x0E,0x07,0xB1,0xFC,0xEF,0x19,0xC7,0xF0,0xFE, // '&' + 0xAA, // ''' + 0x21,0x98,0x8C,0x63,0x18,0xC6,0x31,0x8C,0x21,0x84,0x30, // '(' + 0x82,0x18,0x43,0x18,0xC6,0x31,0x8C,0x63,0x11,0x88,0x80, // ')' + 0x10,0x10,0xFE,0x18,0x28,0x6C, // '*' + 0x30,0x60,0xC7,0xEF,0xC6,0x0C,0x18, // '+' + 0x66,0x66,0xC0, // ',' + 0xF7,0x80, // '-' + 0xEE, // '.' + 0x18,0x61,0x0C,0x30,0xC2,0x18,0x61,0x84,0x30,0xC0, // '/' + 0x79,0xFB,0x36,0x6C,0xD9,0xB3,0x66,0xCD,0x9B,0xF3,0xC0, // '0' + 0x19,0xEF,0xAE,0x38,0xE3,0x8E,0x38,0xE3,0x8E, // '1' + 0x79,0xFB,0x36,0x60,0xC3,0x86,0x18,0x71,0xC3,0xF7,0xE0, // '2' + 0x3C,0x7E,0x66,0x06,0x1C,0x1C,0x06,0x06,0x06,0xE6,0x7E,0x3C, // '3' + 0x1C,0x1C,0x3C,0x3C,0x7C,0x5C,0xDC,0xFE,0xFE,0x1C,0x1C,0x1C, // '4' + 0xFD,0xFB,0x06,0x0F,0x9F,0x83,0x06,0x0D,0x9B,0xF3,0xC0, // '5' + 0x18,0xF1,0x86,0x0F,0x9F,0xB3,0x66,0xCD,0x99,0xF3,0xC0, // '6' + 0xFD,0xF8,0x30,0x61,0x83,0x0E,0x18,0x30,0xE1,0x87,0x00, // '7' + 0x79,0xFB,0x36,0x6C,0xCF,0x1E,0x66,0xCD,0x9B,0xF3,0xC0, // '8' + 0x79,0xF3,0x36,0x6C,0xD9,0xBF,0x3E,0x0C,0x31,0xE3,0x80, // '9' + 0xEE,0x00,0x00,0xEE, // ':' + 0x73,0x80,0x00,0x01,0x8C,0x63,0x30, // ';' + 0x04,0x39,0xF7,0x8F,0x0F,0x87,0x02, // '<' + 0xFD,0xF8,0x07,0xEF,0xC0, // '=' + 0x81,0xC3,0xE0,0xE3,0xDF,0x38,0x40, // '>' + 0x38,0xFB,0xB0,0x60,0xC3,0x86,0x18,0x30,0x00,0xC1,0xC0, // '?' + 0x0F,0x80,0x86,0x08,0x18,0xCE,0x44,0xDA,0x24,0x91,0x64,0x8B,0x24,0x59,0x22,0x59,0x13,0x70,0xC0,0x03,0x10,0x0F,0x80, // '@' + 0x0C,0x01,0x80,0x78,0x0F,0x01,0xE0,0x66,0x0C,0xC1,0x98,0x7F,0x8F,0xF1,0x86,0x70,0xE0, // 'A' + 0xFC,0xFE,0xC6,0xC6,0xFC,0xFE,0xC6,0xC6,0xC6,0xC6,0xFE,0xFC, // 'B' + 0x3C,0x3F,0x31,0x98,0xEC,0x06,0x03,0x01,0x80,0xC7,0x63,0x1F,0x87,0x80, // 'C' + 0xF8,0xFC,0xCE,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xCE,0xFC,0xF8, // 'D' + 0xFD,0xFB,0x06,0x0C,0x1F,0xBF,0x60,0xC1,0x83,0xF7,0xE0, // 'E' + 0xFD,0xFB,0x06,0x0C,0x1F,0xBF,0x60,0xC1,0x83,0x06,0x00, // 'F' + 0x3C,0xFE,0xC6,0xC6,0xC0,0xC0,0xCE,0xCE,0xC6,0xE6,0xFE,0x3C, // 'G' + 0xC3,0x61,0xB0,0xD8,0x6C,0x37,0xFB,0xFD,0x86,0xC3,0x61,0xB0,0xD8,0x60, // 'H' + 0xDB,0x6D,0xB6,0xDB,0x60, // 'I' + 0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0xE6,0x6E,0x7C,0x38, // 'J' + 0xC7,0x67,0x33,0x1B,0x8D,0x87,0xC3,0xE1,0xF8,0xCC,0x67,0x31,0x98,0xE0, // 'K' + 0xC1,0x83,0x06,0x0C,0x18,0x30,0x60,0xC1,0x83,0xF7,0xE0, // 'L' + 0xE1,0xDC,0x3B,0xC7,0x79,0xEF,0x3D,0xE7,0xB6,0xB6,0xF6,0xDE,0xD9,0xDB,0x33,0x66,0x60, // 'M' + 0xE3,0x71,0xB8,0xDE,0x6D,0x36,0xDB,0x6D,0x9E,0xCF,0x63,0xB1,0xD8,0xE0, // 'N' + 0x3C,0x3F,0x39,0xD8,0x6C,0x36,0x1B,0x0D,0x86,0xC3,0x73,0x9F,0x87,0x80, // 'O' + 0xFC,0xFE,0xC6,0xC6,0xC6,0xC6,0xFE,0xFC,0xC0,0xC0,0xC0,0xC0, // 'P' + 0x3C,0x3F,0x39,0xD8,0x6C,0x36,0x1B,0x0D,0x86,0xC3,0x73,0x9F,0x87,0xC0,0x70,0x10, // 'Q' + 0xFC,0x7F,0x31,0x98,0xCC,0x66,0x33,0xF9,0xF8,0xCC,0x67,0x33,0x98,0xE0, // 'R' + 0x3C,0x7E,0xE6,0xC6,0xE0,0x78,0x3C,0x0E,0xC6,0xC6,0xFE,0x3C, // 'S' + 0xFF,0x7F,0x86,0x03,0x01,0x80,0xC0,0x60,0x30,0x18,0x0C,0x06,0x03,0x00, // 'T' + 0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xFE,0x7C, // 'U' + 0xE3,0xB8,0xE6,0x31,0x8C,0x77,0x0D,0x83,0x60,0xD8,0x36,0x07,0x01,0xC0,0x70, // 'V' + 0xE6,0x73,0x33,0x19,0x98,0xDE,0xC6,0xF6,0x37,0xB1,0xFF,0x87,0xF8,0x39,0xC1,0xCE,0x0E,0x70,0x73,0x80, // 'W' + 0xE3,0x9D,0xC7,0x70,0xD8,0x3E,0x07,0x01,0xC0,0xF8,0x36,0x1D,0xC6,0x73,0x8E, // 'X' + 0xE3,0x98,0xC6,0x70,0xD8,0x36,0x0F,0x01,0xC0,0x70,0x1C,0x07,0x01,0xC0,0x70, // 'Y' + 0xFE,0xFE,0x0C,0x1C,0x18,0x38,0x30,0x70,0x60,0xE0,0xFE,0xFE, // 'Z' + 0xEE,0xCC,0xCC,0xCC,0xCC,0xCC,0xCC,0xEE, // '[' + 0xC0,0xC1,0x83,0x07,0x06,0x0C,0x1C,0x18,0x30,0x70,0x60,0xC0, // '\' + 0xEE,0x66,0x66,0x66,0x66,0x66,0x66,0xEE, // ']' + 0x30,0x61,0xE3,0xC4,0x99,0x80, // '^' + 0xFD,0xF8, // '_' + 0xE1,0x80, // '`' + 0x79,0xFB,0x30,0x67,0xDF,0xB3,0x7E,0x7C, // 'a' + 0xC1,0x83,0x07,0xCF,0xD9,0xB3,0x66,0xCD,0x9B,0xF7,0xC0, // 'b' + 0x38,0x7C,0x6E,0xE0,0xE0,0xE0,0x66,0x7C,0x38, // 'c' + 0x0C,0x18,0x33,0xEF,0xD9,0xB3,0x66,0xCD,0x9B,0xF3,0xE0, // 'd' + 0x79,0xFB,0x36,0x6F,0xDF,0xB2,0x7E,0x78, // 'e' + 0x39,0xE6,0x3E,0xF9,0x86,0x18,0x61,0x86,0x18, // 'f' + 0x7D,0xFB,0x36,0x6C,0xD9,0xB3,0x7E,0x7C,0x1B,0xF3,0xC0, // 'g' + 0xC1,0x83,0x07,0xCF,0xD9,0xB3,0x66,0xCD,0x9B,0x36,0x60, // 'h' + 0xD8,0x6D,0xB6,0xDB,0x60, // 'i' + 0x66,0x06,0x66,0x66,0x66,0x66,0x6E,0xC0, // 'j' + 0xC0,0xC0,0xC0,0xCC,0xD8,0xF8,0xF0,0xF0,0xF8,0xD8,0xDC,0xCE, // 'k' + 0xDB,0x6D,0xB6,0xDB,0x60, // 'l' + 0xFB,0x9F,0xFB,0x33,0x66,0x6C,0xCD,0x99,0xB3,0x36,0x66,0xCC,0xC0, // 'm' + 0xF9,0xFB,0x36,0x6C,0xD9,0xB3,0x66,0xCC, // 'n' + 0x79,0xFB,0x36,0x6C,0xD9,0xB3,0x7E,0x78, // 'o' + 0xF9,0xFB,0x36,0x6C,0xD9,0xB3,0x7E,0xF9,0x83,0x06,0x00, // 'p' + 0x7D,0xFB,0x36,0x6C,0xD9,0xB3,0x7E,0x7C,0x18,0x30,0x60, // 'q' + 0xF7,0xB1,0x8C,0x63,0x18,0xC0, // 'r' + 0x38,0x7C,0x6E,0x70,0x7C,0x1C,0xEE,0x7C,0x38, // 's' + 0x61,0x8F,0xBE,0x61,0x86,0x18,0x61,0xE3,0x80, // 't' + 0xCD,0x9B,0x36,0x6C,0xD9,0xB3,0x7E,0x7C, // 'u' + 0xEE,0xEC,0x6C,0x6C,0x6C,0x28,0x38,0x38,0x38, // 'v' + 0xCC,0xDD,0xB1,0xB6,0x3F,0xC7,0xF8,0xFF,0x1C,0xE1,0x98,0x33,0x00, // 'w' + 0xEE,0x6C,0x7C,0x38,0x38,0x3C,0x7C,0x6C,0xE6, // 'x' + 0xEE,0xEC,0x6C,0x6C,0x6C,0x38,0x38,0x38,0x38,0x30,0x70,0x60, // 'y' + 0xFD,0xF8,0x61,0x87,0x0C,0x38,0x7E,0xFC, // 'z' + 0x26,0x66,0x66,0xCC,0xCE,0x66,0x66,0x20, // '{' + 0xDB,0x6D,0xB6,0xDB,0x6D,0x80, // '|' + 0x8C,0xCC,0xCC,0x66,0x6E,0xCC,0xCC,0x80 // '}' +}; +const GFXglyph Roboto_Condensed_Bold_16Glyphs[] PROGMEM = { +// bitmapOffset, width, height, xAdvance, xOffset, yOffset + { 0, 1, 1, 5, 0, 0 }, // ' ' + { 1, 3, 12, 5, 1, -12 }, // '!' + { 6, 6, 4, 6, 0, -12 }, // '"' + { 9, 9, 12, 9, 0, -12 }, // '#' + { 23, 7, 16, 9, 1, -14 }, // '$' + { 37, 9, 12, 11, 1, -12 }, // '%' + { 51, 10, 12, 10, 0, -12 }, // '&' + { 66, 2, 4, 4, 1, -12 }, // ''' + { 67, 5, 17, 6, 1, -13 }, // '(' + { 78, 5, 17, 6, 0, -13 }, // ')' + { 89, 8, 6, 8, 0, -12 }, // '*' + { 95, 7, 8, 9, 1, -9 }, // '+' + { 102, 4, 5, 5, 0, -2 }, // ',' + { 105, 5, 2, 7, 1, -6 }, // '-' + { 107, 4, 2, 6, 1, -2 }, // '.' + { 108, 6, 13, 6, 0, -12 }, // '/' + { 118, 7, 12, 9, 1, -12 }, // '0' + { 129, 6, 12, 9, 1, -12 }, // '1' + { 138, 7, 12, 9, 1, -12 }, // '2' + { 149, 8, 12, 9, 0, -12 }, // '3' + { 161, 8, 12, 9, 1, -12 }, // '4' + { 173, 7, 12, 9, 1, -12 }, // '5' + { 184, 7, 12, 9, 1, -12 }, // '6' + { 195, 7, 12, 9, 1, -12 }, // '7' + { 206, 7, 12, 9, 1, -12 }, // '8' + { 217, 7, 12, 9, 1, -12 }, // '9' + { 228, 4, 8, 5, 1, -8 }, // ':' + { 232, 5, 11, 5, 0, -8 }, // ';' + { 239, 7, 8, 8, 0, -9 }, // '<' + { 246, 7, 5, 9, 1, -7 }, // '=' + { 251, 7, 8, 8, 1, -9 }, // '>' + { 258, 7, 12, 8, 0, -12 }, // '?' + { 269, 13, 14, 13, 0, -11 }, // '@' + { 292, 11, 12, 11, 0, -12 }, // 'A' + { 309, 8, 12, 10, 1, -12 }, // 'B' + { 321, 9, 12, 10, 1, -12 }, // 'C' + { 335, 8, 12, 10, 1, -12 }, // 'D' + { 347, 7, 12, 9, 1, -12 }, // 'E' + { 358, 7, 12, 9, 1, -12 }, // 'F' + { 369, 8, 12, 10, 1, -12 }, // 'G' + { 381, 9, 12, 11, 1, -12 }, // 'H' + { 395, 3, 12, 5, 1, -12 }, // 'I' + { 400, 8, 12, 9, 0, -12 }, // 'J' + { 412, 9, 12, 10, 1, -12 }, // 'K' + { 426, 7, 12, 9, 1, -12 }, // 'L' + { 437, 11, 12, 13, 1, -12 }, // 'M' + { 454, 9, 12, 11, 1, -12 }, // 'N' + { 468, 9, 12, 11, 1, -12 }, // 'O' + { 482, 8, 12, 10, 1, -12 }, // 'P' + { 494, 9, 14, 11, 1, -12 }, // 'Q' + { 510, 9, 12, 10, 1, -12 }, // 'R' + { 524, 8, 12, 10, 1, -12 }, // 'S' + { 536, 9, 12, 10, 0, -12 }, // 'T' + { 550, 8, 12, 10, 1, -12 }, // 'U' + { 562, 10, 12, 10, 0, -12 }, // 'V' + { 577, 13, 12, 13, 0, -12 }, // 'W' + { 597, 10, 12, 10, 0, -12 }, // 'X' + { 612, 10, 12, 10, 0, -12 }, // 'Y' + { 627, 8, 12, 9, 1, -12 }, // 'Z' + { 639, 4, 16, 5, 1, -13 }, // '[' + { 647, 7, 13, 7, 0, -12 }, // '\' + { 659, 4, 16, 5, 0, -13 }, // ']' + { 667, 7, 6, 7, 0, -12 }, // '^' + { 673, 7, 2, 7, 0, 0 }, // '_' + { 675, 5, 2, 6, 0, -12 }, // '`' + { 677, 7, 9, 9, 1, -9 }, // 'a' + { 685, 7, 12, 9, 1, -12 }, // 'b' + { 696, 8, 9, 8, 0, -9 }, // 'c' + { 705, 7, 12, 9, 1, -12 }, // 'd' + { 716, 7, 9, 9, 1, -9 }, // 'e' + { 724, 6, 12, 6, 0, -12 }, // 'f' + { 733, 7, 12, 9, 1, -9 }, // 'g' + { 744, 7, 12, 9, 1, -12 }, // 'h' + { 755, 3, 12, 5, 1, -12 }, // 'i' + { 760, 4, 15, 5, 0, -12 }, // 'j' + { 768, 8, 12, 9, 1, -12 }, // 'k' + { 780, 3, 12, 5, 1, -12 }, // 'l' + { 785, 11, 9, 13, 1, -9 }, // 'm' + { 798, 7, 9, 9, 1, -9 }, // 'n' + { 806, 7, 9, 9, 1, -9 }, // 'o' + { 814, 7, 12, 9, 1, -9 }, // 'p' + { 825, 7, 12, 9, 1, -9 }, // 'q' + { 836, 5, 9, 6, 1, -9 }, // 'r' + { 842, 8, 9, 8, 0, -9 }, // 's' + { 851, 6, 11, 6, 0, -11 }, // 't' + { 860, 7, 9, 9, 1, -9 }, // 'u' + { 868, 8, 9, 8, 0, -9 }, // 'v' + { 877, 11, 9, 11, 0, -9 }, // 'w' + { 890, 8, 9, 8, 0, -9 }, // 'x' + { 899, 8, 12, 8, 0, -9 }, // 'y' + { 911, 7, 9, 8, 1, -9 }, // 'z' + { 919, 4, 15, 6, 1, -12 }, // '{' + { 927, 3, 14, 5, 1, -12 }, // '|' + { 933, 4, 15, 6, 1, -12 } // '}' +}; +const GFXfont Roboto_Condensed_Bold_16 PROGMEM = { +(uint8_t *)Roboto_Condensed_Bold_16Bitmaps,(GFXglyph *)Roboto_Condensed_Bold_16Glyphs,0x20, 0x7E, 19}; \ No newline at end of file diff --git a/src/core/watch/tft.cpp b/src/core/watch/tft.cpp index 4d8d4b1..fcdb612 100644 --- a/src/core/watch/tft.cpp +++ b/src/core/watch/tft.cpp @@ -10,7 +10,8 @@ */ #include "tft.hpp" #include "ttgo.hpp" -#include "fonts.hpp" +#include "smallFont.hpp" +#include "mediumFont.hpp" static TFT_eSprite *sprite; static bool dirty; @@ -24,14 +25,17 @@ static void setTextSize(unsigned char s) static void setTextFont(unsigned char f) { dirty = true; - if (f == MIDDLE_FONT) + if (f == SMALL_FONT) { - sprite->setFreeFont(&Roboto_Condensed_Bold_24); + sprite->setFreeFont(&Roboto_Condensed_Bold_16); + return; } - else + if (f == MEDIUM_FONT) { - sprite->setTextFont(f); + sprite->setFreeFont(&Roboto_Condensed_Bold_24); + return; } + sprite->setTextFont(f); } static void setTextColor(unsigned short f, unsigned short b) diff --git a/src/core/watch/tft.hpp b/src/core/watch/tft.hpp index 3c2a865..f3bb3ad 100644 --- a/src/core/watch/tft.hpp +++ b/src/core/watch/tft.hpp @@ -7,7 +7,8 @@ */ #pragma once -const unsigned char MIDDLE_FONT = 128; +const unsigned char SMALL_FONT = 128; +const unsigned char MEDIUM_FONT = 129; typedef struct {