mirror of https://github.com/xemu-project/xemu.git
ui: Trim FontAwesome font to glyphs in use (save 940KiB)
This commit is contained in:
parent
fdb78c5dbd
commit
046d127f31
Binary file not shown.
|
@ -7,7 +7,7 @@ pfiles = [
|
||||||
'abxy.ttf',
|
'abxy.ttf',
|
||||||
'Roboto-Medium.ttf',
|
'Roboto-Medium.ttf',
|
||||||
'RobotoCondensed-Regular.ttf',
|
'RobotoCondensed-Regular.ttf',
|
||||||
'font_awesome_6_1_1_solid.otf',
|
'font_awesome_6_1_1_solid.min.otf', # Update glyphs with scripts/gen-min-fa-font.sh
|
||||||
]
|
]
|
||||||
|
|
||||||
libpfile_targets = []
|
libpfile_targets = []
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -ex
|
||||||
|
# uv tool install fonttools
|
||||||
|
FONT_INPUT=font_awesome_6_1_1_solid.otf
|
||||||
|
FONT_OUTPUT=font_awesome_6_1_1_solid.min.otf
|
||||||
|
GLYPHS=$(grep -rhoE "ICON_FA_\w+" ../ui/xui | sort | uniq | sed -E 's/^ICON_FA_//; s/_/-/g; s/.*/\L&/' | paste -sd ",")
|
||||||
|
pyftsubset $FONT_INPUT --output-file=$FONT_OUTPUT --glyphs=$GLYPHS
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
#include "data/Roboto-Medium.ttf.h"
|
#include "data/Roboto-Medium.ttf.h"
|
||||||
#include "data/RobotoCondensed-Regular.ttf.h"
|
#include "data/RobotoCondensed-Regular.ttf.h"
|
||||||
#include "data/font_awesome_6_1_1_solid.otf.h"
|
#include "data/font_awesome_6_1_1_solid.min.otf.h"
|
||||||
#include "data/abxy.ttf.h"
|
#include "data/abxy.ttf.h"
|
||||||
|
|
||||||
FontManager g_font_mgr;
|
FontManager g_font_mgr;
|
||||||
|
@ -81,8 +81,8 @@ void FontManager::Rebuild()
|
||||||
ImVec2(0, -3 * g_viewport_mgr.m_scale * m_font_scale);
|
ImVec2(0, -3 * g_viewport_mgr.m_scale * m_font_scale);
|
||||||
config.GlyphMinAdvanceX = 32.0f * g_viewport_mgr.m_scale * m_font_scale;
|
config.GlyphMinAdvanceX = 32.0f * g_viewport_mgr.m_scale * m_font_scale;
|
||||||
static const ImWchar icon_ranges[] = { ICON_MIN_FA, ICON_MAX_FA, 0 };
|
static const ImWchar icon_ranges[] = { ICON_MIN_FA, ICON_MAX_FA, 0 };
|
||||||
io.Fonts->AddFontFromMemoryTTF((void *)font_awesome_6_1_1_solid_data,
|
io.Fonts->AddFontFromMemoryTTF((void *)font_awesome_6_1_1_solid_min_data,
|
||||||
font_awesome_6_1_1_solid_size,
|
font_awesome_6_1_1_solid_min_size,
|
||||||
18.0f * g_viewport_mgr.m_scale *
|
18.0f * g_viewport_mgr.m_scale *
|
||||||
m_font_scale,
|
m_font_scale,
|
||||||
&config, icon_ranges);
|
&config, icon_ranges);
|
||||||
|
|
Loading…
Reference in New Issue