acidportal

- 😈 Worlds smallest Evil Portal on a LilyGo T-QT
git clone git://git.acid.vegas/acidportal.git
Log | Files | Refs | Archive | README | LICENSE

Create_font.pde (25800B)

      1 // This is a Processing sketch, see https://processing.org/ to download the IDE
      2 
      3 // Select the font, size and character ranges in the user configuration section
      4 // of this sketch, which starts at line 120. Instructions start at line 50.
      5 
      6 
      7 /*
      8 Software License Agreement (FreeBSD License)
      9  
     10  Copyright (c) 2018 Bodmer (https://github.com/Bodmer)
     11  
     12  All rights reserved.
     13  
     14  Redistribution and use in source and binary forms, with or without
     15  modification, are permitted provided that the following conditions are met:
     16  
     17  1. Redistributions of source code must retain the above copyright notice, this
     18  list of conditions and the following disclaimer.
     19  2. Redistributions in binary form must reproduce the above copyright notice,
     20  this list of conditions and the following disclaimer in the documentation
     21  and/or other materials provided with the distribution.
     22  
     23  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
     24  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
     25  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
     26  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
     27  ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
     28  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
     29  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
     30  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     31  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
     32  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     33  
     34  The views and conclusions contained in the software and documentation are those
     35  of the authors and should not be interpreted as representing official policies,
     36  either expressed or implied, of the FreeBSD Project.
     37  */
     38 
     39 ////////////////////////////////////////////////////////////////////////////////////////////////
     40 
     41 // This is a processing sketch to create font files for the TFT_eSPI library:
     42 
     43 // https://github.com/Bodmer/TFT_eSPI
     44 
     45 // Coded by Bodmer January 2018, updated 10/2/19
     46 // Version 0.8
     47 
     48 // >>>>>>>>>>>>>>>>>>>>             INSTRUCTIONS             <<<<<<<<<<<<<<<<<<<<
     49 
     50 // See comments below in code for specifying the font parameters (point size,
     51 // unicode blocks to include etc). Ranges of characters (glyphs) and specific
     52 // individual glyphs can be included in the created "*.vlw" font file.
     53 
     54 // Created fonts are saved in the sketches "FontFiles" folder. Press Ctrl+K to
     55 // see that folder location.
     56 
     57 // 16 bit Unicode point codes in the range 0x0000 - 0xFFFF are supported.
     58 // Codes 0-31 are control codes such as "tab" and "carraige return" etc.
     59 // and 32 is a "space", these should NOT be included.
     60 
     61 // The sketch will convert True Type (a .ttf or .otf file) file stored in the
     62 // sketches "Data" folder as well as your computers' system fonts.
     63 
     64 // To maximise rendering performance and the memory consumed only include the characters
     65 // you will use. Characters at the start of the file will render faster than those at
     66 // the end due to the buffering and file seeking overhead.
     67 
     68 // The inclusion of "non-existant" characters in a font may give unpredicatable results
     69 // when rendering with the TFT_eSPI library. The Processing sketch window that pops up
     70 // to show the font characters will print "boxes" (also known as Tofu!) for non existant
     71 // characters.
     72 
     73 // Once created the files must be loaded into the ESP32 or ESP8266 SPIFFS memory
     74 // using the Arduino IDE plugin detailed here:
     75 // https://github.com/esp8266/arduino-esp8266fs-plugin
     76 // https://github.com/me-no-dev/arduino-esp32fs-plugin
     77 
     78 // When the sketch is run it will generate a file called "System_Font_List.txt" in the
     79 // sketch "FontFiles" folder, press Ctrl+K to see it. Open the file in a text editor to
     80 // view it. This list provides the font reference number needed below to locate that
     81 // font on your system.
     82 
     83 // The sketch also lists all the available system fonts to the console, you can increase
     84 // the console line count (in preferences.txt) to stop some fonts scrolling out of view.
     85 // See link in File>Preferences to locate "preferences.txt" file. You must close
     86 // Processing then edit the file lines. If Processing is not closed first then the
     87 // edits will be overwritten by defaults! Edit "preferences.txt" as follows for
     88 // 3000 lines, then save, then run Processing again:
     89 
     90 //     console.length=3000;             // Line 4 in file
     91 //     console.scrollback.lines=3000;   // Line 7 in file
     92 
     93 
     94 // Useful links:
     95 /*
     96 
     97  https://en.wikipedia.org/wiki/Unicode_font
     98  
     99  https://www.gnu.org/software/freefont/
    100  https://www.gnu.org/software/freefont/sources/
    101  https://www.gnu.org/software/freefont/ranges/
    102  http://savannah.gnu.org/projects/freefont/
    103  
    104  http://www.google.com/get/noto/
    105  
    106  https://github.com/Bodmer/TFT_eSPI
    107  https://github.com/esp8266/arduino-esp8266fs-plugin
    108  https://github.com/me-no-dev/arduino-esp32fs-plugin
    109  
    110    >>>>>>>>>>>>>>>>>>>>         END OF INSTRUCTIONS         <<<<<<<<<<<<<<<<<<<< */
    111 
    112 
    113 import java.awt.Desktop; // Required to allow sketch to open file windows
    114 
    115 
    116 ////////////////////////////////////////////////////////////////////////////////////////////////
    117 
    118 //                       >>>>>>>>>> USER CONFIGURED PARAMETERS START HERE <<<<<<<<<<
    119 
    120 // Use font number or name, -1 for fontNumber means use fontName below, a value >=0 means use system font number from list.
    121 // When the sketch is run it will generate a file called "systemFontList.txt" in the sketch folder, press Ctrl+K to see it.
    122 // Open the "systemFontList.txt" in a text editor to view the font files and reference numbers for your system.
    123 
    124 int fontNumber = -1; // << Use [Number] in brackets from the fonts listed.
    125 
    126 // OR use font name for ttf files placed in the "Data" folder or the font number seen in IDE Console for system fonts
    127 //                                                  the font numbers are listed when the sketch is run.
    128 //                |         1         2     |       Maximum filename size for SPIFFS is 31 including leading /
    129 //                 1234567890123456789012345        and added point size and .vlw extension, so max is 25
    130 String fontName = "Final-Frontier";  // Manually crop the filename length later after creation if needed
    131                                      // Note: SPIFFS does NOT accept underscore in a filename!
    132 String fontType = ".ttf";
    133 //String fontType = ".otf";
    134 
    135 
    136 // Define the font size in points for the TFT_eSPI font file
    137 int  fontSize = 28;
    138 
    139 // Font size to use in the Processing sketch display window that pops up (can be different to above)
    140 int displayFontSize = 28;
    141 
    142 // Create a C header (.h file) ready to be used or copied in your sketch folder
    143 boolean createHeaderFile = true;
    144 
    145 // Automaticely open the folder with created files when done
    146 boolean openFolder = true;
    147 
    148 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    149 // Next we specify which unicode blocks from the the Basic Multilingual Plane (BMP) are included in the final font file. //
    150 // Note: The ttf/otf font file MAY NOT contain all possible Unicode characters, refer to the fonts online documentation. //
    151 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    152 
    153 static final int[] unicodeBlocks = {
    154   // The list below has been created from the table here: https://en.wikipedia.org/wiki/Unicode_block
    155   // Remove // at start of lines below to include that unicode block, different code ranges can also be specified by
    156   // editing the start and end-of-range values. Multiple lines from the list below can be included, limited only by
    157   // the final font file size!
    158 
    159   // Block range,   //Block name, Code points, Assigned characters, Scripts
    160   // First, last,   //Range is inclusive of first and last codes
    161   0x0021, 0x007E, //Basic Latin, 128, 128, Latin (52 characters), Common (76 characters)
    162   //0x0080, 0x00FF, //Latin-1 Supplement, 128, 128, Latin (64 characters), Common (64 characters)
    163   //0x0100, 0x017F, //Latin Extended-A, 128, 128, Latin
    164   //0x0180, 0x024F, //Latin Extended-B, 208, 208, Latin
    165   //0x0250, 0x02AF, //IPA Extensions, 96, 96, Latin
    166   //0x02B0, 0x02FF, //Spacing Modifier Letters, 80, 80, Bopomofo (2 characters), Latin (14 characters), Common (64 characters)
    167   //0x0300, 0x036F, //Combining Diacritical Marks, 112, 112, Inherited
    168   //0x0370, 0x03FF, //Greek and Coptic, 144, 135, Coptic (14 characters), Greek (117 characters), Common (4 characters)
    169   //0x0400, 0x04FF, //Cyrillic, 256, 256, Cyrillic (254 characters), Inherited (2 characters)
    170   //0x0500, 0x052F, //Cyrillic Supplement, 48, 48, Cyrillic
    171   //0x0530, 0x058F, //Armenian, 96, 89, Armenian (88 characters), Common (1 character)
    172   //0x0590, 0x05FF, //Hebrew, 112, 87, Hebrew
    173   //0x0600, 0x06FF, //Arabic, 256, 255, Arabic (237 characters), Common (6 characters), Inherited (12 characters)
    174   //0x0700, 0x074F, //Syriac, 80, 77, Syriac
    175   //0x0750, 0x077F, //Arabic Supplement, 48, 48, Arabic
    176   //0x0780, 0x07BF, //Thaana, 64, 50, Thaana
    177   //0x07C0, 0x07FF, //NKo, 64, 59, Nko
    178   //0x0800, 0x083F, //Samaritan, 64, 61, Samaritan
    179   //0x0840, 0x085F, //Mandaic, 32, 29, Mandaic
    180   //0x0860, 0x086F, //Syriac Supplement, 16, 11, Syriac
    181   //0x08A0, 0x08FF, //Arabic Extended-A, 96, 73, Arabic (72 characters), Common (1 character)
    182   //0x0900, 0x097F, //Devanagari, 128, 128, Devanagari (124 characters), Common (2 characters), Inherited (2 characters)
    183   //0x0980, 0x09FF, //Bengali, 128, 95, Bengali
    184   //0x0A00, 0x0A7F, //Gurmukhi, 128, 79, Gurmukhi
    185   //0x0A80, 0x0AFF, //Gujarati, 128, 91, Gujarati
    186   //0x0B00, 0x0B7F, //Oriya, 128, 90, Oriya
    187   //0x0B80, 0x0BFF, //Tamil, 128, 72, Tamil
    188   //0x0C00, 0x0C7F, //Telugu, 128, 96, Telugu
    189   //0x0C80, 0x0CFF, //Kannada, 128, 88, Kannada
    190   //0x0D00, 0x0D7F, //Malayalam, 128, 117, Malayalam
    191   //0x0D80, 0x0DFF, //Sinhala, 128, 90, Sinhala
    192   //0x0E00, 0x0E7F, //Thai, 128, 87, Thai (86 characters), Common (1 character)
    193   //0x0E80, 0x0EFF, //Lao, 128, 67, Lao
    194   //0x0F00, 0x0FFF, //Tibetan, 256, 211, Tibetan (207 characters), Common (4 characters)
    195   //0x1000, 0x109F, //Myanmar, 160, 160, Myanmar
    196   //0x10A0, 0x10FF, //Georgian, 96, 88, Georgian (87 characters), Common (1 character)
    197   //0x1100, 0x11FF, //Hangul Jamo, 256, 256, Hangul
    198   //0x1200, 0x137F, //Ethiopic, 384, 358, Ethiopic
    199   //0x1380, 0x139F, //Ethiopic Supplement, 32, 26, Ethiopic
    200   //0x13A0, 0x13FF, //Cherokee, 96, 92, Cherokee
    201   //0x1400, 0x167F, //Unified Canadian Aboriginal Syllabics, 640, 640, Canadian Aboriginal
    202   //0x1680, 0x169F, //Ogham, 32, 29, Ogham
    203   //0x16A0, 0x16FF, //Runic, 96, 89, Runic (86 characters), Common (3 characters)
    204   //0x1700, 0x171F, //Tagalog, 32, 20, Tagalog
    205   //0x1720, 0x173F, //Hanunoo, 32, 23, Hanunoo (21 characters), Common (2 characters)
    206   //0x1740, 0x175F, //Buhid, 32, 20, Buhid
    207   //0x1760, 0x177F, //Tagbanwa, 32, 18, Tagbanwa
    208   //0x1780, 0x17FF, //Khmer, 128, 114, Khmer
    209   //0x1800, 0x18AF, //Mongolian, 176, 156, Mongolian (153 characters), Common (3 characters)
    210   //0x18B0, 0x18FF, //Unified Canadian Aboriginal Syllabics Extended, 80, 70, Canadian Aboriginal
    211   //0x1900, 0x194F, //Limbu, 80, 68, Limbu
    212   //0x1950, 0x197F, //Tai Le, 48, 35, Tai Le
    213   //0x1980, 0x19DF, //New Tai Lue, 96, 83, New Tai Lue
    214   //0x19E0, 0x19FF, //Khmer Symbols, 32, 32, Khmer
    215   //0x1A00, 0x1A1F, //Buginese, 32, 30, Buginese
    216   //0x1A20, 0x1AAF, //Tai Tham, 144, 127, Tai Tham
    217   //0x1AB0, 0x1AFF, //Combining Diacritical Marks Extended, 80, 15, Inherited
    218   //0x1B00, 0x1B7F, //Balinese, 128, 121, Balinese
    219   //0x1B80, 0x1BBF, //Sundanese, 64, 64, Sundanese
    220   //0x1BC0, 0x1BFF, //Batak, 64, 56, Batak
    221   //0x1C00, 0x1C4F, //Lepcha, 80, 74, Lepcha
    222   //0x1C50, 0x1C7F, //Ol Chiki, 48, 48, Ol Chiki
    223   //0x1C80, 0x1C8F, //Cyrillic Extended-C, 16, 9, Cyrillic
    224   //0x1CC0, 0x1CCF, //Sundanese Supplement, 16, 8, Sundanese
    225   //0x1CD0, 0x1CFF, //Vedic Extensions, 48, 42, Common (15 characters), Inherited (27 characters)
    226   //0x1D00, 0x1D7F, //Phonetic Extensions, 128, 128, Cyrillic (2 characters), Greek (15 characters), Latin (111 characters)
    227   //0x1D80, 0x1DBF, //Phonetic Extensions Supplement, 64, 64, Greek (1 character), Latin (63 characters)
    228   //0x1DC0, 0x1DFF, //Combining Diacritical Marks Supplement, 64, 63, Inherited
    229   //0x1E00, 0x1EFF, //Latin Extended Additional, 256, 256, Latin
    230   //0x1F00, 0x1FFF, //Greek Extended, 256, 233, Greek
    231   //0x2000, 0x206F, //General Punctuation, 112, 111, Common (109 characters), Inherited (2 characters)
    232   //0x2070, 0x209F, //Superscripts and Subscripts, 48, 42, Latin (15 characters), Common (27 characters)
    233   //0x20A0, 0x20CF, //Currency Symbols, 48, 32, Common
    234   //0x20D0, 0x20FF, //Combining Diacritical Marks for Symbols, 48, 33, Inherited
    235   //0x2100, 0x214F, //Letterlike Symbols, 80, 80, Greek (1 character), Latin (4 characters), Common (75 characters)
    236   //0x2150, 0x218F, //Number Forms, 64, 60, Latin (41 characters), Common (19 characters)
    237   //0x2190, 0x21FF, //Arrows, 112, 112, Common
    238   //0x2200, 0x22FF, //Mathematical Operators, 256, 256, Common
    239   //0x2300, 0x23FF, //Miscellaneous Technical, 256, 256, Common
    240   //0x2400, 0x243F, //Control Pictures, 64, 39, Common
    241   //0x2440, 0x245F, //Optical Character Recognition, 32, 11, Common
    242   //0x2460, 0x24FF, //Enclosed Alphanumerics, 160, 160, Common
    243   //0x2500, 0x257F, //Box Drawing, 128, 128, Common
    244   //0x2580, 0x259F, //Block Elements, 32, 32, Common
    245   //0x25A0, 0x25FF, //Geometric Shapes, 96, 96, Common
    246   //0x2600, 0x26FF, //Miscellaneous Symbols, 256, 256, Common
    247   //0x2700, 0x27BF, //Dingbats, 192, 192, Common
    248   //0x27C0, 0x27EF, //Miscellaneous Mathematical Symbols-A, 48, 48, Common
    249   //0x27F0, 0x27FF, //Supplemental Arrows-A, 16, 16, Common
    250   //0x2800, 0x28FF, //Braille Patterns, 256, 256, Braille
    251   //0x2900, 0x297F, //Supplemental Arrows-B, 128, 128, Common
    252   //0x2980, 0x29FF, //Miscellaneous Mathematical Symbols-B, 128, 128, Common
    253   //0x2A00, 0x2AFF, //Supplemental Mathematical Operators, 256, 256, Common
    254   //0x2B00, 0x2BFF, //Miscellaneous Symbols and Arrows, 256, 207, Common
    255   //0x2C00, 0x2C5F, //Glagolitic, 96, 94, Glagolitic
    256   //0x2C60, 0x2C7F, //Latin Extended-C, 32, 32, Latin
    257   //0x2C80, 0x2CFF, //Coptic, 128, 123, Coptic
    258   //0x2D00, 0x2D2F, //Georgian Supplement, 48, 40, Georgian
    259   //0x2D30, 0x2D7F, //Tifinagh, 80, 59, Tifinagh
    260   //0x2D80, 0x2DDF, //Ethiopic Extended, 96, 79, Ethiopic
    261   //0x2DE0, 0x2DFF, //Cyrillic Extended-A, 32, 32, Cyrillic
    262   //0x2E00, 0x2E7F, //Supplemental Punctuation, 128, 74, Common
    263   //0x2E80, 0x2EFF, //CJK Radicals Supplement, 128, 115, Han
    264   //0x2F00, 0x2FDF, //Kangxi Radicals, 224, 214, Han
    265   //0x2FF0, 0x2FFF, //Ideographic Description Characters, 16, 12, Common
    266   //0x3000, 0x303F, //CJK Symbols and Punctuation, 64, 64, Han (15 characters), Hangul (2 characters), Common (43 characters), Inherited (4 characters)
    267   //0x3040, 0x309F, //Hiragana, 96, 93, Hiragana (89 characters), Common (2 characters), Inherited (2 characters)
    268   //0x30A0, 0x30FF, //Katakana, 96, 96, Katakana (93 characters), Common (3 characters)
    269   //0x3100, 0x312F, //Bopomofo, 48, 42, Bopomofo
    270   //0x3130, 0x318F, //Hangul Compatibility Jamo, 96, 94, Hangul
    271   //0x3190, 0x319F, //Kanbun, 16, 16, Common
    272   //0x31A0, 0x31BF, //Bopomofo Extended, 32, 27, Bopomofo
    273   //0x31C0, 0x31EF, //CJK Strokes, 48, 36, Common
    274   //0x31F0, 0x31FF, //Katakana Phonetic Extensions, 16, 16, Katakana
    275   //0x3200, 0x32FF, //Enclosed CJK Letters and Months, 256, 254, Hangul (62 characters), Katakana (47 characters), Common (145 characters)
    276   //0x3300, 0x33FF, //CJK Compatibility, 256, 256, Katakana (88 characters), Common (168 characters)
    277   //0x3400, 0x4DBF, //CJK Unified Ideographs Extension A, 6,592, 6,582, Han
    278   //0x4DC0, 0x4DFF, //Yijing Hexagram Symbols, 64, 64, Common
    279   //0x4E00, 0x9FFF, //CJK Unified Ideographs, 20,992, 20,971, Han
    280   //0xA000, 0xA48F, //Yi Syllables, 1,168, 1,165, Yi
    281   //0xA490, 0xA4CF, //Yi Radicals, 64, 55, Yi
    282   //0xA4D0, 0xA4FF, //Lisu, 48, 48, Lisu
    283   //0xA500, 0xA63F, //Vai, 320, 300, Vai
    284   //0xA640, 0xA69F, //Cyrillic Extended-B, 96, 96, Cyrillic
    285   //0xA6A0, 0xA6FF, //Bamum, 96, 88, Bamum
    286   //0xA700, 0xA71F, //Modifier Tone Letters, 32, 32, Common
    287   //0xA720, 0xA7FF, //Latin Extended-D, 224, 160, Latin (155 characters), Common (5 characters)
    288   //0xA800, 0xA82F, //Syloti Nagri, 48, 44, Syloti Nagri
    289   //0xA830, 0xA83F, //Common Indic Number Forms, 16, 10, Common
    290   //0xA840, 0xA87F, //Phags-pa, 64, 56, Phags Pa
    291   //0xA880, 0xA8DF, //Saurashtra, 96, 82, Saurashtra
    292   //0xA8E0, 0xA8FF, //Devanagari Extended, 32, 30, Devanagari
    293   //0xA900, 0xA92F, //Kayah Li, 48, 48, Kayah Li (47 characters), Common (1 character)
    294   //0xA930, 0xA95F, //Rejang, 48, 37, Rejang
    295   //0xA960, 0xA97F, //Hangul Jamo Extended-A, 32, 29, Hangul
    296   //0xA980, 0xA9DF, //Javanese, 96, 91, Javanese (90 characters), Common (1 character)
    297   //0xA9E0, 0xA9FF, //Myanmar Extended-B, 32, 31, Myanmar
    298   //0xAA00, 0xAA5F, //Cham, 96, 83, Cham
    299   //0xAA60, 0xAA7F, //Myanmar Extended-A, 32, 32, Myanmar
    300   //0xAA80, 0xAADF, //Tai Viet, 96, 72, Tai Viet
    301   //0xAAE0, 0xAAFF, //Meetei Mayek Extensions, 32, 23, Meetei Mayek
    302   //0xAB00, 0xAB2F, //Ethiopic Extended-A, 48, 32, Ethiopic
    303   //0xAB30, 0xAB6F, //Latin Extended-E, 64, 54, Latin (52 characters), Greek (1 character), Common (1 character)
    304   //0xAB70, 0xABBF, //Cherokee Supplement, 80, 80, Cherokee
    305   //0xABC0, 0xABFF, //Meetei Mayek, 64, 56, Meetei Mayek
    306   //0xAC00, 0xD7AF, //Hangul Syllables, 11,184, 11,172, Hangul
    307   //0xD7B0, 0xD7FF, //Hangul Jamo Extended-B, 80, 72, Hangul
    308   //0xD800, 0xDB7F, //High Surrogates, 896, 0, Unknown
    309   //0xDB80, 0xDBFF, //High Private Use Surrogates, 128, 0, Unknown
    310   //0xDC00, 0xDFFF, //Low Surrogates, 1,024, 0, Unknown
    311   //0xE000, 0xF8FF, //Private Use Area, 6,400, 6,400, Unknown
    312   //0xF900, 0xFAFF, //CJK Compatibility Ideographs, 512, 472, Han
    313   //0xFB00, 0xFB4F, //Alphabetic Presentation Forms, 80, 58, Armenian (5 characters), Hebrew (46 characters), Latin (7 characters)
    314   //0xFB50, 0xFDFF, //Arabic Presentation Forms-A, 688, 611, Arabic (609 characters), Common (2 characters)
    315   //0xFE00, 0xFE0F, //Variation Selectors, 16, 16, Inherited
    316   //0xFE10, 0xFE1F, //Vertical Forms, 16, 10, Common
    317   //0xFE20, 0xFE2F, //Combining Half Marks, 16, 16, Cyrillic (2 characters), Inherited (14 characters)
    318   //0xFE30, 0xFE4F, //CJK Compatibility Forms, 32, 32, Common
    319   //0xFE50, 0xFE6F, //Small Form Variants, 32, 26, Common
    320   //0xFE70, 0xFEFF, //Arabic Presentation Forms-B, 144, 141, Arabic (140 characters), Common (1 character)
    321   //0xFF00, 0xFFEF, //Halfwidth and Fullwidth Forms, 240, 225, Hangul (52 characters), Katakana (55 characters), Latin (52 characters), Common (66 characters)
    322   //0xFFF0, 0xFFFF, //Specials, 16, 5, Common
    323 
    324   //0x0030, 0x0039, //Example custom range (numbers 0-9)
    325   //0x0041, 0x005A, //Example custom range (Upper case A-Z)
    326   //0x0061, 0x007A, //Example custom range (Lower case a-z)
    327 };
    328 
    329 // Here we specify particular individual Unicodes to be included (appended at end of selected range)
    330 static final int[] specificUnicodes = {
    331 
    332   // Commonly used codes, add or remove // in next line
    333   // 0x00A3, 0x00B0, 0x00B5, 0x03A9, 0x20AC, // £ ° µ Ω €
    334 
    335   // Numbers and characters for showing time, change next line to //* to use
    336 /*
    337     0x002B, 0x002D, 0x002E, 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, // - + . 0 1 2 3 4
    338     0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x0061, 0x006D, // 5 6 7 8 9 : a m
    339     0x0070,                                                         // p
    340  //*/
    341 
    342   // More characters for TFT_eSPI test sketches, change next line to //* to use
    343   /*
    344     0x0102, 0x0103, 0x0104, 0x0105, 0x0106, 0x0107, 0x010C, 0x010D,
    345     0x010E, 0x010F, 0x0110, 0x0111, 0x0118, 0x0119, 0x011A, 0x011B,
    346  
    347     0x0131, 0x0139, 0x013A, 0x013D, 0x013E, 0x0141, 0x0142, 0x0143,
    348     0x0144, 0x0147, 0x0148, 0x0150, 0x0151, 0x0152, 0x0153, 0x0154,
    349     0x0155, 0x0158, 0x0159, 0x015A, 0x015B, 0x015E, 0x015F, 0x0160,
    350     0x0161, 0x0162, 0x0163, 0x0164, 0x0165, 0x016E, 0x016F, 0x0170,
    351     0x0171, 0x0178, 0x0179, 0x017A, 0x017B, 0x017C, 0x017D, 0x017E,
    352     0x0192,
    353  
    354     0x02C6, 0x02C7, 0x02D8, 0x02D9, 0x02DA, 0x02DB, 0x02DC, 0x02DD,
    355     0x03A9, 0x03C0, 0x2013, 0x2014, 0x2018, 0x2019, 0x201A, 0x201C,
    356     0x201D, 0x201E, 0x2020, 0x2021, 0x2022, 0x2026, 0x2030, 0x2039,
    357     0x203A, 0x2044, 0x20AC,
    358  
    359     0x2122, 0x2202, 0x2206, 0x220F,
    360  
    361     0x2211, 0x221A, 0x221E, 0x222B, 0x2248, 0x2260, 0x2264, 0x2265,
    362     0x25CA,
    363  
    364     0xF8FF, 0xFB01, 0xFB02,
    365   //*/
    366 };
    367 
    368 //                       >>>>>>>>>> USER CONFIGURED PARAMETERS END HERE <<<<<<<<<<
    369 
    370 ////////////////////////////////////////////////////////////////////////////////////////////////
    371 
    372 // Variable to hold the inclusive Unicode range (16 bit values only for this sketch)
    373 int firstUnicode = 0;
    374 int lastUnicode  = 0;
    375 
    376 PFont myFont;
    377 
    378 PrintWriter logOutput;
    379 
    380 void setup() {
    381   logOutput = createWriter("FontFiles/System_Font_List.txt"); 
    382 
    383   size(1000, 800);
    384 
    385   // Print the available fonts to the console as a list:
    386   String[] fontList = PFont.list();
    387   printArray(fontList);
    388 
    389   // Save font list to file
    390   for (int x = 0; x < fontList.length; x++)
    391   {
    392     logOutput.print("[" + x + "] ");
    393     logOutput.println(fontList[x]);
    394   }
    395   logOutput.flush(); // Writes the remaining data to the file
    396   logOutput.close(); // Finishes the file
    397 
    398   // Set the fontName from the array number or the defined fontName
    399   if (fontNumber >= 0)
    400   {
    401 //    fontName = fontList[fontNumber];
    402     fontType = "";
    403   }
    404 
    405   char[]   charset;
    406   int  index = 0, count = 0;
    407 
    408   int blockCount = unicodeBlocks.length;
    409 
    410   for (int i = 0; i < blockCount; i+=2) {
    411     firstUnicode = unicodeBlocks[i];
    412     lastUnicode  = unicodeBlocks[i+1];
    413     if (lastUnicode < firstUnicode) {
    414       delay(100);
    415       System.err.println("ERROR: Bad Unicode range secified, last < first!");
    416       System.err.print("first in range = 0x" + hex(firstUnicode, 4));
    417       System.err.println(", last in range  = 0x" + hex(lastUnicode, 4));
    418       while (true);
    419     }
    420     // calculate the number of characters
    421     count += (lastUnicode - firstUnicode + 1);
    422   }
    423 
    424   count += specificUnicodes.length;
    425 
    426   println();
    427   println("=====================");
    428   println("Creating font file...");
    429   println("Unicode blocks included     = " + (blockCount/2));
    430   println("Specific unicodes included  = " + specificUnicodes.length);
    431   println("Total number of characters  = " + count);
    432 
    433   if (count == 0) {
    434     delay(100);
    435     System.err.println("ERROR: No Unicode range or specific codes have been defined!");
    436     while (true);
    437   }
    438 
    439   // allocate memory
    440   charset = new char[count];
    441 
    442   for (int i = 0; i < blockCount; i+=2) {
    443     firstUnicode = unicodeBlocks[i];
    444     lastUnicode  =  unicodeBlocks[i+1];
    445 
    446     // loading the range specified
    447     for (int code = firstUnicode; code <= lastUnicode; code++) {
    448       charset[index] = Character.toChars(code)[0];
    449       index++;
    450     }
    451   }
    452 
    453   // loading the specific point codes
    454   for (int i = 0; i < specificUnicodes.length; i++) {
    455     charset[index] = Character.toChars(specificUnicodes[i])[0];
    456     index++;
    457   }
    458 
    459   // Make font smooth (anti-aliased)
    460   boolean smooth = true;
    461 
    462   // Create the font in memory
    463   myFont = createFont(fontName+fontType, displayFontSize, smooth, charset);
    464 
    465   // Print characters to the sketch window
    466   fill(0, 0, 0);
    467   textFont(myFont);
    468 
    469   // Set the left and top margin
    470   int margin = displayFontSize;
    471   translate(margin/2, margin);
    472 
    473   int gapx = displayFontSize*10/8;
    474   int gapy = displayFontSize*10/8;
    475   index = 0;
    476   fill(0);
    477 
    478   textSize(displayFontSize);
    479 
    480   for (int y = 0; y < height-gapy; y += gapy) {
    481     int x = 0;
    482     while (x < width) {
    483 
    484       int unicode = charset[index];
    485       float cwidth = textWidth((char)unicode) + 2;
    486       if ( (x + cwidth) > (width - gapx) ) break;
    487 
    488       // Draw the glyph to the screen
    489       text(new String(Character.toChars(unicode)), x, y);
    490 
    491       // Move cursor
    492       x += cwidth;
    493       // Increment the counter
    494       index++;
    495       if (index >= count) break;
    496     }
    497     if (index >= count) break;
    498   }
    499 
    500 
    501   // creating font to save as a file
    502   PFont    font;
    503 
    504   font = createFont(fontName+fontType, fontSize, smooth, charset);
    505 
    506   println("Created font " + fontName + str(fontSize) + ".vlw");
    507 
    508   String fontFileName = "FontFiles/" + fontName + str(fontSize) + ".vlw";
    509 
    510   // creating file
    511   try {
    512     print("Saving to sketch FontFiles folder... ");
    513 
    514     OutputStream output = createOutput(fontFileName);
    515     font.save(output);
    516     output.close();
    517 
    518     println("OK!");
    519 
    520     delay(100);
    521 
    522     // Open up the FontFiles folder to access the saved file
    523     String path = sketchPath();
    524     if(openFolder){
    525       Desktop.getDesktop().open(new File(path+"/FontFiles"));
    526     }
    527 
    528     System.err.println("All done! Note: Rectangles are displayed for non-existant characters.");
    529   }
    530   catch(IOException e) {
    531     println("Doh! Failed to create the file");
    532   }
    533 
    534   if(!createHeaderFile) return;
    535   // Now creating header file if the option was specified.
    536   try{
    537     print("saving header file to FontFile folder...");
    538 
    539     InputStream input = createInputRaw(fontFileName);
    540     PrintWriter output = createWriter("FontFiles/" + fontName + str(fontSize) + ".h");
    541 
    542     output.println("#include <pgmspace.h>");
    543     output.println();
    544     output.println("const uint8_t " + fontName + str(fontSize) + "[] PROGMEM = {");
    545 
    546     int i = 0;
    547     int data = input.read();
    548     while(data != -1){
    549       output.print("0x");
    550       output.print(hex(data, 2));
    551       if(i++ < 15){
    552         output.print(", ");
    553       } else {
    554         output.println(",");
    555         i = 0;
    556       }
    557       data = input.read();
    558     }
    559 //    font.save(output);
    560     output.println("\n};");
    561 
    562     output.close();
    563     input.close();
    564 
    565     println("C header file created.");
    566 
    567   } catch(IOException e){
    568     println("Failed to create C header file");
    569   }
    570 }