// simple project using Arduino UNO and 128x64 SSD1306 IIC OLED Display 
// to show custom fonts for u8g2 library

// created by upir, 2023
// youtube channel: https://www.youtube.com/upir_upir

// YOUTUBE VIDEO: https://youtu.be/WIAcy5FXuAA
// SOURCE FILES: https://github.com/upiir/u8g2_custom_fonts

// Links from the video:
// Custom fonts FAQ: https://github.com/olikraus/u8g2/blob/c7dc077995ca513337a7d2a1970df693e18ee308/doc/faq.txt#L245
// bdfconv utility: https://github.com/olikraus/u8g2/tree/master/tools/font/bdfconv
// 128x64 SSD1306 OLED Display 1.54": https://s.click.aliexpress.com/e/_DCYdWXb 
// 128x64 SSD1306 OLED Display 0.96": https://s.click.aliexpress.com/e/_DCKdvnh
// 128x64 SSD1306 OLED Display 2.42": https://s.click.aliexpress.com/e/_DFdMoTh
// Arduino UNO: https://s.click.aliexpress.com/e/_AXDw1h
// Arduino breadboard prototyping shield: https://s.click.aliexpress.com/e/_ApbCwx
// Fony Font Editor: http://hukka.ncn.fi/?fony
// Photopea (online graphics editor like Photoshop): https://www.photopea.com/


// Related videos with Arduino UNO and 128x64 OLED screen:
// Arduino OLED menu: https://youtu.be/HVHVkKt-ldc
// U8g vs U8g2: https://youtu.be/K5e0lFRvZ2E
// Arduino Parking Sensor - https://youtu.be/sEWw087KOj0
// Turbo pressure gauge with Arduino and OLED display - https://youtu.be/JXmw1xOlBdk
// Arduino Car Cluster with OLED Display - https://youtu.be/El5SJelwV_0
// Knob over OLED Display - https://youtu.be/SmbcNx7tbX8
// Arduino + OLED = 3D ? - https://youtu.be/kBAcaA7NAlA
// Arduino OLED Gauge - https://youtu.be/xI6dXTA02UQ
// Smaller & Faster Arduino - https://youtu.be/4GfPQoIRqW8
// Save Image from OLED Display to PC - https://youtu.be/Ft2pRMVm44E


#include <Arduino.h>
#include <U8g2lib.h>

#include <Wire.h> // library requires for IIC communication

U8G2_SSD1306_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE); // initialization for the used OLED display

