diff --git a/src/ViewModels/Preference.cs b/src/ViewModels/Preference.cs index 33b5f99c..8508ae7b 100644 --- a/src/ViewModels/Preference.cs +++ b/src/ViewModels/Preference.cs @@ -85,8 +85,11 @@ namespace SourceGit.ViewModels get => _defaultFont; set { - if (SetProperty(ref _defaultFont, value) && _onlyUseMonoFontInEditor) + if (SetProperty(ref _defaultFont, value)) + { + MonospaceFontWithFallbackDefault = new FontFamily($"{_monospaceFont}, {_defaultFont}"); OnPropertyChanged(nameof(PrimaryFont)); + } } } @@ -95,15 +98,25 @@ namespace SourceGit.ViewModels get => _monospaceFont; set { - if (SetProperty(ref _monospaceFont, value) && !_onlyUseMonoFontInEditor) + if (SetProperty(ref _monospaceFont, value)) + { + MonospaceFontWithFallbackDefault = new FontFamily($"{_monospaceFont}, {_defaultFont}"); OnPropertyChanged(nameof(PrimaryFont)); + } } } + [JsonIgnore] + public FontFamily MonospaceFontWithFallbackDefault + { + get => _monospaceFontWithFallbackDefault; + set => SetProperty(ref _monospaceFontWithFallbackDefault, value); + } + [JsonIgnore] public FontFamily PrimaryFont { - get => _onlyUseMonoFontInEditor ? _defaultFont : _monospaceFont; + get => _onlyUseMonoFontInEditor ? _defaultFont : _monospaceFontWithFallbackDefault; } public bool OnlyUseMonoFontInEditor @@ -112,7 +125,10 @@ namespace SourceGit.ViewModels set { if (SetProperty(ref _onlyUseMonoFontInEditor, value)) + { + MonospaceFontWithFallbackDefault = new FontFamily($"{_monospaceFont}, {_defaultFont}"); OnPropertyChanged(nameof(PrimaryFont)); + } } } @@ -501,6 +517,7 @@ namespace SourceGit.ViewModels private string _themeOverrides = string.Empty; private FontFamily _defaultFont = null; private FontFamily _monospaceFont = null; + private FontFamily _monospaceFontWithFallbackDefault = null; private bool _onlyUseMonoFontInEditor = false; private double _defaultFontSize = 13; private LayoutInfo _layout = new LayoutInfo(); diff --git a/src/Views/Blame.axaml b/src/Views/Blame.axaml index 065695d6..e4c992bd 100644 --- a/src/Views/Blame.axaml +++ b/src/Views/Blame.axaml @@ -58,7 +58,7 @@ BorderThickness="1" Background="{DynamicResource Brush.Contents}" Foreground="{DynamicResource Brush.FG1}" - FontFamily="{Binding Source={x:Static vm:Preference.Instance}, Path=MonospaceFont}" + FontFamily="{Binding Source={x:Static vm:Preference.Instance}, Path=MonospaceFontWithFallbackDefault}" BlameData="{Binding Data}"/> diff --git a/src/Views/BranchTree.axaml b/src/Views/BranchTree.axaml index 59b0b609..6991a2e4 100644 --- a/src/Views/BranchTree.axaml +++ b/src/Views/BranchTree.axaml @@ -86,7 +86,7 @@ diff --git a/src/Views/CommitBaseInfo.axaml b/src/Views/CommitBaseInfo.axaml index 70da7fcd..43a5727d 100644 --- a/src/Views/CommitBaseInfo.axaml +++ b/src/Views/CommitBaseInfo.axaml @@ -96,7 +96,7 @@ BranchNameBackground="{DynamicResource Brush.DecoratorBranch}" TagNameBackground="{DynamicResource Brush.DecoratorTag}" LabelForeground="{DynamicResource Brush.DecoratorFG}" - FontFamily="{Binding Source={x:Static vm:Preference.Instance}, Path=MonospaceFont}" + FontFamily="{Binding Source={x:Static vm:Preference.Instance}, Path=MonospaceFontWithFallbackDefault}" FontSize="10" VerticalAlignment="Center"/> diff --git a/src/Views/Histories.axaml b/src/Views/Histories.axaml index 0033b93a..76a83129 100644 --- a/src/Views/Histories.axaml +++ b/src/Views/Histories.axaml @@ -73,7 +73,7 @@ BranchNameBackground="{DynamicResource Brush.DecoratorBranch}" TagNameBackground="{DynamicResource Brush.DecoratorTag}" LabelForeground="{DynamicResource Brush.DecoratorFG}" - FontFamily="{Binding Source={x:Static vm:Preference.Instance}, Path=MonospaceFont}" + FontFamily="{Binding Source={x:Static vm:Preference.Instance}, Path=MonospaceFontWithFallbackDefault}" FontSize="10" VerticalAlignment="Center"/> diff --git a/src/Views/Repository.axaml b/src/Views/Repository.axaml index d60f729b..4ab9bf6e 100644 --- a/src/Views/Repository.axaml +++ b/src/Views/Repository.axaml @@ -95,7 +95,7 @@ Margin="6,0" VerticalAlignment="Center" Count="{Binding LocalChangesCount}" - FontFamily="{Binding Source={x:Static vm:Preference.Instance}, Path=MonospaceFont}" + FontFamily="{Binding Source={x:Static vm:Preference.Instance}, Path=MonospaceFontWithFallbackDefault}" FontSize="10" Foreground="{DynamicResource Brush.BadgeFG}" Background="{DynamicResource Brush.Badge}"/> @@ -110,7 +110,7 @@ Margin="6,0" VerticalAlignment="Center" Count="{Binding StashesCount}" - FontFamily="{Binding Source={x:Static vm:Preference.Instance}, Path=MonospaceFont}" + FontFamily="{Binding Source={x:Static vm:Preference.Instance}, Path=MonospaceFontWithFallbackDefault}" FontSize="10" Foreground="{DynamicResource Brush.BadgeFG}" Background="{DynamicResource Brush.Badge}"/> diff --git a/src/Views/RevisionFiles.axaml b/src/Views/RevisionFiles.axaml index aef71e19..eb147172 100644 --- a/src/Views/RevisionFiles.axaml +++ b/src/Views/RevisionFiles.axaml @@ -42,7 +42,7 @@ - + diff --git a/src/Views/TextDiffView.axaml b/src/Views/TextDiffView.axaml index b49faa7d..6cb8a11c 100644 --- a/src/Views/TextDiffView.axaml +++ b/src/Views/TextDiffView.axaml @@ -22,7 +22,7 @@ AddedHighlightBrush="{DynamicResource Brush.Diff.AddedHighlight}" DeletedHighlightBrush="{DynamicResource Brush.Diff.DeletedHighlight}" IndicatorForeground="{DynamicResource Brush.FG2}" - FontFamily="{Binding Source={x:Static vm:Preference.Instance}, Path=MonospaceFont}" + FontFamily="{Binding Source={x:Static vm:Preference.Instance}, Path=MonospaceFontWithFallbackDefault}" UseSyntaxHighlighting="{Binding Source={x:Static vm:Preference.Instance}, Path=UseSyntaxHighlighting}" WordWrap="{Binding Source={x:Static vm:Preference.Instance}, Path=EnableDiffViewWordWrap}" ShowHiddenSymbols="{Binding Source={x:Static vm:Preference.Instance}, Path=ShowHiddenSymbolsInDiffView}" @@ -43,7 +43,7 @@ AddedHighlightBrush="{DynamicResource Brush.Diff.AddedHighlight}" DeletedHighlightBrush="{DynamicResource Brush.Diff.DeletedHighlight}" IndicatorForeground="{DynamicResource Brush.FG2}" - FontFamily="{Binding Source={x:Static vm:Preference.Instance}, Path=MonospaceFont}" + FontFamily="{Binding Source={x:Static vm:Preference.Instance}, Path=MonospaceFontWithFallbackDefault}" UseSyntaxHighlighting="{Binding Source={x:Static vm:Preference.Instance}, Path=UseSyntaxHighlighting}" WordWrap="{Binding Source={x:Static vm:Preference.Instance}, Path=EnableDiffViewWordWrap}" ShowHiddenSymbols="{Binding Source={x:Static vm:Preference.Instance}, Path=ShowHiddenSymbolsInDiffView}" @@ -63,7 +63,7 @@ AddedHighlightBrush="{DynamicResource Brush.Diff.AddedHighlight}" DeletedHighlightBrush="{DynamicResource Brush.Diff.DeletedHighlight}" IndicatorForeground="{DynamicResource Brush.FG2}" - FontFamily="{Binding Source={x:Static vm:Preference.Instance}, Path=MonospaceFont}" + FontFamily="{Binding Source={x:Static vm:Preference.Instance}, Path=MonospaceFontWithFallbackDefault}" UseSyntaxHighlighting="{Binding Source={x:Static vm:Preference.Instance}, Path=UseSyntaxHighlighting}" WordWrap="{Binding Source={x:Static vm:Preference.Instance}, Path=EnableDiffViewWordWrap}" ShowHiddenSymbols="{Binding Source={x:Static vm:Preference.Instance}, Path=ShowHiddenSymbolsInDiffView}"