Skip to content

Commit f3e5ce5

Browse files
Add some metrics, disable drawing comparison
1 parent 9873490 commit f3e5ce5

File tree

5 files changed

+40
-48
lines changed

5 files changed

+40
-48
lines changed

SixLabors.Fonts.sln

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Microsoft Visual Studio Solution File, Format Version 12.00
22
# Visual Studio Version 18
3-
VisualStudioVersion = 18.0.11012.119 d18.0
3+
VisualStudioVersion = 18.0.11012.119
44
MinimumVisualStudioVersion = 10.0.40219.1
55
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_root", "_root", "{C317F1B1-D75E-4C6D-83EB-80367343E0D7}"
66
ProjectSection(SolutionItems) = preProject
@@ -73,10 +73,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "UnicodeTestData", "UnicodeT
7373
EndProject
7474
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SixLabors.Fonts.Benchmarks", "tests\SixLabors.Fonts.Benchmarks\SixLabors.Fonts.Benchmarks\SixLabors.Fonts.Benchmarks.csproj", "{FB8FDC5F-7FEB-4132-9133-C25E05C0B3D9}"
7575
EndProject
76-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DrawWithImageSharp", "samples\DrawWithImageSharp\DrawWithImageSharp.csproj", "{3D3F6164-6DE9-433F-8B20-61A40F53F343}"
77-
EndProject
78-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ImageSharp.Drawing", "..\ImageSharp.Drawing\src\ImageSharp.Drawing\ImageSharp.Drawing.csproj", "{B3CC1B00-B7A3-C49D-FDB4-942633326556}"
79-
EndProject
8076
Global
8177
GlobalSection(SolutionConfigurationPlatforms) = preSolution
8278
Debug|Any CPU = Debug|Any CPU
@@ -103,14 +99,6 @@ Global
10399
{FB8FDC5F-7FEB-4132-9133-C25E05C0B3D9}.Debug|Any CPU.Build.0 = Debug|Any CPU
104100
{FB8FDC5F-7FEB-4132-9133-C25E05C0B3D9}.Release|Any CPU.ActiveCfg = Release|Any CPU
105101
{FB8FDC5F-7FEB-4132-9133-C25E05C0B3D9}.Release|Any CPU.Build.0 = Release|Any CPU
106-
{3D3F6164-6DE9-433F-8B20-61A40F53F343}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
107-
{3D3F6164-6DE9-433F-8B20-61A40F53F343}.Debug|Any CPU.Build.0 = Debug|Any CPU
108-
{3D3F6164-6DE9-433F-8B20-61A40F53F343}.Release|Any CPU.ActiveCfg = Release|Any CPU
109-
{3D3F6164-6DE9-433F-8B20-61A40F53F343}.Release|Any CPU.Build.0 = Release|Any CPU
110-
{B3CC1B00-B7A3-C49D-FDB4-942633326556}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
111-
{B3CC1B00-B7A3-C49D-FDB4-942633326556}.Debug|Any CPU.Build.0 = Debug|Any CPU
112-
{B3CC1B00-B7A3-C49D-FDB4-942633326556}.Release|Any CPU.ActiveCfg = Release|Any CPU
113-
{B3CC1B00-B7A3-C49D-FDB4-942633326556}.Release|Any CPU.Build.0 = Release|Any CPU
114102
EndGlobalSection
115103
GlobalSection(SolutionProperties) = preSolution
116104
HideSolutionNode = FALSE
@@ -125,15 +113,12 @@ Global
125113
{ABB6E111-672F-4846-88D6-C49C6CD01606} = {249327CF-1415-428B-8EEA-8C7705B1DE8F}
126114
{654DD381-B93D-4459-B669-296F5D9172ED} = {56801022-D71A-4FBE-BC5B-CBA08E2284EC}
127115
{FB8FDC5F-7FEB-4132-9133-C25E05C0B3D9} = {56801022-D71A-4FBE-BC5B-CBA08E2284EC}
128-
{3D3F6164-6DE9-433F-8B20-61A40F53F343} = {71A3911C-D6B9-4EBE-9691-2FE28BDF462E}
129-
{B3CC1B00-B7A3-C49D-FDB4-942633326556} = {56801022-D71A-4FBE-BC5B-CBA08E2284EC}
130116
EndGlobalSection
131117
GlobalSection(ExtensibilityGlobals) = postSolution
132118
SolutionGuid = {38F4B47F-4F74-40F5-8707-C0EF1D0BDF92}
133119
EndGlobalSection
134120
GlobalSection(SharedMSBuildProjectFiles) = preSolution
135121
shared-infrastructure\src\SharedInfrastructure\SharedInfrastructure.projitems*{09e744ec-4852-4fc7-be78-c1b399f17967}*SharedItemsImports = 5
136122
shared-infrastructure\src\SharedInfrastructure\SharedInfrastructure.projitems*{abb6e111-672f-4846-88d6-c49c6cd01606}*SharedItemsImports = 5
137-
..\ImageSharp.Drawing\shared-infrastructure\src\SharedInfrastructure\SharedInfrastructure.projitems*{b3cc1b00-b7a3-c49d-fdb4-942633326556}*SharedItemsImports = 5
138123
EndGlobalSection
139124
EndGlobal