/*
  Fontname: big_digits_aldo
  Copyright: Created with Fony 1.4.7
  Glyphs: 10/256
  BBX Build Mode: 0
*/
/*
  Fontname: Aldo the Apache
  Copyright: 
  Glyphs: 91/256
  BBX Build Mode: 0
*/
const uint8_t aldo_the_apache[1253] U8G2_FONT_SECTION("aldo_the_apache") = 
  "[\0\3\4\4\4\2\5\5\14\22\0\375\14\0\15\377\1\311\3a\4\310 \5\0B\12!\10\302C"
  "\212\207!\2\42\10V\342\13!:\11#\32\313\302M\21Q!Q!\61\25\65!Q!\261\7\263 "
  "\341 Q!\61\0$\20\347><\241\207\244\342\321Q\223\207\64!\0% \313B\36\302\220\262\22\261"
  " \21\241\260\22\61\22q\240\20\302\220\62\21IR\204\302J\2I\0&\15\231\313\275\341i\17l\205"
  "\303\241\0'\6R\342\11\5(\12\344\276\232$\371'\222\1)\13\344\276\212\21\42\371\247\24\0*\16"
  "f[,\241\20\221\223\61\22\241\20\0+\14\231\313\275\341i\17l\303\323\0,\11S:\212\224\20\21"
  "\0-\6$\326\12\4.\6\63B\212\4/\17\344\276\272\230\204\302b\222\24\26I\10\0\60\14\310\302"
  "\234\207!\373\351a\4\0\61\10\305B\33\247\371\7\62\23\310\302,\223\23\241\21\241A\262\42\242\62\302"
  "\321\207\0\63\23\307C\234\22\23!\21!QAQ\302\242\242\207\20\0\64\23\310\303\314\340Aje\42"
  "B#B\222P\16\205\205\0\65\15\306C\14G\211%f%%)\5\66\16\310\302\234\207!\253\17D"
  "\226\36F\0\67\21\307C\14\23\23\241\42\301\211\202\23\5\7\5\1\70\13\306C\234&J\227(\265\0"
  "\71\17\310\302\254\7!K\17\244FF\17#\0:\10\243B\212t\320\4;\13\303:\212t\320\224\20"
  "\21\0<\26\271\302|\220\340A\62\302Qq\220q\0r\0r\200q\220\0=\12h\316\214\207pH"
  "\17\1>\27\271\302\214p\220q\0r\200q\220q\20\321\301A\302\341p\20\0\77\20\306C\214\22$"
  "\42A\61\211\342\220\4\205\0@\27\312C\236\7c\42\224\224!\222!\222!\222!\222!\222\24\23\0"
  "A\14\310\302\254\7!\233\36\216l\32B\16\310\302\214\223%K*'C\226V\16C\15\310\302\234\207"
  "!\253s\62z\30\1D\14\310\302\14\243%\373\351a\4\0E\12\306\302\213\267io\323\30F\12\306"
  "\302\33\267ios\3G\15\310\302\214\223\223\321\271\134+{\30H\14\310\302\214!;=\34\331i\0"
  "I\11\304C\13\224\371e\1J\15\307B\34\33\347hb\362\20\2\0K\17\310\302\214!\223\271\10\31"
  "=\20\331i\0L\11\307\302\213\301\371G\7M\26\311B\215\61\263\23\134LFHFHFHF\210"
  "\202\210\202\4N\15\307B\214\241J&&+\66U\32O\13\310\302\214\7\42\373\351\201\0P\14\310\302"
  "\234\207!;=\234N\5Q\16\350\272\234\207!\373\351\201X\34 \0R\16\310\302\234\207!\233\36N"
  "\346d\64\0S\13\306C\214\227\22\63J\17\15T\12\307C\14\247\301\371'\0U\12\310\302\214!\373"
  "\247\7\2V\21\310B\214\241\21!y\32\21\262\255\214\220\22\0W \314\302\216!\241\21!\241\21!"
  "\231F\204N\204N\304H\310H\310\206\6\207\6\207\6\207\206\0X\23\310\303\214!\221I\42b\25\7"
  "\313*\215\314\42\66\0Y\20\307\303\14!\23\23\241J\204\23\5'\12\2Z\17\307B\234\42\303\261\301"
  "\261\301A\301i\16[\11\343>\12\24\371\27\3\134\15\344\276\12\261\330\204\304\342&\26\3]\11\343\277"
  "\12\23\371\27\4^\5\0B\12_\7)\266\214\207\1`\7#\367\12!\1a\14\310\302\254\7!\233"
  "\36\216l\32b\16\310\302\214\223%K*'C\226V\16c\15\310\302\234\207!\253s\62z\30\1d"
  "\14\310\302\14\243%\373\351a\4\0e\12\306\302\213\267io\323\30f\12\306\302\33\267ios\3g"
  "\15\310\302\214\223\223\321\271\134+{\30h\14\310\302\214!;=\34\331i\0i\10\303B\212\264\207\4"
  "j\15\307B\314\331\1g\64\61y\10\1k\17\310\302\214!\223\271\10\31=\20\331i\0l\11\307\302"
  "\213\301\371G\7m\26\311B\215\61\263\23\134LFHFHFHF\210\202\210\202\4n\15\307B\214"
  "\241J&&+\66U\32o\13\310\302\214\7\42\373\351\201\0p\14\310\302\234\207!;=\234N\5q"
  "\16\350\272\234\207!\373\351\201X\34 \0r\16\310\302\234\207!\233\36N\346d\64\0s\13\306C\214"
  "\227\62\332\212\210\34t\12\307C\14\247\301\371'\0u\12\310\302\214!\373\247\7\2v\21\310B\214\241"
  "\21!y\32\21\262\255\214\220\22\0w \314\302\216!\241\21!\241\21!\231F\204N\204N\304H\310"
  "H\310\206\6\207\6\207\6\207\206\0x\23\310\303\214!\221I\42b\25\7\313*\215\314\42\66\0y\20"
  "\307\303\14!\23\23\241J\204\23\5'\12\2z\17\307B\234\42\303\261\301\261\301A\301i\16\0\0\0"
  "\4\377\377\0";


