Skip to content
Gerald Lechner edited this page Apr 3, 2024 · 6 revisions

Font editor:

Font page

The font editor allows you to modify or extend an existing font or create a new font from scratch.

  • Read an existing font by clicking the button "Read font". In the grid on the panel, you will see all the characters defined in the font. The name will be filled as well as font height, baseline, and line height. Font height is the maximum size, the sum from ascender and descender. The baseline value is the height of the highest ascender. Line height is the distance between the baselines of two rows. The buttons "Assign values" and "Clear all chars" are not required in this case. If you click on a field in the grid, the corresponding character will be opened in the pixel editor.
  • To create a new font simply click the button "Create new font" then select a font out of your installed fonts. That's it. Sizes below 12 pt may be off bad quality. Eventually you can adjust threhold for black recognition. The new font covers Windows Codepage 1252. With the following function you can convert Arduinos UTF8 to code page 1252:
String utf8ToWindows(String s) {
  String  res = "";
  uint8_t prev = 0;
  uint8_t c;
  for (uint16_t i = 0; i<s.length(); i++) {
    c = byte(s[i]);
    if (c < 0x80) {
      res += char(c);
    } else {
      switch (prev) {
        case 0xC2 : res += char(c); break;
        case 0xC3 : res += char(c | 0xC0); break;
        case 0x82 : if (c == 0xac) res += char(0x80); break; 
      }
    }
    prev = c;
  }
  return res;
}
Clone this wiki locally