Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 17 additions & 16 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,42 +19,43 @@ jobs:
- ${{ contains(github.event.pull_request.labels.*.name, 'arch:arm32') || contains(github.event.pull_request.labels.*.name, 'arch:arm64') }}
options:
- os: ubuntu-latest
framework: net7.0
sdk: 7.0.x
framework: net9.0
sdk: 9.0.x
sdk-preview: true
runtime: -x64
codecov: false
- os: macos-latest
framework: net7.0
sdk: 7.0.x
framework: net9.0
sdk: 9.0.x
sdk-preview: true
runtime: -x64
codecov: false
- os: windows-latest
framework: net7.0
sdk: 7.0.x
framework: net9.0
sdk: 9.0.x
sdk-preview: true
runtime: -x64
codecov: false
- os: buildjet-4vcpu-ubuntu-2204-arm
framework: net7.0
sdk: 7.0.x
framework: net9.0
sdk: 9.0.x
sdk-preview: true
runtime: -x64
codecov: false

- os: ubuntu-latest
framework: net6.0
sdk: 6.0.x
framework: net8.0
sdk: 8.0.x
runtime: -x64
codecov: false
- os: macos-latest
framework: net6.0
sdk: 6.0.x
framework: net8.0
sdk: 8.0.x
runtime: -x64
codecov: false
- os: windows-latest
framework: net6.0
sdk: 6.0.x
framework: net8.0
sdk: 8.0.x
runtime: -x64
codecov: true
exclude:
Expand Down Expand Up @@ -111,14 +112,14 @@ jobs:
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.0.x
8.0.x

- name: DotNet Setup Preview
if: ${{ matrix.options.sdk-preview == true }}
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
7.0.x
9.0.x

- name: DotNet Build
if: ${{ matrix.options.sdk-preview != true }}
Expand Down
6 changes: 3 additions & 3 deletions samples/DrawWithImageSharp/DrawWithImageSharp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@
<Choose>
<When Condition="$(SIXLABORS_TESTING_PREVIEW) == true">
<PropertyGroup>
<TargetFrameworks>net7.0;net6.0</TargetFrameworks>
<TargetFrameworks>net9.0;net8.0</TargetFrameworks>
</PropertyGroup>
</When>
<Otherwise>
<PropertyGroup>
<TargetFrameworks>net6.0</TargetFrameworks>
<TargetFrameworks>net8.0</TargetFrameworks>
</PropertyGroup>
</Otherwise>
</Choose>

<ItemGroup>
<Content Include="..\..\tests\SixLabors.Fonts.Tests\Fonts\**\*.ttf" Link="Fonts\%(Filename)%(Extension)">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
Expand Down
6 changes: 3 additions & 3 deletions samples/ListFonts/ListFonts.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@
<Choose>
<When Condition="$(SIXLABORS_TESTING_PREVIEW) == true">
<PropertyGroup>
<TargetFrameworks>net7.0;net6.0</TargetFrameworks>
<TargetFrameworks>net9.0;net8.0</TargetFrameworks>
</PropertyGroup>
</When>
<Otherwise>
<PropertyGroup>
<TargetFrameworks>net6.0</TargetFrameworks>
<TargetFrameworks>net8.0</TargetFrameworks>
</PropertyGroup>
</Otherwise>
</Choose>

<ItemGroup>
<ProjectReference Include="..\..\src\SixLabors.Fonts\SixLabors.Fonts.csproj" />
</ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions src/SixLabors.Fonts/FontCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ private FontFamily AddImpl(Stream stream, CultureInfo culture, out FontDescripti
return ((IFontMetricsCollection)this).AddMetrics(metrics, culture);
}