/*
  Fontname: Aldo the Apache
  Copyright: 
  Glyphs: 91/256
  BBX Build Mode: 0
*/
const uint8_t aldo_the_apache_26pt[2338] U8G2_FONT_SECTION("aldo_the_apache_26pt") = 
  "[\0\4\4\5\5\3\6\6\30%\0\372\31\0\33\375\3,\6@\11\5 \6\0\20D\1!\15%"
  "\27<\341\7%\206\314o\37(\42\12J\65f\201\10\376\23\2#>\66\27\304o\20QBD\11\21"
  "%D\224\20QBc\11\15{`\342\301\203V\204\210\22\42J\210(!\242\204H=\60\361\300\304\3"
  "c\203\210\22\42J\210(!\242\204\210\22\42Jh\34\0$\35\255\327{\213$\241\7\77P\224a\301"
  "s\327\241\273\316\240\32m\36\374@\25IB\0%M\66\27\314\345d \224C\20\16!\62n\14\221"
  "a\203\210\14\33Dd\324(\42\203\206\21\31\63\216\310\230qh\6\42\31yd<\240\61\7\307\240\33"
  "\223l\320\230a\203\306\214\232f\320\260\61\203\304\215\231n\314\220\201)F\242\11z\4\0&\27tv"
  "\274\317\270\275{\360\277c\250\24\261q\362 \306\3\11\14\0'\10D\65\66\341\3\5(\23\310\267S"
  "\247\210\211\7\214\350\377\177\364 \304\21\63\5)\24\310\267S\241\214\221\23\17\2\321\377\377\350\1\13#"
  "e\0*\32\256\225\205\213(eB\210\10a\321\244\221\271c\251\210\220!\63.P \0+\17tv"
  "\274\317\270\275{\360\277\63n\337\1,\14E\225;\341\213!#\6\5\1-\10\207TM\341A\3."
  "\7\305\24<\341\3/\30\310\267Sk*a\242\346J\230\250\271\22\65\257D\315\225\60Q\263\2\60\25"
  ".\27\204g\11\213\7\37\4\322\377\217\36|\20\202\311\32\0\61\17)\27\134\307\310\211\7+\60\252\377"
  "\377\0\62\32-\27|G\311\212\7\17\332\250)X\235\261S\367\231\271\202\5\37\374\240\0\63\37.\27"
  "\214g\11\213\7\37\4\322\250du\347J\22=w\262\244\42\215\36|\20\202\311\32\0\64%\60\27\224"
  "q\64Y\243\7\261K\246\214D\251\22\245J\24*R\250H\231:)T\346\305\23\67-\313\326\11\0"
  "\65\33.\27\204\241E_\224\254\345\32&-\36\264\254R\221F\17\36\214h\302f\1\66\32-\27|"
  "G\311\212\7\17\332hX\341\203\37\250\321\233\7\17Z,Q\3\0\67!.\27\204a\15\223\26\17\36"
  "\14RT\260d\205%K\222\254\260d\205%\13\32,Y\320`\71\0\70\34.\27\214g\11\213\7\37"
  "\4\322G$\230\254b\361`\220\36=\370 \4\223\65\0\71\33-\27|G\311\212\7\17\332\350\315\203"
  "\37(,\250F\233\7\17Z,Q\3\0:\11\245\26<\341{\30|;\17%\227C\341{\30|\61"
  "d\304\240 \0<\35\361\366\233\37D\360\301eM\36\274\362\340\245\205I\27\276\261\341\213\15\27\37\17"
  "\42\0=\15P\365\234\341\7\343\341\350\301\7\3>#\361\366\233!<\10\361\0H\33>{\370b\303"
  "\207M\223\65y\322\344\301+\215\232%-\36@x\20\0\77\32-\27|A\315\22\26\17\36\204QS"
  "\260v\306lW\260\366\20\25\254#\0@\67\26\27\314\347\1\221\7%\36|\60X\253\7\202\36\214y"
  "@\344A\221\7EJ))\245\244\224\222RJJ))\245\244\224\222RJ\36\24yP\304E\221&"
  "E\330\0A\24.\27\204g\11\213\7\37\4\322\217\36\374A!\375Q\1B%/\27\214a\21\233&"
  ".\134\24*Q\250D\241\22\205J\24*\341\242\11\233&\17J\351\325\203\7%\234\264aC\27.\27"
  "\204g\11\213\7\37\4\322\227\365#\215\36|\20\202\311\32\0D\26.\27\204a\15\223\26\17\36\14\322"
  "\377\217\36|\20\202\311\32\0E\21,\27t\341\17\312\325\335\212\275(Ww\17~F\24,\27t'"
  "\211\212\7\17\324\325\335\212\275(W\377\16\0G\22/\27\224\301\205_\24\255\337\360\225\256\36\374A\1"
  "H\20.\27\204\241\220\376\243\7\177PH\377Q\1I\15)\27\134\341'\205\352\377\223\7\37J\23-"
  "\27|e\37\326\377P\215\66\17\36\264X\242\6\0K#/\27\224\241\224\242\22\205J\24*Q\246H"
  "\231\42\325\24)S\242P\211B%\12=\370\203R\372W\5L\15,\27|\241\134\375\377\357\36\374\0"
  "M\67\63\27\264\301\34\273V^\275y\20\346A\230\7a\36\210x\60\342\301\10\27'T\234PqB"
  "\305\11%E\224\24QRDI\21\65c\324\214Q\63F\315\30E\201\12N\32/\27\224\241\324\242\215"
  "\330p\323\244\23\27.T\214P\341Iox\264\253\2O\17/\27\214\341\37\224\322\377\257\36\374A\1"
  "P\24.\27\204g\11\213\7\37\4\322\77z\360\7%\353%\0Q\26\257\227\213\207I\213\7\37\220\322"
  "\377\257\36\374A\321\262\244\205\7R\36.\27\214g\11\213\7\37\4\322G\17\376\240\10\231\42uS\242"
  "L\211\62%\12iT\0S\26-\27|\341\17\324hX\360\334u\350\256\63\250F\233\7\77PT\15"
  "/\27\214\341_\25\255\377\377\25\0U\15.\27\204\241\220\376\377\217\36\374\1V//\27\214\241\20\33"
  "\66%\314\24)S\244L\221\62E\312\24)S\244\210\221\212J\24*Q\250D\241\22\205J\24*Q"
  "\250D!e\371\15\0WJ\67\27\324\241\24!U\204\24UQ\246P\211\62\205J\224)D\244\214\221"
  "j\214Tr\244\14\221#eJ\34)Sb\4E%FPTbD\242$\250\220\240:\203\352\314\261"
  "\63\307\316\234\63d\316\220\271R\346J\25,U\10\0X\60\61\27\234\243T\21\63f**S\310\204"
  "\251\22\305J\24[\227\60\313\223(\23\246S\267\254D)\23\206L\30*S\306\22\63FJ\225\60e"
  "\0Y&\60\27\224\301\220\211BE\12\25\261\246H\241\42\205X)\323\16!\226F--[\324h\331"
  "\242F\313\26\65\10\0Z\37-\27\204\201\5\213\7\17\322\231+g\256\234\271r\346\312\231+g\231\71"
  "s\345\36\374\240\0[\17\307\267K\341\203\64\364\377\277y\360\240\0\134\32\310\267Sa\324d\222\215\232"
  "\231\260Q\63\223l\324\314$\33\65\63\311F\15]\17\307\267K\341\203\62\364\377\277y\360 \1^\6"
  "\0\20D\1_\10qT\233\341\7\6`\13\246XO\201\14\21\62\203\6a\24.\27\204g\11\213\7"
  "\37\4\322\217\36\374A!\375Q\1b%/\27\214a\21\233&.\134\24*Q\250D\241\22\205J\24"
  "*\341\242\11\233&\17J\351\325\203\7%\234\264ac\27.\27\204g\11\213\7\37\4\322\227\365#\215"
  "\36|\20\202\311\32\0d\26.\27\204a\15\223\26\17\36\14\322\377\217\36|\20\202\311\32\0e\21,"
  "\27t\341\17\312\325\335\212\275(Ww\17~f\24,\27t'\211\212\7\17\324\325\335\212\275(W\377"
  "\16\0g\22/\27\224\301\205_\24\255\337\360\225\256\36\374A\1h\20.\27\204\241\220\376\243\7\177P"
  "H\377Q\1i\13%\27<\341\323\7\177\240\0j\25-\27|\261\276\7V\260\376P\215\66\17\36\264"
  "X\242\6\0k#/\27\224\241\224\242\22\205J\24*Q\246H\231\42\325\24)S\242P\211B%\12"
  "=\370\203R\372W\5l\15,\27|\241\134\375\377\357\36\374\0m\67\63\27\264\301\34\273V^\275y"
  "\20\346A\230\7a\36\210x\60\342\301\10\27'T\234PqB\305\11%E\224\24QRDI\21\65"
  "c\324\214Q\63F\315\30E\201\12n\32/\27\224\241\324\242\215\330p\323\244\23\27.T\214P\341I"
  "ox\264\253\2o\17/\27\214\341\37\224\322\377\257\36\374A\1p\24.\27\204g\11\213\7\37\4\322"
  "\77z\360\7%\353%\0q\26\257\227\213\207I\213\7\37\220\322\377\257\36\374A\321\262\244\205\7r\36"
  ".\27\214g\11\213\7\37\4\322G\17\376\240\10\231\42uS\242L\211\62%\12iT\0s\26-\27"
  "|\341\17\324hX\360\334u\350\256\63\250F\233\7\77Pt\15/\27\214\341_\25\255\377\377\25\0u"
  "\15.\27\204\241\220\376\377\217\36\374\1v//\27\214\241\20\33\66%\314\24)S\244L\221\62E\312"
  "\24)S\244\210\221\212J\24*Q\250D\241\22\205J\24*Q\250D!e\371\15\0wJ\67\27\324"
  "\241\24!U\204\24UQ\246P\211\62\205J\224)D\244\214\221j\214Tr\244\14\221#eJ\34)"
  "Sb\4E%FPTbD\242$\250\220\240:\203\352\314\261\63\307\316\234\63d\316\220\271R\346J"
  "\25,U\10\0x\60\61\27\234\243T\21\63f**S\310\204\251\22\305J\24[\227\60\313\223(\23"
  "\246S\267\254D)\23\206L\30*S\306\22\63FJ\225\60e\0y&\60\27\224\301\220\211BE\12"
  "\25\261\246H\241\42\205X)\323\16!\226F--[\324h\331\242F\313\26\65\10\0z\37-\27\204"
  "\201\5\213\7\17\322\231+g\256\234\271r\346\312\231+g\231\71s\345\36\374\240\0\0\0\0\4\377\377"
  "\0";


