1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-02-12 23:52:39 +00:00
trezor-firmware/core/tools/codegen/gen_font.mako

60 lines
1.8 KiB
Plaintext
Raw Normal View History

//! This file is generated by core/tools/codegen/gen_font.py
#![cfg_attr(any(), rustfmt::skip)]
#![allow(non_upper_case_globals)]
// Each glyph:
// - first two bytes: width, height
// - next three bytes: advance, bearingX, bearingY
// - rest is packed ${bpp}-bit glyph data
use crate::ui::display::font::FontInfo;
% for g in glyphs:
/// '${g["char"]}' (ASCII ${g["ascii"]})
const ${g["var_name"]}: [u8; ${g["arr_len"]}] = [ ${g["arr_content"]} ];
% endfor
/// Nonprintable glyph (inverse colors of '?')
const ${nonprintable["var_name"]}: [u8; ${nonprintable["arr_len"]}] = [ ${nonprintable["arr_content"]} ];
% if gen_normal:
/// Array of references for '${name}' normal ASCII glyphs
const Font_${name}: [&[u8]; ${len(glyph_array)}] = [
% for ref in glyph_array:
${ref},
% endfor
];
% endif
% if gen_upper:
/// Array of references for '${name}' ASCII glyphs (forced uppercase)
const Font_${name}_upper: [&[u8]; ${len(glyph_array_upper)}] = [
% for ref in glyph_array_upper:
${ref},
% endfor
];
% endif
% if gen_normal:
/// FontInfo struct for normal ASCII usage
pub const Font_${name}_info: FontInfo = FontInfo {
translation_blob_idx: ${font_info["translation_blob_idx"]},
height: ${font_info["height"]},
max_height: ${font_info["max_height"]},
baseline: ${font_info["baseline"]},
glyph_data: &${font_info["glyph_array"]},
glyph_nonprintable: &${font_info["nonprintable"]},
};
% endif
% if gen_upper:
/// FontInfo struct for forced uppercase usage
pub const Font_${name}_upper_info: FontInfo = FontInfo {
translation_blob_idx: ${font_info_upper["translation_blob_idx"]},
height: ${font_info_upper["height"]},
max_height: ${font_info_upper["max_height"]},
baseline: ${font_info_upper["baseline"]},
glyph_data: &${font_info_upper["glyph_array"]},
glyph_nonprintable: &${font_info_upper["nonprintable"]},
};
% endif