Skip to content

Commit

Permalink
#100 custom fonts
Browse files Browse the repository at this point in the history
first poc
  • Loading branch information
igors48 committed Jun 26, 2022
1 parent 5b5e776 commit b1b4aac
Show file tree
Hide file tree
Showing 6 changed files with 228 additions and 19 deletions.
12 changes: 6 additions & 6 deletions src/apps/clock/clockAppTile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,9 @@ 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)(4, 1, COLOR_INFORMATION, provideBatteryState);
dateState = (factory->createTextStateRef)(4, 1, COLOR_ATTENTION, provideDateState);
stepCounter = (factory->createTextStateRef)(4, 1, COLOR_INFORMATION, provideStepCounterState);
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);
Expand All @@ -158,9 +158,9 @@ Component *createClockAppTile(ClockAppApi *clockAppApi, Factory *factory)

components[0] = hourMinuteText;
components[1] = secondText;
components[2] = (factory->createTextComponentRef)(125, 110, 50, 50, battery);
components[3] = (factory->createTextComponentRef)(50, 135, 50, 50, dateState);
components[4] = (factory->createTextComponentRef)(25, 110, 50, 50, stepCounter);
components[2] = (factory->createTextComponentRef)(135, 110, 50, 50, battery);
components[3] = (factory->createTextComponentRef)(60, 135, 50, 50, dateState);
components[4] = (factory->createTextComponentRef)(35, 110, 50, 50, stepCounter);
components[5] = (factory->createTextComponentRef)(10, 180, 50, 50, wakeUpReason);
components[6] = (factory->createTextComponentRef)(10, 200, 50, 50, timeToSleep);
components[7] = (factory->createTextComponentRef)(10, 220, 50, 50, nextWakeUp);
Expand Down
2 changes: 1 addition & 1 deletion src/apps/step/stepAppTile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ Component* createStepAppTile(StepAppApi* stepAppApi, Factory *factory)
{
api = stepAppApi;

stepCounter = (factory->createTextStateRef)(1, 3, COLOR_ATTENTION, provideStepCounterState);
stepCounter = (factory->createTextStateRef)(MIDDLE_FONT, 0, COLOR_ATTENTION, provideStepCounterState);
resetButtonState = (factory->createButtonStateRef)(RESET, EG_ONCE, reset);

stepCounterComponent = (factory->createTextComponentRef)(55, 120, 50, 50, stepCounter);
Expand Down
6 changes: 3 additions & 3 deletions src/core/component/textComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ bool textComponentIsStateModified(Component *component)
TextState *state = (TextState *)component->state;
(state->provide)(state);
return (strcmp(state->content, state->_content) != 0) ||
(state->size != state->_size) ||
//(state->size != state->_size) || todo is these checks needed
(state->fontColor != state->_fontColor) ||
(state->backColor != state->_backColor) ||
(state->font != state->_font);
(state->backColor != state->_backColor); //||
//(state->font != state->_font);
}

