Skip to content
This repository has been archived by the owner on Jun 21, 2023. It is now read-only.

Commit

Permalink
Add design time resources for font scaling
Browse files Browse the repository at this point in the history
Add scaling styles for built in Labels and TextBlocks on Visual Studio 2015 and up.
  • Loading branch information
jcansdale committed May 3, 2019
1 parent efd10b8 commit 0971918
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/GitHub.InlineReviews/Properties/DesignTimeResources.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
<ResourceDictionary Source="pack://application:,,,/GitHub.VisualStudio.UI;component/Themes/Dark/ThemedDialogColors.xaml" />
<ResourceDictionary Source="pack://application:,,,/GitHub.VisualStudio.UI;component/Themes/Dark/EnvironmentColors.xaml" />
<ResourceDictionary Source="pack://application:,,,/GitHub.VisualStudio.UI;component/Themes/Dark/TreeViewColors.xaml" />
<ResourceDictionary Source="pack://application:,,,/GitHub.VisualStudio.UI;component/Themes/FontScalingLabelStyle.xaml" />
<ResourceDictionary Source="pack://application:,,,/GitHub.VisualStudio.UI;component/Themes/FontScalingTextBlockStyle.xaml" />
<ResourceDictionary Source="pack://application:,,,/GitHub.VisualStudio.UI;component/Themes/CommonControlsButtonStyle.xaml" />
<ResourceDictionary Source="pack://application:,,,/GitHub.VisualStudio.UI;component/Themes/CommonControlsCheckboxStyle.xaml" />
<ResourceDictionary Source="pack://application:,,,/GitHub.VisualStudio.UI;component/Themes/CommonControlsComboboxStyle.xaml" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
<ResourceDictionary Source="/Themes/Dark/ThemedDialogColors.xaml" />
<ResourceDictionary Source="/Themes/Dark/EnvironmentColors.xaml" />
<ResourceDictionary Source="/Themes/Dark/TreeViewColors.xaml" />
<ResourceDictionary Source="/Themes/FontScalingLabelStyle.xaml" />
<ResourceDictionary Source="/Themes/FontScalingTextBlockStyle.xaml" />
<ResourceDictionary Source="/Themes/CommonControlsButtonStyle.xaml" />
<ResourceDictionary Source="/Themes/CommonControlsCheckboxStyle.xaml" />
<ResourceDictionary Source="/Themes/CommonControlsComboboxStyle.xaml" />
Expand Down
47 changes: 47 additions & 0 deletions src/GitHub.VisualStudio.UI/Themes/FontScalingLabelStyle.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<ResourceDictionary
x:Uid="ResourceDictionary_1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:vsfx="clr-namespace:Microsoft.VisualStudio.Shell;assembly=Microsoft.VisualStudio.Shell.14.0">

<Style x:Uid="Style_1" TargetType="{x:Type Label}" x:Key="{x:Static vsfx:VsResourceKeys.LabelEnvironment375PercentFontSizeStyleKey}">
<Setter x:Uid="Setter_1" Property="FontSize" Value="{DynamicResource {x:Static vsfx:VsFonts.Environment375PercentFontSizeKey}}" />
<Setter x:Uid="Setter_2" Property="FontWeight" Value="{DynamicResource {x:Static vsfx:VsFonts.Environment375PercentFontWeightKey}}" />
<Setter x:Uid="Setter_3" Property="TextOptions.TextFormattingMode" Value="Ideal" />
</Style>

<Style x:Uid="Style_2" TargetType="{x:Type Label}" x:Key="{x:Static vsfx:VsResourceKeys.LabelEnvironment310PercentFontSizeStyleKey}">
<Setter x:Uid="Setter_4" Property="FontSize" Value="{DynamicResource {x:Static vsfx:VsFonts.Environment310PercentFontSizeKey}}" />
<Setter x:Uid="Setter_5" Property="FontWeight" Value="{DynamicResource {x:Static vsfx:VsFonts.Environment310PercentFontWeightKey}}" />
<Setter x:Uid="Setter_6" Property="TextOptions.TextFormattingMode" Value="Ideal" />
</Style>

