mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-06-26 04:44:59 +00:00
fix: make MonospaceFont fallback to DefaultFont (#366)
This commit is contained in:
parent
24dde77548
commit
ad53d874a2
8 changed files with 30 additions and 13 deletions
|
@ -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();
|
||||
|
|
|
@ -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}"/>
|
||||
|
||||
<!-- Not supported mask (for binary files) -->
|
||||
|
|
|
@ -86,7 +86,7 @@
|
|||
<v:BranchTreeNodeTrackStatusPresenter Grid.Column="2"
|
||||
Margin="8,0"
|
||||
VerticalAlignment="Center"
|
||||
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}"/>
|
||||
|
|
|
@ -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"/>
|
||||
</Border>
|
||||
|
|
|
@ -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"/>
|
||||
|
||||
|
|
|
@ -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}"/>
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
</DataTemplate>
|
||||
|
||||
<DataTemplate DataType="m:RevisionTextFile">
|
||||
<v:RevisionTextFileView FontFamily="{Binding Source={x:Static vm:Preference.Instance}, Path=MonospaceFont}" Background="{DynamicResource Brush.Contents}"/>
|
||||
<v:RevisionTextFileView FontFamily="{Binding Source={x:Static vm:Preference.Instance}, Path=MonospaceFontWithFallbackDefault}" Background="{DynamicResource Brush.Contents}"/>
|
||||
</DataTemplate>
|
||||
|
||||
<DataTemplate DataType="m:RevisionImageFile">
|
||||
|
|
|
@ -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}"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue