mirror of
https://github.com/ByteWelder/Tactility.git
synced 2026-10-17 19:05:07 +00:00
**Fonts** Dynamically load text and icon fonts when the device boots. Font bitdepth depends on whether the device is an ESP32 one and whether it has external RAM available. When no external RAM is available on ESP32, only small and medium font variants are generated; large font variants refer to the medium size ones. Implemented Appearance settings app for changing font and font size. **Other changes** - Added keyboard shortcuts to delete or rename files in directory views. - Improved app-grid tile sizing to provide more room for labels. - Reduced the default LED strip brightness.
56 lines
2.0 KiB
C
56 lines
2.0 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 */
|
|
const char* ttf_path;
|
|
/** 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
|