libpynq (release 5EWC0-2023 version 0.2.6 of 2023-10-24 17:28)
Loading...
Searching...
No Matches
Font library

Data Structures

struct  FontxFile
 

Typedefs

typedef struct _IO_FILE FILE
 

Functions

void AaddFontx (FontxFile *fx, const char *path)
 
void InitFontx (FontxFile *fxs, const char *f0, const char *f1)
 
bool OpenFontx (FontxFile *fx)
 
void CloseFontx (FontxFile *fx)
 
void DumpFontx (FontxFile *fxs)
 
uint8_t GetFontWidth (FontxFile *fx)
 
uint8_t GetFontHeight (FontxFile *fx)
 
bool GetFontx (FontxFile *fxs, uint8_t ascii, uint8_t *pGlyph, uint8_t *pw, uint8_t *ph)
 
void Font2Bitmap (uint8_t *fonts, uint8_t *line, uint8_t w, uint8_t h, uint8_t inverse)
 
void UnderlineBitmap (uint8_t *line, uint8_t w, uint8_t h)
 
void ReversBitmap (uint8_t *line, uint8_t w, uint8_t h)
 
void ShowFont (uint8_t *fonts, uint8_t pw, uint8_t ph)
 
void ShowBitmap (uint8_t *bitmap, uint8_t pw, uint8_t ph)
 
uint8_t RotateByte (uint8_t ch)
 

Detailed Description

Do not use. Low-level library to work with bitmap fonts on the display.

It provides functionality for loading and manipulating font files, rendering fonts and bitmaps to the screen, and performing various transformations on bitmaps. The library also includes a struct, FontxFile, which represents a font file and contains metadata about the font.

This is an internal library and should not be directly used.

Typedef Documentation

◆ FILE

typedef struct _IO_FILE FILE

Definition at line 23 of file fontx.h.

Function Documentation

◆ AaddFontx()

void AaddFontx ( FontxFile fx,
const char *  path 
)

Adds a font file to the given FontxFile structure.

Parameters
fxPointer to the FontxFile structure
pathPath to the font file

◆ CloseFontx()

void CloseFontx ( FontxFile fx)

Closes the font file.

Parameters
fxPointer to the FontxFile structure

Definition at line 67 of file fontx.c.

◆ DumpFontx()

void DumpFontx ( FontxFile fxs)

Dumps the font data stored in the FontxFile structure.

Parameters
fxsPointer to the FontxFile structure

Definition at line 74 of file fontx.c.

◆ 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.

Parameters
fontsPointer to the font data buffer
linePointer to the bitmap buffer
wWidth of the bitmap in pixels
hHeight of the bitmap in pixels
inverseIf true, the bitmap will be inverted

Definition at line 135 of file fontx.c.

Here is the call graph for this function:

◆ GetFontHeight()

uint8_t GetFontHeight ( FontxFile fx)

Gets the height of a character in the font.

Parameters
fxPointer to the FontxFile structure
Returns
The height of a character in pixels

◆ GetFontWidth()

uint8_t GetFontWidth ( FontxFile fx)

Gets the width of a character in the font.

Parameters
fxPointer to the FontxFile structure
Returns
The width of a character in pixels

◆ 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.

Parameters
fxsPointer to the FontxFile structure
asciiASCII value of the character to get the glyph for
pGlyphPointer to the buffer to store the glyph data
pwPointer to the variable to store the width of the glyph
phPointer to the variable to store the height of the glyph
Returns
True if the glyph was found, false otherwise

Definition at line 98 of file fontx.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ InitFontx()

void InitFontx ( FontxFile fxs,
const char *  f0,
const char *  f1 
)

Initializes the given FontxFile structure with the specified font files.

Parameters
fxsPointer to the FontxFile structure
f0Path to the 8x16 font file
f1Path to the 16x16 font file

Definition at line 17 of file fontx.c.

Here is the call graph for this function:

◆ OpenFontx()

bool OpenFontx ( FontxFile fx)

Opens the font file and reads the font data into the FontxFile structure.

Parameters
fxPointer to the FontxFile structure
Returns
True if the font file was opened successfully, false otherwise
Warning
The font-file path must be valid from the directory in which the executable is called, otherwise the error message "cannot get font from font file" will be thrown. Absolute paths (starting with /) are safe.

Definition at line 22 of file fontx.c.

Here is the caller graph for this function:

◆ ReversBitmap()

void ReversBitmap ( uint8_t *  line,
uint8_t  w,
uint8_t  h 
)

Reverses the bits in each byte of a bitmap.

Parameters
linePointer to the bitmap buffer
wWidth of the bitmap in pixels
hHeight of the bitmap in pixels

Definition at line 181 of file fontx.c.

◆ RotateByte()

uint8_t RotateByte ( uint8_t  ch)

Rotates a byte by 90 degrees.

Parameters
chByte to be rotated
Returns
The rotated byte

Definition at line 234 of file fontx.c.

Here is the caller graph for this function:

◆ ShowBitmap()

void ShowBitmap ( uint8_t *  bitmap,
uint8_t  pw,
uint8_t  ph 
)

Displays a bitmap on the screen.

Parameters
bitmapPointer to the bitmap buffer
pwWidth of the font in pixels
phHeight of the font in pixels

Definition at line 211 of file fontx.c.

◆ ShowFont()

void ShowFont ( uint8_t *  fonts,
uint8_t  pw,
uint8_t  ph 
)

Displays a font on the screen.

Parameters
fontsPointer to the font buffer
pwWidth of the font in pixels
phHeight of the font in pixels

Definition at line 192 of file fontx.c.

◆ UnderlineBitmap()

void UnderlineBitmap ( uint8_t *  line,
uint8_t  w,
uint8_t  h 
)

Adds an underline to a bitmap.

Parameters
linePointer to the bitmap buffer
wWidth of the bitmap in pixels
hHeight of the bitmap in pixels

Definition at line 169 of file fontx.c.