mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-06-26 12:55:00 +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;
|
get => _defaultFont;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (SetProperty(ref _defaultFont, value) && _onlyUseMonoFontInEditor)
|
if (SetProperty(ref _defaultFont, value))
|
||||||
|
{
|
||||||
|
MonospaceFontWithFallbackDefault = new FontFamily($"{_monospaceFont}, {_defaultFont}");
|
||||||
OnPropertyChanged(nameof(PrimaryFont));
|
OnPropertyChanged(nameof(PrimaryFont));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,15 +98,25 @@ namespace SourceGit.ViewModels
|
||||||
get => _monospaceFont;
|
get => _monospaceFont;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (SetProperty(ref _monospaceFont, value) && !_onlyUseMonoFontInEditor)
|
if (SetProperty(ref _monospaceFont, value))
|
||||||
|
{
|
||||||
|
MonospaceFontWithFallbackDefault = new FontFamily($"{_monospaceFont}, {_defaultFont}");
|
||||||
OnPropertyChanged(nameof(PrimaryFont));
|
OnPropertyChanged(nameof(PrimaryFont));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
|
public FontFamily MonospaceFontWithFallbackDefault
|
||||||
|
{
|
||||||
|
get => _monospaceFontWithFallbackDefault;
|
||||||
|
set => SetProperty(ref _monospaceFontWithFallbackDefault, value);
|
||||||
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public FontFamily PrimaryFont
|
public FontFamily PrimaryFont
|
||||||
{
|
{
|
||||||
get => _onlyUseMonoFontInEditor ? _defaultFont : _monospaceFont;
|
get => _onlyUseMonoFontInEditor ? _defaultFont : _monospaceFontWithFallbackDefault;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool OnlyUseMonoFontInEditor
|
public bool OnlyUseMonoFontInEditor
|
||||||
|
@ -112,7 +125,10 @@ namespace SourceGit.ViewModels
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (SetProperty(ref _onlyUseMonoFontInEditor, value))
|
if (SetProperty(ref _onlyUseMonoFontInEditor, value))
|
||||||
|
{
|
||||||
|
MonospaceFontWithFallbackDefault = new FontFamily($"{_monospaceFont}, {_defaultFont}");
|
||||||
OnPropertyChanged(nameof(PrimaryFont));
|
OnPropertyChanged(nameof(PrimaryFont));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -501,6 +517,7 @@ namespace SourceGit.ViewModels
|
||||||
private string _themeOverrides = string.Empty;
|
private string _themeOverrides = string.Empty;
|
||||||
private FontFamily _defaultFont = null;
|
private FontFamily _defaultFont = null;
|
||||||
private FontFamily _monospaceFont = null;
|
private FontFamily _monospaceFont = null;
|
||||||
|
private FontFamily _monospaceFontWithFallbackDefault = null;
|
||||||
private bool _onlyUseMonoFontInEditor = false;
|
private bool _onlyUseMonoFontInEditor = false;
|
||||||
private double _defaultFontSize = 13;
|
private double _defaultFontSize = 13;
|
||||||
private LayoutInfo _layout = new LayoutInfo();
|
private LayoutInfo _layout = new LayoutInfo();
|
||||||
|
|
|
@ -58,7 +58,7 @@
|
||||||
BorderThickness="1"
|
BorderThickness="1"
|
||||||
Background="{DynamicResource Brush.Contents}"
|
Background="{DynamicResource Brush.Contents}"
|
||||||
Foreground="{DynamicResource Brush.FG1}"
|
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}"/>
|
BlameData="{Binding Data}"/>
|
||||||
|
|
||||||
<!-- Not supported mask (for binary files) -->
|
<!-- Not supported mask (for binary files) -->
|
||||||
|
|
|
@ -86,7 +86,7 @@
|
||||||
<v:BranchTreeNodeTrackStatusPresenter Grid.Column="2"
|
<v:BranchTreeNodeTrackStatusPresenter Grid.Column="2"
|
||||||
Margin="8,0"
|
Margin="8,0"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
FontFamily="{Binding Source={x:Static vm:Preference.Instance}, Path=MonospaceFont}"
|
FontFamily="{Binding Source={x:Static vm:Preference.Instance}, Path=MonospaceFontWithFallbackDefault}"
|
||||||
FontSize="10"
|
FontSize="10"
|
||||||
Foreground="{DynamicResource Brush.BadgeFG}"
|
Foreground="{DynamicResource Brush.BadgeFG}"
|
||||||
Background="{DynamicResource Brush.Badge}"/>
|
Background="{DynamicResource Brush.Badge}"/>
|
||||||
|
|
|
@ -96,7 +96,7 @@
|
||||||
BranchNameBackground="{DynamicResource Brush.DecoratorBranch}"
|
BranchNameBackground="{DynamicResource Brush.DecoratorBranch}"
|
||||||
TagNameBackground="{DynamicResource Brush.DecoratorTag}"
|
TagNameBackground="{DynamicResource Brush.DecoratorTag}"
|
||||||
LabelForeground="{DynamicResource Brush.DecoratorFG}"
|
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"
|
FontSize="10"
|
||||||
VerticalAlignment="Center"/>
|
VerticalAlignment="Center"/>
|
||||||
</Border>
|
</Border>
|
||||||
|
|
|
@ -73,7 +73,7 @@
|
||||||
BranchNameBackground="{DynamicResource Brush.DecoratorBranch}"
|
BranchNameBackground="{DynamicResource Brush.DecoratorBranch}"
|
||||||
TagNameBackground="{DynamicResource Brush.DecoratorTag}"
|
TagNameBackground="{DynamicResource Brush.DecoratorTag}"
|
||||||
LabelForeground="{DynamicResource Brush.DecoratorFG}"
|
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"
|
FontSize="10"
|
||||||
VerticalAlignment="Center"/>
|
VerticalAlignment="Center"/>
|
||||||
|
|
||||||
|
|
|
@ -95,7 +95,7 @@
|
||||||
Margin="6,0"
|
Margin="6,0"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Count="{Binding LocalChangesCount}"
|
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"
|
FontSize="10"
|
||||||
Foreground="{DynamicResource Brush.BadgeFG}"
|
Foreground="{DynamicResource Brush.BadgeFG}"
|
||||||
Background="{DynamicResource Brush.Badge}"/>
|
Background="{DynamicResource Brush.Badge}"/>
|
||||||
|
@ -110,7 +110,7 @@
|
||||||
Margin="6,0"
|
Margin="6,0"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Count="{Binding StashesCount}"
|
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"
|
FontSize="10"
|
||||||
Foreground="{DynamicResource Brush.BadgeFG}"
|
Foreground="{DynamicResource Brush.BadgeFG}"
|
||||||
Background="{DynamicResource Brush.Badge}"/>
|
Background="{DynamicResource Brush.Badge}"/>
|
||||||
|
|
|
@ -42,7 +42,7 @@
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
|
|
||||||
<DataTemplate DataType="m:RevisionTextFile">
|
<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>
|
||||||
|
|
||||||
<DataTemplate DataType="m:RevisionImageFile">
|
<DataTemplate DataType="m:RevisionImageFile">
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
AddedHighlightBrush="{DynamicResource Brush.Diff.AddedHighlight}"
|
AddedHighlightBrush="{DynamicResource Brush.Diff.AddedHighlight}"
|
||||||
DeletedHighlightBrush="{DynamicResource Brush.Diff.DeletedHighlight}"
|
DeletedHighlightBrush="{DynamicResource Brush.Diff.DeletedHighlight}"
|
||||||
IndicatorForeground="{DynamicResource Brush.FG2}"
|
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}"
|
UseSyntaxHighlighting="{Binding Source={x:Static vm:Preference.Instance}, Path=UseSyntaxHighlighting}"
|
||||||
WordWrap="{Binding Source={x:Static vm:Preference.Instance}, Path=EnableDiffViewWordWrap}"
|
WordWrap="{Binding Source={x:Static vm:Preference.Instance}, Path=EnableDiffViewWordWrap}"
|
||||||
ShowHiddenSymbols="{Binding Source={x:Static vm:Preference.Instance}, Path=ShowHiddenSymbolsInDiffView}"
|
ShowHiddenSymbols="{Binding Source={x:Static vm:Preference.Instance}, Path=ShowHiddenSymbolsInDiffView}"
|
||||||
|
@ -43,7 +43,7 @@
|
||||||
AddedHighlightBrush="{DynamicResource Brush.Diff.AddedHighlight}"
|
AddedHighlightBrush="{DynamicResource Brush.Diff.AddedHighlight}"
|
||||||
DeletedHighlightBrush="{DynamicResource Brush.Diff.DeletedHighlight}"
|
DeletedHighlightBrush="{DynamicResource Brush.Diff.DeletedHighlight}"
|
||||||
IndicatorForeground="{DynamicResource Brush.FG2}"
|
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}"
|
UseSyntaxHighlighting="{Binding Source={x:Static vm:Preference.Instance}, Path=UseSyntaxHighlighting}"
|
||||||
WordWrap="{Binding Source={x:Static vm:Preference.Instance}, Path=EnableDiffViewWordWrap}"
|
WordWrap="{Binding Source={x:Static vm:Preference.Instance}, Path=EnableDiffViewWordWrap}"
|
||||||
ShowHiddenSymbols="{Binding Source={x:Static vm:Preference.Instance}, Path=ShowHiddenSymbolsInDiffView}"
|
ShowHiddenSymbols="{Binding Source={x:Static vm:Preference.Instance}, Path=ShowHiddenSymbolsInDiffView}"
|
||||||
|
@ -63,7 +63,7 @@
|
||||||
AddedHighlightBrush="{DynamicResource Brush.Diff.AddedHighlight}"
|
AddedHighlightBrush="{DynamicResource Brush.Diff.AddedHighlight}"
|
||||||
DeletedHighlightBrush="{DynamicResource Brush.Diff.DeletedHighlight}"
|
DeletedHighlightBrush="{DynamicResource Brush.Diff.DeletedHighlight}"
|
||||||
IndicatorForeground="{DynamicResource Brush.FG2}"
|
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}"
|
UseSyntaxHighlighting="{Binding Source={x:Static vm:Preference.Instance}, Path=UseSyntaxHighlighting}"
|
||||||
WordWrap="{Binding Source={x:Static vm:Preference.Instance}, Path=EnableDiffViewWordWrap}"
|
WordWrap="{Binding Source={x:Static vm:Preference.Instance}, Path=EnableDiffViewWordWrap}"
|
||||||
ShowHiddenSymbols="{Binding Source={x:Static vm:Preference.Instance}, Path=ShowHiddenSymbolsInDiffView}"
|
ShowHiddenSymbols="{Binding Source={x:Static vm:Preference.Instance}, Path=ShowHiddenSymbolsInDiffView}"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue