libpynq (release 5EWC0-2023 version 0.2.6 of 2023-10-24 17:28)
Loading...
Searching...
No Matches
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
23typedef struct _IO_FILE FILE;
24
28typedef 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
48void AaddFontx(FontxFile *fx, const char *path);
49
58void InitFontx(FontxFile *fxs, const char *f0, const char *f1);
59
73bool OpenFontx(FontxFile *fx);
74
80void CloseFontx(FontxFile *fx);
81
87void DumpFontx(FontxFile *fxs);
88
97
106
118bool GetFontx(FontxFile *fxs, uint8_t ascii, uint8_t *pGlyph, uint8_t *pw,
119 uint8_t *ph);
120
130void Font2Bitmap(uint8_t *fonts, uint8_t *line, uint8_t w, uint8_t h,
131 uint8_t inverse);
132
140void UnderlineBitmap(uint8_t *line, uint8_t w, uint8_t h);
141
149void ReversBitmap(uint8_t *line, uint8_t w, uint8_t h);
150
158void ShowFont(uint8_t *fonts, uint8_t pw, uint8_t ph);
159
167void ShowBitmap(uint8_t *bitmap, uint8_t pw, uint8_t ph);
168
176uint8_t RotateByte(uint8_t ch);
177
182#endif
void AaddFontx(FontxFile *fx, const char *path)
Adds a font file to the given FontxFile structure.
void DumpFontx(FontxFile *fxs)
Dumps the font data stored in the FontxFile structure.
Definition fontx.c:74
void InitFontx(FontxFile *fxs, const char *f0, const char *f1)
Initializes the given FontxFile structure with the specified font files.
Definition fontx.c:17
void CloseFontx(FontxFile *fx)
Closes the font file.
Definition fontx.c:67
void ShowBitmap(uint8_t *bitmap, uint8_t pw, uint8_t ph)
Displays a bitmap on the screen.
Definition fontx.c:211
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:98
uint8_t RotateByte(uint8_t ch)
Rotates a byte by 90 degrees.
Definition fontx.c:234
struct _IO_FILE FILE
Definition fontx.h:23
void ReversBitmap(uint8_t *line, uint8_t w, uint8_t h)
Reverses the bits in each byte of a bitmap.
Definition fontx.c:181
uint8_t GetFontWidth(FontxFile *fx)
Gets the width of a character in the font.
void ShowFont(uint8_t *fonts, uint8_t pw, uint8_t ph)
Displays a font on the screen.
Definition fontx.c:192
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
bool OpenFontx(FontxFile *fx)
Opens the font file and reads the font data into the FontxFile structure.
Definition fontx.c:22
void UnderlineBitmap(uint8_t *line, uint8_t w, uint8_t h)
Adds an underline to a bitmap.
Definition fontx.c:169
uint8_t GetFontHeight(FontxFile *fx)
Gets the height of a character in the font.
Struct representing a font file.
Definition fontx.h:28
uint8_t bc
Definition fontx.h:38
uint16_t fsz
Definition fontx.h:37
const char * path
Definition fontx.h:29
bool is_ank
Definition fontx.h:33
uint8_t w
Definition fontx.h:35
bool opened
Definition fontx.h:31
FILE * file
Definition fontx.h:39
bool valid
Definition fontx.h:32
uint8_t h
Definition fontx.h:36