Closed NoobTracker closed 2 years ago
I had a similar issue, as I wanted to have some tick labels. Finally I found this here: https://blog.mclemon.org/hacking-a-tiny-new-font-for-the-ssd1306-128x64-oled-screen , which leads to the Tom Thumb font from https://robey.lag.net/2010/01/23/tiny-monospace-font.html . Unfortunately the format is BDF, which I've managed to convert to the format used by this library (using an Excel-based tool from https://forum.arduino.cc/index.php?topic=447956 ) as results in the attached snippet. Simply copy this into the OLEDDisplayFonts.h file (or include your own file with that content). Note that according to the authors Brian Swetland and Robey Pointer this font is licensed according to the CC0 or CC-BY 3.0 license.
const uint8_t TomThumb4x6[] PROGMEM = {
0x03, // Width: 3
0x06, // Height: 6
0x20, // First char: 32
0xBD, // Number of chars: 189
// Jump Table:
0xFF,0xFF,0x00,0x02, // space
0x00,0x00,0x02,0x03, // exclam
0x00,0x02,0x03,0x03, // quotedbl
0x00,0x05,0x03,0x03, // numbersign
0x00,0x08,0x03,0x03, // dollar
0x00,0x0B,0x03,0x03, // percent
0x00,0x0E,0x03,0x03, // ampersand
0x00,0x11,0x02,0x03, // quotesingle
0x00,0x13,0x03,0x03, // parenleft
0x00,0x16,0x02,0x03, // parenright
0x00,0x18,0x03,0x03, // asterisk
0x00,0x1B,0x03,0x03, // plus
0x00,0x1E,0x02,0x03, // comma
0x00,0x20,0x03,0x03, // hyphen
0x00,0x23,0x02,0x03, // period
0x00,0x25,0x03,0x03, // slash
0x00,0x28,0x03,0x03, // zero
0x00,0x2B,0x02,0x03, // one
0x00,0x2D,0x03,0x03, // two
0x00,0x30,0x03,0x03, // three
0x00,0x33,0x03,0x03, // four
0x00,0x36,0x03,0x03, // five
0x00,0x39,0x03,0x03, // six
0x00,0x3C,0x03,0x03, // seven
0x00,0x3F,0x03,0x03, // eight
0x00,0x42,0x03,0x03, // nine
0x00,0x45,0x02,0x03, // colon
0x00,0x47,0x02,0x03, // semicolon
0x00,0x49,0x03,0x03, // less
0x00,0x4C,0x03,0x03, // equal
0x00,0x4F,0x03,0x03, // greater
0x00,0x52,0x03,0x03, // question
0x00,0x55,0x03,0x03, // at
0x00,0x58,0x03,0x03, // A
0x00,0x5B,0x03,0x03, // B
0x00,0x5E,0x03,0x03, // C
0x00,0x61,0x03,0x03, // D
0x00,0x64,0x03,0x03, // E
0x00,0x67,0x03,0x03, // F
0x00,0x6A,0x03,0x03, // G
0x00,0x6D,0x03,0x03, // H
0x00,0x70,0x03,0x03, // I
0x00,0x73,0x03,0x03, // J
0x00,0x76,0x03,0x03, // K
0x00,0x79,0x03,0x03, // L
0x00,0x7C,0x03,0x03, // M
0x00,0x7F,0x03,0x03, // N
0x00,0x82,0x03,0x03, // O
0x00,0x85,0x03,0x03, // P
0x00,0x88,0x03,0x03, // Q
0x00,0x8B,0x03,0x03, // R
0x00,0x8E,0x03,0x03, // S
0x00,0x91,0x03,0x03, // T
0x00,0x94,0x03,0x03, // U
0x00,0x97,0x03,0x03, // V
0x00,0x9A,0x03,0x03, // W
0x00,0x9D,0x03,0x03, // X
0x00,0xA0,0x03,0x03, // Y
0x00,0xA3,0x03,0x03, // Z
0x00,0xA6,0x03,0x03, // bracketleft
0x00,0xA9,0x03,0x03, // backslash
0x00,0xAC,0x03,0x03, // bracketright
0x00,0xAF,0x03,0x03, // asciicircum
0x00,0xB2,0x03,0x03, // underscore
0x00,0xB5,0x02,0x03, // grave
0x00,0xB7,0x03,0x03, // a
0x00,0xBA,0x03,0x03, // b
0x00,0xBD,0x03,0x03, // c
0x00,0xC0,0x03,0x03, // d
0x00,0xC3,0x03,0x03, // e
0x00,0xC6,0x03,0x03, // f
0x00,0xC9,0x03,0x03, // g
0x00,0xCC,0x03,0x03, // h
0x00,0xCF,0x02,0x03, // i
0x00,0xD1,0x03,0x03, // j
0x00,0xD4,0x03,0x03, // k
0x00,0xD7,0x03,0x03, // l
0x00,0xDA,0x03,0x03, // m
0x00,0xDD,0x03,0x03, // n
0x00,0xE0,0x03,0x03, // o
0x00,0xE3,0x03,0x03, // p
0x00,0xE6,0x03,0x03, // q
0x00,0xE9,0x03,0x03, // r
0x00,0xEC,0x03,0x03, // s
0x00,0xEF,0x03,0x03, // t
0x00,0xF2,0x03,0x03, // u
0x00,0xF5,0x03,0x03, // v
0x00,0xF8,0x03,0x03, // w
0x00,0xFB,0x03,0x03, // x
0x00,0xFE,0x03,0x03, // y
0x01,0x01,0x03,0x03, // z
0x01,0x04,0x03,0x03, // braceleft
0x01,0x07,0x02,0x03, // bar
0x01,0x09,0x03,0x03, // braceright
0x01,0x0C,0x03,0x03, // asciitilde
0x01,0x0F,0x02,0x03, // exclamdown
0x01,0x11,0x03,0x03, // cent
0x01,0x14,0x03,0x03, // sterling
0x01,0x17,0x03,0x03, // currency
0x01,0x1A,0x03,0x03, // yen
0x01,0x1D,0x02,0x03, // brokenbar
0x01,0x1F,0x03,0x03, // section
0x01,0x22,0x03,0x03, // dieresis
0x01,0x25,0x03,0x03, // copyright
0x01,0x28,0x03,0x03, // ordfeminine
0x01,0x2B,0x02,0x03, // guillemotleft
0x01,0x2D,0x03,0x03, // logicalnot
0x01,0x30,0x02,0x03, // softhyphen
0x01,0x32,0x03,0x03, // registered
0x01,0x35,0x03,0x03, // macron
0x01,0x38,0x03,0x03, // degree
0x01,0x3B,0x03,0x03, // plusminus
0x01,0x3E,0x03,0x03, // twosuperior
0x01,0x41,0x03,0x03, // threesuperior
0x01,0x44,0x03,0x03, // acute
0x01,0x47,0x03,0x03, // mu
0x01,0x4A,0x03,0x03, // paragraph
0x01,0x4D,0x03,0x03, // periodcentered
0x01,0x50,0x03,0x03, // cedilla
0x01,0x53,0x02,0x03, // onesuperior
0x01,0x55,0x03,0x03, // ordmasculine
0x01,0x58,0x03,0x03, // guillemotright
0x01,0x5B,0x03,0x03, // onequarter
0x01,0x5E,0x03,0x03, // onehalf
0x01,0x61,0x03,0x03, // threequarters
0x01,0x64,0x03,0x03, // questiondown
0x01,0x67,0x03,0x03, // Agrave
0x01,0x6A,0x03,0x03, // Aacute
0x01,0x6D,0x03,0x03, // Acircumflex
0x01,0x70,0x03,0x03, // Atilde
0x01,0x73,0x03,0x03, // Adieresis
0x01,0x76,0x03,0x03, // Aring
0x01,0x79,0x03,0x03, // AE
0x01,0x7C,0x03,0x03, // Ccedilla
0x01,0x7F,0x03,0x03, // Egrave
0x01,0x82,0x03,0x03, // Eacute
0x01,0x85,0x03,0x03, // Ecircumflex
0x01,0x88,0x03,0x03, // Edieresis
0x01,0x8B,0x03,0x03, // Igrave
0x01,0x8E,0x03,0x03, // Iacute
0x01,0x91,0x03,0x03, // Icircumflex
0x01,0x94,0x03,0x03, // Idieresis
0x01,0x97,0x03,0x03, // Eth
0x01,0x9A,0x03,0x03, // Ntilde
0x01,0x9D,0x03,0x03, // Ograve
0x01,0xA0,0x03,0x03, // Oacute
0x01,0xA3,0x03,0x03, // Ocircumflex
0x01,0xA6,0x03,0x03, // Otilde
0x01,0xA9,0x03,0x03, // Odieresis
0x01,0xAC,0x03,0x03, // multiply
0x01,0xAF,0x03,0x03, // Oslash
0x01,0xB2,0x03,0x03, // Ugrave
0x01,0xB5,0x03,0x03, // Uacute
0x01,0xB8,0x03,0x03, // Ucircumflex
0x01,0xBB,0x03,0x03, // Udieresis
0x01,0xBE,0x03,0x03, // Yacute
0x01,0xC1,0x03,0x03, // Thorn
0x01,0xC4,0x03,0x03, // germandbls
0x01,0xC7,0x03,0x03, // agrave
0x01,0xCA,0x03,0x03, // aacute
0x01,0xCD,0x03,0x03, // acircumflex
0x01,0xD0,0x03,0x03, // atilde
0x01,0xD3,0x03,0x03, // adieresis
0x01,0xD6,0x03,0x03, // aring
0x01,0xD9,0x03,0x03, // ae
0x01,0xDC,0x03,0x03, // ccedilla
0x01,0xDF,0x03,0x03, // egrave
0x01,0xE2,0x03,0x03, // eacute
0x01,0xE5,0x03,0x03, // ecircumflex
0x01,0xE8,0x03,0x03, // edieresis
0x01,0xEB,0x03,0x03, // igrave
0x01,0xEE,0x02,0x03, // iacute
0x01,0xF0,0x03,0x03, // icircumflex
0x01,0xF3,0x03,0x03, // idieresis
0x01,0xF6,0x03,0x03, // eth
0x01,0xF9,0x03,0x03, // ntilde
0x01,0xFC,0x03,0x03, // ograve
0x01,0xFF,0x03,0x03, // oacute
0x02,0x02,0x03,0x03, // ocircumflex
0x02,0x05,0x03,0x03, // otilde
0x02,0x08,0x03,0x03, // odieresis
0x02,0x0B,0x03,0x03, // divide
0x02,0x0E,0x03,0x03, // oslash
0x02,0x11,0x03,0x03, // ugrave
0x02,0x14,0x03,0x03, // uacute
0x02,0x17,0x03,0x03, // ucircumflex
0x02,0x1A,0x03,0x03, // udieresis
0x02,0x1D,0x03,0x03, // yacute
0x02,0x20,0x03,0x03, // thorn
// Font Data:
0x00,0x17, // exclam
0x03,0x00,0x03, // quotedbl
0x1F,0x0A,0x1F, // numbersign
0x0A,0x1F,0x05, // dollar
0x09,0x04,0x12, // percent
0x0F,0x17,0x1C, // ampersand
0x00,0x03, // quotesingle
0x00,0x0E,0x11, // parenleft
0x11,0x0E, // parenright
0x05,0x02,0x05, // asterisk
0x04,0x0E,0x04, // plus
0x10,0x08, // comma
0x04,0x04,0x04, // hyphen
0x00,0x10, // period
0x18,0x04,0x03, // slash
0x1E,0x11,0x0F, // zero
0x02,0x1F, // one
0x19,0x15,0x12, // two
0x11,0x15,0x0A, // three
0x07,0x04,0x1F, // four
0x17,0x15,0x09, // five
0x1E,0x15,0x1D, // six
0x19,0x05,0x03, // seven
0x1F,0x15,0x1F, // eight
0x17,0x15,0x0F, // nine
0x00,0x0A, // colon
0x10,0x0A, // semicolon
0x04,0x0A,0x11, // less
0x0A,0x0A,0x0A, // equal
0x11,0x0A,0x04, // greater
0x01,0x15,0x03, // question
0x0E,0x15,0x16, // at
0x1E,0x05,0x1E, // A
0x1F,0x15,0x0A, // B
0x0E,0x11,0x11, // C
0x1F,0x11,0x0E, // D
0x1F,0x15,0x15, // E
0x1F,0x05,0x05, // F
0x0E,0x15,0x1D, // G
0x1F,0x04,0x1F, // H
0x11,0x1F,0x11, // I
0x08,0x10,0x0F, // J
0x1F,0x04,0x1B, // K
0x1F,0x10,0x10, // L
0x1F,0x06,0x1F, // M
0x1F,0x0E,0x1F, // N
0x0E,0x11,0x0E, // O
0x1F,0x05,0x02, // P
0x0E,0x19,0x1E, // Q
0x1F,0x0D,0x16, // R
0x12,0x15,0x09, // S
0x01,0x1F,0x01, // T
0x0F,0x10,0x1F, // U
0x07,0x18,0x07, // V
0x1F,0x0C,0x1F, // W
0x1B,0x04,0x1B, // X
0x03,0x1C,0x03, // Y
0x19,0x15,0x13, // Z
0x1F,0x11,0x11, // bracketleft
0x02,0x04,0x08, // backslash
0x11,0x11,0x1F, // bracketright
0x02,0x01,0x02, // asciicircum
0x10,0x10,0x10, // underscore
0x01,0x02, // grave
0x1A,0x16,0x1C, // a
0x1F,0x12,0x0C, // b
0x0C,0x12,0x12, // c
0x0C,0x12,0x1F, // d
0x0C,0x1A,0x16, // e
0x04,0x1E,0x05, // f
0x0C,0x2A,0x1E, // g
0x1F,0x02,0x1C, // h
0x00,0x1D, // i
0x10,0x20,0x1D, // j
0x1F,0x0C,0x12, // k
0x11,0x1F,0x10, // l
0x1E,0x0E,0x1E, // m
0x1E,0x02,0x1C, // n
0x0C,0x12,0x0C, // o
0x3E,0x12,0x0C, // p
0x0C,0x12,0x3E, // q
0x1C,0x02,0x02, // r
0x14,0x1E,0x0A, // s
0x02,0x1F,0x12, // t
0x0E,0x10,0x1E, // u
0x0E,0x18,0x0E, // v
0x1E,0x1C,0x1E, // w
0x12,0x0C,0x12, // x
0x06,0x28,0x1E, // y
0x1A,0x1E,0x16, // z
0x04,0x1B,0x11, // braceleft
0x00,0x1B, // bar
0x11,0x1B,0x04, // braceright
0x02,0x03,0x01, // asciitilde
0x00,0x1D, // exclamdown
0x0E,0x1B,0x0A, // cent
0x14,0x1F,0x15, // sterling
0x15,0x0E,0x15, // currency
0x0B,0x1C,0x0B, // yen
0x00,0x1B, // brokenbar
0x14,0x1B,0x05, // section
0x01,0x00,0x01, // dieresis
0x02,0x05,0x05, // copyright
0x16,0x15,0x17, // ordfeminine
0x02,0x05, // guillemotleft
0x02,0x02,0x06, // logicalnot
0x04,0x04, // softhyphen
0x07,0x03,0x04, // registered
0x01,0x01,0x01, // macron
0x02,0x05,0x02, // degree
0x12,0x17,0x12, // plusminus
0x01,0x07,0x04, // twosuperior
0x05,0x07,0x07, // threesuperior
0x00,0x02,0x01, // acute
0x1F,0x08,0x07, // mu
0x02,0x1D,0x1F, // paragraph
0x0E,0x0E,0x0E, // periodcentered
0x10,0x14,0x08, // cedilla
0x00,0x07, // onesuperior
0x12,0x15,0x12, // ordmasculine
0x00,0x05,0x02, // guillemotright
0x03,0x08,0x18, // onequarter
0x0B,0x18,0x10, // onehalf
0x03,0x0B,0x18, // threequarters
0x18,0x15,0x10, // questiondown
0x18,0x0D,0x1A, // Agrave
0x1A,0x0D,0x18, // Aacute
0x19,0x0D,0x19, // Acircumflex
0x1A,0x0F,0x19, // Atilde
0x1D,0x0A,0x1D, // Adieresis
0x1F,0x0B,0x1C, // Aring
0x1E,0x1F,0x15, // AE
0x06,0x29,0x19, // Ccedilla
0x1C,0x1D,0x16, // Egrave
0x1E,0x1D,0x14, // Eacute
0x1D,0x1D,0x15, // Ecircumflex
0x1D,0x1C,0x15, // Edieresis
0x14,0x1D,0x16, // Igrave
0x16,0x1D,0x14, // Iacute
0x15,0x1D,0x15, // Icircumflex
0x15,0x1C,0x15, // Idieresis
0x1F,0x15,0x0E, // Eth
0x1D,0x0B,0x1E, // Ntilde
0x1C,0x15,0x1E, // Ograve
0x1E,0x15,0x1C, // Oacute
0x1D,0x15,0x1D, // Ocircumflex
0x1D,0x17,0x1E, // Otilde
0x1D,0x14,0x1D, // Odieresis
0x0A,0x04,0x0A, // multiply
0x1E,0x15,0x0F, // Oslash
0x1D,0x12,0x1C, // Ugrave
0x1C,0x12,0x1D, // Uacute
0x1D,0x11,0x1D, // Ucircumflex
0x1D,0x10,0x1D, // Udieresis
0x0C,0x1A,0x0D, // Yacute
0x1F,0x0A,0x0E, // Thorn
0x3E,0x15,0x0B, // germandbls
0x18,0x15,0x1E, // agrave
0x1A,0x15,0x1C, // aacute
0x19,0x15,0x1D, // acircumflex
0x1A,0x17,0x1D, // atilde
0x19,0x14,0x1D, // adieresis
0x18,0x17,0x1F, // aring
0x1C,0x1E,0x0E, // ae
0x04,0x2A,0x1A, // ccedilla
0x08,0x1D,0x1E, // egrave
0x0A,0x1D,0x1C, // eacute
0x09,0x1D,0x1D, // ecircumflex
0x09,0x1C,0x1D, // edieresis
0x00,0x1D,0x02, // igrave
0x02,0x1D, // iacute
0x01,0x1D,0x01, // icircumflex
0x01,0x1C,0x01, // idieresis
0x0A,0x17,0x1D, // eth
0x1D,0x07,0x1A, // ntilde
0x08,0x15,0x0A, // ograve
0x0A,0x15,0x08, // oacute
0x09,0x15,0x09, // ocircumflex
0x09,0x17,0x0A, // otilde
0x09,0x14,0x09, // odieresis
0x04,0x15,0x04, // divide
0x1C,0x16,0x0E, // oslash
0x0D,0x12,0x1C, // ugrave
0x0C,0x12,0x1D, // uacute
0x0D,0x11,0x1D, // ucircumflex
0x0D,0x10,0x1D, // udieresis
0x04,0x2A,0x1D, // yacute
0x3E,0x14,0x08 // thorn
};
I have been thinking about how to make your new font available to users of this project. As this is a library continuing to package out-of-the-box fonts into OLEDDisplayFonts.h
does not scale well. Some options:
.h
file per font (including yours). Developers will have to include every font the want to use.What do you think?
I would recommend to add documentation how to convert fonts and in addition bundle some thare license-wise okay as one .h file per font. This would make extending easy but also make clear what fonts arre available. Not sure memory is an issue with many fonts, I guess compilers strip what‘s not used.
add documentation how to convert fonts
Can you maybe add a paragraph or two here as a comment so I know what you (as a user) would like to read? I can take it from there. I guess the documentation would have to include links to http://sourpuss.net/projects/fontedit/ and https://oleddisplay.squix.ch/.
Hm, not sure I can help so much with this: I’d prefer if you could document the format of the fonts (seems to be different from other formats - or is it the same as an already documented one?) and then my old notes hint at a tool how to convert from the standard BDF format to your format.
Love the Tom Thumb font, but it really needs single pixel spacing added when rendering to make it more legible. Would be great to have a fontSpacing parameter for this.. and for other creative uses.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
I have a problem creating new fonts. All fonts under size 8 are really unreadable. And size means width. This means that each letter is 10 pixels high. This is annoying, because I switched from the Adafruit GFX to this lib primarily because of the font functions. And the preview on the font website is irritating because the font is not pixelated as it actually looks. However, I would need a font that is 8 pixels high so that I can reprogram the lib so that only individual areas are updated and these are 8 pixels high. I would very much like to have a few additional standard fonts, such as 5x7 (6x8 with spacing), 5x7 with variable width and 3x5 (4x6) with variable width. I would also like to see the preview pixelated down to 128x64. Would it be possible?