Skip to content

Commit c797ef8

Browse files
Merge pull request Sub6Resources#1079 from kaiquegazola/feature/add-font-family-fallback
Feature/add font family fallback
2 parents c3f6f8b + 4812d83 commit c797ef8

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

lib/style.dart

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,14 @@ class Style {
3737
/// Default: Theme.of(context).style.textTheme.body1.fontFamily
3838
String? fontFamily;
3939

40+
41+
/// The list of font families to fall back on when a glyph cannot be found in default font family.
42+
///
43+
/// Inherited: yes,
44+
/// Default: null
45+
List<String>? fontFamilyFallback;
46+
47+
4048
/// CSS attribute "`font-feature-settings`"
4149
///
4250
/// Inherited: yes,
@@ -199,6 +207,7 @@ class Style {
199207
this.direction,
200208
this.display,
201209
this.fontFamily,
210+
this.fontFamilyFallback,
202211
this.fontFeatureSettings,
203212
this.fontSize,
204213
this.fontStyle,
@@ -263,6 +272,7 @@ class Style {
263272
decorationStyle: textDecorationStyle,
264273
decorationThickness: textDecorationThickness,
265274
fontFamily: fontFamily,
275+
fontFamilyFallback: fontFamilyFallback,
266276
fontFeatures: fontFeatureSettings,
267277
fontSize: fontSize?.size,
268278
fontStyle: fontStyle,
@@ -288,6 +298,7 @@ class Style {
288298
direction: other.direction,
289299
display: other.display,
290300
fontFamily: other.fontFamily,
301+
fontFamilyFallback: other.fontFamilyFallback,
291302
fontFeatureSettings: other.fontFeatureSettings,
292303
fontSize: other.fontSize,
293304
fontStyle: other.fontStyle,
@@ -341,6 +352,7 @@ class Style {
341352
direction: child.direction ?? direction,
342353
display: display == Display.NONE ? display : child.display,
343354
fontFamily: child.fontFamily ?? fontFamily,
355+
fontFamilyFallback: child.fontFamilyFallback ?? fontFamilyFallback,
344356
fontFeatureSettings: child.fontFeatureSettings ?? fontFeatureSettings,
345357
fontSize: finalFontSize,
346358
fontStyle: child.fontStyle ?? fontStyle,
@@ -368,6 +380,7 @@ class Style {
368380
TextDirection? direction,
369381
Display? display,
370382
String? fontFamily,
383+
List<String>? fontFamilyFallback,
371384
List<FontFeature>? fontFeatureSettings,
372385
FontSize? fontSize,
373386
FontStyle? fontStyle,
@@ -405,6 +418,7 @@ class Style {
405418
direction: direction ?? this.direction,
406419
display: display ?? this.display,
407420
fontFamily: fontFamily ?? this.fontFamily,
421+
fontFamilyFallback: fontFamilyFallback ?? this.fontFamilyFallback,
408422
fontFeatureSettings: fontFeatureSettings ?? this.fontFeatureSettings,
409423
fontSize: fontSize ?? this.fontSize,
410424
fontStyle: fontStyle ?? this.fontStyle,
@@ -446,6 +460,7 @@ class Style {
446460
this.textDecorationStyle = textStyle.decorationStyle;
447461
this.textDecorationThickness = textStyle.decorationThickness;
448462
this.fontFamily = textStyle.fontFamily;
463+
this.fontFamilyFallback = textStyle.fontFamilyFallback;
449464
this.fontFeatureSettings = textStyle.fontFeatures;
450465
this.fontSize = FontSize(textStyle.fontSize);
451466
this.fontStyle = textStyle.fontStyle;

0 commit comments

Comments
 (0)