Files
pipelines/app/lib/ui/theme/app_font_licenses.dart
T
alan 2853b18b9e Settings: per-device interface font choice
System default plus Inter, IBM Plex Sans, Source Sans 3 and Atkinson
Hyperlegible Next (OFL 1.1, bundled as on-demand assets and loaded with
FontLoader, so the web fetches only the previewed/chosen files). Stored in
shared_preferences, applied live to Material and Cupertino text themes;
RobotoMono styles unchanged. Licences registered with LicenseRegistry.
2026-11-04 02:01:49 +00:00

24 lines
672 B
Dart

import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';
import 'app_font.dart';
bool _registered = false;
/// Adds each bundled interface font's SIL Open Font License to the
/// [LicenseRegistry]. The texts are read from the bundle only when a licence
/// page asks for them.
void registerAppFontLicenses() {
if (_registered) return;
_registered = true;
LicenseRegistry.addLicense(() async* {
for (final font in AppFont.values) {
final asset = font.licenseAsset;
if (asset == null) continue;
yield LicenseEntryWithLineBreaks(<String>[
font.label,
], await rootBundle.loadString(asset));
}
});
}