style<*>: change font render mode

This commit is contained in:
leo 2021-05-17 16:47:56 +08:00
parent 0b581752fb
commit a94a62bd27
10 changed files with 53 additions and 45 deletions

View file

@ -14,6 +14,9 @@
<Setter Property="Grid.IsSharedSizeScope" Value="False" />
<Setter Property="HorizontalOffset" Value="-4"/>
<Setter Property="VerticalOffset" Value="-4"/>
<Setter Property="TextOptions.TextFormattingMode" Value="Display"/>
<Setter Property="TextOptions.TextRenderingMode" Value="ClearType"/>
<Setter Property="TextElement.FontSize" Value="9pt"/>
<Setter Property="Template">
<Setter.Value>

View file

@ -2,7 +2,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style TargetType="{x:Type TextBlock}">
<Setter Property="SnapsToDevicePixels" Value="True"/>
<Setter Property="FontSize" Value="12"/>
<Setter Property="FontSize" Value="9pt"/>
<Setter Property="Foreground" Value="{DynamicResource Brush.FG1}"/>
<Setter Property="HorizontalAlignment" Value="Left"/>
<Setter Property="VerticalAlignment" Value="Center"/>
@ -10,7 +10,7 @@
<Style x:Key="Style.TextBlock.LineNumber" TargetType="{x:Type TextBlock}">
<Setter Property="SnapsToDevicePixels" Value="True"/>
<Setter Property="FontSize" Value="12"/>
<Setter Property="FontSize" Value="9pt"/>
<Setter Property="Foreground" Value="{DynamicResource Brush.FG1}"/>
<Setter Property="HorizontalAlignment" Value="Right"/>
<Setter Property="VerticalAlignment" Value="Center"/>
@ -19,7 +19,7 @@
<Style x:Key="Style.TextBlock.LineContent" TargetType="{x:Type TextBlock}">
<Setter Property="SnapsToDevicePixels" Value="True"/>
<Setter Property="FontSize" Value="12"/>
<Setter Property="FontSize" Value="9pt"/>
<Setter Property="Foreground" Value="{DynamicResource Brush.FG1}"/>
<Setter Property="HorizontalAlignment" Value="Left"/>
<Setter Property="VerticalAlignment" Value="Center"/>

View file

@ -55,9 +55,10 @@
x:Name="PART_Header"
Grid.Column="1"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
ContentSource="Header"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
TextElement.FontFamily="Consolas,SimSun"/>
</Grid>
</Border>
<ItemsPresenter x:Name="ItemsHost" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>

View file

@ -9,9 +9,11 @@
xmlns:models="clr-namespace:SourceGit.Models"
mc:Ignorable="d"
UseLayoutRounding="True"
Title="{StaticResource Text.About.Title}"
MinWidth="1280" MinHeight="720"
WindowStartupLocation="CenterScreen"
TextOptions.TextFormattingMode="Display"
TextOptions.TextRenderingMode="ClearType"
MinWidth="1280" MinHeight="720"
Title="{StaticResource Text.About.Title}"
Width="{Binding Source={x:Static models:Preference.Instance}, Path=Window.Width, Mode=TwoWay}"
Height="{Binding Source={x:Static models:Preference.Instance}, Path=Window.Height, Mode=TwoWay}">
<WindowChrome.WindowChrome>

View file

@ -107,7 +107,7 @@
Grid.Column="1"
Text="{Binding Path, Converter={StaticResource PureFileName}}"
Margin="4,0,0,0"
FontSize="11"/>
FontSize="9pt"/>
</Grid>
<HierarchicalDataTemplate.Triggers>

View file

@ -42,7 +42,7 @@
<controls:TextEdit x:Name="txtAuthorName" IsReadOnly="True" BorderThickness="0"/>
<controls:TextEdit x:Name="txtAuthorEmail" IsReadOnly="True" BorderThickness="0" Foreground="{StaticResource Brush.FG2}" Margin="4,0,0,0"/>
</StackPanel>
<controls:TextEdit x:Name="txtAuthorTime" IsReadOnly="True" BorderThickness="0" Foreground="{StaticResource Brush.FG2}" FontSize="10"/>
<controls:TextEdit x:Name="txtAuthorTime" IsReadOnly="True" BorderThickness="0" Foreground="{StaticResource Brush.FG2}" FontSize="8pt"/>
</StackPanel>
<!-- Committer Avatar -->
@ -171,7 +171,7 @@
Grid.Row="3" Grid.Column="1"
x:Name="txtMessage"
IsReadOnly="true"
FontFamily="Consolas"
FontFamily="Consolas,SimSun"
BorderThickness="0"
TextWrapping="Wrap"
Margin="11,5,16,0"

