Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add nitram micro5 font #15

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ These fonts are released with ESPVGAX, inside the /fonts/ folder:
- **Monospaced DOS 12** <br>![mdos12](gfx/mdos.png)
- **Monospaced DOS 8** <br>![mdos8](gfx/mdosH8.png)
- **MS Sans 10** <br>![mssans10](gfx/mssans10.png)
- **Nitram-Micro-Font 5 (by Nitram509)** <br>![nitram5](gfx/nitram5.png)
- **Ocra 9** <br>![ocra9](gfx/ocra9.png)
- **PT Monospaced 9** <br>![ptmono9](gfx/ptmono9.png)
- **Tahoma 11** <br>![tahoma11](gfx/tahoma11.png)
Expand Down
106 changes: 106 additions & 0 deletions fonts/nitram5.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
#ifndef __FNT_NITRAM5__
#define __FNT_NITRAM5__

//font generated from 1BITFONT - by Sandro Maffiodo
#define FNT_NITRAM5_HEIGHT 5
#define FNT_NITRAM5_SYMBOLS_COUNT 95
#define FNT_NITRAM5_GLYPH_WIDTH 1
//data size=475 bytes
const unsigned char ESPVGAX_ALIGN32 fnt_NITRAM5_data[FNT_NITRAM5_SYMBOLS_COUNT][4+FNT_NITRAM5_HEIGHT*FNT_NITRAM5_GLYPH_WIDTH] PROGMEM={
{ 1,0,0,0, 0x80, 0x80, 0x80, 0x00, 0x80, }, //glyph '!' code=0
{ 3,0,0,0, 0xa0, 0xa0, 0x00, 0x00, 0x00, }, //glyph '"' code=1
{ 5,0,0,0, 0x50, 0xf8, 0x50, 0xf8, 0x50, }, //glyph '#' code=2
{ 5,0,0,0, 0xf8, 0xa0, 0xf8, 0x28, 0xf8, }, //glyph '$' code=3
{ 5,0,0,0, 0x88, 0x10, 0x20, 0x40, 0x88, }, //glyph '%' code=4
{ 5,0,0,0, 0x60, 0x90, 0x68, 0x90, 0x68, }, //glyph '&' code=5
{ 2,0,0,0, 0x40, 0x80, 0x00, 0x00, 0x00, }, //glyph ''' code=6
{ 2,0,0,0, 0x40, 0x80, 0x80, 0x80, 0x40, }, //glyph '(' code=7
{ 2,0,0,0, 0x80, 0x40, 0x40, 0x40, 0x80, }, //glyph ')' code=8
{ 5,0,0,0, 0xa8, 0x70, 0xf8, 0x70, 0xa8, }, //glyph '*' code=9
{ 3,0,0,0, 0x00, 0x40, 0xe0, 0x40, 0x00, }, //glyph '+' code=10
{ 2,0,0,0, 0x00, 0x00, 0x00, 0x40, 0x80, }, //glyph ',' code=11
{ 3,0,0,0, 0x00, 0x00, 0xe0, 0x00, 0x00, }, //glyph '-' code=12
{ 1,0,0,0, 0x00, 0x00, 0x00, 0x00, 0x80, }, //glyph '.' code=13
{ 3,0,0,0, 0x20, 0x40, 0x40, 0x40, 0x80, }, //glyph '/' code=14
{ 5,0,0,0, 0x70, 0x98, 0xa8, 0xc8, 0x70, }, //glyph '0' code=15
{ 3,0,0,0, 0x40, 0xc0, 0x40, 0x40, 0xe0, }, //glyph '1' code=16
{ 3,0,0,0, 0xe0, 0x20, 0xe0, 0x80, 0xe0, }, //glyph '2' code=17
{ 3,0,0,0, 0xe0, 0x20, 0x60, 0x20, 0xe0, }, //glyph '3' code=18
{ 3,0,0,0, 0x80, 0x80, 0xa0, 0xe0, 0x20, }, //glyph '4' code=19
{ 3,0,0,0, 0xe0, 0x80, 0xe0, 0x20, 0xe0, }, //glyph '5' code=20
{ 3,0,0,0, 0xc0, 0x80, 0xe0, 0xa0, 0xe0, }, //glyph '6' code=21
{ 3,0,0,0, 0xe0, 0x20, 0x60, 0x20, 0x20, }, //glyph '7' code=22
{ 3,0,0,0, 0xe0, 0xa0, 0xe0, 0xa0, 0xe0, }, //glyph '8' code=23
{ 3,0,0,0, 0xe0, 0xa0, 0xe0, 0x20, 0xe0, }, //glyph '9' code=24
{ 1,0,0,0, 0x00, 0x80, 0x00, 0x80, 0x00, }, //glyph ':' code=25
{ 2,0,0,0, 0x00, 0x40, 0x00, 0x40, 0x80, }, //glyph ';' code=26
{ 3,0,0,0, 0x20, 0x40, 0x80, 0x40, 0x20, }, //glyph '<' code=27
{ 3,0,0,0, 0x00, 0xe0, 0x00, 0xe0, 0x00, }, //glyph '=' code=28
{ 3,0,0,0, 0x80, 0x40, 0x20, 0x40, 0x80, }, //glyph '>' code=29
{ 5,0,0,0, 0x70, 0x88, 0x30, 0x00, 0x20, }, //glyph '?' code=30
{ 4,0,0,0, 0x70, 0x90, 0xa0, 0x80, 0x70, }, //glyph '@' code=31
{ 5,0,0,0, 0x60, 0x90, 0x88, 0xf8, 0x88, }, //glyph 'A' code=32
{ 5,0,0,0, 0xe0, 0x90, 0xf0, 0x88, 0xf0, }, //glyph 'B' code=33
{ 5,0,0,0, 0x70, 0x88, 0x80, 0x88, 0x70, }, //glyph 'C' code=34
{ 5,0,0,0, 0xf0, 0x98, 0x88, 0x88, 0xf0, }, //glyph 'D' code=35
{ 5,0,0,0, 0xf8, 0x80, 0xf0, 0x80, 0xf8, }, //glyph 'E' code=36
{ 5,0,0,0, 0xf8, 0x80, 0xf0, 0x80, 0x80, }, //glyph 'F' code=37
{ 5,0,0,0, 0x70, 0x80, 0x98, 0x88, 0x70, }, //glyph 'G' code=38
{ 5,0,0,0, 0x90, 0x88, 0xf8, 0x88, 0x88, }, //glyph 'H' code=39
{ 3,0,0,0, 0xe0, 0x40, 0x40, 0x40, 0xe0, }, //glyph 'I' code=40
{ 3,0,0,0, 0x60, 0x20, 0x20, 0xa0, 0xe0, }, //glyph 'J' code=41
{ 4,0,0,0, 0x90, 0xa0, 0xc0, 0xa0, 0x90, }, //glyph 'K' code=42
{ 4,0,0,0, 0x80, 0x80, 0x80, 0x80, 0xf0, }, //glyph 'L' code=43
{ 5,0,0,0, 0x88, 0xd8, 0xa8, 0x88, 0x88, }, //glyph 'M' code=44
{ 5,0,0,0, 0x88, 0xc8, 0xa8, 0x98, 0x88, }, //glyph 'N' code=45
{ 5,0,0,0, 0x70, 0x98, 0x88, 0x88, 0x70, }, //glyph 'O' code=46
{ 4,0,0,0, 0xe0, 0x90, 0xe0, 0x80, 0x80, }, //glyph 'P' code=47
{ 5,0,0,0, 0x70, 0x88, 0x88, 0x98, 0x78, }, //glyph 'Q' code=48
{ 4,0,0,0, 0xe0, 0x90, 0xe0, 0xa0, 0x90, }, //glyph 'R' code=49
{ 5,0,0,0, 0x78, 0x80, 0x70, 0x08, 0xf0, }, //glyph 'S' code=50
{ 5,0,0,0, 0xf8, 0x20, 0x20, 0x20, 0x20, }, //glyph 'T' code=51
{ 5,0,0,0, 0x90, 0x88, 0x88, 0x88, 0x70, }, //glyph 'U' code=52
{ 3,0,0,0, 0xa0, 0xa0, 0xa0, 0xa0, 0x40, }, //glyph 'V' code=53
{ 5,0,0,0, 0x90, 0x88, 0xa8, 0xa8, 0x50, }, //glyph 'W' code=54
{ 5,0,0,0, 0x88, 0x50, 0x20, 0x50, 0x88, }, //glyph 'X' code=55
{ 5,0,0,0, 0x88, 0x50, 0x20, 0x20, 0x20, }, //glyph 'Y' code=56
{ 5,0,0,0, 0xf8, 0x10, 0x20, 0x40, 0xf8, }, //glyph 'Z' code=57
{ 2,0,0,0, 0xc0, 0x80, 0x80, 0x80, 0xc0, }, //glyph '[' code=58
{ 3,0,0,0, 0x80, 0x40, 0x40, 0x40, 0x20, }, //glyph '\' code=59
{ 2,0,0,0, 0xc0, 0x40, 0x40, 0x40, 0xc0, }, //glyph ']' code=60
{ 3,0,0,0, 0x40, 0xa0, 0x00, 0x00, 0x00, }, //glyph '^' code=61
{ 3,0,0,0, 0x00, 0x00, 0x00, 0x00, 0xe0, }, //glyph '_' code=62
{ 2,0,0,0, 0x80, 0x40, 0x00, 0x00, 0x00, }, //glyph '`' code=63
{ 5,0,0,0, 0x60, 0x90, 0x88, 0xf8, 0x88, }, //glyph 'a' code=64
{ 5,0,0,0, 0xe0, 0x90, 0xf0, 0x88, 0xf0, }, //glyph 'b' code=65
{ 5,0,0,0, 0x70, 0x88, 0x80, 0x88, 0x70, }, //glyph 'c' code=66
{ 5,0,0,0, 0xf0, 0x98, 0x88, 0x88, 0xf0, }, //glyph 'd' code=67
{ 5,0,0,0, 0xf8, 0x80, 0xf0, 0x80, 0xf8, }, //glyph 'e' code=68
{ 5,0,0,0, 0xf8, 0x80, 0xf0, 0x80, 0x80, }, //glyph 'f' code=69
{ 5,0,0,0, 0x70, 0x80, 0x98, 0x88, 0x70, }, //glyph 'g' code=70
{ 5,0,0,0, 0x90, 0x88, 0xf8, 0x88, 0x88, }, //glyph 'h' code=71
{ 3,0,0,0, 0xe0, 0x40, 0x40, 0x40, 0xe0, }, //glyph 'i' code=72
{ 3,0,0,0, 0x60, 0x20, 0x20, 0xa0, 0xe0, }, //glyph 'j' code=73
{ 4,0,0,0, 0x90, 0xa0, 0xc0, 0xa0, 0x90, }, //glyph 'k' code=74
{ 4,0,0,0, 0x80, 0x80, 0x80, 0x80, 0xf0, }, //glyph 'l' code=75
{ 5,0,0,0, 0x88, 0xd8, 0xa8, 0x88, 0x88, }, //glyph 'm' code=76
{ 5,0,0,0, 0x88, 0xc8, 0xa8, 0x98, 0x88, }, //glyph 'n' code=77
{ 5,0,0,0, 0x70, 0x98, 0x88, 0x88, 0x70, }, //glyph 'o' code=78
{ 4,0,0,0, 0xe0, 0x90, 0xe0, 0x80, 0x80, }, //glyph 'p' code=79
{ 5,0,0,0, 0x70, 0x88, 0x88, 0x98, 0x78, }, //glyph 'q' code=80
{ 4,0,0,0, 0xe0, 0x90, 0xe0, 0xa0, 0x90, }, //glyph 'r' code=81
{ 5,0,0,0, 0x78, 0x80, 0x70, 0x08, 0xf0, }, //glyph 's' code=82
{ 5,0,0,0, 0xf8, 0x20, 0x20, 0x20, 0x20, }, //glyph 't' code=83
{ 5,0,0,0, 0x90, 0x88, 0x88, 0x88, 0x70, }, //glyph 'u' code=84
{ 3,0,0,0, 0xa0, 0xa0, 0xa0, 0xa0, 0x40, }, //glyph 'v' code=85
{ 5,0,0,0, 0x90, 0x88, 0xa8, 0xa8, 0x50, }, //glyph 'w' code=86
{ 5,0,0,0, 0x88, 0x50, 0x20, 0x50, 0x88, }, //glyph 'x' code=87
{ 5,0,0,0, 0x88, 0x50, 0x20, 0x20, 0x20, }, //glyph 'y' code=88
{ 5,0,0,0, 0xf8, 0x10, 0x20, 0x40, 0xf8, }, //glyph 'z' code=89
{ 3,0,0,0, 0x60, 0x40, 0x80, 0x40, 0x60, }, //glyph '{' code=90
{ 1,0,0,0, 0x80, 0x80, 0x80, 0x80, 0x80, }, //glyph '|' code=91
{ 3,0,0,0, 0xc0, 0x40, 0x20, 0x40, 0xc0, }, //glyph '}' code=92
{ 4,0,0,0, 0x50, 0xa0, 0x00, 0x00, 0x00, }, //glyph '~' code=93
{ 5,0,0,0, 0x30, 0x48, 0xe0, 0x40, 0xf8, }, //glyph '£' code=94
};
#endif
Binary file added gfx/nitram5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 12 additions & 8 deletions tools/1bitfont.html
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
var r = data[idx + 0];
var g = data[idx + 1];
var b = data[idx + 2];
if (r==g && g==b && b==0)
if (r==g && g==b && b==0)
bytes[bi]|=1<<pshift;
pshift--;
if (pshift<0) {
Expand Down Expand Up @@ -132,13 +132,17 @@
ostring+=comment+gstring+'\n';
}
var fontname=$('#vname').val();
var header="//font generated from 1BITFONT - by Sandro Maffiodo\n"+
var header="#ifndef __FNT_"+fontname.toUpperCase()+"__\n" +
"#define __FNT_"+fontname.toUpperCase()+"__\n" +
"\n" +
"//font generated from 1BITFONT - by Sandro Maffiodo\n"+
"#define FNT_"+fontname.toUpperCase()+"_HEIGHT "+cdata.height+"\n"+
"#define FNT_"+fontname.toUpperCase()+"_SYMBOLS_COUNT "+gcount+"\n"+
"#define FNT_"+fontname.toUpperCase()+"_GLYPH_WIDTH "+maxbc+"\n"+
"#define FNT_"+fontname.toUpperCase()+"_GLYPH_WIDTH "+maxbc+"\n"+
"//data size="+(gcount*cdata.height)+" bytes\n"+
"const unsigned char ESPVGAX_ALIGN32 fnt_"+fontname+"_data[FNT_"+fontname.toUpperCase()+"_SYMBOLS_COUNT][4+FNT_"+fontname.toUpperCase()+"_HEIGHT*FNT_"+fontname.toUpperCase()+"_GLYPH_WIDTH] PROGMEM={\n";
var footer="};\n";
var footer="};\n" +
"#endif\n";
$('#out').text(header+ostring+footer);
}
function boot() {
Expand All @@ -165,13 +169,13 @@ <h2><b>1BITFONT</b></h2>
<h3>WHAT IS:</h3>
1BITFONT is a simple web tool to generate bit fonts for ESPVGAX library. <br>
<br>
1BITFONT read an image where all the fonts glyphs are layouted in a single
1BITFONT read an image where all the fonts glyphs are layouted in a single
line. Each glyph must be separated from the next with a single white line.
The tool will autodetect the glyph boundaries and generate a byte table
where each byte is 8 horizontal pixels of the glyph. All glyphs will
have the same height but different widths. The first byte of the glyph,
inside the generated table, is the glyph width (in pixels, where 1pixel=1bit).

<h3>RULES:</h3>
<ul>
<li>source image must have all glyphs on a single line. black is foreground color, white is background</li>
Expand All @@ -180,7 +184,7 @@ <h3>RULES:</h3>
<li>source image must use a single pixel to delimitate all glyphs (white line separator). <br> When a white line is part of the glyph (for example the glyph ") you can use a red pixel to join the two separated pixels</li>
<li>the maximum width of a single glyph must be less or equal 8</li>
</ul>

<h3>INPUT:</h3>
source image: <input id="f" type="file" /><br>
<div id='previewbox' style='display: none'>
Expand All @@ -194,7 +198,7 @@ <h3>INPUT:</h3>
<BR>
output variable name:
<input value="varname" type='text' id='vname'/>

<h3>OUTPUT:</h3>
<button onclick='generate()'>GENERATE</button>
<pre id='out'></pre>
Expand Down