Skip to content

Commit 09e6ce1

Browse files
authored
fix: bundle and fallback to Noto Sans CJK for missing Chinese glyphs (#2182)
## Summary Flutter has a known issue on ARM64 Linux platforms (flutter/flutter#90951) where Chinese glyphs fail to render and display as tofu boxes (`□□□`). Within snap confinement, the application lacks access to necessary CJK glyph tables, causing unrendered characters across the interface. Ahead of an upstream release for the Lenovo partnership, this provides a workaround in App Center by bundling the fonts and declaring explicit fallbacks. ## Changes **Add Noto Sans CJK to font fallbacks** — In `packages/app_center/lib/store/store_app.dart` (inside `StoreAppThemeX`), added `Noto Sans CJK (SC, TC, HK)` to `fontFamilyFallback`. **Stage CJK fonts in the snap** — Added `fonts-noto-cjk` to `stage-packages` in `snapcraft.yaml` so the required font files are bundled and accessible inside snap confinement at runtime. ## Testing Manual verification on ARM64 hardware: 1. Build and install the snap on an ARM64 test machine. 2. Launch App Center with a Chinese locale (`LANG=zh_CN.UTF-8`). 3. Verify that Chinese glyphs render properly across all views without tofu boxes (□□□). --- UDENG-11262
2 parents 0cf7cf2 + b8ef6ad commit 09e6ce1

2 files changed

Lines changed: 39 additions & 20 deletions

File tree

‎packages/app_center/lib/store/store_app.dart‎

Lines changed: 37 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,7 @@ class _StoreAppState extends ConsumerState<StoreApp> {
9393
}
9494

9595
class _StoreAppHome extends ConsumerWidget {
96-
const _StoreAppHome({
97-
required this.navigatorKey,
98-
required this.searchFocus,
99-
});
96+
const _StoreAppHome({required this.navigatorKey, required this.searchFocus});
10097

10198
final GlobalKey<NavigatorState> navigatorKey;
10299
final FocusNode searchFocus;
@@ -174,27 +171,21 @@ class _StoreAppHome extends ConsumerWidget {
174171
settings: settings,
175172
builder: (_) => YaruDetailPage(
176173
appBar: searchField,
177-
body: DebPage(
178-
id: StoreRoutes.debOf(settings)!,
179-
),
174+
body: DebPage(id: StoreRoutes.debOf(settings)!),
180175
),
181176
),
182177
StoreRoutes.localDeb => MaterialPageRoute(
183178
settings: settings,
184179
builder: (_) => YaruDetailPage(
185180
appBar: searchField,
186-
body: LocalDebPage(
187-
path: StoreRoutes.localDebOf(settings)!,
188-
),
181+
body: LocalDebPage(path: StoreRoutes.localDebOf(settings)!),
189182
),
190183
),
191184
StoreRoutes.snap => MaterialPageRoute(
192185
settings: settings,
193186
builder: (_) => YaruDetailPage(
194187
appBar: searchField,
195-
body: SnapPage(
196-
snapName: StoreRoutes.snapOf(settings)!,
197-
),
188+
body: SnapPage(snapName: StoreRoutes.snapOf(settings)!),
198189
),
199190
),
200191
StoreRoutes.search => MaterialPageRoute(
@@ -216,10 +207,8 @@ class _StoreAppHome extends ConsumerWidget {
216207
),
217208
StoreRoutes.manage => MaterialPageRoute(
218209
settings: settings,
219-
builder: (_) => YaruDetailPage(
220-
appBar: searchField,
221-
body: const ManagePage(),
222-
),
210+
builder: (_) =>
211+
YaruDetailPage(appBar: searchField, body: const ManagePage()),
223212
),
224213
StoreRoutes.gstreamer => MaterialPageRoute(
225214
settings: settings,
@@ -257,16 +246,44 @@ class _MaybeBackButton extends ConsumerWidget {
257246

258247
extension StoreAppThemeX on ThemeData {
259248
ThemeData customize({bool highContrast = false}) {
249+
const cjkFallback = [
250+
'Noto Sans CJK SC',
251+
'Noto Sans CJK TC',
252+
'Noto Sans CJK HK',
253+
];
254+
260255
final base = copyWith(
256+
textTheme: textTheme.apply(fontFamilyFallback: cjkFallback),
257+
primaryTextTheme: primaryTextTheme.apply(fontFamilyFallback: cjkFallback),
258+
259+
appBarTheme: appBarTheme.copyWith(
260+
titleTextStyle: appBarTheme.titleTextStyle?.apply(
261+
fontFamilyFallback: cjkFallback,
262+
),
263+
),
264+
265+
navigationRailTheme: navigationRailTheme.copyWith(
266+
selectedLabelTextStyle: navigationRailTheme.selectedLabelTextStyle
267+
?.apply(fontFamilyFallback: cjkFallback),
268+
unselectedLabelTextStyle: navigationRailTheme.unselectedLabelTextStyle
269+
?.apply(fontFamilyFallback: cjkFallback),
270+
),
271+
272+
listTileTheme: listTileTheme.copyWith(
273+
titleTextStyle: listTileTheme.titleTextStyle?.apply(
274+
fontFamilyFallback: cjkFallback,
275+
),
276+
subtitleTextStyle: listTileTheme.subtitleTextStyle?.apply(
277+
fontFamilyFallback: cjkFallback,
278+
),
279+
),
261280
inputDecorationTheme: inputDecorationTheme.copyWith(
262281
fillColor: colorScheme.surface,
263282
hoverColor: colorScheme.surface,
264283
),
265284
);
266285

267-
final highContrastTheme = base.copyWith(
268-
hintColor: colorScheme.onSurface,
269-
);
286+
final highContrastTheme = base.copyWith(hintColor: colorScheme.onSurface);
270287

271288
return highContrast ? highContrastTheme : base;
272289
}

‎snap/snapcraft.yaml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ parts:
5050
fvm flutter build linux --release -v
5151
mkdir -p $CRAFT_PART_INSTALL/bin/
5252
cp -r build/linux/*/release/bundle/* $CRAFT_PART_INSTALL/bin/
53+
stage-packages:
54+
- fonts-noto-cjk
5355

5456
packagekit-session-installer:
5557
source: ./packagekit-session-installer

0 commit comments

Comments
 (0)