Browse Source
Merge pull request #10293 from Gillibald/feature/moveThemeFontAssets
Move theme font assets to a dedicated package
pull/10476/head
Max Katz
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
29 changed files with
48 additions and
19 deletions
-
Avalonia.sln
-
samples/ControlCatalog/ControlCatalog.csproj
-
BIN
src/Avalonia.Fonts.Inter/Assets/Inter-Bold.otf
-
BIN
src/Avalonia.Fonts.Inter/Assets/Inter-ExtraLight.otf
-
BIN
src/Avalonia.Fonts.Inter/Assets/Inter-Light.otf
-
BIN
src/Avalonia.Fonts.Inter/Assets/Inter-Medium.otf
-
BIN
src/Avalonia.Fonts.Inter/Assets/Inter-Regular.otf
-
BIN
src/Avalonia.Fonts.Inter/Assets/Inter-SemiBold.otf
-
BIN
src/Avalonia.Fonts.Inter/Assets/Inter-Thin.otf
-
src/Avalonia.Fonts.Inter/Avalonia.Fonts.Inter.csproj
-
src/Avalonia.Fonts.Inter/Properties/AssemblyInfo.cs
-
src/Avalonia.Themes.Fluent/Accents/Base.xaml
-
BIN
src/Avalonia.Themes.Fluent/Assets/Inter-Bold.ttf
-
BIN
src/Avalonia.Themes.Fluent/Assets/Inter-ExtraLight.ttf
-
BIN
src/Avalonia.Themes.Fluent/Assets/Inter-Light.ttf
-
BIN
src/Avalonia.Themes.Fluent/Assets/Inter-Medium.ttf
-
BIN
src/Avalonia.Themes.Fluent/Assets/Inter-Regular.ttf
-
BIN
src/Avalonia.Themes.Fluent/Assets/Inter-SemiBold.ttf
-
BIN
src/Avalonia.Themes.Fluent/Assets/Inter-Thin.ttf
-
src/Avalonia.Themes.Fluent/Avalonia.Themes.Fluent.csproj
-
src/Avalonia.Themes.Fluent/Controls/EmbeddableControlRoot.xaml
-
src/Avalonia.Themes.Simple/Accents/Base.xaml
-
src/Avalonia.Themes.Simple/Controls/EmbeddableControlRoot.xaml
-
src/Avalonia.Themes.Simple/Controls/OverlayPopupHost.xaml
-
src/Avalonia.Themes.Simple/Controls/PopupRoot.xaml
-
src/Avalonia.Themes.Simple/Controls/Window.xaml
-
src/Skia/Avalonia.Skia/FontManagerImpl.cs
-
src/Skia/Avalonia.Skia/Helpers/DrawingContextHelper.cs
-
tests/Avalonia.Markup.Xaml.UnitTests/Xaml/BasicTests.cs
|
|
|
@ -244,6 +244,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avalonia.Controls.ItemsRepe |
|
|
|
EndProject |
|
|
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avalonia.Controls.ItemsRepeater.UnitTests", "tests\Avalonia.Controls.ItemsRepeater.UnitTests\Avalonia.Controls.ItemsRepeater.UnitTests.csproj", "{F4E36AA8-814E-4704-BC07-291F70F45193}" |
|
|
|
EndProject |
|
|
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Avalonia.Fonts.Inter", "src\Avalonia.Fonts.Inter\Avalonia.Fonts.Inter.csproj", "{13F1135D-BA1A-435C-9C5B-A368D1D63DE4}" |
|
|
|
EndProject |
|
|
|
Global |
|
|
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution |
|
|
|
Debug|Any CPU = Debug|Any CPU |
|
|
|
@ -571,6 +573,10 @@ Global |
|
|
|
{F4E36AA8-814E-4704-BC07-291F70F45193}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|
|
|
{F4E36AA8-814E-4704-BC07-291F70F45193}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|
|
|
{F4E36AA8-814E-4704-BC07-291F70F45193}.Release|Any CPU.Build.0 = Release|Any CPU |
|
|
|
{13F1135D-BA1A-435C-9C5B-A368D1D63DE4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|
|
|
{13F1135D-BA1A-435C-9C5B-A368D1D63DE4}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|
|
|
{13F1135D-BA1A-435C-9C5B-A368D1D63DE4}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|
|
|
{13F1135D-BA1A-435C-9C5B-A368D1D63DE4}.Release|Any CPU.Build.0 = Release|Any CPU |
|
|
|
EndGlobalSection |
|
|
|
GlobalSection(SolutionProperties) = preSolution |
|
|
|
HideSolutionNode = FALSE |
|
|
|
|
|
|
|
@ -29,6 +29,7 @@ |
|
|
|
<ProjectReference Include="..\..\src\Avalonia.Controls.ItemsRepeater\Avalonia.Controls.ItemsRepeater.csproj" /> |
|
|
|
<ProjectReference Include="..\..\src\Avalonia.Themes.Simple\Avalonia.Themes.Simple.csproj" /> |
|
|
|
<ProjectReference Include="..\..\src\Avalonia.Themes.Fluent\Avalonia.Themes.Fluent.csproj" /> |
|
|
|
<ProjectReference Include="..\..\src\Avalonia.Fonts.Inter\Avalonia.Fonts.Inter.csproj" /> |
|
|
|
<ProjectReference Include="..\MiniMvvm\MiniMvvm.csproj" /> |
|
|
|
<ProjectReference Include="..\SampleControls\ControlSamples.csproj" /> |
|
|
|
</ItemGroup> |
|
|
|
|
|
|
|
@ -0,0 +1,13 @@ |
|
|
|
<Project Sdk="Microsoft.NET.Sdk"> |
|
|
|
<PropertyGroup> |
|
|
|
<TargetFrameworks>net6.0;netstandard2.0</TargetFrameworks> |
|
|
|
<PackageId>Avalonia.Fonts.Inter</PackageId> |
|
|
|
</PropertyGroup> |
|
|
|
<ItemGroup> |
|
|
|
<AvaloniaResource Include="Assets\*" /> |
|
|
|
</ItemGroup> |
|
|
|
<ItemGroup> |
|
|
|
<ProjectReference Include="..\Avalonia.Base\Avalonia.Base.csproj" /> |
|
|
|
</ItemGroup> |
|
|
|
<Import Project="..\..\build\BuildTargets.targets" /> |
|
|
|
</Project> |
|
|
|
@ -0,0 +1,3 @@ |
|
|
|
using Avalonia.Metadata; |
|
|
|
|
|
|
|
[assembly: XmlnsDefinition("https://github.com/avaloniaui", "Avalonia.Fonts.Inter")] |
|
|
|
@ -3,7 +3,7 @@ |
|
|
|
xmlns:sys="using:System" |
|
|
|
xmlns:converters="using:Avalonia.Controls.Converters"> |
|
|
|
<!-- https://docs.microsoft.com/en-us/previous-versions/windows/apps/dn518235(v=win.10)?redirectedfrom=MSDN --> |
|
|
|
<FontFamily x:Key="ContentControlThemeFontFamily">avares://Avalonia.Themes.Fluent/Assets#Inter</FontFamily> |
|
|
|
<FontFamily x:Key="ContentControlThemeFontFamily">avares://Avalonia.Fonts.Inter/Assets#Inter, $Default</FontFamily> |
|
|
|
<sys:Double x:Key="ControlContentThemeFontSize">14</sys:Double> |
|
|
|
|
|
|
|
<SolidColorBrush x:Key="SystemControlTransparentBrush" Color="Transparent" /> |
|
|
|
|
|
|
|
@ -9,8 +9,7 @@ |
|
|
|
<ProjectReference Include="..\Avalonia.Controls\Avalonia.Controls.csproj" /> |
|
|
|
<ProjectReference Include="..\Avalonia.Dialogs\Avalonia.Dialogs.csproj" /> |
|
|
|
<ProjectReference Include="..\Markup\Avalonia.Markup.Xaml\Avalonia.Markup.Xaml.csproj" /> |
|
|
|
<AvaloniaResource Include="**/*.xaml" /> |
|
|
|
<AvaloniaResource Include="Assets\*" /> |
|
|
|
<AvaloniaResource Include="**/*.xaml" /> |
|
|
|
</ItemGroup> |
|
|
|
<Import Project="..\..\build\NullableEnable.props" /> |
|
|
|
<Import Project="..\..\build\BuildTargets.targets" /> |
|
|
|
|
|
|
|
@ -4,6 +4,7 @@ |
|
|
|
<Setter Property="Foreground" Value="{DynamicResource SystemControlForegroundBaseHighBrush}"/> |
|
|
|
<Setter Property="Background" Value="{DynamicResource SystemControlBackgroundAltHighBrush}"/> |
|
|
|
<Setter Property="FontSize" Value="{DynamicResource ControlContentThemeFontSize}"/> |
|
|
|
<Setter Property="FontFamily" Value="{DynamicResource ContentControlThemeFontFamily}" /> |
|
|
|
<Setter Property="Template"> |
|
|
|
<ControlTemplate> |
|
|
|
<Panel> |
|
|
|
|
|
|
|
@ -76,6 +76,7 @@ |
|
|
|
<SolidColorBrush x:Key="RefreshVisualizerBackground" Color="Transparent" /> |
|
|
|
</ResourceDictionary> |
|
|
|
</ResourceDictionary.ThemeDictionaries> |
|
|
|
<FontFamily x:Key="ContentControlThemeFontFamily">avares://Avalonia.Fonts.Inter/Assets#Inter, $Default</FontFamily> |
|
|
|
<Color x:Key="ThemeAccentColor">#CC119EDA</Color> |
|
|
|
<Color x:Key="ThemeAccentColor2">#99119EDA</Color> |
|
|
|
<Color x:Key="ThemeAccentColor3">#66119EDA</Color> |
|
|
|
|
|
|
|
@ -5,6 +5,7 @@ |
|
|
|
<Setter Property="Foreground" Value="{DynamicResource ThemeForegroundBrush}" /> |
|
|
|
<Setter Property="Background" Value="{DynamicResource ThemeBackgroundBrush}" /> |
|
|
|
<Setter Property="FontSize" Value="{DynamicResource FontSizeNormal}" /> |
|
|
|
<Setter Property="FontFamily" Value="{DynamicResource ContentControlThemeFontFamily}" /> |
|
|
|
<Setter Property="Template"> |
|
|
|
<ControlTemplate> |
|
|
|
<Panel> |
|
|
|
|
|
|
|
@ -4,9 +4,7 @@ |
|
|
|
TargetType="OverlayPopupHost"> |
|
|
|
<Setter Property="Foreground" Value="{DynamicResource ThemeForegroundBrush}" /> |
|
|
|
<Setter Property="FontSize" Value="{DynamicResource FontSizeNormal}" /> |
|
|
|
<Setter Property="FontFamily" Value="{x:Static FontFamily.Default}" /> |
|
|
|
<Setter Property="FontWeight" Value="400" /> |
|
|
|
<Setter Property="FontStyle" Value="Normal" /> |
|
|
|
<Setter Property="FontFamily" Value="{DynamicResource ContentControlThemeFontFamily}" /> |
|
|
|
<Setter Property="Template"> |
|
|
|
<ControlTemplate> |
|
|
|
<!-- Do not forget to update Templated_Control_With_Popup_In_Template_Should_Set_TemplatedParent test --> |
|
|
|
|
|
|
|
@ -6,9 +6,7 @@ |
|
|
|
<Setter Property="TransparencyLevelHint" Value="Transparent" /> |
|
|
|
<Setter Property="Foreground" Value="{DynamicResource ThemeForegroundBrush}" /> |
|
|
|
<Setter Property="FontSize" Value="{DynamicResource FontSizeNormal}" /> |
|
|
|
<Setter Property="FontFamily" Value="{x:Static FontFamily.Default}" /> |
|
|
|
<Setter Property="FontWeight" Value="400" /> |
|
|
|
<Setter Property="FontStyle" Value="Normal" /> |
|
|
|
<Setter Property="FontFamily" Value="{DynamicResource ContentControlThemeFontFamily}" /> |
|
|
|
<Setter Property="Template"> |
|
|
|
<ControlTemplate> |
|
|
|
<LayoutTransformControl LayoutTransform="{TemplateBinding Transform}"> |
|
|
|
|
|
|
|
@ -2,6 +2,7 @@ |
|
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> |
|
|
|
<ControlTheme x:Key="{x:Type Window}" |
|
|
|
TargetType="Window"> |
|
|
|
<Setter Property="FontFamily" Value="{DynamicResource ContentControlThemeFontFamily}" /> |
|
|
|
<Setter Property="Background" Value="{DynamicResource ThemeBackgroundBrush}" /> |
|
|
|
<Setter Property="TransparencyBackgroundFallback" Value="{DynamicResource HighlightForegroundColor}" /> |
|
|
|
<Setter Property="Foreground" Value="{DynamicResource ThemeForegroundBrush}" /> |
|
|
|
|
|
|
|
@ -99,7 +99,20 @@ namespace Avalonia.Skia |
|
|
|
{ |
|
|
|
SKTypeface? skTypeface = null; |
|
|
|
|
|
|
|
if (typeface.FontFamily.Key is null) |
|
|
|
if(typeface.FontFamily.Key is not null) |
|
|
|
{ |
|
|
|
var fontCollection = SKTypefaceCollectionCache.GetOrAddTypefaceCollection(typeface.FontFamily); |
|
|
|
|
|
|
|
skTypeface = fontCollection.Get(typeface); |
|
|
|
|
|
|
|
if (skTypeface is null && !typeface.FontFamily.FamilyNames.HasFallbacks) |
|
|
|
{ |
|
|
|
throw new InvalidOperationException( |
|
|
|
$"Could not create glyph typeface for: {typeface.FontFamily.Name}."); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (skTypeface is null) |
|
|
|
{ |
|
|
|
var defaultName = SKTypeface.Default.FamilyName; |
|
|
|
|
|
|
|
@ -128,13 +141,7 @@ namespace Avalonia.Skia |
|
|
|
skTypeface ??= _skFontManager.MatchTypeface(SKTypeface.Default, fontStyle) |
|
|
|
?? SKTypeface.Default; |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
var fontCollection = SKTypefaceCollectionCache.GetOrAddTypefaceCollection(typeface.FontFamily); |
|
|
|
|
|
|
|
skTypeface = fontCollection.Get(typeface); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (skTypeface == null) |
|
|
|
{ |
|
|
|
throw new InvalidOperationException( |
|
|
|
|
|
|
|
@ -13,7 +13,6 @@ namespace Avalonia.Skia.Helpers |
|
|
|
/// </summary>
|
|
|
|
/// <param name="canvas"></param>
|
|
|
|
/// <param name="dpi"></param>
|
|
|
|
/// <param name="visualBrushRenderer"></param>
|
|
|
|
/// <returns>DrawingContext</returns>
|
|
|
|
public static IDrawingContextImpl WrapSkiaCanvas(SKCanvas canvas, Vector dpi) |
|
|
|
{ |
|
|
|
|
|
|
|
@ -702,9 +702,10 @@ namespace Avalonia.Markup.Xaml.UnitTests.Xaml |
|
|
|
|
|
|
|
// EndInit should be second-to-last operation, as last operation will be
|
|
|
|
// caused by styling being applied on EndInit.
|
|
|
|
Assert.Equal("EndInit 0", tracker.Order[tracker.Order.Count - 2]); |
|
|
|
Assert.Equal("EndInit 0", tracker.Order[tracker.Order.Count - 3]); |
|
|
|
|
|
|
|
// Caused by styling.
|
|
|
|
Assert.Equal("Property FontFamily Changed", tracker.Order[tracker.Order.Count - 2]); |
|
|
|
Assert.Equal("Property Foreground Changed", tracker.Order[tracker.Order.Count - 1]); |
|
|
|
} |
|
|
|
} |
|
|
|
|