samples/DrawWithImageSharp/DrawWithImageSharp.csproj

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,12 @@
4141
</Content>
4242
</ItemGroup>
4343

44-
<ItemGroup>
45-
<ProjectReference Include="..\..\..\ImageSharp.Drawing\src\ImageSharp.Drawing\ImageSharp.Drawing.csproj" />
44+
<ItemGroup>
4645
<ProjectReference Include="..\..\src\SixLabors.Fonts\SixLabors.Fonts.csproj" />
4746
</ItemGroup>
4847

4948
<ItemGroup>
50-
<!--<PackageReference Include="SixLabors.ImageSharp.Drawing" Version="2.1.4" />-->
49+
<PackageReference Include="SixLabors.ImageSharp.Drawing" Version="2.1.4" />
5150
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
5251
</ItemGroup>
5352

Lines changed: 33 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright (c) Six Labors.
22
// Licensed under the Six Labors Split License.
33

4+
using SixLabors.Fonts.Rendering;
45
using SixLabors.Fonts.Unicode;
56

67
namespace SixLabors.Fonts.Tests.Issues;
@@ -16,16 +17,12 @@ public void CanRenderEmojiFont_With_COLRv1()
1617
Font font = this.emoji.CreateFont(100);
1718
const string text = "a😨 b😅\r\nc🥲 d🤩";
1819

19-
// There are too many metrics to validate here so we just ensure no exceptions are thrown
20-
// and the rendering looks correct by inspecting the snapshot.
21-
TextLayoutTestUtilities.TestLayout(
22-
text,
23-
new TextOptions(font)
24-
{
25-
ColorFontSupport = ColorFontSupport.ColrV1,
26-
LineSpacing = 1.8F,
27-
FallbackFontFamilies = new[] { this.noto },
28-
TextRuns = new List<TextRun>
20+
TextOptions options = new(font)
21+
{
22+
ColorFontSupport = ColorFontSupport.ColrV1,
23+
LineSpacing = 1.8F,
24+
FallbackFontFamilies = new[] { this.noto },
25+
TextRuns = new List<TextRun>
2926
{
3027
new()
3128
{
@@ -34,7 +31,17 @@ public void CanRenderEmojiFont_With_COLRv1()
3431
TextDecorations = TextDecorations.Strikeout | TextDecorations.Underline | TextDecorations.Overline
3532
}
3633
}
37-
},
34+
};
35+
36+
GlyphRenderer renderer = new();
37+
TextRenderer.RenderTextTo(renderer, text, options);
38+
Assert.Equal(10, renderer.GlyphKeys.Count);
39+
40+
// There are too many metrics to validate here so we just ensure no exceptions are thrown
41+
// and the rendering looks correct by inspecting the snapshot.
42+
TextLayoutTestUtilities.TestLayout(
43+
text,
44+
options,
3845
includeGeometry: true);
3946
}
4047

