acid-drop

- Hacking the planet from a LilyGo T-Deck using custom firmware
git clone git://git.acid.vegas/acid-drop.git
Log | Files | Refs | Archive | README | LICENSE

U8g2FontUTF8FullUnifont.ino (6608B)

      1 /*******************************************************************************
      2  * U8g2 latest unifont-14.0.02 all glyphs example
      3  * Please note this font is 2,250,360 in size and cannot fit in many platform.
      4  * This font is generated by U8g2 tools:
      5  * u8g2/tools/font/bdfconv/./bdfconv -v -f 1 -b 1 -m "0-1114111" unifont_jp-14.0.02.bdf -o u8g2_font_unifont_h_utf8.h -n u8g2_font_unifont_h_utf8
      6  * Hello world in multiple languages
      7  * https://codegolf.stackexchange.com/questions/146544/hello-world-in-multiple-languages
      8  ******************************************************************************/
      9 
     10 /*******************************************************************************
     11  * Start of Arduino_GFX setting
     12  *
     13  * Arduino_GFX try to find the settings depends on selected board in Arduino IDE
     14  * Or you can define the display dev kit not in the board list
     15  * Defalult pin list for non display dev kit:
     16  * Arduino Nano, Micro and more: CS:  9, DC:  8, RST:  7, BL:  6, SCK: 13, MOSI: 11, MISO: 12
     17  * ESP32 various dev board     : CS:  5, DC: 27, RST: 33, BL: 22, SCK: 18, MOSI: 23, MISO: nil
     18  * ESP32-C3 various dev board  : CS:  7, DC:  2, RST:  1, BL:  3, SCK:  4, MOSI:  6, MISO: nil
     19  * ESP32-S2 various dev board  : CS: 34, DC: 38, RST: 33, BL: 21, SCK: 36, MOSI: 35, MISO: nil
     20  * ESP32-S3 various dev board  : CS: 40, DC: 41, RST: 42, BL: 48, SCK: 36, MOSI: 35, MISO: nil
     21  * ESP8266 various dev board   : CS: 15, DC:  4, RST:  2, BL:  5, SCK: 14, MOSI: 13, MISO: 12
     22  * Raspberry Pi Pico dev board : CS: 17, DC: 27, RST: 26, BL: 28, SCK: 18, MOSI: 19, MISO: 16
     23  * RTL8720 BW16 old patch core : CS: 18, DC: 17, RST:  2, BL: 23, SCK: 19, MOSI: 21, MISO: 20
     24  * RTL8720_BW16 Official core  : CS:  9, DC:  8, RST:  6, BL:  3, SCK: 10, MOSI: 12, MISO: 11
     25  * RTL8722 dev board           : CS: 18, DC: 17, RST: 22, BL: 23, SCK: 13, MOSI: 11, MISO: 12
     26  * RTL8722_mini dev board      : CS: 12, DC: 14, RST: 15, BL: 13, SCK: 11, MOSI:  9, MISO: 10
     27  * Seeeduino XIAO dev board    : CS:  3, DC:  2, RST:  1, BL:  0, SCK:  8, MOSI: 10, MISO:  9
     28  * Teensy 4.1 dev board        : CS: 39, DC: 41, RST: 40, BL: 22, SCK: 13, MOSI: 11, MISO: 12
     29  ******************************************************************************/
     30 #include <U8g2lib.h>
     31 #include <Arduino_GFX_Library.h>
     32 
     33 #define GFX_BL DF_GFX_BL // default backlight pin, you may replace DF_GFX_BL to actual backlight pin
     34 
     35 /* More dev device declaration: https://github.com/moononournation/Arduino_GFX/wiki/Dev-Device-Declaration */
     36 #if defined(DISPLAY_DEV_KIT)
     37 Arduino_GFX *gfx = create_default_Arduino_GFX();
     38 #else /* !defined(DISPLAY_DEV_KIT) */
     39 
     40 /* More data bus class: https://github.com/moononournation/Arduino_GFX/wiki/Data-Bus-Class */
     41 Arduino_DataBus *bus = create_default_Arduino_DataBus();
     42 
     43 /* More display class: https://github.com/moononournation/Arduino_GFX/wiki/Display-Class */
     44 Arduino_GFX *gfx = new Arduino_ILI9341(bus, DF_GFX_RST, 3 /* rotation */, false /* IPS */);
     45 
     46 #endif /* !defined(DISPLAY_DEV_KIT) */
     47 /*******************************************************************************
     48  * End of Arduino_GFX setting
     49  ******************************************************************************/
     50 
     51 /* more fonts at: https://github.com/moononournation/ArduinoFreeFontFile.git */
     52 
     53 String helloWorldStrings[] = {
     54 "Hello Wêreld!", // Afrikaans
     55 "Përshendetje Botë!", // Albanian
     56 "ሰላም ልዑል!", // Amharic
     57 "مرحبا بالعالم!", // Arabic
     58 "Բարեւ աշխարհ!", // Armenian
     59 "Kaixo Mundua!", // Basque
     60 "Прывітанне Сусвет!", // Belarussian
     61 "ওহে বিশ্ব!", // Bengali
     62 "Здравей свят!", // Bulgarian
     63 "Hola món!", // Catalan
     64 "Moni Dziko Lapansi!", // Chichewa
     65 "世界你好!", // Chinese
     66 "Pozdrav svijete!", // Croatian
     67 "Ahoj světe!", // Czech
     68 "Hej Verden!", // Danish
     69 "Hallo Wereld!", // Dutch
     70 "Hello World!", // English
     71 "Tere maailm!", // Estonian
     72 "Hei maailma!", // Finnish
     73 "Bonjour monde!", // French
     74 "Hallo wrâld!", // Frisian
     75 "გამარჯობა მსოფლიო!", // Georgian
     76 "Hallo Welt!", // German
     77 "Γειά σου Κόσμε!", // Greek
     78 "Sannu Duniya!", // Hausa
     79 "שלום עולם!", // Hebrew
     80 "नमस्ते दुनिया!", // Hindi
     81 "Helló Világ!", // Hungarian
     82 "Halló heimur!", // Icelandic
     83 "Ndewo Ụwa!", // Igbo
     84 "Halo Dunia!", // Indonesian
     85 "Ciao mondo!", // Italian
     86 "こんにちは世界!", // Japanese
     87 "Сәлем Әлем!", // Kazakh
     88 "សួស្តី​ពិភពលោក!", // Khmer
     89 "Салам дүйнө!", // Kyrgyz
     90 "ສະ​ບາຍ​ດີ​ຊາວ​ໂລກ!", // Lao
     91 "Sveika pasaule!", // Latvian
     92 "Labas pasauli!", // Lithuanian
     93 "Moien Welt!", // Luxemburgish
     94 "Здраво свету!", // Macedonian
     95 "Hai dunia!", // Malay
     96 "ഹലോ വേൾഡ്!", // Malayalam
     97 "Сайн уу дэлхий!", // Mongolian
     98 "မင်္ဂလာပါကမ္ဘာလောက!", // Myanmar
     99 "नमस्कार संसार!", // Nepali
    100 "Hei Verden!", // Norwegian
    101 "سلام نړی!", // Pashto
    102 "سلام دنیا!", // Persian
    103 "Witaj świecie!", // Polish
    104 "Olá Mundo!", // Portuguese
    105 "ਸਤਿ ਸ੍ਰੀ ਅਕਾਲ ਦੁਨਿਆ!", // Punjabi
    106 "Salut Lume!", // Romanian
    107 "Привет мир!", // Russian
    108 "Hàlo a Shaoghail!", // Scots Gaelic
    109 "Здраво Свете!", // Serbian
    110 "Lefatše Lumela!", // Sesotho
    111 "හෙලෝ වර්ල්ඩ්!", // Sinhala
    112 "Pozdravljen svet!", // Slovenian
    113 "¡Hola Mundo!", // Spanish, Leading '¡' optional
    114 "Halo Dunya!", // Sundanese
    115 "Salamu Dunia!", // Swahili
    116 "Hej världen!", // Swedish
    117 "Салом Ҷаҳон!", // Tajik
    118 "สวัสดีชาวโลก!", // Thai
    119 "Selam Dünya!", // Turkish
    120 "Привіт Світ!", // Ukrainian
    121 "Salom Dunyo!", // Uzbek
    122 "Chào thế giới!", // Vietnamese
    123 "Helo Byd!", // Welsh
    124 "Molo Lizwe!", // Xhosa
    125 "העלא וועלט!", // Yiddish
    126 "Mo ki O Ile Aiye!", // Yoruba
    127 "Sawubona Mhlaba!" // Zulu
    128 };
    129 
    130 void setup(void)
    131 {
    132     gfx->begin();
    133     gfx->fillScreen(BLACK);
    134     gfx->setUTF8Print(true); // enable UTF8 support for the Arduino print() function
    135 
    136 #ifdef GFX_BL
    137     pinMode(GFX_BL, OUTPUT);
    138     digitalWrite(GFX_BL, HIGH);
    139 #endif
    140 
    141     gfx->setCursor(0, 14);
    142     gfx->setFont(u8g2_font_unifont_h_utf8);
    143     gfx->println("Hello world in multiple languages");
    144 
    145     delay(2000); // 2 seconds
    146 }
    147 
    148 void loop()
    149 {
    150     gfx->setCursor(random(gfx->width() / 4), random(gfx->height() - 32) + 16);
    151     gfx->setTextColor(random(0xffff), random(0xffff));
    152     gfx->setTextSize(random(2) + 2 /* x scale */, random(2) + 2 /* y scale */);
    153     gfx->println(helloWorldStrings[random(74)]);
    154 
    155     delay(500); // 0.5 second
    156 }