<Style x:Uid="Style_11" TargetType="{x:Type Label}" x:Key="{x:Static vsfx:VsResourceKeys.LabelEnvironment200PercentFontSizeStyleKey}">
<Setter x:Uid="Setter_30" Property="FontSize" Value="{DynamicResource {x:Static vsfx:VsFonts.Environment200PercentFontSizeKey}}" />
<Setter x:Uid="Setter_31" Property="FontWeight" Value="{DynamicResource {x:Static vsfx:VsFonts.Environment200PercentFontWeightKey}}" />
<Setter x:Uid="Setter_32" Property="TextOptions.TextFormattingMode" Value="Ideal" />
</Style>

<Style x:Uid="Style_4" TargetType="{x:Type Label}" x:Key="{x:Static vsfx:VsResourceKeys.LabelEnvironment155PercentFontSizeStyleKey}">
<Setter x:Uid="Setter_10" Property="FontSize" Value="{DynamicResource {x:Static vsfx:VsFonts.Environment155PercentFontSizeKey}}" />
<Setter x:Uid="Setter_11" Property="FontWeight" Value="{DynamicResource {x:Static vsfx:VsFonts.Environment155PercentFontWeightKey}}" />
<Setter x:Uid="Setter_12" Property="TextOptions.TextFormattingMode" Value="Ideal" />
</Style>

<Style x:Uid="Style_5" TargetType="{x:Type Label}" x:Key="{x:Static vsfx:VsResourceKeys.LabelEnvironment133PercentFontSizeStyleKey}">
<Setter x:Uid="Setter_13" Property="FontSize" Value="{DynamicResource {x:Static vsfx:VsFonts.Environment133PercentFontSizeKey}}" />
<Setter x:Uid="Setter_14" Property="FontWeight" Value="{DynamicResource {x:Static vsfx:VsFonts.Environment133PercentFontWeightKey}}" />
<Setter x:Uid="Setter_15" Property="TextOptions.TextFormattingMode" Value="Ideal" />
</Style>

<Style x:Uid="Style_6" TargetType="{x:Type Label}" x:Key="{x:Static vsfx:VsResourceKeys.LabelEnvironment122PercentFontSizeStyleKey}">
<Setter x:Uid="Setter_16" Property="FontSize" Value="{DynamicResource {x:Static vsfx:VsFonts.Environment122PercentFontSizeKey}}" />
<Setter x:Uid="Setter_17" Property="FontWeight" Value="{DynamicResource {x:Static vsfx:VsFonts.Environment122PercentFontWeightKey}}" />
<Setter x:Uid="Setter_18" Property="TextOptions.TextFormattingMode" Value="Ideal" />
</Style>

<Style x:Uid="Style_8" TargetType="{x:Type Label}" x:Key="{x:Static vsfx:VsResourceKeys.LabelEnvironmentBoldStyleKey}">
<Setter x:Uid="Setter_22" Property="FontSize" Value="{DynamicResource {x:Static vsfx:VsFonts.EnvironmentFontSizeKey}}" />
<Setter x:Uid="Setter_23" Property="FontWeight" Value="{DynamicResource {x:Static vsfx:VsFonts.EnvironmentBoldFontWeightKey}}" />
</Style>

</ResourceDictionary>
47 changes: 47 additions & 0 deletions src/GitHub.VisualStudio.UI/Themes/FontScalingTextBlockStyle.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<ResourceDictionary
x:Uid="ResourceDictionary_1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:vsfx="clr-namespace:Microsoft.VisualStudio.Shell;assembly=Microsoft.VisualStudio.Shell.14.0">

<Style x:Uid="Style_1" TargetType="{x:Type TextBlock}" x:Key="{x:Static vsfx:VsResourceKeys.TextBlockEnvironment375PercentFontSizeStyleKey}">
<Setter x:Uid="Setter_1" Property="FontSize" Value="{DynamicResource {x:Static vsfx:VsFonts.Environment375PercentFontSizeKey}}" />
<Setter x:Uid="Setter_2" Property="FontWeight" Value="{DynamicResource {x:Static vsfx:VsFonts.Environment375PercentFontWeightKey}}" />
<Setter x:Uid="Setter_3" Property="TextOptions.TextFormattingMode" Value="Ideal" />
</Style>

