font 1.0
fonts for display driver library
Loading...
Searching...
No Matches
font.c File Reference

Source file containing character lookup function for text rendering. More...

#include "font.h"
Include dependency graph for font.c:

Functions

void font_get_bitmap (char character, unsigned char *bitmap)
 Retrieves the bitmap array for a given ASCII character from the font table.

Variables

const unsigned char font_ascii_table [][5]

Detailed Description

Source file containing character lookup function for text rendering.

This file defines the font data table map function. The character table entries represent the bitmap patterns for individual characters, which are selected by the lookup function font_get_bitmap(). This function handles bounds checking and optional conversion of lowercase to uppercase letters when enabled, to optimize memory usage. The table and accessor function are designed for use in embedded systems with constrained storage, such as microcontrollers, where font data is read for graphical text displays.

The configuration macros allow customization:

Author
g.raf
Date
2026-07-15
Version
1.0 Release
Note
This file is part of a larger project and subject to the license specified in the repository. For updates and the complete revision history, see the GitHub repository.
See also
https://github.com/0x007e/drivers-display-font "Drivers Display Font GitHub Repository"

Function Documentation

◆ font_get_bitmap()

void font_get_bitmap ( char character,
unsigned char * bitmap )

Retrieves the bitmap array for a given ASCII character from the font table.

Parameters
characterThe ASCII character to retrieve the bitmap for.
bitmapPointer to a array for storing the bitmap bytes representing the character.

This function maps an input ASCII character to its corresponding bitmap pattern stored in the font table. If the character is outside the supported ASCII range defined by FONT_ASCII_START_CHAR and FONT_ASCII_END_CHAR, it defaults is the '?' character. When the macro FONT_IGNORE_LOWER_CASE is defined, lowercase letters are converted to uppercase to save memory, and adjustments are made to the character code accordingly.

Note
The bitmap data is read from either EEPROM or program memory (PROGMEM) depending on the macro FONT_STORE_IN_EEPROM. The data is copied into an array pointed to. The operator has to prevent the correct size of this array!

Variable Documentation

◆ font_ascii_table

const unsigned char font_ascii_table[][5]
extern