1
0
mirror of synced 2025-01-29 19:17:28 +01:00

impr: More efficiently pack glyphs on font atlas

This commit is contained in:
WerWolv 2023-11-28 10:37:38 +01:00
parent eae73b3113
commit abf6e37938

View File

@ -10,9 +10,15 @@
namespace hex::plugin::builtin {
void loadFonts() {
ImHexApi::Fonts::loadFont("Unifont", romfs::get("fonts/unifont.otf").span<u8>());
ImHexApi::Fonts::loadFont("VS Codicons", romfs::get("fonts/codicons.ttf").span<u8>(), { { ICON_MIN_VS, ICON_MAX_VS } }, { 0, 3_scaled });
/**
* !!IMPORTANT!!
* Always load the font files in decreasing size of their glyphs. This will make the rasterize be more
* efficient when packing the glyphs into the font atlas and therefor make the atlas much smaller.
*/
ImHexApi::Fonts::loadFont("Font Awesome 5", romfs::get("fonts/fontawesome.otf").span<u8>(), { { ICON_MIN_FA, ICON_MAX_FA } }, { 0, 3_scaled });
ImHexApi::Fonts::loadFont("VS Codicons", romfs::get("fonts/codicons.ttf").span<u8>(), { { ICON_MIN_VS, ICON_MAX_VS } }, { 0, 3_scaled });
ImHexApi::Fonts::loadFont("Unifont", romfs::get("fonts/unifont.otf").span<u8>());
}
}