forge
Explore
Log in

Don't you dare go Hollow

The room's text lands on the pixel grid

Browse files at this commit

2d435c2a0820b3b7044051d0afeffce4eae7d7b0Ahmet Kaan GümüşParent: 1480a08cc021cf
  • style
    • the room's text lands on the pixel grid
Show full message
💄 style(ui): the room's text lands on the pixel grid

Type scale moves from 13/10.5/10-9.5/9/8 to an all-integer 15/13/12-11/10/9.
Two sizes were fractional half-pixels and several sat below the size where
greyscale AA resolves a hard edge. DESIGN.md 3 and the contract test move
with it, plus an assertion that no size may be fractional again.
DESIGN.mdmodified+5 -3
@@ -76,9 +76,11 @@ Two faces, fixed roles (bundled, no runtime deps):
76 - **Spline Sans Mono** — everything the film says: timecode, chords, readouts, metadata,76 - **Spline Sans Mono** — everything the film says: timecode, chords, readouts, metadata,
77 cue text, the ledger. Mono = data; if a string is *about the footage or a key*, it is mono.77 cue text, the ledger. Mono = data; if a string is *about the footage or a key*, it is mono.
78 78
79-Scale: 13px hero timecode (700, colons in `ink3`) · 10.5px labels/rows (500) · 9.5–10px chords79+Scale: 15px hero timecode (700, colons in `ink3`) · 13px labels/rows (500) · 11–12px chords
80-and metadata (500) · 9px section heads (Archivo 700, uppercase, +0.14em letter-spacing, `ink3`).80+and metadata (500) · 10px section heads (Archivo 700, uppercase, +0.14em letter-spacing, `ink3`).
81-Nothing below 8px. No italics. Tabular figures wherever digits align.81+Nothing below 9px. Every size is a whole pixel (no half-pixel sizes -- they put glyph baselines
82+off the pixel grid and blurred cosmic-text's AA). No italics. Tabular figures wherever digits
83+align.
82 84
83 ## 4. Ghost grammar — the control language85 ## 4. Ghost grammar — the control language
84 86
crates/app/src/ui/type_scale.rsmodified+39 -14
@@ -36,13 +36,21 @@ pub const ARCHIVO: &str = "Archivo";
36 pub const SPLINE_SANS_MONO: &str = "Spline Sans Mono";36 pub const SPLINE_SANS_MONO: &str = "Spline Sans Mono";
37 37
38 /// DESIGN §3's scale, named so a call site reads the role, not a number.38 /// DESIGN §3's scale, named so a call site reads the role, not a number.
39-pub const HERO_TIMECODE_PX: f32 = 13.;39+///
40-pub const LABEL_ROW_PX: f32 = 10.5;40+/// Landed at a conservative +2px bump over the original half-pixel scale
41-pub const CHORD_METADATA_MAX_PX: f32 = 10.;41+/// (13/10.5/10-9.5/9/8 -> 15/13/12-11/10/9), chosen over a fuller
42-pub const CHORD_METADATA_MIN_PX: f32 = 9.5;42+/// "readable at arm's length" candidate (18/15/14-13/12/10) to keep the
43-pub const SECTION_HEAD_PX: f32 = 9.;43+/// fixed-width dock/bench card labels clear of the truncation ladder
44+/// (DESIGN §7). To try the fuller scale, swap these six values for
45+/// 18./15./14./13./12./10. and update `the_scale_matches_design_3` (and
46+/// DESIGN.md §3) to match.
47+pub const HERO_TIMECODE_PX: f32 = 15.;
48+pub const LABEL_ROW_PX: f32 = 13.;
49+pub const CHORD_METADATA_MAX_PX: f32 = 12.;
50+pub const CHORD_METADATA_MIN_PX: f32 = 11.;
51+pub const SECTION_HEAD_PX: f32 = 10.;
44 /// The floor DESIGN §3 sets: nothing in the room reads smaller than this.52 /// The floor DESIGN §3 sets: nothing in the room reads smaller than this.
45-pub const FLOOR_PX: f32 = 8.;53+pub const FLOOR_PX: f32 = 9.;
46 54
47 /// A family, weight and size together -- what a call site needs to paint55 /// A family, weight and size together -- what a call site needs to paint
48 /// text with `.font(style.font).text_size(style.size)`, and nothing it has56 /// text with `.font(style.font).text_size(style.size)`, and nothing it has
@@ -173,15 +181,32 @@ mod tests {
173 use gpui::FontStyle;181 use gpui::FontStyle;
174 182
175 /// The scale never drifts below DESIGN §3's floor, and role sizes match183 /// The scale never drifts below DESIGN §3's floor, and role sizes match
176- /// the numbers §3 names -- a call site changing `13.` to `12.` for the184+ /// the numbers §3 names -- a call site changing `15.` to `14.` for the
177 /// hero timecode is the design contract silently moving.185 /// hero timecode is the design contract silently moving.
186+ ///
187+ /// Sizes are all whole pixels (raised from the original 13/10.5/9.5-10/9/8
188+ /// scale, which put glyph baselines on half-pixel rows and left body text
189+ /// too small for crisp greyscale AA -- a pixel scan through "SPINE" at
190+ /// the old 9px section-head size showed 5-6 intermediate grey levels per
191+ /// stroke instead of a hard 1-2px edge). No fractional size is allowed
192+ /// back into this scale.
178 #[test]193 #[test]
179 fn the_scale_matches_design_3() {194 fn the_scale_matches_design_3() {
180- assert_eq!(HERO_TIMECODE_PX, 13.);195+ assert_eq!(HERO_TIMECODE_PX, 15.);
181- assert_eq!(LABEL_ROW_PX, 10.5);196+ assert_eq!(LABEL_ROW_PX, 13.);
182- assert!((9.5..=10.).contains(&CHORD_METADATA_MIN_PX));197+ assert!((11. ..=12.).contains(&CHORD_METADATA_MIN_PX));
183- assert_eq!(SECTION_HEAD_PX, 9.);198+ assert_eq!(SECTION_HEAD_PX, 10.);
184- assert_eq!(FLOOR_PX, 8.);199+ assert_eq!(FLOOR_PX, 9.);
200+ for size in [
201+ HERO_TIMECODE_PX,
202+ LABEL_ROW_PX,
203+ CHORD_METADATA_MAX_PX,
204+ CHORD_METADATA_MIN_PX,
205+ SECTION_HEAD_PX,
206+ FLOOR_PX,
207+ ] {
208+ assert_eq!(size.fract(), 0., "{size} is not a whole pixel");
209+ }
185 for size in [210 for size in [
186 HERO_TIMECODE_PX,211 HERO_TIMECODE_PX,
187 LABEL_ROW_PX,212 LABEL_ROW_PX,
@@ -210,9 +235,9 @@ mod tests {
210 }235 }
211 236
212 /// `head()` is exactly what DESIGN §3 names for section heads: Archivo,237 /// `head()` is exactly what DESIGN §3 names for section heads: Archivo,
213- /// 700, 9px.238+ /// 700, `SECTION_HEAD_PX`.
214 #[test]239 #[test]
215- fn head_is_archivo_bold_9px() {240+ fn head_is_archivo_bold_at_section_head_size() {
216 let h = head();241 let h = head();
217 assert_eq!(h.font.family.as_ref(), ARCHIVO);242 assert_eq!(h.font.family.as_ref(), ARCHIVO);
218 assert_eq!(h.font.weight, FontWeight::BOLD);243 assert_eq!(h.font.weight, FontWeight::BOLD);