View file

@ -24,65 +24,65 @@
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0" Orientation="Horizontal" Margin="6,0">
<Button Click="Explore" Margin="4,0,0,0" ToolTip="{StaticResource Text.Dashboard.Explore.Tip}" BorderThickness="0">
<Button Click="Explore" Margin="6,0" ToolTip="{StaticResource Text.Dashboard.Explore.Tip}" BorderThickness="0">
<StackPanel Orientation="Horizontal">
<Path Width="16" Height="14" Data="{StaticResource Icon.Folder.Open}"/>
<Label Content="{StaticResource Text.Dashboard.Explore}"/>
<Path Width="14" Height="14" Data="{StaticResource Icon.Folder.Open}"/>
<TextBlock Margin="4,0" FontWeight="Bold" Text="{StaticResource Text.Dashboard.Explore}"/>
</StackPanel>
</Button>
<Button Click="Terminal" Margin="4,0,0,0" ToolTip="{StaticResource Text.Dashboard.Terminal.Tip}" BorderThickness="0">
<Button Click="Terminal" Margin="6,0" ToolTip="{StaticResource Text.Dashboard.Terminal.Tip}" BorderThickness="0">
<StackPanel Orientation="Horizontal">
<Path Width="13" Height="13" Data="{StaticResource Icon.Terminal}"/>
<Label Content="{StaticResource Text.Dashboard.Terminal}"/>
<TextBlock Margin="4,0" FontWeight="Bold" Text="{StaticResource Text.Dashboard.Terminal}"/>
</StackPanel>
</Button>
</StackPanel>
<StackPanel Grid.Column="1" Orientation="Horizontal">
<Button Click="OpenFetch" BorderThickness="0">
<StackPanel Orientation="Horizontal" Margin="6,0">
<Button Click="OpenFetch" Margin="8,0" BorderThickness="0">
<StackPanel Orientation="Horizontal">
<Path Width="14" Height="14" Data="{StaticResource Icon.Fetch}"/>
<Label Content="{StaticResource Text.Fetch}" Margin="2,0,0,0"/>
<TextBlock Margin="4,0" FontWeight="Bold" Text="{StaticResource Text.Fetch}"/>
</StackPanel>
</Button>
<Button Click="OpenPull" BorderThickness="0">
<StackPanel Orientation="Horizontal" Margin="6,0">
<Button Click="OpenPull" Margin="8,0" BorderThickness="0">
<StackPanel Orientation="Horizontal">
<Path Width="14" Height="14" Data="{StaticResource Icon.Pull}"/>
<Label Content="{StaticResource Text.Pull}" Margin="2,0,0,0"/>
<TextBlock Margin="4,0" FontWeight="Bold" Text="{StaticResource Text.Pull}"/>
</StackPanel>
</Button>
<Button Click="OpenPush" BorderThickness="0">
<StackPanel Orientation="Horizontal" Margin="6,0">
<Button Click="OpenPush" Margin="8,0" BorderThickness="0">
<StackPanel Orientation="Horizontal">
<Path Width="14" Height="14" Data="{StaticResource Icon.Push}"/>
<Label Content="{StaticResource Text.Push}" Margin="2,0,0,0"/>
<TextBlock Margin="4,0" FontWeight="Bold" Text="{StaticResource Text.Push}"/>
</StackPanel>
</Button>
<Button Click="OpenStash" BorderThickness="0">
<StackPanel Orientation="Horizontal" Margin="6,0">
<Button Click="OpenStash" Margin="8,0" BorderThickness="0">
<StackPanel Orientation="Horizontal">
<Path Width="14" Height="14" Data="{StaticResource Icon.SaveStash}"/>
<Label Content="{StaticResource Text.Stash}" Margin="2,0,0,0"/>
<TextBlock Margin="4,0" FontWeight="Bold" Text="{StaticResource Text.Stash}"/>
</StackPanel>
</Button>
<Button Click="OpenApply" BorderThickness="0">
<StackPanel Orientation="Horizontal" Margin="6,0">
<Path Width="14" Height="14" Margin="0,2,0,0" Data="{StaticResource Icon.Apply}"/>
<Label Content="{StaticResource Text.Apply}" Margin="2,0,0,0"/>
<Button Click="OpenApply" Margin="8,0" BorderThickness="0">
<StackPanel Orientation="Horizontal">
<Path Width="14" Height="14" Data="{StaticResource Icon.Apply}"/>
<TextBlock Margin="4,0" FontWeight="Bold" Text="{StaticResource Text.Apply}"/>
</StackPanel>
</Button>
</StackPanel>
<StackPanel Grid.Column="2" Orientation="Horizontal" HorizontalAlignment="Right">
<Button Click="OpenSearch" Margin="4,0,0,0" BorderThickness="0" ToolTip="{StaticResource Text.Dashboard.Search.Tip}">
<Button Click="OpenSearch" Margin="6,0" BorderThickness="0" ToolTip="{StaticResource Text.Dashboard.Search.Tip}">
<StackPanel Orientation="Horizontal">
<Path Width="16" Height="16" Data="{StaticResource Icon.Search}"/>
<Label Content="{StaticResource Text.Dashboard.Search}"/>
<Path Width="14" Height="14" Data="{StaticResource Icon.Search}"/>
<TextBlock Margin="4,0" FontWeight="Bold" Text="{StaticResource Text.Dashboard.Search}"/>
</StackPanel>
</Button>
<Button Click="OpenConfigure" Margin="4,0,0,0" BorderThickness="0" ToolTip="{StaticResource Text.Dashboard.Configure.Tip}">
<Button Click="OpenConfigure" Margin="6,0" BorderThickness="0" ToolTip="{StaticResource Text.Dashboard.Configure.Tip}">
<StackPanel Orientation="Horizontal">
<Path Width="16" Height="16" Data="{StaticResource Icon.Setting}"/>
<Label Content="{StaticResource Text.Configure}"/>
<Path Width="14" Height="14" Data="{StaticResource Icon.Setting}"/>
<TextBlock Margin="4,0" FontWeight="Bold" Text="{StaticResource Text.Configure}"/>
</StackPanel>
</Button>
</StackPanel>

