bundle Josefin Sans as the default UI face at weight 300

Vendor the JosefinSans variable font (upright + italic, weight range
100-700), OFL licensed. _AppRoot installs it as the ambient
DefaultTextStyle at weight w300 (Light); ClideText inherits rather
than re-specifying the family, so Alchemist's Ahem injection keeps
goldens deterministic per D-024 while production renders the
intended face.

typography.dart gains clideUiFamily + clideUiFamilyFallback
alongside the existing mono constants; .gitignore learns about
Alchemist's failures/ diff output dir so local re-runs don't leak
into `git status`.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-04-22 08:18:15 +02:00
co-authored by Claude
parent 7bdeb9ab24
commit c1ad33f1b0
8 changed files with 172 additions and 21 deletions
+15 -4
View File
@@ -1,14 +1,22 @@
import 'package:clide_app/kernel/src/theme/controller.dart';
import 'package:clide_app/widgets/src/typography.dart';
import 'package:flutter/widgets.dart';
/// Theme-aware Text. Defaults pull from the global foreground token.
/// Theme-aware Text. Defaults pull from the global foreground token
/// and [clideUiDefaultWeight].
///
/// The UI font family is deliberately **not** set on this widget — it
/// inherits from the ambient `DefaultTextStyle` which `_AppRoot`
/// provides ([clideUiFamily] in real runs). Goldens rely on Alchemist
/// injecting Ahem for deterministic metrics; hard-coding a family here
/// would override that and break pixel determinism per D-024.
class ClideText extends StatelessWidget {
const ClideText(
this.data, {
super.key,
this.color,
this.fontSize = 13,
this.fontWeight = FontWeight.w400,
this.fontWeight,
this.muted = false,
this.maxLines,
this.overflow,
@@ -18,7 +26,7 @@ class ClideText extends StatelessWidget {
final String data;
final Color? color;
final double fontSize;
final FontWeight fontWeight;
final FontWeight? fontWeight;
final bool muted;
final int? maxLines;
final TextOverflow? overflow;
@@ -37,8 +45,11 @@ class ClideText extends StatelessWidget {
style: TextStyle(
color: resolved,
fontSize: fontSize,
// Null means inherit from the ambient DefaultTextStyle —
// _AppRoot installs clideUiDefaultWeight there; goldens get
// whatever Alchemist injects. Passing an explicit weight (e.g.
// FontWeight.bold) still wins.
fontWeight: fontWeight,
fontFamilyFallback: const ['Inter', 'Helvetica', 'Arial', 'sans-serif'],
),
);
}
+42 -7
View File
@@ -1,12 +1,48 @@
/// Typography constants shared across widgets.
///
/// Terminal panes, diff views, and any other monospace surface should
/// import from here rather than hardcoding a family. The fallback chain
/// exists for web builds + platforms where the bundled `JetBrainsMono`
/// Two bundled families:
///
/// - [clideUiFamily] — Josefin Sans, the application-wide UI face.
/// Shipped as a variable font (weights 100-700) + italic companion;
/// default weight is [clideUiDefaultWeight] (Light / `w300`).
/// - [clideMonoFamily] — JetBrains Mono, for terminal panes, diff
/// views, code editors, and any other monospace surface.
///
/// Fallback chains exist for web builds + harnesses where the bundled
/// asset isn't picked up (rare, but possible during `flutter test` if
/// assets aren't declared in the harness).
/// asset fonts aren't declared in the harness).
library;
import 'package:flutter/widgets.dart' show FontWeight;
// ---------------------------------------------------------------------------
// UI face — Josefin Sans
// ---------------------------------------------------------------------------
/// The bundled application UI family. Always resolved first.
const String clideUiFamily = 'JosefinSans';
/// Default weight for UI text. Josefin Sans reads well at Light; the
/// rest of the design adjusts contrast and size to stay legible.
const FontWeight clideUiDefaultWeight = FontWeight.w300;
/// System fallback chain for the UI face. Sans-serif humanist faces
/// that sit close to Josefin's proportions, ordered by platform.
const List<String> clideUiFamilyFallback = [
// User system install of Josefin, if any.
'Josefin Sans',
// Platform humanist sans defaults.
'Inter',
'Helvetica Neue',
'Helvetica',
'Arial',
'sans-serif',
];
// ---------------------------------------------------------------------------
// Monospace face — JetBrains Mono
// ---------------------------------------------------------------------------
/// The bundled monospace family. Always resolved first.
const String clideMonoFamily = 'JetBrainsMono';
@@ -17,9 +53,8 @@ const List<String> clideMonoFamilyFallback = [
'SF Mono',
'Menlo',
'Monaco',
// Linux
'JetBrains Mono', // if the user has it system-installed under the
// canonical PostScript name
// Linux — user system install under the canonical PostScript name
'JetBrains Mono',
'Fira Code',
'Hack',
'DejaVu Sans Mono',