palette: enlarge the region title into WCAG large class; repoint the grabbed envelope handle off hue
Corrects theme.h's large-text thresholds, names accent/secondary's real binding limiter, and adds compositeOver so the loop-span fill's 2.25:1 under-floor pair is asserted rather than assumed.
This commit is contained in:
@@ -40,7 +40,17 @@ namespace {
|
||||
// this converts a KitColor's 8-bit alpha so a disabled surface composites at the right opacity.
|
||||
float drawAlpha(const KitColor& c) { return c.a / 255.0f; }
|
||||
|
||||
// Font::RegionTitle exists so an ACCENT-colored title can answer to the 3:1 indicator floor
|
||||
// instead of the 4.5:1 body floor. That entitlement is the font's, not the color's, so the
|
||||
// metrics are pinned here against theme's thresholds: shrink either one and the build stops
|
||||
// rather than silently reclassifying every pair drawn in it.
|
||||
constexpr int kRegionTitlePx = 19;
|
||||
constexpr int kRegionTitleWeight = FW_BOLD;
|
||||
static_assert(kRegionTitlePx >= ui::kLargeTextMinBoldPx, "region title must clear WCAG large");
|
||||
static_assert(kRegionTitleWeight >= FW_BOLD, "the large-bold threshold requires bold, not semi");
|
||||
|
||||
struct KitFonts {
|
||||
LICE_CachedFont regionTitle;
|
||||
LICE_CachedFont title;
|
||||
LICE_CachedFont label;
|
||||
LICE_CachedFont valueMono;
|
||||
@@ -65,6 +75,7 @@ void loadFont(LICE_CachedFont& dst, int pxHeight, int weight, const char* face)
|
||||
LICE_CachedFont* fontFor(Font f) {
|
||||
if (!g_fonts.ready) return nullptr;
|
||||
switch (f) {
|
||||
case Font::RegionTitle: return &g_fonts.regionTitle;
|
||||
case Font::Title: return &g_fonts.title;
|
||||
case Font::Label: return &g_fonts.label;
|
||||
case Font::ValueMono: return &g_fonts.valueMono;
|
||||
@@ -136,6 +147,7 @@ RECT toRect(const KitBox& b) {
|
||||
|
||||
void kitFontsInit() {
|
||||
if (g_fonts.ready) return; // idempotent
|
||||
loadFont(g_fonts.regionTitle, kRegionTitlePx, kRegionTitleWeight, "Segoe UI");
|
||||
loadFont(g_fonts.title, 15, FW_SEMIBOLD, "Segoe UI");
|
||||
loadFont(g_fonts.label, 12, FW_NORMAL, "Segoe UI");
|
||||
loadFont(g_fonts.valueMono, 12, FW_NORMAL, "Consolas");
|
||||
@@ -147,6 +159,7 @@ void kitFontsShutdown() {
|
||||
if (!g_fonts.ready) return; // idempotent
|
||||
// g_fonts is a static instance, never re-created, so free the HFONTs explicitly:
|
||||
// handing each a null font with OWNS_HFONT cleans up the prior HFONT (lice_text.h).
|
||||
g_fonts.regionTitle.SetFromHFont(nullptr, LICE_FONT_FLAG_OWNS_HFONT);
|
||||
g_fonts.title.SetFromHFont(nullptr, LICE_FONT_FLAG_OWNS_HFONT);
|
||||
g_fonts.label.SetFromHFont(nullptr, LICE_FONT_FLAG_OWNS_HFONT);
|
||||
g_fonts.valueMono.SetFromHFont(nullptr, LICE_FONT_FLAG_OWNS_HFONT);
|
||||
|
||||
Reference in New Issue
Block a user