View file

@ -448,9 +448,11 @@ namespace SourceGit.Views.Widgets {
textContent.SetBinding(TextBlock.ForegroundProperty, new Binding("FG"));
textContent.SetBinding(TextBlock.FontStyleProperty, new Binding("Style"));
textContent.SetValue(TextBlock.BackgroundProperty, Brushes.Transparent);
textContent.SetValue(TextBlock.FontSizeProperty, 12.0);
textContent.SetValue(TextBlock.FontSizeProperty, new FontSizeConverter().ConvertFrom("10pt"));
textContent.SetValue(TextBlock.MarginProperty, new Thickness(0));
textContent.SetValue(TextBlock.PaddingProperty, new Thickness(4, 0, 0, 0));
textContent.SetValue(TextOptions.TextFormattingModeProperty, TextFormattingMode.Display);
textContent.SetValue(TextOptions.TextRenderingModeProperty, TextRenderingMode.ClearType);
var visualTree = new FrameworkElementFactory(typeof(Grid));
visualTree.AppendChild(borderContent);

View file

@ -77,7 +77,7 @@
</Border>
<Border x:Name="Color" Background="#FFFFB835">
<TextBlock Text="{Binding Name}" FontSize="11" Margin="4,0" Foreground="Black"/>
<TextBlock Text="{Binding Name}" FontSize="8pt" Margin="4,0" Foreground="Black"/>
</Border>
</StackPanel>
@ -97,7 +97,7 @@
</ItemsControl.ItemTemplate>
</ItemsControl>
<TextBlock Text="{Binding Subject}" Margin="2,0,0,0"/>
<TextBlock Text="{Binding Subject}" FontFamily="Consolas,SimSun" FontSize="10pt" Margin="2,0,0,0"/>
</StackPanel>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
@ -118,7 +118,7 @@
<DataGridTemplateColumn Width="Auto" IsReadOnly="True">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Committer.Name}" Margin="0,0,8,0"/>
<TextBlock Text="{Binding Committer.Name}" FontFamily="Consolas,SimSun" FontSize="10pt" Margin="0,0,8,0"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
@ -126,15 +126,15 @@
<DataGridTemplateColumn Width="64" IsReadOnly="True">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding ShortSHA}"/>
<TextBlock Text="{Binding ShortSHA}" FontSize="10pt"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Width="128" IsReadOnly="True">
<DataGridTemplateColumn Width="140" IsReadOnly="True">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Committer.Time}"/>
<TextBlock Text="{Binding Committer.Time}" FontSize="10pt"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>

View file

@ -70,7 +70,7 @@
Grid.Column="1"
Text="{Binding Path, Converter={StaticResource PureFileName}}"
Margin="4,0,0,0"
FontSize="11"/>
FontSize="9pt"/>
</Grid>
<HierarchicalDataTemplate.Triggers>