mirror of
https://github.com/ByteWelder/Tactility.git
synced 2026-10-19 03:45:06 +00:00
- The `/system` FAT volume is removed. Its files are embedded in the firmware as generated C arrays. - Default-size fonts are generated at build time and used from flash. - The LVGL task and the Launcher run on PSRAM-preferred stacks. A new kernel `file_ops` API takes the file work off those threads. - `MainDispatcher` is reimplemented as an on-demand task. - More long-lived state is allocated with the PSRAM-preferring helpers. - Other fixes and improvements
60 lines
2.2 KiB
C
60 lines
2.2 KiB
C
// SPDX-License-Identifier: Apache-2.0
|
|
#pragma once
|
|
|
|
#include <tactility/error.h>
|
|
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
typedef struct BinFontGeneratorConfig {
|
|
/** Path to a TrueType (.ttf) file. Ignored when ttf_data is set */
|
|
const char* ttf_path;
|
|
/** A TrueType (.ttf) file in memory that must stay valid during the call, or NULL to read ttf_path */
|
|
const uint8_t* ttf_data;
|
|
/** Size of ttf_data in bytes */
|
|
size_t ttf_size;
|
|
/** Font size in pixels (em height) */
|
|
uint16_t size;
|
|
/** Bits per pixel: 1, 2, 3 or 4 */
|
|
uint8_t bpp;
|
|
/**
|
|
* Codepoints to include. Codepoints that the TTF doesn't contain are skipped.
|
|
* NULL (with codepoint_count 0) includes every codepoint in the TTF's character map.
|
|
*/
|
|
const uint32_t* codepoints;
|
|
size_t codepoint_count;
|
|
} BinFontGeneratorConfig;
|
|
|
|
/**
|
|
* @brief Rasterizes a TrueType font into the lv_font_conv binary format.
|
|
* @param[in] config the generator configuration
|
|
* @param[out] out_data the generated font file contents, to be released with memory_free()
|
|
* @param[out] out_size the size of out_data in bytes
|
|
* @retval ERROR_NONE on success
|
|
* @retval ERROR_INVALID_ARGUMENT when the configuration is invalid
|
|
* @retval ERROR_NOT_FOUND when the TTF file can't be read
|
|
* @retval ERROR_NOT_SUPPORTED when the TTF file or its character map can't be parsed, or it contains none of the codepoints
|
|
* @retval ERROR_OUT_OF_MEMORY when memory allocation failed
|
|
*/
|
|
error_t binfont_generate(const BinFontGeneratorConfig* config, uint8_t** out_data, size_t* out_size);
|
|
|
|
/**
|
|
* @brief Lists the codepoints in the character map of a TrueType font.
|
|
* @param[in] ttf_path path to a TrueType (.ttf) file
|
|
* @param[out] out_codepoints the codepoints, to be released with memory_free()
|
|
* @param[out] out_count the number of codepoints
|
|
* @retval ERROR_NONE on success
|
|
* @retval ERROR_NOT_FOUND when the TTF file can't be read
|
|
* @retval ERROR_NOT_SUPPORTED when the TTF file or its character map can't be parsed
|
|
* @retval ERROR_OUT_OF_MEMORY when memory allocation failed
|
|
*/
|
|
error_t binfont_get_ttf_codepoints(const char* ttf_path, uint32_t** out_codepoints, size_t* out_count);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|