ESP8266 ILI9341 display support code with printf sources, wire-frame viewer and custom fonts  1.0
ESP8266ILI9341DisplayProject
bdffontutil.h
Go to the documentation of this file.
1 #ifndef _UTIL_H_
2 #define _UTIL_H_
3 
4 
39 #define MATCH(a,b) ( ( strcmp(a,b) == 0 ) ? 1 : 0 )
40 #define MAXLINE 1024
41 
42 /* bdffontutil.c */
43 void *db_calloc ( size_t size );
44 void *db_free ( void *p );
45 char *stralloc ( char *str );
46 char *remove_quotes ( char *str );
47 void line_wrap ( char *str , int max );
48 void trim_tail ( char *str );
49 char *skip_spaces ( char *str );
50 char *get_token ( char *str , char *token , int max );
51 int ishex ( int c );
52 int ishexstr ( char *str );
53 char *match_token ( char *str , char *pat );
54 void FontHeaderInfo ( FILE *out , _font *font , char *prog , char *target );
55 void Convert_Font2c ( FILE *out , _font *font );
56 void emit_number ( FILE *out , char *name , int num );
57 void emit_data ( FILE *out , char *name , unsigned char *data , int size );
58 void emit_str ( FILE *out , char *name , unsigned char *data );
59 void InitNames ( void );
60 void InitFonts ( _font *font );
61 void FreeFont ( _font *font );
62 void AddFontName ( _font *font );
63 int FindFontName ( char *str );
64 void WriteFontBits ( FILE *out , _font *font );
65 void WriteFontInfo ( FILE *out , _font *font );
66 void WriteFontTable ( FILE *out , _font *font );
67 void WriteCharacterBits ( FILE *out , _font *font , int num );
68 int ReadBdf ( char *name , _font *font , int lower , int upper );
69 void AdjustFontTable ( _font *font );
70 void FontAdjustFull ( _font *font );
71 void FontAdjustSmall ( _font *font );
72 void ComputeGapSize ( _font *font );
73 void bsetv ( unsigned char *ptr , int addr );
74 void bclrv ( unsigned char *ptr , int addr );
75 int btestv ( unsigned char *ptr , int addr );
76 int bittestxy ( unsigned char *ptr , int x , int y , int w , int h );
77 void bitsetxy ( unsigned char *ptr , int x , int y , int w , int h );
78 void bitclrxy ( unsigned char *ptr , int x , int y , int width , int height );
79 void FontPreview ( FILE *out , _font *font , int num );
80 void FontPreviewFull ( FILE *out , _font *font , int num );
81 void FontPreviewProportional ( FILE *out , _font *font , int num );
82 void WriteFontBitsPreview ( FILE *out , _font *font , int preview );
83 
84 
85 #endif // _UTIL_H_
86 
87 extern _font font;
88 extern _bdffile BDFnames[MAXFONTS];
89 extern char *fnames[MAXFONTS];
90 
int ishex(int c)
is a character hex ASCII character
Definition: bdffontutil.c:247
void WriteFontBitsPreview(FILE *out, _font *font, int preview)
Write all Font characters in a font as ASCII character comments.
Definition: bdffontutil.c:2040
void FontAdjustSmall(_font *font)
Ajust font to use smallest font bounding box for each font Can be used to converting large fixed font...
Definition: bdffontutil.c:1325
void FontPreviewProportional(FILE *out, _font *font, int num)
Write Font Preview as proportional format in ASCII character comments.
Definition: bdffontutil.c:1938
void trim_tail(char *str)
Trim White space and control characters from end of string.
Definition: stringsup.c:271
Definition: font.h:43
int btestv(unsigned char *ptr, int addr)
Test bit in byte array.
Definition: bdffontutil.c:1653
void emit_str(FILE *out, char *name, unsigned char *data)
Write Font Structure string.
Definition: bdffontutil.c:478
int16_t y[XYSTACK+2]
Definition: ili9341.c:372
void line_wrap(char *str, int max)
Line wrap function ASSUMES we write back into the string (replace space or tab with newlines...
Definition: bdffontutil.c:141
void bsetv(unsigned char *ptr, int addr)
bit set in byte array
Definition: bdffontutil.c:1625
void WriteFontTable(FILE *out, _font *font)
Write Specification Font Table.
Definition: bdffontutil.c:684
FILE type structure.
Definition: posix.h:156
char * get_token(char *str, char *token, int max)
return next token
Definition: stringsup.c:628
void InitFonts(_font *font)
Initialize all font structures to reset states.
Definition: bdffontutil.c:512
char * remove_quotes(char *str)
STrip quotes from string and leading spaces.
Definition: bdffontutil.c:109
void AdjustFontTable(_font *font)
Adjust Font X Y offset, renormalize X Y to 0 0 Also readjust font bounding box.
Definition: bdffontutil.c:1191
void FontPreviewFull(FILE *out, _font *font, int num)
Write Font Preview as full format in ASCII character comments.
Definition: bdffontutil.c:1836
void * db_free(void *p)
free memory
Definition: bdffontutil.c:78
int16_t x[XYSTACK+2]
Definition: ili9341.c:371
void emit_data(FILE *out, char *name, unsigned char *data, int size)
Write Font Structure element as a uint8_t value.
Definition: bdffontutil.c:457
char * match_token(char *str, char *pat)
Match next token against pattern.
Definition: bdffontutil.c:279
void InitNames(void)
Reset File and Structure names.
Definition: bdffontutil.c:491
int ReadBdf(char *name, _font *font, int lower, int upper)
Read and parse a BDF file for specified font and character set range Fills fonts structures.
Definition: bdffontutil.c:790
void bclrv(unsigned char *ptr, int addr)
bit clear in byte array
Definition: bdffontutil.c:1639
MEMSPACE int token(char *str, char *pat)
Search for token in a string matching user pattern.
Definition: stringsup.c:671
void WriteFontInfo(FILE *out, _font *font)
Write C Header: Font Information Summary.
Definition: bdffontutil.c:654
void * db_calloc(size_t size)
calloc memory or error exit
Definition: bdffontutil.c:62
void WriteCharacterBits(FILE *out, _font *font, int num)
Write Font bitmap data for one charactre.
Definition: bdffontutil.c:721
char * skip_spaces(char *str)
Skip spaces at start of string.
Definition: bdffontutil.c:193
void Convert_Font2c(FILE *out, _font *font)
Convert font to C structure Writes header information, font specification, font bitmap.
Definition: bdffontutil.c:365
int ishexstr(char *str)
Does a string only contain hex characters ?
Definition: bdffontutil.c:262
char * stralloc(char *str)
Allocate space for string.
Definition: stringsup.c:774
_bdffile BDFnames[MAXFONTS]
Definition: bdffontutil.c:51
void FontAdjustFull(_font *font)
Adjust font to full size with no offset.
Definition: bdffontutil.c:1240
_font font
char * fnames[MAXFONTS]
Definition: bdffontutil.c:53
int bittestxy(unsigned char *ptr, int x, int y, int w, int h)
Test bit in w * h size bit array usng x and y offsets.
Definition: flash.c:166
#define MAXFONTS
Definition: font.h:38
void FontPreview(FILE *out, _font *font, int num)
Write Font Preview bit bounding box in ASCII character comments.
Definition: bdffontutil.c:1753
int FindFontName(char *str)
Search for a font name.
Definition: bdffontutil.c:611
void emit_number(FILE *out, char *name, int num)
Write Font Structure element as a number.
Definition: bdffontutil.c:442
void WriteFontBits(FILE *out, _font *font)
Write Font bitmap data for all characters in a font.
Definition: bdffontutil.c:631
void AddFontName(_font *font)
Generate the font name for this font This is based on the BDF FAMILY_NAME,WEIGHT_NAME,SLANT keywords.
Definition: bdffontutil.c:582
void bitsetxy(unsigned char *ptr, int x, int y, int w, int h)
Set bit in width * height size bit array usng x and y offsets.
Definition: bdffontutil.c:1698
void bitclrxy(unsigned char *ptr, int x, int y, int width, int height)
Clear bit in width * height size bit array usng x and y offsets.
Definition: bdffontutil.c:1726
void FreeFont(_font *font)
Free font data.
Definition: bdffontutil.c:554
Definition: font.h:70
void FontHeaderInfo(FILE *out, _font *font, char *prog, char *target)
Write Font Header Information Copyright, font family, etc.
Definition: bdffontutil.c:323
void ComputeGapSize(_font *font)
Find a good gap size (inter-character spacing) for any font Currently we searching for the smallest w...
Definition: bdffontutil.c:1524