feat(settings): Inter as default UI font + UI font picker (T-460)

Vendor Inter (variable + italic, OFL) under assets/fonts/inter/ and make it
the default application UI face, replacing Josefin Sans (which stays bundled
as a selectable option). pubspec font family + licenses.yaml entry per D-42.

Settings → Appearance gains a UI-font select (Inter / Josefin Sans). The root
DefaultTextStyle reads app.ui.font (kUiFontSettingKey) over the default and
re-applies live on settings change, so a pick takes effect immediately. Bump
the default UI weight to w400 — Inter reads better at Regular than Josefin's
Light.

The monospace picker is deferred to T-471: clideMonoFamily is a const at ~38
call sites (not inherited), so a live mono picker needs the family routed
through context first.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-17 20:15:01 +02:00
co-authored by Claude Opus 4.8
parent b1057b41c8
commit 21d435d1f1
12 changed files with 219 additions and 17 deletions
@@ -4,6 +4,7 @@ import 'package:clide/builtin/theme_picker/src/settings_view.dart';
import 'package:clide/builtin/theme_picker/src/theme_status_item.dart';
import 'package:clide/extension/extension.dart';
import 'package:clide/kernel/kernel.dart';
import 'package:clide/widgets/widgets.dart' show kUiFontSettingKey;
class ThemePickerExtension extends ClideExtension {
@override
@@ -55,6 +56,22 @@ class ThemePickerExtension extends ClideExtension {
),
],
),
SettingsSection(
label: 'Typography',
fields: [
SettingsField(
key: kUiFontSettingKey,
kind: SettingsFieldKind.select,
label: 'UI font',
help: 'Typeface for the app interface; applies live.',
defaultValue: 'Inter',
options: [
SettingsOption(value: 'Inter', label: 'Inter'),
SettingsOption(value: 'JosefinSans', label: 'Josefin Sans'),
],
),
],
),
],
),
),
+6 -1
View File
@@ -48,6 +48,8 @@ class RootShellState extends State<RootShell> {
super.initState();
_keyFocus = FocusNode()..requestFocus();
widget.services.textZoom.addListener(_onZoom);
// Re-apply the UI font when its setting changes (T-460).
widget.services.settings.addListener(_onZoom);
_globalSeq = SequenceMatcher(
keymap: () => widget.services.keymap.keymap ?? Keymap(const []),
context: () => widget.services.keymap.scope,
@@ -61,6 +63,7 @@ class RootShellState extends State<RootShell> {
HardwareKeyboard.instance.removeHandler(_onRawKey);
_seqTimeout?.cancel();
widget.services.textZoom.removeListener(_onZoom);
widget.services.settings.removeListener(_onZoom);
_menuBar.dispose();
_keyFocus.dispose();
super.dispose();
@@ -77,7 +80,9 @@ class RootShellState extends State<RootShell> {
fontSize: 15,
height: clideLineHeight,
fontWeight: clideUiDefaultWeight,
fontFamily: clideUiFamily,
// User-selected UI font (Settings → Appearance, T-460), else the
// bundled default. The fallback chain still covers a missing asset.
fontFamily: widget.services.settings.get<String>(kUiFontSettingKey) ?? clideUiFamily,
fontFamilyFallback: clideUiFamilyFallback,
),
child: MediaQuery(
+19 -14
View File
@@ -2,9 +2,9 @@
///
/// 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`).
/// - [clideUiFamily] — Inter, the application-wide UI face (T-460; was
/// Josefin Sans). Shipped as a variable font + italic companion. Users can
/// switch it from Settings → Appearance via the [kUiFontSettingKey] override.
/// - [clideMonoFamily] — JetBrains Mono, for terminal panes, diff
/// views, code editors, and any other monospace surface.
///
@@ -16,22 +16,22 @@ library;
import 'package:flutter/widgets.dart' show FontWeight;
// ---------------------------------------------------------------------------
// UI face — Josefin Sans
// UI face — Inter
// ---------------------------------------------------------------------------
/// The bundled application UI family. Always resolved first.
const String clideUiFamily = 'JosefinSans';
/// The bundled application UI family, resolved first (T-460). The settings
/// override ([kUiFontSettingKey]) takes precedence at the app root when set.
const String clideUiFamily = 'Inter';
/// 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;
/// Default weight for UI text.
const FontWeight clideUiDefaultWeight = FontWeight.w400;
/// System fallback chain for the UI face. Sans-serif humanist faces
/// that sit close to Josefin's proportions, ordered by platform.
/// System fallback chain for the UI face — the other bundled UI option plus
/// platform humanist sans defaults.
const List<String> clideUiFamilyFallback = [
// User system install of Josefin, if any.
'Josefin Sans',
// Platform humanist sans defaults.
// The other bundled UI family (selectable in Appearance).
'JosefinSans',
// User system install / platform humanist sans defaults.
'Inter',
'Helvetica Neue',
'Helvetica',
@@ -39,6 +39,11 @@ const List<String> clideUiFamilyFallback = [
'sans-serif',
];
/// Settings keys for the user-selectable UI / monospace font families
/// (Settings → Appearance, T-460). Unset → the bundled defaults above.
const String kUiFontSettingKey = 'app.ui.font';
const String kMonoFontSettingKey = 'app.mono.font';
// ---------------------------------------------------------------------------
// Monospace face — JetBrains Mono
// ---------------------------------------------------------------------------