libpynq  (release 5EID0-2023 version 0.3.0 of 2024-04-25 09:42 )
fontx.h
Go to the documentation of this file.
1 #ifndef MAIN_FONTX_H_
2 #define MAIN_FONTX_H_
3 #define FontxGlyphBufSize (32 * 32 / 8)
4 #include <stdbool.h>
5 #include <stdint.h>
6 
23 typedef struct _IO_FILE FILE;
24 
28 typedef struct {
29  const char *path;
30  char fxname[10];
31  bool opened;
32  bool valid;
33  bool is_ank;
35  uint8_t w;
36  uint8_t h;
37  uint16_t fsz;
38  uint8_t bc;
40 } FontxFile;
41 
48 void AaddFontx(FontxFile *fx, const char *path);
49 
58 void InitFontx(FontxFile *fxs, const char *f0, const char *f1);
59 
73 bool OpenFontx(FontxFile *fx);
74 
80 void CloseFontx(FontxFile *fx);
81 
87 void DumpFontx(FontxFile *fxs);
88 
96 uint8_t GetFontWidth(FontxFile *fx);
97 
105 uint8_t GetFontHeight(FontxFile *fx);
106 
118 bool GetFontx(FontxFile *fxs, uint8_t ascii, uint8_t *pGlyph, uint8_t *pw,
119  uint8_t *ph);
120 
130 void Font2Bitmap(uint8_t *fonts, uint8_t *line, uint8_t w, uint8_t h,
131  uint8_t inverse);
132 
140 void UnderlineBitmap(uint8_t *line, uint8_t w, uint8_t h);
141 
149 void ReversBitmap(uint8_t *line, uint8_t w, uint8_t h);
150 
158 void ShowFont(uint8_t *fonts, uint8_t pw, uint8_t ph);
159 
167 void ShowBitmap(uint8_t *bitmap, uint8_t pw, uint8_t ph);
168 
176 uint8_t RotateByte(uint8_t ch);
177 
182 #endif
FontxFile::w
uint8_t w
Definition: fontx.h:35
FontxFile::h
uint8_t h
Definition: fontx.h:36
FontxFile::path
const char * path
Definition: fontx.h:29
DumpFontx
void DumpFontx(FontxFile *fxs)
Dumps the font data stored in the FontxFile structure.
Definition: fontx.c:6
UnderlineBitmap
void UnderlineBitmap(uint8_t *line, uint8_t w, uint8_t h)
Adds an underline to a bitmap.
Definition: fontx.c:11
ShowFont
void ShowFont(uint8_t *fonts, uint8_t pw, uint8_t ph)
Displays a font on the screen.
Definition: fontx.c:13
Font2Bitmap
void Font2Bitmap(uint8_t *fonts, uint8_t *line, uint8_t w, uint8_t h, uint8_t inverse)
Converts a font data buffer into a bitmap.
Definition: fontx.c:135
GetFontHeight
uint8_t GetFontHeight(FontxFile *fx)
Gets the height of a character in the font.
Definition: fontx.c:8
FontxFile::valid
bool valid
Definition: fontx.h:32
FontxFile::file
FILE * file
Definition: fontx.h:39
FontxFile::fsz
uint16_t fsz
Definition: fontx.h:37
FILE
struct _IO_FILE FILE
Definition: fontx.h:23
ReversBitmap
void ReversBitmap(uint8_t *line, uint8_t w, uint8_t h)
Reverses the bits in each byte of a bitmap.
Definition: fontx.c:12
RotateByte
uint8_t RotateByte(uint8_t ch)
Rotates a byte by 90 degrees.
Definition: fontx.c:15
InitFontx
void InitFontx(FontxFile *fxs, const char *f0, const char *f1)
Initializes the given FontxFile structure with the specified font files.
Definition: fontx.c:3
FontxFile::opened
bool opened
Definition: fontx.h:31
FontxFile::bc
uint8_t bc
Definition: fontx.h:38
GetFontx
bool GetFontx(FontxFile *fxs, uint8_t ascii, uint8_t *pGlyph, uint8_t *pw, uint8_t *ph)
Gets the glyph data for the specified ASCII character.
Definition: fontx.c:9
FontxFile::is_ank
bool is_ank
Definition: fontx.h:33
OpenFontx
bool OpenFontx(FontxFile *fx)
Opens the font file and reads the font data into the FontxFile structure.
Definition: fontx.c:4
ShowBitmap
void ShowBitmap(uint8_t *bitmap, uint8_t pw, uint8_t ph)
Displays a bitmap on the screen.
Definition: fontx.c:14
FontxFile
Struct representing a font file.
Definition: fontx.h:28
AaddFontx
void AaddFontx(FontxFile *fx, const char *path)
Adds a font file to the given FontxFile structure.
Definition: fontx.c:2
CloseFontx
void CloseFontx(FontxFile *fx)
Closes the font file.
Definition: fontx.c:5
GetFontWidth
uint8_t GetFontWidth(FontxFile *fx)
Gets the width of a character in the font.
Definition: fontx.c:7