private IEnumerable<FontFamily> AddCollectionImpl(
private HashSet<FontFamily> AddCollectionImpl(
string path,
CultureInfo culture,
out IEnumerable<FontDescription> descriptions)
Expand All @@ -228,7 +228,7 @@ private IEnumerable<FontFamily> AddCollectionImpl(
return families;
}

private IEnumerable<FontFamily> AddCollectionImpl(
private HashSet<FontFamily> AddCollectionImpl(
Stream stream,
CultureInfo culture,
out IEnumerable<FontDescription> descriptions)
Expand All @@ -251,7 +251,7 @@ private IEnumerable<FontFamily> AddCollectionImpl(
return installedFamilies;
}

private IEnumerable<FontFamily> FamiliesByCultureImpl(CultureInfo culture)
private FontFamily[] FamiliesByCultureImpl(CultureInfo culture)
=> this.metricsCollection
.Select(x => x.Description.FontFamily(culture))
.Distinct()
Expand Down
5 changes: 1 addition & 4 deletions src/SixLabors.Fonts/IO/ZlibInflateStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,7 @@ public override void Flush()
/// <inheritdoc/>
public override int Read(byte[] buffer, int offset, int count)
{
if (this.deflateStream is null)
{
throw new ObjectDisposedException("inner stream");
}
ObjectDisposedException.ThrowIf(this.deflateStream is null, this.deflateStream);

// We don't check CRC on reading
int read = this.deflateStream.Read(buffer, offset, count);
Expand Down
16 changes: 3 additions & 13 deletions src/SixLabors.Fonts/SixLabors.Fonts.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,19 @@

<PropertyGroup>
<!--Bump to V2 prior to tagged release.-->
<MinVerMinimumMajorMinor>2.0</MinVerMinimumMajorMinor>
<MinVerMinimumMajorMinor>3.0</MinVerMinimumMajorMinor>
</PropertyGroup>

<Choose>
<When Condition="$(SIXLABORS_TESTING_PREVIEW) == true">
<PropertyGroup>
<TargetFrameworks>net7.0;net6.0</TargetFrameworks>
<TargetFrameworks>net9.0;net8.0</TargetFrameworks>
<IsTrimmable>true</IsTrimmable>
</PropertyGroup>
</When>
<Otherwise>
<PropertyGroup>
<TargetFrameworks>net6.0</TargetFrameworks>
<TargetFrameworks>net8.0</TargetFrameworks>
<IsTrimmable>true</IsTrimmable>
</PropertyGroup>
</Otherwise>
Expand All @@ -55,15 +55,5 @@
<None Include="..\..\shared-infrastructure\branding\icons\fonts\sixlabors.fonts.128.png" Pack="true" PackagePath="" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFrameworkIdentifier)' == '.NETStandard' ">
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="4.7.0" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
<PackageReference Include="System.Numerics.Vectors" Version="4.5.0" />
<PackageReference Include="System.Buffers" Version="4.5.1" />
<PackageReference Include="System.Memory" Version="4.5.4" />
</ItemGroup>

<Import Project="..\..\shared-infrastructure\src\SharedInfrastructure\SharedInfrastructure.projitems" Label="Shared" />
</Project>
2 changes: 1 addition & 1 deletion src/SixLabors.Fonts/StreamFontMetrics.Cff.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ private static StreamFontMetrics LoadCompactFont(FontReader reader)
return new StreamFontMetrics(tables);
}

private GlyphMetrics CreateCffGlyphMetrics(
private CffGlyphMetrics CreateCffGlyphMetrics(
in CodePoint codePoint,
ushort glyphId,
GlyphType glyphType,
Expand Down
2 changes: 1 addition & 1 deletion src/SixLabors.Fonts/StreamFontMetrics.TrueType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ private static StreamFontMetrics LoadTrueTypeFont(FontReader reader)
return new StreamFontMetrics(tables);
}

private GlyphMetrics CreateTrueTypeGlyphMetrics(
private TrueTypeGlyphMetrics CreateTrueTypeGlyphMetrics(
in CodePoint codePoint,
ushort glyphId,
GlyphType glyphType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -836,7 +836,7 @@ private static bool IsJoiner(GlyphShapingData data)
private static bool IsHalantOrCoeng(GlyphShapingData data)
=> data.IndicShapingEngineInfo != null && (data.IndicShapingEngineInfo.Category & HalantOrCoengFlags) != 0;

private static int NextSyllable(IGlyphShapingCollection collection, int index, int count)
private static int NextSyllable(GlyphSubstitutionCollection collection, int index, int count)
{
if (index >= count)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ private static void Reorder(IGlyphShapingCollection collection, int index, int c
}
}

private static int NextSyllable(IGlyphShapingCollection collection, int index, int count)
private static int NextSyllable(GlyphSubstitutionCollection collection, int index, int count)
{
if (index >= count)
{
Expand Down
11 changes: 6 additions & 5 deletions src/SixLabors.Fonts/TextLayout.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) Six Labors.
// Licensed under the Six Labors Split License.

using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Numerics;
Expand Down Expand Up @@ -188,7 +189,7 @@ private static TextBox ProcessText(ReadOnlySpan<char> text, TextOptions options)
return BreakLines(text, options, bidiRuns, bidiMap, positionings, layoutMode);
}

private static IReadOnlyList<GlyphLayout> LayoutText(TextBox textBox, TextOptions options)
private static ReadOnlyCollection<GlyphLayout> LayoutText(TextBox textBox, TextOptions options)
{
LayoutMode layoutMode = options.LayoutMode;
List<GlyphLayout> glyphs = new();
Expand Down Expand Up @@ -300,10 +301,10 @@ private static IReadOnlyList<GlyphLayout> LayoutText(TextBox textBox, TextOption
}
}

return glyphs;
return glyphs.AsReadOnly();
}

private static IEnumerable<GlyphLayout> LayoutLineHorizontal(
private static List<GlyphLayout> LayoutLineHorizontal(
TextBox textBox,
TextLine textLine,
TextDirection direction,
Expand Down Expand Up @@ -444,7 +445,7 @@ private static IEnumerable<GlyphLayout> LayoutLineHorizontal(
return glyphs;
}

private static IEnumerable<GlyphLayout> LayoutLineVertical(
private static List<GlyphLayout> LayoutLineVertical(
TextBox textBox,
TextLine textLine,
TextDirection direction,
Expand Down Expand Up @@ -602,7 +603,7 @@ private static IEnumerable<GlyphLayout> LayoutLineVertical(
return glyphs;
}

private static IEnumerable<GlyphLayout> LayoutLineVerticalMixed(
private static List<GlyphLayout> LayoutLineVerticalMixed(
TextBox textBox,
TextLine textLine,
TextDirection direction,
Expand Down
2 changes: 1 addition & 1 deletion src/SixLabors.Fonts/Unicode/LineBreakEnumerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public bool MoveNext()
return true;
}

bool? shouldBreak = this.GetSimpleBreak() ?? (bool?)this.GetPairTableBreak(lastClass);
bool? shouldBreak = this.GetSimpleBreak() ?? this.GetPairTableBreak(lastClass);

// Rule LB8a
this.lb8a = this.nextClass == LineBreakClass.ZWJ;
Expand Down
6 changes: 3 additions & 3 deletions src/UnicodeTrieGenerator/UnicodeTrieGenerator.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@
<Choose>
<When Condition="$(SIXLABORS_TESTING_PREVIEW) == true">
<PropertyGroup>
<TargetFrameworks>net7.0;net6.0</TargetFrameworks>
<TargetFrameworks>net9.0;net8.0</TargetFrameworks>
</PropertyGroup>
</When>
<Otherwise>
<PropertyGroup>
<TargetFrameworks>net6.0</TargetFrameworks>
<TargetFrameworks>net8.0</TargetFrameworks>
</PropertyGroup>
</Otherwise>
</Choose>

<ItemGroup>
<Compile Include="..\..\tests\SixLabors.Fonts.Tests\Unicode\UnicodeTypeMaps.cs" Link="UnicodeTypeMaps.cs" />
<Compile Include="..\SixLabors.Fonts\Unicode\BidiCharacterType.cs" Link="BidiCharacterType.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,20 @@
<!--Mark members as static-->
<NoWarn>CA1822</NoWarn>
</PropertyGroup>

<Choose>
<When Condition="$(SIXLABORS_TESTING_PREVIEW) == true">
<PropertyGroup>
<TargetFrameworks>net7.0;net6.0</TargetFrameworks>
<TargetFrameworks>net9.0;net8.0</TargetFrameworks>
</PropertyGroup>
</When>
<Otherwise>
<PropertyGroup>
<TargetFrameworks>net6.0</TargetFrameworks>
<TargetFrameworks>net8.0</TargetFrameworks>
</PropertyGroup>
</Otherwise>
</Choose>

<ItemGroup>
<PackageReference Include="BenchmarkDotNet" />
<PackageReference Include="SkiaSharp" />
Expand Down
4 changes: 2 additions & 2 deletions tests/SixLabors.Fonts.Tests/SixLabors.Fonts.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
<Choose>
<When Condition="$(SIXLABORS_TESTING_PREVIEW) == true">
<PropertyGroup>
<TargetFrameworks>net7.0;net6.0</TargetFrameworks>
<TargetFrameworks>net9.0;net8.0</TargetFrameworks>
</PropertyGroup>
</When>
<Otherwise>
<PropertyGroup>
<TargetFrameworks>net6.0</TargetFrameworks>
<TargetFrameworks>net8.0</TargetFrameworks>
</PropertyGroup>
</Otherwise>
</Choose>
Expand Down