/*
  Fontname: Untitled
  Copyright: Created with Fony 1.4.7
  Glyphs: 10/256
  BBX Build Mode: 0
*/
const uint8_t aldo_digits_50px[415] U8G2_FONT_SECTION("aldo_digits_50px") = 
  "\12\0\4\5\5\6\3\1\6\23\62\0\0\62\0\0\0\0\0\0\0\1\202\60\33Sf\272\34z\6\222"
  "(>`\216\375\377\377\377\277\373\200\211H\240y\310)\0\61\24L~\272\16B&\21%>\200be"
  "\346\377\377\377\377\17\62\65Sf\272\34z\6\222(>`\216\275\63\330h\203\215\66\330h\203\215\66\330"
  "h\203\215\66\330h\203\215\66\330h\203\215\66\330h\203\215\66\330h\363\353\17~P\1\63'Sf\272"
  "\34z\6\222(>`\216\275\63\332\374;\346\26T\62Q\346\230\66\377\65s\354\335\7LD\2\315C"
  "N\1\64ESfz\15>\30YD\225T\341\332\261\231\21\206\31a\230\21F\31b\224!F\31b"
  "\220\61\6\31c\220\61&\62\306 c\14\62\304(C\214\62\304(#\14\63\302\60#\14c\216\71#"
  "d\22\33X\233\377\1\65 Sf\32\376`k\363\377\265S\17A\23\211\24S\233\377\232\71\366\316\10"
  "I\242\201\350)\307\32\66 Sf\272\34z\6\222(>`\216}m\376\372\203\37l\307\376\377\356\3"
  "&\42\201\346!\247\0\67+Sf\32\42\211D\12)>\70\332\34\33m\306F\233\261\321fl\264\31"
  "\33m\306F\233\261\321fl\264\31\33m\306F\233)\0\70$Sf\272\34z\6\222(>`\216\375"
  "\377\256\210H\240y\16\222(\260c\377\277\373\200\211H\240y\310)\0\71!Sf\272\34z\6\222("
  ">`\216\375\377\356\203\37lm\376\65s\354\335\7LD\2\315CN\1\0\0\0\4\377\377\0";



void setup(void) {
  u8g2.begin(); // start the u8g2 library
}

void loop(void) {
  u8g2.clearBuffer();		// clear the internal memory

	u8g2.setFont(aldo_digits_50px); // set custom font
  u8g2.drawStr(0,56,"123456"); // print some message

  u8g2.sendBuffer();		// transfer internal memory to the display
  delay(1000);  // one second delay, but we are only displaying a static text, so it makes no difference
}