void textComponentUpdateState(Component *component)
Expand Down
199 changes: 199 additions & 0 deletions src/core/watch/fonts.hpp
Original file line number Diff line number Diff line change
@@ -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_24Bitmaps[] PROGMEM = {

// Bitmap Data:
0x00, // ' '
0xF7,0xBD,0xEF,0x39,0xCE,0x73,0x98,0x00,0x33,0xDE,0x60, // '!'
0xCD,0x9B,0x36,0x6C,0xD9,0x80, // '"'
0x0C,0xC0,0xD8,0x0D,0x81,0xD8,0x19,0x87,0xFE,0x7F,0xE1,0xB8,0x1B,0x01,0xB0,0xFF,0xCF,0xFC,0x33,0x03,0x30,0x36,0x03,0x60,0x76,0x00, // '#'
0x0C,0x01,0x80,0x30,0x0F,0x03,0xF8,0xFF,0x1C,0xF3,0x8E,0x71,0xCF,0x01,0xF8,0x1F,0x80,0xF8,0x07,0xB8,0x77,0x0E,0xF3,0xCF,0xF9,0xFE,0x0F,0x80,0xC0,0x18,0x00, // '$'
0x78,0x03,0xF0,0x0C,0xC4,0x33,0x38,0xCC,0xC3,0x36,0x0F,0xD8,0x1E,0xC0,0x03,0x00,0x1B,0xC0,0x7F,0x83,0x66,0x0D,0x98,0x66,0x61,0x99,0x8C,0x7E,0x00,0xF0, // '%'
0x1E,0x00,0xFC,0x07,0xF8,0x1C,0xE0,0x73,0x81,0xCE,0x03,0xF0,0x0F,0x80,0x3C,0x01,0xF9,0xCF,0xF6,0x39,0xF8,0xE3,0xE3,0xCF,0x8F,0xFE,0x1F,0xF8,0x3E,0xF8, // '&'
0xDB,0x6D,0x80, // '''
0x08,0x63,0x9C,0x71,0x8E,0x38,0xE3,0x0C,0x30,0xC3,0x0C,0x38,0xE3,0x86,0x18,0x70,0xE1,0x82, // '('
0x81,0x83,0x83,0x87,0x07,0x0E,0x1C,0x38,0x30,0x70,0xE1,0xC3,0x86,0x1C,0x38,0x70,0xE3,0x87,0x1C,0x30,0x40, // ')'
0x0E,0x00,0x60,0x86,0x07,0x7C,0xFF,0xE0,0xE0,0x1F,0x03,0xB8,0x31,0x85,0x10, // '*'
0x1C,0x03,0x80,0x70,0x0E,0x01,0xC1,0xFF,0xBF,0xF7,0xFE,0x1C,0x03,0x80,0x70,0x0E,0x01,0xC0, // '+'
0x38,0xE3,0x8C,0x71,0xCE,0x00, // ','
0xFD,0xFB,0xF0, // '-'
0x73,0xBC,0xE0, // '.'
0x07,0x03,0x03,0x81,0xC0,0xC0,0x60,0x70,0x30,0x18,0x1C,0x0E,0x06,0x03,0x03,0x81,0x80,0xC0,0xE0,0x70,0x00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1E,0x07,0xE1,0xFE,0x79,0xCF,0x3D,0xC7,0xB8,0x77,0x0E,0xF3,0xCF,0xF9,0xFF,0x1F,0xC0,0x38,0x0F,0x0F,0xC1,0xF0,0x38,0x00, // '9'
0x73,0xBC,0xE0,0x00,0x00,0x00,0x1C,0xEF,0x38, // ':'
0x38,0xE7,0x8E,0x00,0x00,0x00,0x00,0x00,0x0E,0x38,0xE3,0x1C,0x73,0x80, // ';'
0x01,0x03,0x87,0xCF,0xEF,0x87,0x03,0xE0,0xFE,0x1F,0x03,0x80,0x40, // '<'
0xFF,0x7F,0xBF,0xC0,0x00,0x07,0xFB,0xFD,0xFE, // '='
0x80,0x3C,0x0F,0xC1,0xFC,0x0F,0x80,0xE1,0xF9,0xFC,0xFC,0x3C,0x08,0x00, // '>'
0x3E,0x1F,0xCF,0xFB,0x9E,0xE3,0x81,0xE0,0x70,0x38,0x1C,0x07,0x01,0xC0,0x00,0x00,0x06,0x03,0xC0,0xF0,0x18,0x00, // '?'
0x03,0xE0,0x07,0xFC,0x07,0x07,0x07,0x01,0xC7,0x00,0x63,0x0F,0x19,0x8F,0xCD,0xCE,0xE6,0xC6,0x73,0x67,0x39,0xB3,0x9C,0xD9,0xCC,0x6C,0xE6,0x36,0x73,0x1B,0x3B,0x99,0x8F,0xFC,0xE7,0x3C,0x30,0x00,0x1C,0x00,0x07,0x04,0x01,0xFE,0x00,0x3F,0x80, // '@'
0x07,0x80,0x0F,0x00,0x1E,0x00,0x7E,0x00,0xFC,0x01,0xF8,0x07,0xF8,0x0E,0x70,0x1C,0xE0,0x79,0xE0,0xF3,0xC1,0xFF,0x87,0xFF,0x8F,0xFF,0x1C,0x1E,0x38,0x1C,0xF0,0x3C, // 'A'
0xFF,0x0F,0xFC,0xFF,0xCF,0x1E,0xF1,0xEF,0x1E,0xF1,0xEF,0xFC,0xFF,0x8F,0xFC,0xF1,0xEF,0x0E,0xF0,0xEF,0x1E,0xFF,0xEF,0xFC,0xFF,0x80, // 'B'
0x0F,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x1C,0x71,0xC7,0xBC,0x3B,0x83,0xB8,0x3B,0x83,0xF8,0x1F,0x01,0xF0,0x1F,0x00,0xE0,0x0E,0x00,0xE0,0x1E,0x03,0xC0,0x3C,0x03,0x80, // 'y'
0xFF,0xBF,0xEF,0xF8,0x1C,0x0E,0x07,0x81,0xC0,0xE0,0x78,0x1C,0x0F,0xFB,0xFE,0xFF,0x80, // 'z'
0x08,0xE3,0x9C,0x71,0xC7,0x1C,0x71,0xCE,0x30,0xE1,0xC7,0x1C,0x71,0xC7,0x1C,0x38,0xE0,0x80, // '{'
0xDB,0x6D,0xB6,0xDB,0x6D,0xB6,0xDB,0x60, // '|'
0x83,0x8E,0x1C,0x71,0xC7,0x1C,0x71,0xC3,0x86,0x39,0xC7,0x1C,0x71,0xC7,0x1C,0xE3,0x88,0x00 // '}'
};
const GFXglyph Roboto_Condensed_Bold_24Glyphs[] PROGMEM = {
// bitmapOffset, width, height, xAdvance, xOffset, yOffset
{ 0, 1, 1, 7, 0, 0 }, // ' '
{ 1, 5, 17, 7, 1, -17 }, // '!'
{ 12, 7, 6, 9, 1, -18 }, // '"'
{ 18, 12, 17, 14, 1, -17 }, // '#'
{ 44, 11, 22, 13, 1, -20 }, // '$'
{ 75, 14, 17, 16, 1, -17 }, // '%'
{ 105, 14, 17, 15, 1, -17 }, // '&'
{ 135, 3, 6, 5, 1, -18 }, // '''
{ 138, 6, 24, 9, 2, -19 }, // '('
{ 156, 7, 24, 9, 1, -19 }, // ')'
{ 177, 12, 10, 12, 0, -17 }, // '*'
{ 192, 11, 13, 12, 1, -15 }, // '+'
{ 210, 6, 7, 7, 0, -3 }, // ','
{ 216, 7, 3, 10, 1, -9 }, // '-'
{ 219, 5, 4, 8, 1, -4 }, // '.'
{ 222, 9, 18, 9, 0, -17 }, // '/'
{ 243, 11, 17, 13, 1, -17 }, // '0'
{ 267, 7, 17, 13, 2, -17 }, // '1'
{ 282, 11, 17, 13, 1, -17 }, // '2'
{ 306, 11, 17, 13, 1, -17 }, // '3'
{ 330, 11, 17, 13, 1, -17 }, // '4'
{ 354, 11, 17, 13, 1, -17 }, // '5'
{ 378, 11, 17, 13, 1, -17 }, // '6'
{ 402, 11, 17, 13, 1, -17 }, // '7'
{ 426, 11, 17, 13, 1, -17 }, // '8'
{ 450, 11, 17, 13, 1, -17 }, // '9'
{ 474, 5, 14, 8, 1, -14 }, // ':'
{ 483, 6, 18, 7, 0, -14 }, // ';'
{ 497, 9, 11, 12, 1, -13 }, // '<'
{ 510, 9, 8, 13, 2, -11 }, // '='
{ 519, 10, 11, 12, 1, -13 }, // '>'
{ 533, 10, 17, 12, 1, -17 }, // '?'
{ 555, 17, 22, 19, 1, -17 }, // '@'
{ 602, 15, 17, 15, 0, -17 }, // 'A'
{ 634, 12, 17, 14, 1, -17 }, // 'B'
{ 660, 13, 17, 15, 1, -17 }, // 'C'
{ 688, 12, 17, 15, 2, -17 }, // 'D'
{ 714, 11, 17, 13, 1, -17 }, // 'E'
{ 738, 11, 17, 12, 1, -17 }, // 'F'
{ 762, 13, 17, 15, 1, -17 }, // 'G'
{ 790, 13, 17, 16, 1, -17 }, // 'H'
{ 818, 4, 17, 8, 2, -17 }, // 'I'
{ 827, 11, 17, 13, 1, -17 }, // 'J'
{ 851, 13, 17, 14, 1, -17 }, // 'K'
{ 879, 11, 17, 12, 1, -17 }, // 'L'
{ 903, 17, 17, 19, 1, -17 }, // 'M'
{ 940, 13, 17, 16, 2, -17 }, // 'N'
{ 968, 13, 17, 15, 1, -17 }, // 'O'
{ 996, 12, 17, 15, 2, -17 }, // 'P'
{ 1022, 13, 20, 15, 1, -17 }, // 'Q'
{ 1055, 13, 17, 14, 1, -17 }, // 'R'
{ 1083, 12, 17, 14, 1, -17 }, // 'S'
{ 1109, 12, 17, 14, 1, -17 }, // 'T'
{ 1135, 13, 17, 15, 1, -17 }, // 'U'
{ 1163, 15, 17, 15, 0, -17 }, // 'V'
{ 1195, 18, 17, 19, 1, -17 }, // 'W'
{ 1234, 14, 17, 14, 0, -17 }, // 'X'
{ 1264, 14, 17, 14, 0, -17 }, // 'Y'
{ 1294, 12, 17, 14, 1, -17 }, // 'Z'
{ 1320, 6, 24, 7, 1, -20 }, // '['
{ 1338, 10, 18, 10, 0, -17 }, // '\'
{ 1361, 6, 24, 7, 0, -20 }, // ']'
{ 1379, 10, 8, 10, 0, -17 }, // '^'
{ 1389, 10, 3, 11, 0, 0 }, // '_'
{ 1393, 7, 4, 9, 1, -18 }, // '`'
{ 1397, 10, 13, 12, 1, -13 }, // 'a'
{ 1414, 11, 18, 13, 1, -18 }, // 'b'
{ 1439, 10, 13, 12, 1, -13 }, // 'c'
{ 1456, 11, 18, 13, 1, -18 }, // 'd'
{ 1481, 11, 13, 12, 1, -13 }, // 'e'
{ 1499, 8, 18, 9, 1, -18 }, // 'f'
{ 1517, 11, 18, 13, 1, -13 }, // 'g'
{ 1542, 11, 18, 13, 1, -18 }, // 'h'
{ 1567, 5, 19, 7, 1, -19 }, // 'i'
{ 1579, 7, 24, 7, -1, -19 }, // 'j'
{ 1600, 12, 18, 12, 1, -18 }, // 'k'
{ 1627, 5, 18, 7, 1, -18 }, // 'l'
{ 1639, 17, 13, 19, 1, -13 }, // 'm'
{ 1667, 11, 13, 13, 1, -13 }, // 'n'
{ 1685, 11, 13, 13, 1, -13 }, // 'o'
{ 1703, 11, 18, 13, 1, -13 }, // 'p'
{ 1728, 11, 18, 13, 1, -13 }, // 'q'
{ 1753, 8, 13, 9, 1, -13 }, // 'r'
{ 1766, 10, 13, 12, 1, -13 }, // 's'
{ 1783, 8, 16, 8, 0, -16 }, // 't'
{ 1799, 11, 13, 13, 1, -13 }, // 'u'
{ 1817, 12, 13, 12, 0, -13 }, // 'v'
{ 1837, 16, 13, 16, 0, -13 }, // 'w'
{ 1863, 12, 13, 12, 0, -13 }, // 'x'
{ 1883, 12, 18, 12, 0, -13 }, // 'y'
{ 1910, 10, 13, 12, 1, -13 }, // 'z'
{ 1927, 6, 23, 8, 1, -19 }, // '{'
{ 1945, 3, 20, 7, 2, -17 }, // '|'
{ 1953, 6, 23, 8, 1, -19 } // '}'
};
const GFXfont Roboto_Condensed_Bold_24 PROGMEM = {
(uint8_t *)Roboto_Condensed_Bold_24Bitmaps,(GFXglyph *)Roboto_Condensed_Bold_24Glyphs,0x20, 0x7E, 29};
26 changes: 17 additions & 9 deletions src/core/watch/tft.cpp
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
/**
* @file
* @file
* @author Igor Usenko (github: igors48)
* @brief TFT API implementation based on sprite
*
* Holds in memory full-screen sprite
* All drawings are performed on that sprite
* When all is drawn - sprite is pushed to video memory
* Also maintains the dirty flag to prevent not needed pushes
*/
*
* Holds in memory full-screen sprite
* All drawings are performed on that sprite
* When all is drawn - sprite is pushed to video memory
* Also maintains the dirty flag to prevent not needed pushes
*/
#include "tft.hpp"
#include "ttgo.hpp"
#include "fonts.hpp"

static TFT_eSprite *sprite;
static bool dirty;
Expand All @@ -23,7 +24,14 @@ static void setTextSize(unsigned char s)
static void setTextFont(unsigned char f)
{
dirty = true;
sprite->setTextFont(f);
if (f == MIDDLE_FONT)
{
sprite->setFreeFont(&Roboto_Condensed_Bold_24);
}
else
{
sprite->setTextFont(f);
}
}

static void setTextColor(unsigned short f, unsigned short b)
Expand Down Expand Up @@ -89,7 +97,7 @@ TftApi watchTftApi()
sprite->createSprite(240, 240);

dirty = false;

return {
.setTextSize = setTextSize,
.setTextFont = setTextFont,
Expand Down
Loading

0 comments on commit b1b4aac

Please sign in to comment.