mirror of
https://github.com/kuhyx/diet-guard.git
synced 2026-11-10 19:07:15 +01:00
Some checks are pending
dependency freshness / dependencies on newest stable (push) Waiting to run
file-length / file length <= 250 lines (push) Waiting to run
md-naming / markdown naming convention (push) Waiting to run
pre-commit / pre-commit (push) Waiting to run
Tests / test (push) Waiting to run
release-apk / release (APK) (push) Waiting to run
Also bumps Flutter 3.47.3, flutter_secure_storage 11.1.0, idb_shim 2.9.9, mcp 2.2.0 and ruff 0.16.7 so the freshness gate lets this through. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AwtowrowDXx6ccmWVPkCaF
38 lines
1.6 KiB
Python
38 lines
1.6 KiB
Python
"""Shared type scale for the diet_guard gate (tokens.md's typography scale).
|
|
|
|
Split out so :mod:`._gatelock_ui`, :mod:`._gatelock_calendar`, and
|
|
:mod:`._gatelock_buttons` read the same sizes instead of each picking its
|
|
own value per label -- see ``DESIGN_AUDIT_TODO.md``.
|
|
|
|
**These are Tk font sizes, and Tk encodes the unit in the sign: positive
|
|
means points, negative means pixels.** The design-system scale in
|
|
``~/src/utils/unified-design-system/tokens.md`` is in *pixels*, so every constant
|
|
here is negative.
|
|
|
|
This module previously carried the positive values with a comment asserting
|
|
that "Tk has no separate px/pt distinction". That premise was wrong, and the
|
|
consequence was not cosmetic: at ~100 DPI a positive 16 renders with a 26px
|
|
linespace where a negative 16 gives 20px, so every string in the gate was
|
|
~30% oversized. That alone pushed the Log Meal tab to 866px of required
|
|
height inside a 739px pane on a 1366x768 screen -- clipping the title and the
|
|
dashboard symmetrically, with no scrollbar to recover them. Keep the signs
|
|
negative; ``tests/test_gatelock_typography.py`` enforces it, and
|
|
``tests/measure_gate_layout.py`` enforces the height that depends on it.
|
|
|
|
``gatelock.LockConfig`` grew the same scale (plus ``LockConfig.font()``, which
|
|
applies the sign for you). Once the gatelock pin here moves past v0.2.1, this
|
|
module should become a thin re-export of that shared scale rather than a
|
|
second copy.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
# Pixel sizes from tokens.md, negated for Tk. Keep in sync with
|
|
# gatelock.LockConfig.type_* until this module can defer to it.
|
|
DISPLAY = -32
|
|
TITLE = -24
|
|
SUBTITLE = -20
|
|
BODY = -16
|
|
LABEL = -14
|
|
CAPTION = -12
|