The room speaks in its own type and its badges get terse
Browse files at this commitd5dd5fc620e93082b78dc4abb467abec59db1b1aParent: 25a08e3- style
- the room speaks in its own type and its badges get terse
7 changed files +311 -93
- crates/app/src/keymap.rs +48 -0
- crates/app/src/ui/bench_stance.rs +27 -6
- crates/app/src/ui/dock_stance.rs +62 -34
- crates/app/src/ui/spine_stance.rs +31 -23
- crates/app/src/ui/stance.rs +86 -16
- crates/app/src/ui/timeband_stance.rs +44 -13
- crates/app/src/ui/type_scale.rs +13 -1
crates/app/src/keymap.rsmodified+48 -0
| @@ -877,6 +877,26 @@ impl Chord { | ||
| 877 | 877 | } |
| 878 | 878 | } |
| 879 | 879 | |
| 880 | + /// The spelling a badge with room for one token reads (MOCK-SPEC.md | |
| 881 | + /// "Spine": `del`, `z`, not `x or delete`, `ctrl+z`): `^` in place of | |
| 882 | + /// `ctrl+`, and the handful of key names whose everyday short form isn't | |
| 883 | + /// gpui's own (`delete` -> `del`, `escape` -> `esc`, `space` -> `spc`). | |
| 884 | + /// [`Chord::pretty`] stays the keys overlay's own spelling -- this is for | |
| 885 | + /// a glyph badge, not the full truth. | |
| 886 | + pub fn compact(&self) -> String { | |
| 887 | + let key = match self.key.as_str() { | |
| 888 | + "escape" => "esc", | |
| 889 | + "delete" => "del", | |
| 890 | + "space" => "spc", | |
| 891 | + other => other, | |
| 892 | + }; | |
| 893 | + if self.ctrl { | |
| 894 | + format!("^{key}") | |
| 895 | + } else { | |
| 896 | + key.to_string() | |
| 897 | + } | |
| 898 | + } | |
| 899 | + | |
| 880 | 900 | /// Whether the file can carry this stroke and read it back as itself. gpui |
| 881 | 901 | /// reports strokes this format cannot spell -- shift+= arrives as the key |
| 882 | 902 | /// `"+"`, which is the chord grammar's own separator -- and binding one |
| @@ -1215,6 +1235,20 @@ impl Keymap { | ||
| 1215 | 1235 | } |
| 1216 | 1236 | } |
| 1217 | 1237 | |
| 1238 | + /// The primary chord for `action`, compact ([`Chord::compact`]) -- a | |
| 1239 | + /// badge that has room for one token, not [`Keymap::display`]'s sentence. | |
| 1240 | + /// The first bound stroke wins (`defaults`' own insertion order, and | |
| 1241 | + /// `rebind_action`'s "makes `chord` the whole of what reaches `action`" | |
| 1242 | + /// leaves at most one anyway); an action with no stroke reads `--` | |
| 1243 | + /// rather than the unbound sentence, since a badge is not a warning. | |
| 1244 | + pub fn chord(&self, action: ActionId) -> String { | |
| 1245 | + self.bindings | |
| 1246 | + .iter() | |
| 1247 | + .find(|b| b.action == action) | |
| 1248 | + .map(|b| b.chord.compact()) | |
| 1249 | + .unwrap_or_else(|| "--".to_string()) | |
| 1250 | + } | |
| 1251 | + | |
| 1218 | 1252 | /// Every binding, in display order. |
| 1219 | 1253 | pub fn entries(&self) -> &[Binding] { |
| 1220 | 1254 | &self.bindings |
| @@ -1742,6 +1776,20 @@ mod tests { | ||
| 1742 | 1776 | assert_eq!(k.display(ActionId::ZoomIn), "ctrl+="); |
| 1743 | 1777 | } |
| 1744 | 1778 | |
| 1779 | + /// [`Keymap::chord`] is the badge's one token, not [`Keymap::display`]'s | |
| 1780 | + /// sentence: the primary (first-bound) stroke only, `^` for ctrl, and the | |
| 1781 | + /// short names a glyph badge actually has room for. | |
| 1782 | + #[test] | |
| 1783 | + fn chord_is_the_primary_stroke_compact() { | |
| 1784 | + let k = Keymap::defaults(); | |
| 1785 | + assert_eq!(k.chord(ActionId::Delete), "x"); | |
| 1786 | + assert_eq!(k.chord(ActionId::Undo), "z"); | |
| 1787 | + assert_eq!(k.chord(ActionId::AddFiles), "^o"); | |
| 1788 | + assert_eq!(k.chord(ActionId::CancelExport), "^esc"); | |
| 1789 | + assert_eq!(k.chord(ActionId::Play), "spc"); | |
| 1790 | + assert_eq!(whole("edith-keys 1\n").chord(ActionId::Cut), "--"); | |
| 1791 | + } | |
| 1792 | + | |
| 1745 | 1793 | /// The one row of [`FIXED`] that speaks for a whole table elsewhere: it |
| 1746 | 1794 | /// named six keys for seven codecs, and OGG's `o` was a stroke the card |
| 1747 | 1795 | /// never mentioned. The chord is generated from `FORMATS` now, and this |
crates/app/src/ui/bench_stance.rsmodified+27 -6
| @@ -28,6 +28,7 @@ | ||
| 28 | 28 | //! answer for. |
| 29 | 29 | |
| 30 | 30 | use crate::*; |
| 31 | +use crate::ui::type_scale::{self, Typeset}; | |
| 31 | 32 | |
| 32 | 33 | /// The pinned ruler's own height, above the lane stack -- tall enough for a |
| 33 | 34 | /// tick line plus a mono `MM:SS` label under it (DESIGN §5's "tick marks with |
| @@ -275,12 +276,22 @@ fn clip_box( | ||
| 275 | 276 | .gap(px(4.)) |
| 276 | 277 | .bg(rgba(DARK_SEAM())) |
| 277 | 278 | .when_some(label, |d, label| { |
| 278 | - d.child(div().min_w(px(0.)).truncate().text_size(px(9.5)).text_color(rgb(INK1())).child(label)) | |
| 279 | + d.child( | |
| 280 | + div() | |
| 281 | + .min_w(px(0.)) | |
| 282 | + .truncate() | |
| 283 | + .type_style(type_scale::mono( | |
| 284 | + type_scale::CHORD_METADATA_MIN_PX, | |
| 285 | + gpui::FontWeight::MEDIUM, | |
| 286 | + )) | |
| 287 | + .text_color(rgb(INK1())) | |
| 288 | + .child(label), | |
| 289 | + ) | |
| 279 | 290 | }) |
| 280 | 291 | .child( |
| 281 | 292 | div() |
| 282 | 293 | .flex_none() |
| 283 | - .text_size(px(9.)) | |
| 294 | + .type_style(type_scale::mono(9., gpui::FontWeight::MEDIUM)) | |
| 284 | 295 | .text_color(rgb(INK3())) |
| 285 | 296 | .child(readout), |
| 286 | 297 | ), |
| @@ -296,7 +307,7 @@ fn clip_box( | ||
| 296 | 307 | .right_0() |
| 297 | 308 | .px(px(3.)) |
| 298 | 309 | .bg(rgb(DARK_RAISED())) |
| 299 | - .text_size(px(9.)) | |
| 310 | + .type_style(type_scale::mono(9., gpui::FontWeight::MEDIUM)) | |
| 300 | 311 | .text_color(rgb(INK2())) |
| 301 | 312 | .child(format!("{speed}")), |
| 302 | 313 | ) |
| @@ -360,7 +371,11 @@ fn lane_row( | ||
| 360 | 371 | .justify_center() |
| 361 | 372 | .gap(px(2.)) |
| 362 | 373 | .bg(rgb(DARK_PANEL())) |
| 363 | - .text_size(px(9.5)) | |
| 374 | + // MOCK-SPEC.md "Bench": "V1, A1 in mono". | |
| 375 | + .type_style(type_scale::mono( | |
| 376 | + type_scale::CHORD_METADATA_MIN_PX, | |
| 377 | + gpui::FontWeight::MEDIUM, | |
| 378 | + )) | |
| 364 | 379 | .text_color(rgb(INK2())) |
| 365 | 380 | .child(lane.label()) |
| 366 | 381 | .child(div().flex_none().w(px(4.)).h(px(4.)).rounded(px(2.)).bg(rgb(dot))), |
| @@ -462,7 +477,10 @@ pub(crate) fn render(player: &mut Player, box_h: f32, cx: &mut Context<Player>) | ||
| 462 | 477 | .child(div().w(px(1.)).h(px(4.)).bg(rgb(INK3()))) |
| 463 | 478 | .child( |
| 464 | 479 | div() |
| 465 | - .text_size(px(8.)) | |
| 480 | + .type_style(type_scale::mono( | |
| 481 | + type_scale::FLOOR_PX, | |
| 482 | + gpui::FontWeight::MEDIUM, | |
| 483 | + )) | |
| 466 | 484 | .text_color(rgb(INK3())) |
| 467 | 485 | .child(label), |
| 468 | 486 | ), |
| @@ -492,7 +510,10 @@ pub(crate) fn render(player: &mut Player, box_h: f32, cx: &mut Context<Player>) | ||
| 492 | 510 | .items_center() |
| 493 | 511 | .px(px(4.)) |
| 494 | 512 | .bg(rgb(DARK_CANVAS())) |
| 495 | - .text_size(px(10.)) | |
| 513 | + .type_style(type_scale::mono( | |
| 514 | + type_scale::CHORD_METADATA_MAX_PX, | |
| 515 | + gpui::FontWeight::MEDIUM, | |
| 516 | + )) | |
| 496 | 517 | .text_color(rgb(INK1())) |
| 497 | 518 | .child(playhead_tc), |
| 498 | 519 | ), |
crates/app/src/ui/dock_stance.rsmodified+62 -34
| @@ -12,6 +12,8 @@ | ||
| 12 | 12 | //! [`clip_middle`]...), only the anatomy around them is new. |
| 13 | 13 | |
| 14 | 14 | use crate::*; |
| 15 | +use crate::ui::type_scale::{self, head, label, mono}; | |
| 16 | +use gpui::FontWeight; | |
| 15 | 17 | |
| 16 | 18 | /// Where the dock tab pick lives: one word beside the theme and the |
| 17 | 19 | /// keybindings (`ui::theme::config_path`/`save`/`load` is the exact pattern |
| @@ -73,7 +75,7 @@ impl DockSort { | ||
| 73 | 75 | /// hover instead of disappearing (§8). |
| 74 | 76 | fn ghost_verb( |
| 75 | 77 | id: &'static str, |
| 76 | - label: &'static str, | |
| 78 | + verb_label: &'static str, | |
| 77 | 79 | action: ActionId, |
| 78 | 80 | active: bool, |
| 79 | 81 | hint: &str, |
| @@ -88,6 +90,8 @@ fn ghost_verb( | ||
| 88 | 90 | } |
| 89 | 91 | .into(); |
| 90 | 92 | let on = enabled.yes(); |
| 93 | + let label_style = label(type_scale::LABEL_ROW_PX, FontWeight::MEDIUM); | |
| 94 | + let chord_style = mono(type_scale::CHORD_METADATA_MIN_PX, FontWeight::MEDIUM); | |
| 91 | 95 | div() |
| 92 | 96 | .id(id) |
| 93 | 97 | .flex_none() |
| @@ -98,7 +102,6 @@ fn ghost_verb( | ||
| 98 | 102 | .px(px(8.)) |
| 99 | 103 | .rounded(px(3.)) |
| 100 | 104 | .when(active, |d| d.bg(rgb(DARK_RAISED()))) |
| 101 | - .text_color(rgb(if active { INK1() } else { INK2() })) | |
| 102 | 105 | .tooltip(move |_, cx| cx.new(|_| Tip(say.clone())).into()) |
| 103 | 106 | .when(!on, |d| d.opacity(0.4).cursor_not_allowed()) |
| 104 | 107 | .when(on, |d| { |
| @@ -106,11 +109,18 @@ fn ghost_verb( | ||
| 106 | 109 | .hover(|s| s.bg(rgb(DARK_RAISED())).text_color(rgb(INK1()))) |
| 107 | 110 | .on_click(on_click) |
| 108 | 111 | }) |
| 109 | - .child(label) | |
| 112 | + .child( | |
| 113 | + div() | |
| 114 | + .font(label_style.font) | |
| 115 | + .text_size(label_style.size) | |
| 116 | + .text_color(rgb(if active { INK1() } else { INK2() })) | |
| 117 | + .child(verb_label), | |
| 118 | + ) | |
| 110 | 119 | .child( |
| 111 | 120 | div() |
| 112 | 121 | .flex_none() |
| 113 | - .text_size(px(9.5)) | |
| 122 | + .font(chord_style.font) | |
| 123 | + .text_size(chord_style.size) | |
| 114 | 124 | .text_color(rgb(if active { INK1() } else { INK3() })) |
| 115 | 125 | .child(key), |
| 116 | 126 | ) |
| @@ -124,7 +134,8 @@ fn ghost_verb( | ||
| 124 | 134 | /// DESIGN §11's frequency check puts a lift and a mark far ahead of a tab |
| 125 | 135 | /// switch -- wearing a chord this room does not answer to would be exactly |
| 126 | 136 | /// the lie DESIGN §4 forbids, so the letters go instead. |
| 127 | -fn dock_tab(id: &'static str, label: &'static str, active: bool, cx: &mut Context<Player>) -> impl IntoElement { | |
| 137 | +fn dock_tab(id: &'static str, label_text: &'static str, active: bool, cx: &mut Context<Player>) -> impl IntoElement { | |
| 138 | + let style = label(type_scale::LABEL_ROW_PX, FontWeight::MEDIUM); | |
| 128 | 139 | div() |
| 129 | 140 | .id(id) |
| 130 | 141 | .flex_1() |
| @@ -135,27 +146,28 @@ fn dock_tab(id: &'static str, label: &'static str, active: bool, cx: &mut Contex | ||
| 135 | 146 | .pt(px(6.)) |
| 136 | 147 | .pb(px(6.)) |
| 137 | 148 | .when(active, |d| d.border_t_1().border_color(rgb(INK1()))) |
| 138 | - .text_size(px(10.5)) | |
| 139 | - .text_color(rgb(if active { INK1() } else { INK3() })) | |
| 140 | 149 | .cursor_pointer() |
| 141 | 150 | .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| { |
| 142 | - this.dock_src_active = label == "SOURCES"; | |
| 151 | + this.dock_src_active = label_text == "SOURCES"; | |
| 143 | 152 | save(this.dock_src_active); |
| 144 | 153 | cx.notify(); |
| 145 | 154 | })) |
| 146 | 155 | .child( |
| 147 | 156 | div() |
| 148 | - .text_size(px(10.5)) | |
| 157 | + .font(style.font) | |
| 158 | + .text_size(style.size) | |
| 149 | 159 | .text_color(rgb(if active { INK1() } else { INK3() })) |
| 150 | - .child(label), | |
| 160 | + .child(label_text), | |
| 151 | 161 | ) |
| 152 | 162 | } |
| 153 | 163 | |
| 154 | 164 | /// A 9px uppercase Archivo section head, `ink3` (DESIGN §3). |
| 155 | 165 | fn section_head(text: impl Into<SharedString>) -> impl IntoElement { |
| 166 | + let style = head(); | |
| 156 | 167 | div() |
| 157 | 168 | .flex_none() |
| 158 | - .text_size(px(9.)) | |
| 169 | + .font(style.font) | |
| 170 | + .text_size(style.size) | |
| 159 | 171 | .text_color(rgb(INK3())) |
| 160 | 172 | .child(text.into()) |
| 161 | 173 | } |
| @@ -271,31 +283,37 @@ fn source_row(player: &Player, i: usize, row: &Row, placed: usize, picked: bool, | ||
| 271 | 283 | ) |
| 272 | 284 | }), |
| 273 | 285 | ) |
| 274 | - .child( | |
| 286 | + .child({ | |
| 287 | + let style = mono(type_scale::LABEL_ROW_PX, FontWeight::MEDIUM); | |
| 275 | 288 | div() |
| 276 | 289 | .flex_1() |
| 277 | 290 | .min_w(px(0.)) |
| 278 | 291 | .truncate() |
| 279 | - .text_size(px(10.5)) | |
| 292 | + .font(style.font) | |
| 293 | + .text_size(style.size) | |
| 280 | 294 | .text_color(rgb(INK1())) |
| 281 | - .child(name), | |
| 282 | - ) | |
| 283 | - .child( | |
| 295 | + .child(name) | |
| 296 | + }) | |
| 297 | + .child({ | |
| 298 | + let style = mono(type_scale::CHORD_METADATA_MIN_PX, FontWeight::MEDIUM); | |
| 284 | 299 | div() |
| 285 | 300 | .flex_none() |
| 286 | - .text_size(px(9.5)) | |
| 301 | + .font(style.font) | |
| 302 | + .text_size(style.size) | |
| 287 | 303 | .text_color(rgb(INK3())) |
| 288 | - .child(usage), | |
| 289 | - ), | |
| 304 | + .child(usage) | |
| 305 | + }), | |
| 290 | 306 | ) |
| 291 | - .child( | |
| 307 | + .child({ | |
| 308 | + let style = mono(type_scale::CHORD_METADATA_MIN_PX, FontWeight::MEDIUM); | |
| 292 | 309 | div() |
| 293 | 310 | .pl(px(14.)) |
| 294 | 311 | .truncate() |
| 295 | - .text_size(px(9.5)) | |
| 312 | + .font(style.font) | |
| 313 | + .text_size(style.size) | |
| 296 | 314 | .text_color(rgb(INK3())) |
| 297 | - .child(under), | |
| 298 | - ) | |
| 315 | + .child(under) | |
| 316 | + }) | |
| 299 | 317 | } |
| 300 | 318 | |
| 301 | 319 | /// The Sources tab, built off MOCK-SPEC.md's "Dock" section: count line, |
| @@ -345,12 +363,14 @@ fn sources_tab(player: &Player, cx: &mut Context<Player>) -> impl IntoElement { | ||
| 345 | 363 | .p(px(8.)) |
| 346 | 364 | .overflow_y_scroll() |
| 347 | 365 | .child(section_head(format!("SOURCES · {total} · {unused_count} UNUSED"))) |
| 348 | - .child( | |
| 366 | + .child({ | |
| 367 | + let style = mono(type_scale::CHORD_METADATA_MAX_PX, FontWeight::MEDIUM); | |
| 349 | 368 | div() |
| 350 | 369 | .id("dock-filter") |
| 351 | 370 | .flex_none() |
| 352 | 371 | .cursor_text() |
| 353 | - .text_size(px(10.)) | |
| 372 | + .font(style.font) | |
| 373 | + .text_size(style.size) | |
| 354 | 374 | .text_color(rgb(if player.dock_filter_edit { INK1() } else { INK3() })) |
| 355 | 375 | .on_click(cx.listener(|this, _: &ClickEvent, _, cx| { |
| 356 | 376 | this.dock_filter_edit = true; |
| @@ -359,8 +379,8 @@ fn sources_tab(player: &Player, cx: &mut Context<Player>) -> impl IntoElement { | ||
| 359 | 379 | .child(match player.dock_filter.is_empty() { |
| 360 | 380 | true => "⌕ type to filter — name, codec, unused…".to_string(), |
| 361 | 381 | false => format!("⌕ {filter_text}"), |
| 362 | - }), | |
| 363 | - ) | |
| 382 | + }) | |
| 383 | + }) | |
| 364 | 384 | .child( |
| 365 | 385 | div() |
| 366 | 386 | .flex_none() |
| @@ -368,13 +388,15 @@ fn sources_tab(player: &Player, cx: &mut Context<Player>) -> impl IntoElement { | ||
| 368 | 388 | .gap(px(4.)) |
| 369 | 389 | .children(DockSort::ALL.map(|sort| { |
| 370 | 390 | let on = sort == player.dock_sort; |
| 391 | + let style = label(9.5, FontWeight::MEDIUM); | |
| 371 | 392 | div() |
| 372 | 393 | .id(("dock-sort", sort as usize)) |
| 373 | 394 | .flex_none() |
| 374 | 395 | .px(px(6.)) |
| 375 | 396 | .py(px(2.)) |
| 376 | 397 | .rounded(px(3.)) |
| 377 | - .text_size(px(9.5)) | |
| 398 | + .font(style.font) | |
| 399 | + .text_size(style.size) | |
| 378 | 400 | .when(on, |d| d.bg(rgb(DARK_RAISED())).text_color(rgb(INK1()))) |
| 379 | 401 | .when(!on, |d| d.text_color(rgb(INK3()))) |
| 380 | 402 | .cursor_pointer() |
| @@ -396,9 +418,11 @@ fn sources_tab(player: &Player, cx: &mut Context<Player>) -> impl IntoElement { | ||
| 396 | 418 | .gap(px(2.)) |
| 397 | 419 | .overflow_y_scroll() |
| 398 | 420 | .when(rows.is_empty(), |d| { |
| 421 | + let style = label(type_scale::LABEL_ROW_PX, FontWeight::MEDIUM); | |
| 399 | 422 | d.child( |
| 400 | 423 | div() |
| 401 | - .text_size(px(10.5)) | |
| 424 | + .font(style.font) | |
| 425 | + .text_size(style.size) | |
| 402 | 426 | .text_color(rgb(INK3())) |
| 403 | 427 | .child(match player.dock_filter.is_empty() { |
| 404 | 428 | true => "No sources yet — Add files, or drop one on the window".to_string(), |
| @@ -443,16 +467,18 @@ fn sources_tab(player: &Player, cx: &mut Context<Player>) -> impl IntoElement { | ||
| 443 | 467 | cx.listener(|this, _: &ClickEvent, _, cx| this.paste_file_path(cx)), |
| 444 | 468 | )), |
| 445 | 469 | ) |
| 446 | - .child( | |
| 470 | + .child({ | |
| 471 | + let style = mono(9., FontWeight::MEDIUM); | |
| 447 | 472 | div() |
| 448 | 473 | .flex_none() |
| 449 | - .text_size(px(9.)) | |
| 474 | + .font(style.font) | |
| 475 | + .text_size(style.size) | |
| 450 | 476 | .text_color(rgb(INK3())) |
| 451 | 477 | .child( |
| 452 | 478 | "drag a row to a lane · ↵ add at playhead · double-click plays in screen · \ |
| 453 | 479 | right-click the dot to re-ink a source (rare — lives out of the way)", |
| 454 | - ), | |
| 455 | - ) | |
| 480 | + ) | |
| 481 | + }) | |
| 456 | 482 | } |
| 457 | 483 | |
| 458 | 484 | /// The Clip tab: the four verbs DESIGN §5 names, as ghosts, over whichever |
| @@ -534,12 +560,14 @@ fn clip_tab(player: &Player, width: f32, window_h: Pixels, cx: &mut Context<Play | ||
| 534 | 560 | // A plate, not bare space: DESIGN §11's "states" checklist -- |
| 535 | 561 | // nothing picked reads as a hint, not as a hole in the panel. |
| 536 | 562 | .when(none_open, |d| { |
| 563 | + let style = label(type_scale::LABEL_ROW_PX, FontWeight::MEDIUM); | |
| 537 | 564 | d.child( |
| 538 | 565 | div() |
| 539 | 566 | .rounded(px(2.)) |
| 540 | 567 | .bg(rgb(DARK_CANVAS())) |
| 541 | 568 | .p(px(8.)) |
| 542 | - .text_size(px(10.5)) | |
| 569 | + .font(style.font) | |
| 570 | + .text_size(style.size) | |
| 543 | 571 | .text_color(rgb(INK3())) |
| 544 | 572 | .child("pick a verb above"), |
| 545 | 573 | ) |
crates/app/src/ui/spine_stance.rsmodified+31 -23
| @@ -3,29 +3,26 @@ | ||
| 3 | 3 | //! not the flat ungrouped list of glyph-beside-chord rows the shipped room |
| 4 | 4 | //! drew. `stance.rs::spine()` keeps the panel frame (width, surface, |
| 5 | 5 | //! border); this module owns the rows inside it. |
| 6 | -//! | |
| 7 | -//! corner-cut: sizes below are plain `px()` literals matching DESIGN §3's | |
| 8 | -//! scale (13px glyph, 9.5px chord, 9px head) rather than calls into a | |
| 9 | -//! `ui::type_scale` API -- that module had not landed in this tree at the | |
| 10 | -//! time this was written. Ceiling: swap these three constants for its | |
| 11 | -//! tokens once it lands; nothing else here would change. | |
| 12 | 6 | |
| 13 | 7 | use crate::*; |
| 8 | +use crate::ui::type_scale::{self, Typeset}; | |
| 14 | 9 | |
| 10 | +/// The glyph icon itself: DESIGN §3 names no separate role for it, so this | |
| 11 | +/// keeps the size the module has always drawn it at (13px, the same number | |
| 12 | +/// as the hero timecode by coincidence, not by role) and routes only the | |
| 13 | +/// font family through [`type_scale`] (Archivo -- the glyph is a verb, the | |
| 14 | +/// room's voice, not something the film says). | |
| 15 | 15 | const GLYPH_SIZE: f32 = 13.; |
| 16 | -const CHORD_SIZE: f32 = 9.5; | |
| 17 | -const HEAD_SIZE: f32 = 9.; | |
| 18 | 16 | |
| 19 | -/// A group head: 9px uppercase Archivo 700(-weight token, same as every | |
| 20 | -/// other section head in the stance) in `ink3`, +0.14em tracking (DESIGN | |
| 21 | -/// §3) -- reused as its own small fn rather than `stance::section_head` | |
| 17 | +/// A group head: 9px uppercase Archivo 700 in `ink3`, +0.14em tracking | |
| 18 | +/// (DESIGN §3) -- reused as its own small fn rather than `stance::section_head` | |
| 22 | 19 | /// because that one is private to its module and carries a different |
| 23 | 20 | /// vertical rhythm (a region label, not a spine group head). |
| 24 | 21 | fn group_head(label: &str) -> impl IntoElement { |
| 25 | 22 | div() |
| 26 | 23 | .flex_none() |
| 27 | - .pt(px(6.)) | |
| 28 | - .text_size(px(HEAD_SIZE)) | |
| 24 | + .pt(px(10.)) | |
| 25 | + .type_style(type_scale::head()) | |
| 29 | 26 | .text_color(rgb(INK3())) |
| 30 | 27 | .child(label.to_uppercase()) |
| 31 | 28 | } |
| @@ -46,12 +43,17 @@ fn glyph( | ||
| 46 | 43 | cx: &mut Context<Player>, |
| 47 | 44 | ) -> impl IntoElement + use<> { |
| 48 | 45 | let enabled = player.enable(action, None); |
| 49 | - let key = player.keymap.display(action); | |
| 46 | + // The badge shows the primary chord only (FAULT 1: a chord badge is a | |
| 47 | + // compact token, not a sentence); the tooltip keeps every stroke an | |
| 48 | + // action answers to, and the keys overlay ([`crate::ui::stance`]) is | |
| 49 | + // still where the full truth lives. | |
| 50 | + let full = player.keymap.display(action); | |
| 50 | 51 | let say: SharedString = match enabled.why() { |
| 51 | - Some(why) => format!("{key} — {why}"), | |
| 52 | - None => format!("{key} — {}", action.label()), | |
| 52 | + Some(why) => format!("{full} — {why}"), | |
| 53 | + None => format!("{full} — {}", action.label()), | |
| 53 | 54 | } |
| 54 | 55 | .into(); |
| 56 | + let compact = player.keymap.chord(action); | |
| 55 | 57 | let on = enabled.yes(); |
| 56 | 58 | div() |
| 57 | 59 | .id(id) |
| @@ -59,9 +61,9 @@ fn glyph( | ||
| 59 | 61 | .flex() |
| 60 | 62 | .flex_col() |
| 61 | 63 | .items_center() |
| 62 | - .gap(px(2.)) | |
| 64 | + .gap(px(1.)) | |
| 63 | 65 | .px(px(4.)) |
| 64 | - .py(px(4.)) | |
| 66 | + .py(px(2.)) | |
| 65 | 67 | .rounded(px(3.)) |
| 66 | 68 | .when(active, |d| d.bg(rgb(DARK_RAISED()))) |
| 67 | 69 | .tooltip(move |_, cx| cx.new(|_| Tip(say.clone())).into()) |
| @@ -75,15 +77,18 @@ fn glyph( | ||
| 75 | 77 | }) |
| 76 | 78 | .child( |
| 77 | 79 | div() |
| 78 | - .text_size(px(GLYPH_SIZE)) | |
| 80 | + .type_style(type_scale::label(GLYPH_SIZE, gpui::FontWeight::MEDIUM)) | |
| 79 | 81 | .text_color(rgb(if active { INK1() } else { INK2() })) |
| 80 | 82 | .child(glyph), |
| 81 | 83 | ) |
| 82 | 84 | .child( |
| 83 | 85 | div() |
| 84 | - .text_size(px(CHORD_SIZE)) | |
| 86 | + .type_style(type_scale::mono( | |
| 87 | + type_scale::CHORD_METADATA_MIN_PX, | |
| 88 | + gpui::FontWeight::MEDIUM, | |
| 89 | + )) | |
| 85 | 90 | .text_color(rgb(INK3())) |
| 86 | - .child(key), | |
| 91 | + .child(compact), | |
| 87 | 92 | ) |
| 88 | 93 | } |
| 89 | 94 | |
| @@ -96,7 +101,7 @@ fn pair(left: impl IntoElement, right: impl IntoElement) -> impl IntoElement { | ||
| 96 | 101 | .flex() |
| 97 | 102 | .items_center() |
| 98 | 103 | .justify_center() |
| 99 | - .gap(px(10.)) | |
| 104 | + .gap(px(6.)) | |
| 100 | 105 | .child(left) |
| 101 | 106 | .child(right) |
| 102 | 107 | } |
| @@ -123,7 +128,10 @@ pub(crate) fn render(player: &Player, cx: &mut Context<Player>) -> impl IntoElem | ||
| 123 | 128 | .flex() |
| 124 | 129 | .flex_col() |
| 125 | 130 | .items_center() |
| 126 | - .gap(px(10.)) | |
| 131 | + // FAULT 2: rows close under their group head, real space (the group | |
| 132 | + // head's own `pt`) only between one group and the next -- not one | |
| 133 | + // uniform gap stretching every row down the window. | |
| 134 | + .gap(px(2.)) | |
| 127 | 135 | .overflow_y_scroll() |
| 128 | 136 | .child(group_head("edit")) |
| 129 | 137 | .child(glyph("spine-split", "||", ActionId::Cut, false, player, cx)) |
crates/app/src/ui/stance.rsmodified+86 -16
| @@ -13,6 +13,7 @@ use crate::ui::bench_stance; | ||
| 13 | 13 | use crate::ui::dock_stance; |
| 14 | 14 | use crate::ui::timeband_stance; |
| 15 | 15 | use crate::ui::spine_stance; |
| 16 | +use crate::ui::type_scale::{self, Typeset}; | |
| 16 | 17 | |
| 17 | 18 | /// Left rail, full height (DESIGN §5). |
| 18 | 19 | const SPINE_W: f32 = 56.; |
| @@ -35,7 +36,7 @@ const DOCK_W: f32 = 280.; | ||
| 35 | 36 | fn section_head(label: &str) -> impl IntoElement { |
| 36 | 37 | div() |
| 37 | 38 | .flex_none() |
| 38 | - .text_size(px(9.)) | |
| 39 | + .type_style(type_scale::head()) | |
| 39 | 40 | .text_color(rgb(INK3())) |
| 40 | 41 | .child(label.to_uppercase()) |
| 41 | 42 | } |
| @@ -52,14 +53,19 @@ fn ghost(player: &Player, glyph: &str, action: ActionId) -> impl IntoElement { | ||
| 52 | 53 | .gap(px(2.)) |
| 53 | 54 | .py(px(6.)) |
| 54 | 55 | .rounded(px(3.)) |
| 55 | - .text_size(px(13.)) | |
| 56 | + .type_style(type_scale::label(13., gpui::FontWeight::MEDIUM)) | |
| 56 | 57 | .text_color(rgb(INK2())) |
| 57 | 58 | .child(glyph.to_string()) |
| 58 | 59 | .child( |
| 59 | 60 | div() |
| 60 | - .text_size(px(9.5)) | |
| 61 | + .type_style(type_scale::mono( | |
| 62 | + type_scale::CHORD_METADATA_MIN_PX, | |
| 63 | + gpui::FontWeight::MEDIUM, | |
| 64 | + )) | |
| 61 | 65 | .text_color(rgb(INK3())) |
| 62 | - .child(player.keymap.display(action)), | |
| 66 | + // FAULT 1: the badge shows the primary chord, compact -- | |
| 67 | + // same rule as every glyph in `spine_stance`. | |
| 68 | + .child(player.keymap.chord(action)), | |
| 63 | 69 | ) |
| 64 | 70 | } |
| 65 | 71 | |
| @@ -112,7 +118,7 @@ fn keys_overlay(player: &Player) -> impl IntoElement { | ||
| 112 | 118 | KeyRow::Head(category) => div() |
| 113 | 119 | .flex_none() |
| 114 | 120 | .pt(px(4.)) |
| 115 | - .text_size(px(9.)) | |
| 121 | + .type_style(type_scale::head()) | |
| 116 | 122 | .text_color(rgb(INK3())) |
| 117 | 123 | .child(category.label().to_uppercase()) |
| 118 | 124 | .into_any_element(), |
| @@ -120,9 +126,27 @@ fn keys_overlay(player: &Player) -> impl IntoElement { | ||
| 120 | 126 | .flex() |
| 121 | 127 | .justify_between() |
| 122 | 128 | .gap(px(12.)) |
| 123 | - .text_size(px(9.5)) | |
| 124 | - .child(div().text_color(rgb(INK2())).child(action.label())) | |
| 125 | - .child(div().text_color(rgb(INK3())).child(player.keymap.display(action))) | |
| 129 | + .child( | |
| 130 | + div() | |
| 131 | + .type_style(type_scale::label( | |
| 132 | + type_scale::CHORD_METADATA_MIN_PX, | |
| 133 | + gpui::FontWeight::MEDIUM, | |
| 134 | + )) | |
| 135 | + .text_color(rgb(INK2())) | |
| 136 | + .child(action.label()), | |
| 137 | + ) | |
| 138 | + .child( | |
| 139 | + div() | |
| 140 | + .type_style(type_scale::mono( | |
| 141 | + type_scale::CHORD_METADATA_MIN_PX, | |
| 142 | + gpui::FontWeight::MEDIUM, | |
| 143 | + )) | |
| 144 | + .text_color(rgb(INK3())) | |
| 145 | + // The keys overlay is the full-truth surface | |
| 146 | + // (FAULT 1): every chord an action answers to, | |
| 147 | + // not the badge's primary-only compact form. | |
| 148 | + .child(player.keymap.display(action)), | |
| 149 | + ) | |
| 126 | 150 | .into_any_element(), |
| 127 | 151 | KeyRow::Fixed(i) => { |
| 128 | 152 | let f = &keymap::FIXED[i]; |
| @@ -130,9 +154,24 @@ fn keys_overlay(player: &Player) -> impl IntoElement { | ||
| 130 | 154 | .flex() |
| 131 | 155 | .justify_between() |
| 132 | 156 | .gap(px(12.)) |
| 133 | - .text_size(px(9.5)) | |
| 134 | - .child(div().text_color(rgb(INK2())).child(f.label)) | |
| 135 | - .child(div().text_color(rgb(INK3())).child(f.chord.clone())) | |
| 157 | + .child( | |
| 158 | + div() | |
| 159 | + .type_style(type_scale::label( | |
| 160 | + type_scale::CHORD_METADATA_MIN_PX, | |
| 161 | + gpui::FontWeight::MEDIUM, | |
| 162 | + )) | |
| 163 | + .text_color(rgb(INK2())) | |
| 164 | + .child(f.label), | |
| 165 | + ) | |
| 166 | + .child( | |
| 167 | + div() | |
| 168 | + .type_style(type_scale::mono( | |
| 169 | + type_scale::CHORD_METADATA_MIN_PX, | |
| 170 | + gpui::FontWeight::MEDIUM, | |
| 171 | + )) | |
| 172 | + .text_color(rgb(INK3())) | |
| 173 | + .child(f.chord.clone()), | |
| 174 | + ) | |
| 136 | 175 | .into_any_element() |
| 137 | 176 | } |
| 138 | 177 | })), |
| @@ -278,7 +317,7 @@ fn notice_plate(message: SharedString) -> impl IntoElement { | ||
| 278 | 317 | // shape as the legacy notice bar's own tone stripe (`notice_bar`). |
| 279 | 318 | .border_l(px(3.)) |
| 280 | 319 | .border_color(rgb(notice_severity(&message))) |
| 281 | - .text_size(px(10.)) | |
| 320 | + .type_style(type_scale::label(10., gpui::FontWeight::MEDIUM)) | |
| 282 | 321 | .text_color(rgb(INK1())) |
| 283 | 322 | .child(message) |
| 284 | 323 | } |
| @@ -308,18 +347,49 @@ fn ledger(player: &Player, position: f64) -> impl IntoElement { | ||
| 308 | 347 | .gap(px(14.)) |
| 309 | 348 | .px(px(12.)) |
| 310 | 349 | .child(section_head("ledger")) |
| 311 | - .child(div().text_size(px(9.5)).text_color(rgb(INK1())).child(identity)) | |
| 350 | + // MOCK-SPEC.md "Ledger": "All mono" -- project identity, last | |
| 351 | + // action, export progress and position are all what the film/project | |
| 352 | + // says, not the room's own voice. | |
| 353 | + .child( | |
| 354 | + div() | |
| 355 | + .type_style(type_scale::mono( | |
| 356 | + type_scale::CHORD_METADATA_MIN_PX, | |
| 357 | + gpui::FontWeight::MEDIUM, | |
| 358 | + )) | |
| 359 | + .text_color(rgb(INK1())) | |
| 360 | + .child(identity), | |
| 361 | + ) | |
| 312 | 362 | .child( |
| 313 | 363 | div() |
| 314 | 364 | .flex_1() |
| 315 | 365 | .min_w(px(0.)) |
| 316 | 366 | .truncate() |
| 317 | - .text_size(px(9.5)) | |
| 367 | + .type_style(type_scale::mono( | |
| 368 | + type_scale::CHORD_METADATA_MIN_PX, | |
| 369 | + gpui::FontWeight::MEDIUM, | |
| 370 | + )) | |
| 318 | 371 | .text_color(rgb(INK3())) |
| 319 | 372 | .child(last_action), |
| 320 | 373 | ) |
| 321 | - .children(export.map(|e| div().text_size(px(9.5)).text_color(rgb(INK2())).child(e))) | |
| 322 | - .child(div().flex_none().text_size(px(9.5)).text_color(rgb(INK2())).child(tc)) | |
| 374 | + .children(export.map(|e| { | |
| 375 | + div() | |
| 376 | + .type_style(type_scale::mono( | |
| 377 | + type_scale::CHORD_METADATA_MIN_PX, | |
| 378 | + gpui::FontWeight::MEDIUM, | |
| 379 | + )) | |
| 380 | + .text_color(rgb(INK2())) | |
| 381 | + .child(e) | |
| 382 | + })) | |
| 383 | + .child( | |
| 384 | + div() | |
| 385 | + .flex_none() | |
| 386 | + .type_style(type_scale::mono( | |
| 387 | + type_scale::CHORD_METADATA_MIN_PX, | |
| 388 | + gpui::FontWeight::MEDIUM, | |
| 389 | + )) | |
| 390 | + .text_color(rgb(INK2())) | |
| 391 | + .child(tc), | |
| 392 | + ) | |
| 323 | 393 | } |
| 324 | 394 | |
| 325 | 395 | /// The dock: the only side panel, right, fixed width, carrying the Src/Clip |
crates/app/src/ui/timeband_stance.rsmodified+44 -13
| @@ -8,9 +8,12 @@ | ||
| 8 | 8 | //! (MOCK-SPEC.md) reads closer to ~20px. Kept at 13px here -- the binding |
| 9 | 9 | //! contract's own number, already what `stance.rs::time_band()` shipped -- |
| 10 | 10 | //! rather than silently picking the mock's, and named here per this task's |
| 11 | -//! own instruction to say so when the two disagree. | |
| 11 | +//! own instruction to say so when the two disagree. Every size in this | |
| 12 | +//! module now comes from `ui::type_scale` (role, not a bare `px()` literal). | |
| 12 | 13 | |
| 13 | 14 | use crate::*; |
| 15 | +use crate::ui::type_scale::{self, label, mono}; | |
| 16 | +use gpui::FontWeight; | |
| 14 | 17 | |
| 15 | 18 | thread_local! { |
| 16 | 19 | // corner-cut: every other drag surface in this codebase (the bench |
| @@ -30,18 +33,24 @@ thread_local! { | ||
| 30 | 33 | /// fires it -- the same shape `stance::ghost` draws for the spine, kept local |
| 31 | 34 | /// here so this module owns its own region end to end. |
| 32 | 35 | fn ghost(player: &Player, glyph: &str, action: ActionId) -> impl IntoElement { |
| 36 | + let glyph_style = label(type_scale::HERO_TIMECODE_PX, FontWeight::MEDIUM); | |
| 37 | + // The chord names a key, so DESIGN §3's mono rule ("if a string is about | |
| 38 | + // ... a key, it is mono") applies here same as everywhere else in the band. | |
| 39 | + let chord_style = mono(type_scale::CHORD_METADATA_MIN_PX, FontWeight::MEDIUM); | |
| 33 | 40 | div() |
| 34 | 41 | .flex_none() |
| 35 | 42 | .flex() |
| 36 | 43 | .flex_col() |
| 37 | 44 | .items_center() |
| 38 | 45 | .gap(px(1.)) |
| 39 | - .text_size(px(13.)) | |
| 46 | + .font(glyph_style.font) | |
| 47 | + .text_size(glyph_style.size) | |
| 40 | 48 | .text_color(rgb(INK2())) |
| 41 | 49 | .child(glyph.to_string()) |
| 42 | 50 | .child( |
| 43 | 51 | div() |
| 44 | - .text_size(px(9.)) | |
| 52 | + .font(chord_style.font) | |
| 53 | + .text_size(chord_style.size) | |
| 45 | 54 | .text_color(rgb(INK3())) |
| 46 | 55 | .child(player.keymap.display(action)), |
| 47 | 56 | ) |
| @@ -52,10 +61,12 @@ fn ghost(player: &Player, glyph: &str, action: ActionId) -> impl IntoElement { | ||
| 52 | 61 | /// rather than painted whole, so the colons can read a shade quieter than |
| 53 | 62 | /// the numbers either side of them. |
| 54 | 63 | fn hero_timecode(tc: &str) -> impl IntoElement { |
| 64 | + let style = mono(type_scale::HERO_TIMECODE_PX, FontWeight::BOLD); | |
| 55 | 65 | div() |
| 56 | 66 | .flex_none() |
| 57 | 67 | .flex() |
| 58 | - .text_size(px(13.)) | |
| 68 | + .font(style.font) | |
| 69 | + .text_size(style.size) | |
| 59 | 70 | .children(tc.chars().map(|c| { |
| 60 | 71 | let ink = if c == ':' { INK3() } else { INK1() }; |
| 61 | 72 | div().text_color(rgb(ink)).child(c.to_string()) |
| @@ -99,6 +110,7 @@ fn cut_readout(player: &Player) -> impl IntoElement { | ||
| 99 | 110 | )) |
| 100 | 111 | }); |
| 101 | 112 | let roll_on = player.loop_trim.is_some(); |
| 113 | + let style = mono(type_scale::CHORD_METADATA_MAX_PX, FontWeight::MEDIUM); | |
| 102 | 114 | div() |
| 103 | 115 | .id("stance-cut-readout") |
| 104 | 116 | .flex_none() |
| @@ -108,7 +120,8 @@ fn cut_readout(player: &Player) -> impl IntoElement { | ||
| 108 | 120 | .py(px(4.)) |
| 109 | 121 | .rounded(px(2.)) |
| 110 | 122 | .bg(rgb(DARK_CANVAS())) |
| 111 | - .text_size(px(10.5)) | |
| 123 | + .font(style.font) | |
| 124 | + .text_size(style.size) | |
| 112 | 125 | .child(val(odometer)) |
| 113 | 126 | .when_some(deltas, |el, (in_d, out_d)| { |
| 114 | 127 | el.child(sep()) |
| @@ -278,16 +291,20 @@ fn contact_strip(player: &Player, cx: &mut Context<Player>) -> impl IntoElement | ||
| 278 | 291 | /// by [`super::stance::render`] the same way the keys overlay is. |
| 279 | 292 | fn export_chip(player: &Player, cx: &mut Context<Player>) -> impl IntoElement { |
| 280 | 293 | let exporting = player.exporting().is_some(); |
| 294 | + let label_style = label(type_scale::LABEL_ROW_PX, FontWeight::MEDIUM); | |
| 295 | + let chord_style = mono(type_scale::CHORD_METADATA_MIN_PX, FontWeight::MEDIUM); | |
| 281 | 296 | div() |
| 282 | 297 | .id("stance-export") |
| 283 | 298 | .flex_none() |
| 299 | + .flex() | |
| 300 | + .items_center() | |
| 301 | + .gap(px(6.)) | |
| 284 | 302 | .px(px(10.)) |
| 285 | 303 | .py(px(6.)) |
| 286 | 304 | .rounded(px(3.)) |
| 287 | 305 | .border_1() |
| 288 | 306 | .border_color(rgb(DARK_HAIRLINE())) |
| 289 | 307 | .bg(rgb(DARK_RAISED())) |
| 290 | - .text_size(px(10.5)) | |
| 291 | 308 | .text_color(rgb(INK1())) |
| 292 | 309 | .cursor_pointer() |
| 293 | 310 | .hover(|s| s.bg(rgb(DARK_PANEL()))) |
| @@ -299,11 +316,19 @@ fn export_chip(player: &Player, cx: &mut Context<Player>) -> impl IntoElement { | ||
| 299 | 316 | } |
| 300 | 317 | cx.notify(); |
| 301 | 318 | })) |
| 302 | - .child(format!( | |
| 303 | - "{} {}", | |
| 304 | - if exporting { "Exporting" } else { "Export" }, | |
| 305 | - player.keymap.display(ActionId::Export) | |
| 306 | - )) | |
| 319 | + .child( | |
| 320 | + div() | |
| 321 | + .font(label_style.font) | |
| 322 | + .text_size(label_style.size) | |
| 323 | + .child(if exporting { "Exporting" } else { "Export" }), | |
| 324 | + ) | |
| 325 | + .child( | |
| 326 | + div() | |
| 327 | + .font(chord_style.font) | |
| 328 | + .text_size(chord_style.size) | |
| 329 | + .text_color(rgb(INK3())) | |
| 330 | + .child(player.keymap.display(ActionId::Export)), | |
| 331 | + ) | |
| 307 | 332 | } |
| 308 | 333 | |
| 309 | 334 | /// The whole band, left to right per MOCK-SPEC: hero timecode, ghost |
| @@ -312,8 +337,14 @@ fn export_chip(player: &Player, cx: &mut Context<Player>) -> impl IntoElement { | ||
| 312 | 337 | pub(crate) fn render(player: &mut Player, position: f64, cx: &mut Context<Player>) -> impl IntoElement { |
| 313 | 338 | let tc = timecode(position, player.active_fps()); |
| 314 | 339 | div() |
| 315 | - .id("stance-time-band") | |
| 316 | - .flex_none() | |
| 340 | + .id("stance-time-band-row") | |
| 341 | + // FAULT 1 fix: this div used to be `flex_none`, which sized it to its | |
| 342 | + // own content inside `stance.rs::time_band()`'s row -- leaving the | |
| 343 | + // contact strip's `flex_1` nothing to grow into (its "free space" was | |
| 344 | + // zero, since the parent itself never claimed the band's full width). | |
| 345 | + // `flex_1` here is what actually lets the strip fill the band. | |
| 346 | + .flex_1() | |
| 347 | + .min_w(px(0.)) | |
| 317 | 348 | .h_full() |
| 318 | 349 | .flex() |
| 319 | 350 | .items_center() |
crates/app/src/ui/type_scale.rsmodified+13 -1
| @@ -27,7 +27,7 @@ | ||
| 27 | 27 | // crate's only caller of the public API is `main.rs`'s `register`. |
| 28 | 28 | #![allow(dead_code)] |
| 29 | 29 | |
| 30 | -use gpui::{App, Font, FontFeatures, FontWeight, Pixels, SharedString, font, px}; | |
| 30 | +use gpui::{App, Font, FontFeatures, FontWeight, Pixels, SharedString, Styled, font, px}; | |
| 31 | 31 | use std::borrow::Cow; |
| 32 | 32 | |
| 33 | 33 | /// Archivo: labels, verbs, section heads. |
| @@ -113,6 +113,18 @@ pub fn head() -> TypeStyle { | ||
| 113 | 113 | label(SECTION_HEAD_PX, FontWeight::BOLD) |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | +/// Applies a [`TypeStyle`] to any styled element in one call -- | |
| 117 | +/// `div().type_style(mono(9.5, FontWeight::MEDIUM))` instead of the | |
| 118 | +/// `.font(style.font).text_size(style.size)` pair spelled out at every call | |
| 119 | +/// site. Blanket-implemented over `Styled` so every element in the room gets | |
| 120 | +/// it for free. | |
| 121 | +pub trait Typeset: Styled + Sized { | |
| 122 | + fn type_style(self, style: TypeStyle) -> Self { | |
| 123 | + self.font(style.font).text_size(style.size) | |
| 124 | + } | |
| 125 | +} | |
| 126 | +impl<T: Styled> Typeset for T {} | |
| 127 | + | |
| 116 | 128 | /// One face's worth of TTFs to embed, `(bytes, name)` for the doc comment |
| 117 | 129 | /// above `register` to explain if a load ever fails. |
| 118 | 130 | const EMBEDDED: &[(&[u8], &str)] = &[ |