rastrovy font 6x8 cyrilika
Petr Tomasek
tomasek@etf.cuni.cz
Pondělí Červenec 6 17:45:13 CEST 2009
On Mon, Jul 06, 2009 at 05:09:20PM +0200, Jan Waclawek wrote:
> Upravil som si program, ktory som si pisal (bohuzial ho nemozem zverejnit) aby mi vedel skonvertovat bitmapu na "moj" format fontu.
>
> Tie fonty su vykradnute z programu co som pisal, a su dost hnusne, takze to berte len ako ukazku. Ak mate nejaku bitmapu s pismenami za sebou ako idu, tak Vam ju skonvertujem do takejto podoby.
>
> wek
Mno, pokud by to nekomu pomohlo, pak prikladam podpobny jednoduchy programek, ktery "zkompiluje" rucne psane
fonty (viz fonty.fff) do c-ckovskeho zdrojaku - proste kazdy znak "nakreslite" pomoci
znaku "*" a "."... (Je to urceno primarne pro HD44700, ktere ma jen tusim 8, nebo 16 uzivatelsky
definovanych fontu, ale nemel by problem si to upravit i generovani fontu pro GLCD...)
P.T.
--
Petr Tomasek <http://www.etf.cuni.cz/~tomasek>
Jabber: butrus@jabbim.cz
SIP: butrus@ekiga.net
------------- další část ---------------
/*
* Generates "fonts" to be used together with AVR & LCD (HD44784 based)
* (c) 2007 Petr Tomask <tomasek@etf.cuni.cz>, under the terms of the GPLv3 Licence
* (see www.fsf.org for more info)
*/
#include <stdio.h>
#include <string.h>
/* a routine (simillar to fgets) to read lines from file,
but output is the last char (usefull for testing if the EOF occured) */
int readcr(char * strin, int delka ,FILE * fd) {
int c,i;
i=0;c=0;
for ( ;((c=getc(fd)) != EOF) && (i<(delka--)) && (c!='\n'); )
if ((c!='\n') && (c!=13)) { strin[i]=c; i++; };
strin[i]='\0';
return c;
}
int main (int argc, char *argv[]) {
#define BUFFL 2048
char buff[BUFFL];
char * fnm;
int i,val,fn=0;
printf ("/* font.c, generated from font.fff */\n\n");
fnm= (argc>1)?argv[1]:"font";
printf ("const unsigned char %s[] PROGMEM = {", fnm);
while (readcr(buff, BUFFL-1, stdin)!=EOF) {
if (buff[0]=='@')
{
printf ("\n#define CHAR_%s_%s %d", fnm, (char *)buff+1, fn);
printf ("\n /* %d: %s */\t", fn++, (char *)buff+1);
}
else if ((buff[0]=='\t') && (strlen((char *)(buff+1))>=5))
{
val=0;
for (i=0; i<5; i++)
{
val*=2;
val+=(buff[1+i]=='*')?1:0;
}
printf ("0x%02x,", val);
}
}
printf ("\n\t0x00\n");
printf ("};\n\n/* end of generated file... */\n\n");
return 0;
}
------------- další část ---------------
#
# GPS fix (1=blee, 2=2D, 3=3D)...
#
@nofix
.*.*.
.*.*.
.*.*.
.*.*.
.....
.*.*.
.....
.....
@2d
..*..
.*.*.
...*.
..*..
.***.
.....
*****
.....
@3d
.***.
...*.
..*..
...*.
.**..
.....
*****
.....
@fixinv
.....
.....
.*.*.
..*..
.*.*.
.....
.....
.....
#
# nasledujici ikonky znaci silu singnalu
#
@signal0
.....
.....
.....
.....
.....
.....
.....
.....
@signal1
.....
.....
.....
.....
.....
.....
*****
.....
@signal2
.....
.....
.....
.....
.....
.****
*****
.....
@signal3
.....
.....
.....
.....
..***
.****
*****
.....
@signal4
.....
.....
.....
...**
..***
.****
*****
.....
@signal5
.....
.....
....*
...**
..***
.****
*****
.....
#
# smer
#
@0deg
.....
..*..
.***.
*.*.*
..*..
..*..
..*..
.....
@45deg
.....
.****
...**
..*.*
.*..*
*....
.....
.....
@90deg
.....
..*..
...*.
*****
...*.
..*..
.....
.....
@135deg
.....
*....
.*..*
..*.*
...**
.****
.....
.....
@180deg
.....
..*..
..*..
..*..
*.*.*
.***.
..*..
.....
@225deg
.....
....*
*..*.
*.*..
**...
****.
.....
.....
@270deg
.....
..*..
...*.
*****
...*.
..*..
.....
.....
@315deg
.....
****.
**...
*.*..
*..*.
....*
.....
.....
@nodir
.....
.....
..*..
.***.
..*..
.....
.....
.....
#
# pocet viditelnych satelitu...
#
@sats0
.....
*...*
.*.*.
..*..
.*.*.
*...*
.....
.....
@sats1
.....
.....
.....
..*..
.....
.....
.....
.....
@sats2
.....
*....
.....
.....
.....
....*
.....
.....
@sats3
.....
*....
.....
..*..
.....
....*
.....
.....
@sats4
.....
*...*
.....
.....
.....
*...*
.....
.....
@sats5
.....
*...*
.....
..*..
.....
*...*
.....
.....
@sats6
.....
*...*
.....
*...*
.....
*...*
.....
.....
@sats7
.....
*...*
.....
*.*.*
.....
*...*
.....
.....
@sats8
.....
*...*
..*..
*...*
..*..
*...*
.....
.....
@sats9
.....
*.*.*
.....
*.*.*
.....
*.*.*
.....
.....
@sats10
..*..
*...*
..*..
*...*
..*..
*...*
..*..
.....
@sats11
*...*
..*..
*...*
..*..
*...*
..*..
*...*
.....
@sats12
*.*.*
.....
*.*.*
.....
*.*.*
.....
*.*.*
.....
@satsmore
.*.*.
*.*.*
.*.*.
*.*.*
.*.*.
*.*.*
.*.*.
*.*.*
#
# ruzne znaky/ikonky
#
@plusminus
.....
..*..
..*..
*****
..*..
*****
.....
.....
# dny v tydnu..
#
@U_hacek
...*.
*.*.*
*...*
*...*
*...*
*...*
.***.
.....
@C_hacek
.*.*.
.***.
*.*.*
*....
*....
*...*
.***.
.....
@a_carka
...*.
..*..
.***.
....*
.****
*...*
.****
.....
@c_hacek
.*.*.
..*..
.***.
*....
*....
*...*
.***.
.....
@s_hacek
.*.*.
..*..
.***.
*....
.***.
....*
****.
.....
@y_carka
...*.
..*..
*...*
*...*
.****
....*
.***.
.....
# .....
------------- další část ---------------
/* font.c, generated from font.fff */
const unsigned char lcd_font[] PROGMEM = {
#define CHAR_lcd_font_nofix 0
/* 0: nofix */ 0x0a,0x0a,0x0a,0x0a,0x00,0x0a,0x00,0x00,
#define CHAR_lcd_font_2d 1
/* 1: 2d */ 0x04,0x0a,0x02,0x04,0x0e,0x00,0x1f,0x00,
#define CHAR_lcd_font_3d 2
/* 2: 3d */ 0x0e,0x02,0x04,0x02,0x0c,0x00,0x1f,0x00,
#define CHAR_lcd_font_fixinv 3
/* 3: fixinv */ 0x00,0x00,0x0a,0x04,0x0a,0x00,0x00,0x00,
#define CHAR_lcd_font_signal0 4
/* 4: signal0 */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
#define CHAR_lcd_font_signal1 5
/* 5: signal1 */ 0x00,0x00,0x00,0x00,0x00,0x00,0x1f,0x00,
#define CHAR_lcd_font_signal2 6
/* 6: signal2 */ 0x00,0x00,0x00,0x00,0x00,0x0f,0x1f,0x00,
#define CHAR_lcd_font_signal3 7
/* 7: signal3 */ 0x00,0x00,0x00,0x00,0x07,0x0f,0x1f,0x00,
#define CHAR_lcd_font_signal4 8
/* 8: signal4 */ 0x00,0x00,0x00,0x03,0x07,0x0f,0x1f,0x00,
#define CHAR_lcd_font_signal5 9
/* 9: signal5 */ 0x00,0x00,0x01,0x03,0x07,0x0f,0x1f,0x00,
#define CHAR_lcd_font_0deg 10
/* 10: 0deg */ 0x00,0x04,0x0e,0x15,0x04,0x04,0x04,0x00,
#define CHAR_lcd_font_45deg 11
/* 11: 45deg */ 0x00,0x0f,0x03,0x05,0x09,0x10,0x00,0x00,
#define CHAR_lcd_font_90deg 12
/* 12: 90deg */ 0x00,0x04,0x02,0x1f,0x02,0x04,0x00,0x00,
#define CHAR_lcd_font_135deg 13
/* 13: 135deg */ 0x00,0x10,0x09,0x05,0x03,0x0f,0x00,0x00,
#define CHAR_lcd_font_180deg 14
/* 14: 180deg */ 0x00,0x04,0x04,0x04,0x15,0x0e,0x04,0x00,
#define CHAR_lcd_font_225deg 15
/* 15: 225deg */ 0x00,0x01,0x12,0x14,0x18,0x1e,0x00,0x00,
#define CHAR_lcd_font_270deg 16
/* 16: 270deg */ 0x00,0x04,0x02,0x1f,0x02,0x04,0x00,0x00,
#define CHAR_lcd_font_315deg 17
/* 17: 315deg */ 0x00,0x1e,0x18,0x14,0x12,0x01,0x00,0x00,
#define CHAR_lcd_font_nodir 18
/* 18: nodir */ 0x00,0x00,0x04,0x0e,0x04,0x00,0x00,0x00,
#define CHAR_lcd_font_sats0 19
/* 19: sats0 */ 0x00,0x11,0x0a,0x04,0x0a,0x11,0x00,0x00,
#define CHAR_lcd_font_sats1 20
/* 20: sats1 */ 0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,
#define CHAR_lcd_font_sats2 21
/* 21: sats2 */ 0x00,0x10,0x00,0x00,0x00,0x01,0x00,0x00,
#define CHAR_lcd_font_sats3 22
/* 22: sats3 */ 0x00,0x10,0x00,0x04,0x00,0x01,0x00,0x00,
#define CHAR_lcd_font_sats4 23
/* 23: sats4 */ 0x00,0x11,0x00,0x00,0x00,0x11,0x00,0x00,
#define CHAR_lcd_font_sats5 24
/* 24: sats5 */ 0x00,0x11,0x00,0x04,0x00,0x11,0x00,0x00,
#define CHAR_lcd_font_sats6 25
/* 25: sats6 */ 0x00,0x11,0x00,0x11,0x00,0x11,0x00,0x00,
#define CHAR_lcd_font_sats7 26
/* 26: sats7 */ 0x00,0x11,0x00,0x15,0x00,0x11,0x00,0x00,
#define CHAR_lcd_font_sats8 27
/* 27: sats8 */ 0x00,0x11,0x04,0x11,0x04,0x11,0x00,0x00,
#define CHAR_lcd_font_sats9 28
/* 28: sats9 */ 0x00,0x15,0x00,0x15,0x00,0x15,0x00,0x00,
#define CHAR_lcd_font_sats10 29
/* 29: sats10 */ 0x04,0x11,0x04,0x11,0x04,0x11,0x04,0x00,
#define CHAR_lcd_font_sats11 30
/* 30: sats11 */ 0x11,0x04,0x11,0x04,0x11,0x04,0x11,0x00,
#define CHAR_lcd_font_sats12 31
/* 31: sats12 */ 0x15,0x00,0x15,0x00,0x15,0x00,0x15,0x00,
#define CHAR_lcd_font_satsmore 32
/* 32: satsmore */ 0x0a,0x15,0x0a,0x15,0x0a,0x15,0x0a,0x15,
#define CHAR_lcd_font_plusminus 33
/* 33: plusminus */ 0x00,0x04,0x04,0x1f,0x04,0x1f,0x00,0x00,
#define CHAR_lcd_font_U_hacek 34
/* 34: U_hacek */ 0x02,0x15,0x11,0x11,0x11,0x11,0x0e,0x00,
#define CHAR_lcd_font_C_hacek 35
/* 35: C_hacek */ 0x0a,0x0e,0x15,0x10,0x10,0x11,0x0e,0x00,
#define CHAR_lcd_font_a_carka 36
/* 36: a_carka */ 0x02,0x04,0x0e,0x01,0x0f,0x11,0x0f,0x00,
#define CHAR_lcd_font_c_hacek 37
/* 37: c_hacek */ 0x0a,0x04,0x0e,0x10,0x10,0x11,0x0e,0x00,
#define CHAR_lcd_font_s_hacek 38
/* 38: s_hacek */ 0x0a,0x04,0x0e,0x10,0x0e,0x01,0x1e,0x00,
#define CHAR_lcd_font_y_carka 39
/* 39: y_carka */ 0x02,0x04,0x11,0x11,0x0f,0x01,0x0e,0x00,
0x00
};
/* end of generated file... */
Další informace o konferenci Hw-list