UX improvements

This commit is contained in:
2026-02-28 00:57:11 -06:00
parent 6607bae2b5
commit f5378a55ed
6 changed files with 132 additions and 97 deletions

View File

@@ -43,18 +43,30 @@ namespace Layout {
namespace detail {
inline float& userFontScaleRef() { static float s = 1.0f; return s; }
inline bool& fontReloadNeededRef() { static bool s = false; return s; }
inline float& fontAtlasScaleRef() { static float s = 1.0f; return s; }
}
/**
* @brief Get the user's font scale preference (1.03.0).
* @brief Get the user's font scale preference (1.01.5).
* Multiplied into font loading so glyphs render at the chosen size.
*/
inline float userFontScale() { return detail::userFontScaleRef(); }
/**
* @brief Get the user font scale at which the font atlas was last built.
* Used to compute FontScaleMain compensation during smooth slider drag.
*/
inline float fontAtlasScale() { return detail::fontAtlasScaleRef(); }
/**
* @brief Record the font atlas scale after a rebuild.
* Called from Typography::load() after the atlas is built.
*/
inline void setFontAtlasScale(float v) { detail::fontAtlasScaleRef() = v; }
/**
* @brief Set the user's font scale and flag a font reload.
* Called from the settings UI; the main loop detects the flag and
* calls Typography::reload().
* Called on slider release for a crisp atlas rebuild.
*/
inline void setUserFontScale(float v) {
v = std::max(1.0f, std::min(1.5f, v));
@@ -64,6 +76,16 @@ inline void setUserFontScale(float v) {
}
}
/**
* @brief Set the user's font scale WITHOUT flagging a font reload.
* Called every frame while the slider is being dragged for smooth
* visual scaling via FontScaleMain compensation.
*/
inline void setUserFontScaleVisual(float v) {
v = std::max(1.0f, std::min(1.5f, v));
detail::userFontScaleRef() = v;
}
/**
* @brief Consume the pending font-reload flag (returns true once).
*/