@@ -44,14 +51,12 @@ public void CanRenderEmojiFont_With_SVG()
4451
Font font = this.emoji.CreateFont(100);
4552
const string text = "a😨 b😅\r\nc🥲 d🤩";
4653

47-
TextLayoutTestUtilities.TestLayout(
48-
text,
49-
new TextOptions(font)
50-
{
51-
ColorFontSupport = ColorFontSupport.Svg,
52-
LineSpacing = 1.8F,
53-
FallbackFontFamilies = new[] { this.noto },
54-
TextRuns = new List<TextRun>
54+
TextOptions options = new(font)
55+
{
56+
ColorFontSupport = ColorFontSupport.Svg,
57+
LineSpacing = 1.8F,
58+
FallbackFontFamilies = new[] { this.noto },
59+
TextRuns = new List<TextRun>
5560
{
5661
new()
5762
{
@@ -60,7 +65,15 @@ public void CanRenderEmojiFont_With_SVG()
6065
TextDecorations = TextDecorations.Strikeout | TextDecorations.Underline | TextDecorations.Overline
6166
}
6267
}
63-
},
68+
};
69+
70+
GlyphRenderer renderer = new();
71+
TextRenderer.RenderTextTo(renderer, text, options);
72+
Assert.Equal(10, renderer.GlyphKeys.Count);
73+
74+
TextLayoutTestUtilities.TestLayout(
75+
text,
76+
options,
6477
includeGeometry: true);
6578
}
6679
}

tests/SixLabors.Fonts.Tests/SixLabors.Fonts.Tests.csproj

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@
2929
Comment out this constant declaration to disable all tests based upon image generation.
3030
This allows us to make breaking changes to the Fonts API without breaking the tests.
3131
-->
32-
<DefineConstants>$(DefineConstants);SUPPORTS_DRAWING</DefineConstants>
33-
<HasSupportForDrawing Condition="$(DefineConstants.Contains('SUPPORTS_DRAWING'))">true</HasSupportForDrawing>
32+
<!--<DefineConstants>$(DefineConstants);SUPPORTS_DRAWING</DefineConstants>
33+
<HasSupportForDrawing Condition="$(DefineConstants.Contains('SUPPORTS_DRAWING'))">true</HasSupportForDrawing>-->
3434
</PropertyGroup>
3535

36-
<ItemGroup Condition="$(HasSupportForDrawing) == false">
36+
<ItemGroup Condition="$(HasSupportForDrawing) != true">
3737
<Compile Remove="ImageComparison\**" />
3838
</ItemGroup>
3939

@@ -56,8 +56,4 @@
5656
<PegGrammar Include="..\..\src\UnicodeTrieGenerator\StateAutomation\Grammar.peg" Link="Unicode\StateAutomation\Grammar.peg" />
5757
</ItemGroup>
5858

59-
<ItemGroup>
60-
<ProjectReference Include="..\..\..\ImageSharp.Drawing\src\ImageSharp.Drawing\ImageSharp.Drawing.csproj" Condition="$(HasSupportForDrawing)"/>
61-
</ItemGroup>
62-
6359
</Project>

tests/SixLabors.Fonts.Tests/TextLayoutTests.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
using SixLabors.Fonts.Rendering;
77
using SixLabors.Fonts.Tests.Fakes;
88
using SixLabors.Fonts.Unicode;
9-
using SixLabors.ImageSharp.Drawing.Processing;
109

1110
namespace SixLabors.Fonts.Tests;
1211

@@ -553,7 +552,7 @@ public void CountLinesWithSpan()
553552
public void CountLinesWrappingLength(string text, int wrappingLength, int usedLines)
554553
{
555554
Font font = CreateRenderingFont();
556-
RichTextOptions options = new(font)
555+
TextOptions options = new(font)
557556
{
558557
WrappingLength = wrappingLength
559558
};

0 commit comments

Comments
 (0)