Skip to content

Commit

Permalink
Merge pull request #1079 from kaiquegazola/feature/add-font-family-fa…
Browse files Browse the repository at this point in the history
…llback

Feature/add font family fallback
  • Loading branch information
Sub6Resources authored Jun 14, 2022
2 parents c3f6f8b + 4812d83 commit c797ef8
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions lib/style.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ class Style {
/// Default: Theme.of(context).style.textTheme.body1.fontFamily
String? fontFamily;


/// The list of font families to fall back on when a glyph cannot be found in default font family.
///
/// Inherited: yes,
/// Default: null
List<String>? fontFamilyFallback;


/// CSS attribute "`font-feature-settings`"
///
/// Inherited: yes,
Expand Down Expand Up @@ -199,6 +207,7 @@ class Style {
this.direction,
this.display,
this.fontFamily,
this.fontFamilyFallback,
this.fontFeatureSettings,
this.fontSize,
this.fontStyle,
Expand Down Expand Up @@ -263,6 +272,7 @@ class Style {
decorationStyle: textDecorationStyle,
decorationThickness: textDecorationThickness,
fontFamily: fontFamily,
fontFamilyFallback: fontFamilyFallback,
fontFeatures: fontFeatureSettings,
fontSize: fontSize?.size,
fontStyle: fontStyle,
Expand All @@ -288,6 +298,7 @@ class Style {
direction: other.direction,
display: other.display,
fontFamily: other.fontFamily,
fontFamilyFallback: other.fontFamilyFallback,
fontFeatureSettings: other.fontFeatureSettings,
fontSize: other.fontSize,
fontStyle: other.fontStyle,
Expand Down Expand Up @@ -341,6 +352,7 @@ class Style {
direction: child.direction ?? direction,
display: display == Display.NONE ? display : child.display,
fontFamily: child.fontFamily ?? fontFamily,
fontFamilyFallback: child.fontFamilyFallback ?? fontFamilyFallback,
fontFeatureSettings: child.fontFeatureSettings ?? fontFeatureSettings,
fontSize: finalFontSize,
fontStyle: child.fontStyle ?? fontStyle,
Expand Down Expand Up @@ -368,6 +380,7 @@ class Style {
TextDirection? direction,
Display? display,
String? fontFamily,
List<String>? fontFamilyFallback,
List<FontFeature>? fontFeatureSettings,
FontSize? fontSize,
FontStyle? fontStyle,
Expand Down Expand Up @@ -405,6 +418,7 @@ class Style {
direction: direction ?? this.direction,
display: display ?? this.display,
fontFamily: fontFamily ?? this.fontFamily,
fontFamilyFallback: fontFamilyFallback ?? this.fontFamilyFallback,
fontFeatureSettings: fontFeatureSettings ?? this.fontFeatureSettings,
fontSize: fontSize ?? this.fontSize,
fontStyle: fontStyle ?? this.fontStyle,
Expand Down Expand Up @@ -446,6 +460,7 @@ class Style {
this.textDecorationStyle = textStyle.decorationStyle;
this.textDecorationThickness = textStyle.decorationThickness;
this.fontFamily = textStyle.fontFamily;
this.fontFamilyFallback = textStyle.fontFamilyFallback;
this.fontFeatureSettings = textStyle.fontFeatures;
this.fontSize = FontSize(textStyle.fontSize);
this.fontStyle = textStyle.fontStyle;
Expand Down

0 comments on commit c797ef8

Please sign in to comment.