<Style x:Uid="Style_2" TargetType="{x:Type TextBlock}" x:Key="{x:Static vsfx:VsResourceKeys.TextBlockEnvironment310PercentFontSizeStyleKey}">
<Setter x:Uid="Setter_4" Property="FontSize" Value="{DynamicResource {x:Static vsfx:VsFonts.Environment310PercentFontSizeKey}}" />
<Setter x:Uid="Setter_5" Property="FontWeight" Value="{DynamicResource {x:Static vsfx:VsFonts.Environment310PercentFontWeightKey}}" />
<Setter x:Uid="Setter_6" Property="TextOptions.TextFormattingMode" Value="Ideal" />
</Style>

<Style x:Uid="Style_11" TargetType="{x:Type TextBlock}" x:Key="{x:Static vsfx:VsResourceKeys.TextBlockEnvironment200PercentFontSizeStyleKey}">
<Setter x:Uid="Setter_30" Property="FontSize" Value="{DynamicResource {x:Static vsfx:VsFonts.Environment200PercentFontSizeKey}}" />
<Setter x:Uid="Setter_31" Property="FontWeight" Value="{DynamicResource {x:Static vsfx:VsFonts.Environment200PercentFontWeightKey}}" />
<Setter x:Uid="Setter_32" Property="TextOptions.TextFormattingMode" Value="Ideal" />
</Style>

<Style x:Uid="Style_4" TargetType="{x:Type TextBlock}" x:Key="{x:Static vsfx:VsResourceKeys.TextBlockEnvironment155PercentFontSizeStyleKey}">
<Setter x:Uid="Setter_10" Property="FontSize" Value="{DynamicResource {x:Static vsfx:VsFonts.Environment155PercentFontSizeKey}}" />
<Setter x:Uid="Setter_11" Property="FontWeight" Value="{DynamicResource {x:Static vsfx:VsFonts.Environment155PercentFontWeightKey}}" />
<Setter x:Uid="Setter_12" Property="TextOptions.TextFormattingMode" Value="Ideal" />
</Style>

<Style x:Uid="Style_5" TargetType="{x:Type TextBlock}" x:Key="{x:Static vsfx:VsResourceKeys.TextBlockEnvironment133PercentFontSizeStyleKey}">
<Setter x:Uid="Setter_13" Property="FontSize" Value="{DynamicResource {x:Static vsfx:VsFonts.Environment133PercentFontSizeKey}}" />
<Setter x:Uid="Setter_14" Property="FontWeight" Value="{DynamicResource {x:Static vsfx:VsFonts.Environment133PercentFontWeightKey}}" />
<Setter x:Uid="Setter_15" Property="TextOptions.TextFormattingMode" Value="Ideal" />
</Style>

<Style x:Uid="Style_6" TargetType="{x:Type TextBlock}" x:Key="{x:Static vsfx:VsResourceKeys.TextBlockEnvironment122PercentFontSizeStyleKey}">
<Setter x:Uid="Setter_16" Property="FontSize" Value="{DynamicResource {x:Static vsfx:VsFonts.Environment122PercentFontSizeKey}}" />
<Setter x:Uid="Setter_17" Property="FontWeight" Value="{DynamicResource {x:Static vsfx:VsFonts.Environment122PercentFontWeightKey}}" />
<Setter x:Uid="Setter_18" Property="TextOptions.TextFormattingMode" Value="Ideal" />
</Style>

<Style x:Uid="Style_8" TargetType="{x:Type TextBlock}" x:Key="{x:Static vsfx:VsResourceKeys.TextBlockEnvironmentBoldStyleKey}">
<Setter x:Uid="Setter_22" Property="FontSize" Value="{DynamicResource {x:Static vsfx:VsFonts.EnvironmentFontSizeKey}}" />
<Setter x:Uid="Setter_23" Property="FontWeight" Value="{DynamicResource {x:Static vsfx:VsFonts.EnvironmentBoldFontWeightKey}}" />
</Style>

</ResourceDictionary>

0 comments on commit 0971918

Please sign in to comment.