feature<Preference>: add custom font settings

This commit is contained in:
Jai 2021-08-10 16:55:01 +08:00
parent 0643f5803c
commit 0c7f217106
29 changed files with 202 additions and 70 deletions

View file

@ -356,6 +356,8 @@
<sys:String x:Key="Text.Preference">Preference</sys:String>
<sys:String x:Key="Text.Preference.General">GENERAL SETTING</sys:String>
<sys:String x:Key="Text.Preference.Locale">Language</sys:String>
<sys:String x:Key="Text.Preference.FontFamilyWindow">Window Font</sys:String>
<sys:String x:Key="Text.Preference.FontFamilyContent">Content Font</sys:String>
<sys:String x:Key="Text.Preference.AvatarServer">Avatar Server</sys:String>
<sys:String x:Key="Text.Preference.CheckUpdate">Check for update</sys:String>
<sys:String x:Key="Text.Preference.AutoFetch">Fetch remotes automatically (need restart)</sys:String>

View file

@ -355,6 +355,8 @@
<sys:String x:Key="Text.Preference">偏好设置</sys:String>
<sys:String x:Key="Text.Preference.General">通用配置</sys:String>
<sys:String x:Key="Text.Preference.Locale">显示语言</sys:String>
<sys:String x:Key="Text.Preference.FontFamilyWindow">系统字体</sys:String>
<sys:String x:Key="Text.Preference.FontFamilyContent">文本字体</sys:String>
<sys:String x:Key="Text.Preference.AvatarServer">头像服务</sys:String>
<sys:String x:Key="Text.Preference.CheckUpdate">启用检测更新</sys:String>
<sys:String x:Key="Text.Preference.AutoFetch">启用定时自动拉取远程更新(重启生效)</sys:String>

View file

@ -1,5 +1,6 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:models="clr-namespace:SourceGit.Models">
<Style TargetType="{x:Type MenuItem}">
<Setter Property="Background" Value="Transparent"/>
@ -7,7 +8,7 @@
<Setter Property="Foreground" Value="{DynamicResource Brush.FG1}"/>
<Setter Property="MinHeight" Value="24"/>
<Setter Property="SnapsToDevicePixels" Value="True"/>
<Setter Property="TextElement.FontFamily" Value="Microsoft YaHei UI"/>
<Setter Property="FontFamily" Value="{Binding Source={x:Static models:Preference.Instance}, Path=General.FontFamilyWindow, Mode=OneWay}" />
<Setter Property="TextOptions.TextFormattingMode" Value="Display"/>
<Setter Property="TextOptions.TextRenderingMode" Value="ClearType"/>
<Setter Property="RenderOptions.ClearTypeHint" Value="Enabled"/>

View file

@ -1,5 +1,6 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:models="clr-namespace:SourceGit.Models">
<Style x:Key="Style.DataGridCell" TargetType="{x:Type DataGridCell}">
<Setter Property="BorderThickness" Value="0"/>
@ -44,7 +45,7 @@
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="TextElement.Foreground" Value="{DynamicResource Brush.FG1}"/>
<Setter Property="TextElement.FontFamily" Value="Consolas,Microsoft YaHei UI"/>
<Setter Property="TextElement.FontFamily" Value="{Binding Source={x:Static models:Preference.Instance}, Path=General.FontFamilyContent, Mode=OneWay}"/>
<Setter Property="EnableColumnVirtualization" Value="True"/>
<Setter Property="EnableRowVirtualization" Value="True"/>
<Setter Property="RowBackground" Value="Transparent"/>

View file

@ -49,7 +49,6 @@
<Style TargetType="{x:Type TextBlock}" BasedOn="{x:Null}">
<Setter Property="Foreground" Value="{DynamicResource Brush.FG1}"/>
<Setter Property="FontWeight" Value="DemiBold"/>
<Setter Property="FontFamily" Value="Microsoft YaHei UI"/>
<Setter Property="FontSize" Value="9pt"/>
<Setter Property="RenderOptions.ClearTypeHint" Value="Enabled"/>
<Style.Triggers>

View file

@ -3,7 +3,6 @@
xmlns:controls="clr-namespace:SourceGit.Views.Controls">
<Style x:Key="Style.TextBlock.Base" TargetType="{x:Type TextBlock}">
<Setter Property="SnapsToDevicePixels" Value="True"/>
<Setter Property="FontFamily" Value="Consolas,Microsoft YaHei UI"/>
<Setter Property="FontSize" Value="9pt"/>
<Setter Property="Foreground" Value="{DynamicResource Brush.FG1}"/>
<Setter Property="HorizontalAlignment" Value="Left"/>
@ -20,7 +19,6 @@
<Setter Property="SnapsToDevicePixels" Value="True"/>
<Setter Property="OverridesDefaultStyle" Value="True"/>
<Setter Property="Foreground" Value="{DynamicResource Brush.FG2}"/>
<Setter Property="FontFamily" Value="Microsoft YaHei UI"/>
<Setter Property="FontWeight" Value="ExtraBold"/>
<Setter Property="FontSize" Value="9pt"/>
<Setter Property="Margin" Value="8,0,0,0"/>

View file

@ -7,7 +7,6 @@
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="TextElement.FontFamily" Value="Consolas,Microsoft YaHei UI"/>
<Setter Property="Foreground" Value="{DynamicResource Brush.FG1}"/>
<Setter Property="CaretBrush" Value="{DynamicResource Brush.FG1}"/>
<Setter Property="Background" Value="Transparent"/>

View file

@ -1,6 +1,7 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:SourceGit.Views.Controls">
xmlns:controls="clr-namespace:SourceGit.Views.Controls"
xmlns:models="clr-namespace:SourceGit.Models">
<Style x:Key="Style.TreeView.ToggleButton" TargetType="{x:Type ToggleButton}">
<Setter Property="Focusable" Value="False"/>
@ -58,8 +59,7 @@
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
ContentSource="Header"
TextElement.FontFamily="Consolas,Microsoft YaHei UI"/>
ContentSource="Header"/>
</Grid>
</Border>
<ItemsPresenter x:Name="ItemsHost" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
@ -97,6 +97,7 @@
<Setter Property="VirtualizingStackPanel.VirtualizationMode" Value="Standard" />
<Setter Property="ScrollViewer.CanContentScroll" Value="True" />
<Setter Property="Background" Value="Transparent"/>
<Setter Property="TextElement.FontFamily" Value="{Binding Source={x:Static models:Preference.Instance}, Path=General.FontFamilyContent, Mode=OneWay}"/>
<Setter Property="ItemsPanel">
<Setter.Value>
<ItemsPanelTemplate>

View file

@ -1,6 +1,7 @@
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:models="clr-namespace:SourceGit.Models">
<Style x:Key="Style.Window" TargetType="{x:Type Window}">
<Setter Property="SnapsToDevicePixels" Value="True"/>
@ -12,6 +13,7 @@
<Setter Property="TextOptions.TextHintingMode" Value="Animated"/>
<Setter Property="TextOptions.TextRenderingMode" Value="ClearType"/>
<Setter Property="RenderOptions.ClearTypeHint" Value="Enabled"/>
<Setter Property="FontFamily" Value="{Binding Source={x:Static models:Preference.Instance}, Path=General.FontFamilyWindow, Mode=OneWay}"/>
<Setter Property="WindowChrome.WindowChrome">
<Setter.Value>