From a48a3e4dc8772a9ab423416dff14506b42c7a8b9 Mon Sep 17 00:00:00 2001 From: Christopher Masto Date: Sat, 16 Apr 2022 22:51:46 -0400 Subject: [PATCH 1/2] Add converters for Adafruit/PixelIt fonts These two hacky Python scripts convert a couple of useful fonts to LEDText format. The Adafruit classic font is particularly useful for 8-pixel-tall displays, and has sensible descenders. The PixelIt font is proportional and nicely tuned, though it's quite small. --- convert_classic_font.py | 130 ++++++++++++++++++++++++++++++ convert_gfx_font.py | 171 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 301 insertions(+) create mode 100644 convert_classic_font.py create mode 100644 convert_gfx_font.py diff --git a/convert_classic_font.py b/convert_classic_font.py new file mode 100644 index 0000000..2497fc3 --- /dev/null +++ b/convert_classic_font.py @@ -0,0 +1,130 @@ +# Hacky script to turn the Adafruit GFX "classic" font into an LEDText font. +# Makes all sorts of assumptions, because it's only meant to run once. + +# This program was made specifically to convert +# https://github.com/adafruit/Adafruit-GFX-Library/blob/master/glcdfont.c, +# and will probably require modification for other fonts. + +import re +import sys + +NUM_CHARS = 256 +BYTES_PER_CHAR = 5 + +WIDTH = 5 +HEIGHT = 8 + +FIRST = 32 +LAST = 127 + +font_file = open("glcdfont.c", "r") +out_file = open("FontClassic.h", "w") + +# Read in the source font +while True: + l = font_file.readline() + if not l: + sys.exit("Error: never found bitmap") + if re.search("font.*= {", l, re.IGNORECASE): + break + +# Extract the bitmaps +font = [] +while True: + l = font_file.readline() + if not l: + sys.exit("Unexpected EOF reading bitmaps") + if l.find("};") != -1: + break + l = re.sub("//.*", "", l) + for b in re.findall("0x[0-9a-f]{2}", l, re.IGNORECASE): + font.append(int(b, 16)) + +expect_bytes = NUM_CHARS * BYTES_PER_CHAR +if len(font) != expect_bytes: + sys.exit(f"Expected to read {expect_bytes} bytes, got {len(font)}") + +# Render a given character into a two-dimensional grid +def render(ch): + # Efficiency isn't important here, so we're literally using a matrix + # of spaces and asterisks. Makes it easy to debug. + cells = [list(" " * WIDTH) for i in range(HEIGHT)] + + # https://github.com/adafruit/Adafruit-GFX-Library/blob/6f4981e2f15dc7c80e53ecc6b721e9afed3f2815/Adafruit_GFX.cpp#L1150, + # basically + for i in range(WIDTH): + line = font[ch * 5 + i] + for j in range(HEIGHT): + if line & 1: + cells[j][i] = "*" + line >>= 1 + + return cells + + +# Print out character for debugging +def printchar(ch): + cells = render(ch) + + for y in range(len(cells)): + print("".join(cells[y])) + + +# Returns one line of LEDText font data +def convert(ch): + cells = render(ch) + + s = "" + + for y in range(HEIGHT): + byte = 0 # Assemble the byte one bit at a time + + bit = 7 + for x in range(WIDTH): + if cells[y][x] != " ": + byte |= 2 ** bit + bit -= 1 + + if len(s): + s += ", " + s += "0x{:02x}".format(byte) + + return s + + +def safechr(cnum): + ch = chr(cnum) + if ch == " ": + return "Space" + elif ch == "\\": + return "Backslash" + elif ch == "\x7f": + return "DEL" + else: + return ch + + +HEADER = f"""#ifndef FontClassic_h +#define FontClassic_h + +#include + +constexpr uint8_t ClassicFontData[] = {{ +\t{WIDTH},\t// Font Width +\t{HEIGHT},\t// Font Height +\t{FIRST},\t// Font First Character +\t{LAST},\t// Font Last Character +""" + +print(HEADER, end="", file=out_file) + +for ch in range(FIRST, LAST + 1): + comma = "," if ch != LAST else " " + print(f"\t{convert(ch)}{comma} // {safechr(ch)}", file=out_file) + +FOOTER = """}; + +#endif +""" + +print(FOOTER, end="", file=out_file) diff --git a/convert_gfx_font.py b/convert_gfx_font.py new file mode 100644 index 0000000..2dae93e --- /dev/null +++ b/convert_gfx_font.py @@ -0,0 +1,171 @@ +# This program was made specifically to convert +# https://github.com/o0shojo0o/PixelIt/blob/master/src/PixelItFont.h, +# and will probably require modification for other fonts. + +from math import ceil +import re +import sys +import argparse + +any_int = lambda x: int(x, 0) + +parser = argparse.ArgumentParser(description="Convert Adafruit GFX font to LEDText.") +parser.add_argument("input_file", help="source .h file containing GFX font") +parser.add_argument("output_file", help="destination filename for LEDText .h font file") +parser.add_argument("--name", default="PixelIt", help="font name") +parser.add_argument( + "--first", default=0x20, type=any_int, help="starting character number" +) +parser.add_argument( + "--last", default=0x7F, type=any_int, help="ending character number" +) +parser.add_argument( + "--max_height", default=6, type=any_int, help="maximum character height in pixels" +) + +args = parser.parse_args() + +FOOTER = """}; + +#endif +""" + +max_width = 0 + +font_file = open(args.input_file, "r") +out_file = open(args.output_file, "w") + +# Read in the source font +while True: + l = font_file.readline() + if not l: + sys.exit("Error: never found bitmap") + if re.search("bitmaps.*{", l, re.IGNORECASE): + break + +# Read the bitmap section +bitmaps = [] +while True: + l = font_file.readline() + if not l: + sys.exit("Unexpected EOF reading bitmaps") + if l.find("}") != -1: + break + l = re.sub("//.*", "", l) + for b in re.findall("0x[0-9a-f]{2}", l, re.IGNORECASE): + bitmaps.append(int(b, 16)) + +while True: + l = font_file.readline() + if not l: + sys.exit("Error: never found glyphs") + if re.search("glyphs.*{", l, re.IGNORECASE): + break + +# Read the glyphs section +glyphs = [] +while True: + l = font_file.readline() + if not l: + sys.exit("Unexpected EOF reading glyphs") + if l.find("};") != -1: + break + l = re.sub("//.*", "", l) + m = re.search( + "{.*?(-?\d+).*?,.*?(-?\d+).*?,.*?(-?\d+).*?,.*?(-?\d+).*?,.*?(-?\d+).*?,.*?(-?\d+).*?}", + l, + ) + if m: + g = m.groups() + if len(g) != 6: + sys.exit(f"Expected 6 elements at: {l}") + glyphs.append(g) + if int(g[1]) > max_width: + max_width = int(g[1]) + + +def render(ch): + n = ord(ch) + glyph = glyphs[n - args.first] + i = int(glyph[0]) + width = int(glyph[1]) + height = int(glyph[2]) + xadv = int(glyph[3]) + xoff = int(glyph[4]) + yoff = int(glyph[5]) + + bytes_per_line = ceil(width / 8) + + cells = [list(" " * max_width) for i in range(args.max_height)] + + for y in range(height): + for x in range(bytes_per_line): + b = bitmaps[i] + i += 1 + for bit in range(8): + if bit < xadv and b & (2 ** (7 - bit)): + cells[y + args.max_height + yoff - 1][bit + xoff + x * 8] = "*" + + return xadv, cells + + +def printchar(ch): + xadv, cells = render(ch) + + for y in range(args.max_height): + print("".join(cells[y])) + + +def convert(ch): + xadv, cells = render(ch) + + s = f"{xadv-1}" + + for y in range(args.max_height): + b = 0 + bit = 7 + r = cells[y] + while r: + b |= 0 if r.pop(0) == " " else 2 ** bit + bit -= 1 + if bit < 0: + s += f", {hex(b)}" + b = 0 + bit = 7 + if bit != 7: + s += f", {hex(b)}" + + return s + + +def safechr(cnum): + ch = chr(cnum) + if ch == " ": + return "Space" + elif ch == "\\": + return "Backslash" + elif ch == "\x7f": + return "DEL" + else: + return ch + + +HEADER = f"""#ifndef Font{args.name}_h +#define Font{args.name}_h + +#include + +constexpr uint8_t {args.name}FontData[] = {{ + FONT_PROPORTIONAL | {max_width}, // Font Maximum Width + {args.max_height}, // Font Height + {args.first}, // Font First Character + {args.last},// Font Last Character +""" + +print(HEADER, end="", file=out_file) + +for ch in range(args.first, args.last + 1): + comma = "," if ch != args.last else " " + print(f"\t{convert(chr(ch))}{comma} // {safechr(ch)}", file=out_file) + +print(FOOTER, end="", file=out_file) From f64355338491375dc84a7c40b2195dd061c9b87a Mon Sep 17 00:00:00 2001 From: Christopher Masto Date: Sat, 16 Apr 2022 23:09:36 -0400 Subject: [PATCH 2/2] Add converted font files --- FontClassic.h | 141 ++++++++++++++++++++++++++++++++++++++++++ FontPixelIt.h | 167 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 308 insertions(+) create mode 100644 FontClassic.h create mode 100644 FontPixelIt.h diff --git a/FontClassic.h b/FontClassic.h new file mode 100644 index 0000000..4a7ec4e --- /dev/null +++ b/FontClassic.h @@ -0,0 +1,141 @@ +/* +** This is the 'classic' fixed-space bitmap font for Adafruit_GFX since 1.0. +** +** Converted from Adafruit GFX to LEDText using +** https://github.com/masto/LEDText/blob/font_convert/convert_classic_font.py +** +** Software License Agreement (BSD License) +** +** Copyright (c) 2012 Adafruit Industries. All rights reserved. +** +** Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are met: +** +** - Redistributions of source code must retain the above copyright notice, +** this list of conditions and the following disclaimer. +** - Redistributions in binary form must reproduce the above copyright notice, +** this list of conditions and the following disclaimer in the documentation +** and/or other materials provided with the distribution. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +** POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifndef FontClassic_h +#define FontClassic_h + +#include + +constexpr uint8_t ClassicFontData[] = { + 5, // Font Width + 8, // Font Height + 32, // Font First Character + 127, // Font Last Character + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Space + 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x20, 0x00, // ! + 0x50, 0x50, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, // " + 0x50, 0x50, 0xf8, 0x50, 0xf8, 0x50, 0x50, 0x00, // # + 0x20, 0x78, 0xa0, 0x70, 0x28, 0xf0, 0x20, 0x00, // $ + 0xc0, 0xc8, 0x10, 0x20, 0x40, 0x98, 0x18, 0x00, // % + 0x40, 0xa0, 0xa0, 0x40, 0xa8, 0x90, 0x68, 0x00, // & + 0x30, 0x30, 0x20, 0x40, 0x00, 0x00, 0x00, 0x00, // ' + 0x10, 0x20, 0x40, 0x40, 0x40, 0x20, 0x10, 0x00, // ( + 0x40, 0x20, 0x10, 0x10, 0x10, 0x20, 0x40, 0x00, // ) + 0x20, 0xa8, 0x70, 0xf8, 0x70, 0xa8, 0x20, 0x00, // * + 0x00, 0x20, 0x20, 0xf8, 0x20, 0x20, 0x00, 0x00, // + + 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x20, 0x40, // , + 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, // - + 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x00, // . + 0x00, 0x08, 0x10, 0x20, 0x40, 0x80, 0x00, 0x00, // / + 0x70, 0x88, 0x98, 0xa8, 0xc8, 0x88, 0x70, 0x00, // 0 + 0x20, 0x60, 0x20, 0x20, 0x20, 0x20, 0x70, 0x00, // 1 + 0x70, 0x88, 0x08, 0x70, 0x80, 0x80, 0xf8, 0x00, // 2 + 0xf8, 0x08, 0x10, 0x30, 0x08, 0x88, 0x70, 0x00, // 3 + 0x10, 0x30, 0x50, 0x90, 0xf8, 0x10, 0x10, 0x00, // 4 + 0xf8, 0x80, 0xf0, 0x08, 0x08, 0x88, 0x70, 0x00, // 5 + 0x38, 0x40, 0x80, 0xf0, 0x88, 0x88, 0x70, 0x00, // 6 + 0xf8, 0x08, 0x08, 0x10, 0x20, 0x40, 0x80, 0x00, // 7 + 0x70, 0x88, 0x88, 0x70, 0x88, 0x88, 0x70, 0x00, // 8 + 0x70, 0x88, 0x88, 0x78, 0x08, 0x10, 0xe0, 0x00, // 9 + 0x00, 0x00, 0x20, 0x00, 0x20, 0x00, 0x00, 0x00, // : + 0x00, 0x00, 0x20, 0x00, 0x20, 0x20, 0x40, 0x00, // ; + 0x08, 0x10, 0x20, 0x40, 0x20, 0x10, 0x08, 0x00, // < + 0x00, 0x00, 0xf8, 0x00, 0xf8, 0x00, 0x00, 0x00, // = + 0x40, 0x20, 0x10, 0x08, 0x10, 0x20, 0x40, 0x00, // > + 0x70, 0x88, 0x08, 0x30, 0x20, 0x00, 0x20, 0x00, // ? + 0x70, 0x88, 0xa8, 0xb8, 0xb0, 0x80, 0x78, 0x00, // @ + 0x20, 0x50, 0x88, 0x88, 0xf8, 0x88, 0x88, 0x00, // A + 0xf0, 0x88, 0x88, 0xf0, 0x88, 0x88, 0xf0, 0x00, // B + 0x70, 0x88, 0x80, 0x80, 0x80, 0x88, 0x70, 0x00, // C + 0xf0, 0x88, 0x88, 0x88, 0x88, 0x88, 0xf0, 0x00, // D + 0xf8, 0x80, 0x80, 0xf0, 0x80, 0x80, 0xf8, 0x00, // E + 0xf8, 0x80, 0x80, 0xf0, 0x80, 0x80, 0x80, 0x00, // F + 0x78, 0x88, 0x80, 0x80, 0x98, 0x88, 0x78, 0x00, // G + 0x88, 0x88, 0x88, 0xf8, 0x88, 0x88, 0x88, 0x00, // H + 0x70, 0x20, 0x20, 0x20, 0x20, 0x20, 0x70, 0x00, // I + 0x38, 0x10, 0x10, 0x10, 0x10, 0x90, 0x60, 0x00, // J + 0x88, 0x90, 0xa0, 0xc0, 0xa0, 0x90, 0x88, 0x00, // K + 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xf8, 0x00, // L + 0x88, 0xd8, 0xa8, 0xa8, 0xa8, 0x88, 0x88, 0x00, // M + 0x88, 0x88, 0xc8, 0xa8, 0x98, 0x88, 0x88, 0x00, // N + 0x70, 0x88, 0x88, 0x88, 0x88, 0x88, 0x70, 0x00, // O + 0xf0, 0x88, 0x88, 0xf0, 0x80, 0x80, 0x80, 0x00, // P + 0x70, 0x88, 0x88, 0x88, 0xa8, 0x90, 0x68, 0x00, // Q + 0xf0, 0x88, 0x88, 0xf0, 0xa0, 0x90, 0x88, 0x00, // R + 0x70, 0x88, 0x80, 0x70, 0x08, 0x88, 0x70, 0x00, // S + 0xf8, 0xa8, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, // T + 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x70, 0x00, // U + 0x88, 0x88, 0x88, 0x88, 0x88, 0x50, 0x20, 0x00, // V + 0x88, 0x88, 0x88, 0xa8, 0xa8, 0xa8, 0x50, 0x00, // W + 0x88, 0x88, 0x50, 0x20, 0x50, 0x88, 0x88, 0x00, // X + 0x88, 0x88, 0x50, 0x20, 0x20, 0x20, 0x20, 0x00, // Y + 0xf8, 0x08, 0x10, 0x70, 0x40, 0x80, 0xf8, 0x00, // Z + 0x78, 0x40, 0x40, 0x40, 0x40, 0x40, 0x78, 0x00, // [ + 0x00, 0x80, 0x40, 0x20, 0x10, 0x08, 0x00, 0x00, // Backslash + 0x78, 0x08, 0x08, 0x08, 0x08, 0x08, 0x78, 0x00, // ] + 0x20, 0x50, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, // ^ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, // _ + 0x60, 0x60, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, // ` + 0x00, 0x00, 0x60, 0x10, 0x70, 0x90, 0x78, 0x00, // a + 0x80, 0x80, 0xb0, 0xc8, 0x88, 0xc8, 0xb0, 0x00, // b + 0x00, 0x00, 0x70, 0x88, 0x80, 0x88, 0x70, 0x00, // c + 0x08, 0x08, 0x68, 0x98, 0x88, 0x98, 0x68, 0x00, // d + 0x00, 0x00, 0x70, 0x88, 0xf8, 0x80, 0x70, 0x00, // e + 0x10, 0x28, 0x20, 0x70, 0x20, 0x20, 0x20, 0x00, // f + 0x00, 0x00, 0x70, 0x98, 0x98, 0x68, 0x08, 0x70, // g + 0x80, 0x80, 0xb0, 0xc8, 0x88, 0x88, 0x88, 0x00, // h + 0x20, 0x00, 0x60, 0x20, 0x20, 0x20, 0x70, 0x00, // i + 0x10, 0x00, 0x10, 0x10, 0x10, 0x90, 0x60, 0x00, // j + 0x80, 0x80, 0x90, 0xa0, 0xc0, 0xa0, 0x90, 0x00, // k + 0x60, 0x20, 0x20, 0x20, 0x20, 0x20, 0x70, 0x00, // l + 0x00, 0x00, 0xd0, 0xa8, 0xa8, 0xa8, 0xa8, 0x00, // m + 0x00, 0x00, 0xb0, 0xc8, 0x88, 0x88, 0x88, 0x00, // n + 0x00, 0x00, 0x70, 0x88, 0x88, 0x88, 0x70, 0x00, // o + 0x00, 0x00, 0xb0, 0xc8, 0xc8, 0xb0, 0x80, 0x80, // p + 0x00, 0x00, 0x68, 0x98, 0x98, 0x68, 0x08, 0x08, // q + 0x00, 0x00, 0xb0, 0xc8, 0x80, 0x80, 0x80, 0x00, // r + 0x00, 0x00, 0x78, 0x80, 0x70, 0x08, 0xf0, 0x00, // s + 0x20, 0x20, 0xf8, 0x20, 0x20, 0x28, 0x10, 0x00, // t + 0x00, 0x00, 0x88, 0x88, 0x88, 0x98, 0x68, 0x00, // u + 0x00, 0x00, 0x88, 0x88, 0x88, 0x50, 0x20, 0x00, // v + 0x00, 0x00, 0x88, 0x88, 0xa8, 0xa8, 0x50, 0x00, // w + 0x00, 0x00, 0x88, 0x50, 0x20, 0x50, 0x88, 0x00, // x + 0x00, 0x00, 0x88, 0x88, 0x78, 0x08, 0x88, 0x70, // y + 0x00, 0x00, 0xf8, 0x10, 0x20, 0x40, 0xf8, 0x00, // z + 0x10, 0x20, 0x20, 0x40, 0x20, 0x20, 0x10, 0x00, // { + 0x20, 0x20, 0x20, 0x00, 0x20, 0x20, 0x20, 0x00, // | + 0x40, 0x20, 0x20, 0x10, 0x20, 0x20, 0x40, 0x00, // } + 0x40, 0xa8, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // ~ + 0x20, 0x70, 0xd8, 0x88, 0x88, 0xf8, 0x00, 0x00 // DEL +}; + +#endif diff --git a/FontPixelIt.h b/FontPixelIt.h new file mode 100644 index 0000000..2f30a43 --- /dev/null +++ b/FontPixelIt.h @@ -0,0 +1,167 @@ +/** +** The original 3x5 font is licensed under the 3-clause BSD license: +** +** Copyright 1999 Brian J. Swetland +** Copyright 1999 Vassilii Khachaturov +** Portions (of vt100.c/vt100.h) copyright Dan Marks +** +** All rights reserved. +** +** Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions +** are met: +** 1. Redistributions of source code must retain the above copyright +** notice, this list of conditions, and the following disclaimer. +** 2. Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions, and the following disclaimer in the +** documentation and/or other materials provided with the distribution. +** 3. The name of the authors may not be used to endorse or promote products +** derived from this software without specific prior written permission. +** +** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +** +** Modifications to Tom Thumb for improved readability are from Robey Pointer, +** see: +** http://robey.lag.net/2010/01/23/tiny-monospace-font.html +** +** Modifications for Awtrix 2.0 for improved readability and LaMetric Style are from +** Blueforcer, Yann and hollyghost +** see: +** https://forum.blueforcer.de/d/11-edit-font +** +** The original author does not have any objection to relicensing of Robey +** Pointer's modifications (in this file) in a more permissive license. See +** the discussion at the above blog, and also here: +** http://opengameart.org/forumtopic/how-to-submit-art-using-the-3-clause-bsd-license +** +** Feb 21, 2016: Conversion from Linux BDF --> Adafruit GFX font, +** with the help of this Python script: +** https://gist.github.com/skelliam/322d421f028545f16f6d +** William Skellenger (williamj@skellenger.net) +** Twitter: @skelliam +** +** Adafruit GFX Pixel font customiser +** https://tchapi.github.io/Adafruit-GFX-Font-Customiser/ +** +** Converted from Adafruit GFX to LEDText using +** https://github.com/masto/LEDText/blob/font_convert/convert_gfx_font.py +*/ + +#ifndef FontPixelIt_h +#define FontPixelIt_h + +#include + +constexpr uint8_t PixelItFontData[] = { + FONT_PROPORTIONAL | 8, // Font Maximum Width + 6, // Font Height + 32, // Font First Character + 127, // Font Last Character + 1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, // Space + 1, 0x80, 0x80, 0x80, 0x0, 0x80, 0x0, // ! + 3, 0xa0, 0xa0, 0x0, 0x0, 0x0, 0x0, // " + 3, 0xa0, 0xe0, 0xa0, 0xe0, 0xa0, 0x0, // # + 3, 0x60, 0xc0, 0x60, 0xc0, 0x40, 0x0, // $ + 3, 0xa0, 0x20, 0x40, 0x80, 0xa0, 0x0, // % + 3, 0xc0, 0xc0, 0xe0, 0xa0, 0x60, 0x0, // & + 1, 0x80, 0x80, 0x0, 0x0, 0x0, 0x0, // ' + 2, 0x40, 0x80, 0x80, 0x80, 0x40, 0x0, // ( + 2, 0x80, 0x40, 0x40, 0x40, 0x80, 0x0, // ) + 3, 0xa0, 0x40, 0xa0, 0x0, 0x0, 0x0, // * + 3, 0x0, 0x40, 0xe0, 0x40, 0x0, 0x0, // + + 2, 0x0, 0x0, 0x0, 0x40, 0x80, 0x0, // , + 3, 0x0, 0x0, 0xe0, 0x0, 0x0, 0x0, // - + 1, 0x0, 0x0, 0x0, 0x0, 0x80, 0x0, // . + 3, 0x20, 0x20, 0x40, 0x80, 0x80, 0x0, // / + 3, 0xe0, 0xa0, 0xa0, 0xa0, 0xe0, 0x0, // 0 + 3, 0x40, 0xc0, 0x40, 0x40, 0xe0, 0x0, // 1 + 3, 0xe0, 0x20, 0xe0, 0x80, 0xe0, 0x0, // 2 + 3, 0xe0, 0x20, 0xe0, 0x20, 0xe0, 0x0, // 3 + 3, 0xa0, 0xa0, 0xe0, 0x20, 0x20, 0x0, // 4 + 3, 0xe0, 0x80, 0xe0, 0x20, 0xe0, 0x0, // 5 + 3, 0xe0, 0x80, 0xe0, 0xa0, 0xe0, 0x0, // 6 + 3, 0xe0, 0x20, 0x20, 0x20, 0x20, 0x0, // 7 + 3, 0xe0, 0xa0, 0xe0, 0xa0, 0xe0, 0x0, // 8 + 3, 0xe0, 0xa0, 0xe0, 0x20, 0xe0, 0x0, // 9 + 1, 0x0, 0x80, 0x0, 0x80, 0x0, 0x0, // : + 2, 0x0, 0x40, 0x0, 0x40, 0x80, 0x0, // ; + 3, 0x20, 0x40, 0x80, 0x40, 0x20, 0x0, // < + 3, 0x0, 0xe0, 0x0, 0xe0, 0x0, 0x0, // = + 3, 0x80, 0x40, 0x20, 0x40, 0x80, 0x0, // > + 3, 0xe0, 0x20, 0x40, 0x0, 0x40, 0x0, // ? + 3, 0x40, 0xa0, 0xe0, 0x80, 0x60, 0x0, // @ + 3, 0xc0, 0xa0, 0xe0, 0xa0, 0xa0, 0x0, // A + 3, 0xc0, 0xa0, 0xc0, 0xa0, 0xc0, 0x0, // B + 3, 0x40, 0xa0, 0x80, 0xa0, 0x40, 0x0, // C + 3, 0xc0, 0xa0, 0xa0, 0xa0, 0xc0, 0x0, // D + 3, 0xe0, 0x80, 0xe0, 0x80, 0xe0, 0x0, // E + 3, 0xe0, 0x80, 0xe0, 0x80, 0x80, 0x0, // F + 3, 0x60, 0x80, 0xa0, 0xa0, 0x60, 0x0, // G + 3, 0xa0, 0xa0, 0xe0, 0xa0, 0xa0, 0x0, // H + 1, 0x80, 0x80, 0x80, 0x80, 0x80, 0x0, // I + 3, 0x20, 0x20, 0x20, 0xa0, 0x40, 0x0, // J + 3, 0xa0, 0xa0, 0xc0, 0xa0, 0xa0, 0x0, // K + 3, 0x80, 0x80, 0x80, 0x80, 0xe0, 0x0, // L + 5, 0x88, 0xd8, 0xa8, 0x88, 0x88, 0x0, // M + 4, 0x90, 0xd0, 0xb0, 0x90, 0x90, 0x0, // N + 3, 0x40, 0xa0, 0xa0, 0xa0, 0x40, 0x0, // O + 3, 0xe0, 0xa0, 0xc0, 0x80, 0x80, 0x0, // P + 4, 0x40, 0xa0, 0xa0, 0xa0, 0x70, 0x0, // Q + 3, 0xe0, 0xa0, 0xc0, 0xa0, 0xa0, 0x0, // R + 3, 0xe0, 0x80, 0xe0, 0x20, 0xe0, 0x0, // S + 3, 0xe0, 0x40, 0x40, 0x40, 0x40, 0x0, // T + 3, 0xa0, 0xa0, 0xa0, 0xa0, 0xe0, 0x0, // U + 3, 0xa0, 0xa0, 0xa0, 0xa0, 0x40, 0x0, // V + 5, 0x88, 0x88, 0x88, 0xa8, 0x50, 0x0, // W + 3, 0xa0, 0xa0, 0x40, 0xa0, 0xa0, 0x0, // X + 3, 0xa0, 0xa0, 0xe0, 0x20, 0xc0, 0x0, // Y + 3, 0xe0, 0x20, 0x40, 0x80, 0xe0, 0x0, // Z + 3, 0xe0, 0x80, 0x80, 0x80, 0xe0, 0x0, // [ + 3, 0x0, 0x80, 0x40, 0x20, 0x0, 0x0, // Backslash + 3, 0xe0, 0x20, 0x20, 0x20, 0xe0, 0x0, // ] + 3, 0x40, 0xa0, 0x0, 0x0, 0x0, 0x0, // ^ + 3, 0x0, 0x0, 0x0, 0x0, 0xe0, 0x0, // _ + 2, 0x80, 0x40, 0x0, 0x0, 0x0, 0x0, // ` + 3, 0x0, 0xc0, 0x60, 0xa0, 0xe0, 0x0, // a + 3, 0x80, 0xc0, 0xa0, 0xa0, 0xc0, 0x0, // b + 3, 0x0, 0x60, 0x80, 0x80, 0x60, 0x0, // c + 3, 0x20, 0x60, 0xa0, 0xa0, 0x60, 0x0, // d + 3, 0x0, 0x60, 0xa0, 0xc0, 0x60, 0x0, // e + 3, 0x20, 0x40, 0xe0, 0x40, 0x40, 0x0, // f + 3, 0x0, 0x60, 0xa0, 0xe0, 0x20, 0x40, // g + 3, 0x80, 0xc0, 0xa0, 0xa0, 0xa0, 0x0, // h + 1, 0x80, 0x0, 0x80, 0x80, 0x80, 0x0, // i + 3, 0x20, 0x0, 0x20, 0x20, 0xa0, 0x40, // j + 3, 0x80, 0xa0, 0xc0, 0xc0, 0xa0, 0x0, // k + 3, 0xc0, 0x40, 0x40, 0x40, 0xe0, 0x0, // l + 3, 0x0, 0xe0, 0xe0, 0xe0, 0xa0, 0x0, // m + 3, 0x0, 0xc0, 0xa0, 0xa0, 0xa0, 0x0, // n + 3, 0x0, 0x40, 0xa0, 0xa0, 0x40, 0x0, // o + 3, 0x0, 0xc0, 0xa0, 0xa0, 0xc0, 0x80, // p + 3, 0x0, 0x60, 0xa0, 0xa0, 0x60, 0x20, // q + 3, 0x0, 0x60, 0x80, 0x80, 0x80, 0x0, // r + 3, 0x0, 0x60, 0xc0, 0x60, 0xc0, 0x0, // s + 3, 0x40, 0xe0, 0x40, 0x40, 0x60, 0x0, // t + 3, 0x0, 0xa0, 0xa0, 0xa0, 0x60, 0x0, // u + 3, 0x0, 0xa0, 0xa0, 0xe0, 0x40, 0x0, // v + 3, 0x0, 0xa0, 0xe0, 0xe0, 0xe0, 0x0, // w + 3, 0x0, 0xa0, 0x40, 0x40, 0xa0, 0x0, // x + 3, 0x0, 0xa0, 0xa0, 0x60, 0x20, 0x40, // y + 3, 0x0, 0xe0, 0x60, 0xc0, 0xe0, 0x0, // z + 3, 0x60, 0x40, 0x80, 0x40, 0x60, 0x0, // { + 1, 0x80, 0x80, 0x0, 0x80, 0x80, 0x0, // | + 3, 0xc0, 0x40, 0x20, 0x40, 0xc0, 0x0, // } + 3, 0x60, 0xc0, 0x0, 0x0, 0x0, 0x0, // ~ + 1, 0x80, 0x0, 0x80, 0x80, 0x80, 0x0 // DEL +}; + +#endif