diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 27f189f00..2a464a9f0 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -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: @@ -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 }} diff --git a/samples/DrawWithImageSharp/DrawWithImageSharp.csproj b/samples/DrawWithImageSharp/DrawWithImageSharp.csproj index 58f71516a..36ff222de 100644 --- a/samples/DrawWithImageSharp/DrawWithImageSharp.csproj +++ b/samples/DrawWithImageSharp/DrawWithImageSharp.csproj @@ -13,16 +13,16 @@ - net7.0;net6.0 + net9.0;net8.0 - net6.0 + net8.0 - + PreserveNewest diff --git a/samples/ListFonts/ListFonts.csproj b/samples/ListFonts/ListFonts.csproj index 425e759c6..feb45a09b 100644 --- a/samples/ListFonts/ListFonts.csproj +++ b/samples/ListFonts/ListFonts.csproj @@ -7,16 +7,16 @@ - net7.0;net6.0 + net9.0;net8.0 - net6.0 + net8.0 - + diff --git a/src/SixLabors.Fonts/FontCollection.cs b/src/SixLabors.Fonts/FontCollection.cs index 437d430da..adc139fd8 100644 --- a/src/SixLabors.Fonts/FontCollection.cs +++ b/src/SixLabors.Fonts/FontCollection.cs @@ -208,7 +208,7 @@ private FontFamily AddImpl(Stream stream, CultureInfo culture, out FontDescripti return ((IFontMetricsCollection)this).AddMetrics(metrics, culture); } - private IEnumerable AddCollectionImpl( + private HashSet AddCollectionImpl( string path, CultureInfo culture, out IEnumerable descriptions) @@ -228,7 +228,7 @@ private IEnumerable AddCollectionImpl( return families; } - private IEnumerable AddCollectionImpl( + private HashSet AddCollectionImpl( Stream stream, CultureInfo culture, out IEnumerable descriptions) @@ -251,7 +251,7 @@ private IEnumerable AddCollectionImpl( return installedFamilies; } - private IEnumerable FamiliesByCultureImpl(CultureInfo culture) + private FontFamily[] FamiliesByCultureImpl(CultureInfo culture) => this.metricsCollection .Select(x => x.Description.FontFamily(culture)) .Distinct() diff --git a/src/SixLabors.Fonts/IO/ZlibInflateStream.cs b/src/SixLabors.Fonts/IO/ZlibInflateStream.cs index 0157cea05..30d6885a0 100644 --- a/src/SixLabors.Fonts/IO/ZlibInflateStream.cs +++ b/src/SixLabors.Fonts/IO/ZlibInflateStream.cs @@ -122,10 +122,7 @@ public override void Flush() /// 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); diff --git a/src/SixLabors.Fonts/SixLabors.Fonts.csproj b/src/SixLabors.Fonts/SixLabors.Fonts.csproj index b90f8cfda..d9dd33666 100644 --- a/src/SixLabors.Fonts/SixLabors.Fonts.csproj +++ b/src/SixLabors.Fonts/SixLabors.Fonts.csproj @@ -26,19 +26,19 @@ - 2.0 + 3.0 - net7.0;net6.0 + net9.0;net8.0 true - net6.0 + net8.0 true @@ -55,15 +55,5 @@ - - - - - - - - - - diff --git a/src/SixLabors.Fonts/StreamFontMetrics.Cff.cs b/src/SixLabors.Fonts/StreamFontMetrics.Cff.cs index 42dfc9b0d..29ed9c062 100644 --- a/src/SixLabors.Fonts/StreamFontMetrics.Cff.cs +++ b/src/SixLabors.Fonts/StreamFontMetrics.Cff.cs @@ -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, diff --git a/src/SixLabors.Fonts/StreamFontMetrics.TrueType.cs b/src/SixLabors.Fonts/StreamFontMetrics.TrueType.cs index 416e5af6b..e33738ef6 100644 --- a/src/SixLabors.Fonts/StreamFontMetrics.TrueType.cs +++ b/src/SixLabors.Fonts/StreamFontMetrics.TrueType.cs @@ -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, diff --git a/src/SixLabors.Fonts/Tables/AdvancedTypographic/Shapers/IndicShaper.cs b/src/SixLabors.Fonts/Tables/AdvancedTypographic/Shapers/IndicShaper.cs index 6fe5900e9..e3614743a 100644 --- a/src/SixLabors.Fonts/Tables/AdvancedTypographic/Shapers/IndicShaper.cs +++ b/src/SixLabors.Fonts/Tables/AdvancedTypographic/Shapers/IndicShaper.cs @@ -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) { diff --git a/src/SixLabors.Fonts/Tables/AdvancedTypographic/Shapers/UniversalShaper.cs b/src/SixLabors.Fonts/Tables/AdvancedTypographic/Shapers/UniversalShaper.cs index 05ee92f86..b5edbb1c9 100644 --- a/src/SixLabors.Fonts/Tables/AdvancedTypographic/Shapers/UniversalShaper.cs +++ b/src/SixLabors.Fonts/Tables/AdvancedTypographic/Shapers/UniversalShaper.cs @@ -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) { diff --git a/src/SixLabors.Fonts/TextLayout.cs b/src/SixLabors.Fonts/TextLayout.cs index 526c5d691..a39523e65 100644 --- a/src/SixLabors.Fonts/TextLayout.cs +++ b/src/SixLabors.Fonts/TextLayout.cs @@ -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; @@ -188,7 +189,7 @@ private static TextBox ProcessText(ReadOnlySpan text, TextOptions options) return BreakLines(text, options, bidiRuns, bidiMap, positionings, layoutMode); } - private static IReadOnlyList LayoutText(TextBox textBox, TextOptions options) + private static ReadOnlyCollection LayoutText(TextBox textBox, TextOptions options) { LayoutMode layoutMode = options.LayoutMode; List glyphs = new(); @@ -300,10 +301,10 @@ private static IReadOnlyList LayoutText(TextBox textBox, TextOption } } - return glyphs; + return glyphs.AsReadOnly(); } - private static IEnumerable LayoutLineHorizontal( + private static List LayoutLineHorizontal( TextBox textBox, TextLine textLine, TextDirection direction, @@ -444,7 +445,7 @@ private static IEnumerable LayoutLineHorizontal( return glyphs; } - private static IEnumerable LayoutLineVertical( + private static List LayoutLineVertical( TextBox textBox, TextLine textLine, TextDirection direction, @@ -602,7 +603,7 @@ private static IEnumerable LayoutLineVertical( return glyphs; } - private static IEnumerable LayoutLineVerticalMixed( + private static List LayoutLineVerticalMixed( TextBox textBox, TextLine textLine, TextDirection direction, diff --git a/src/SixLabors.Fonts/Unicode/LineBreakEnumerator.cs b/src/SixLabors.Fonts/Unicode/LineBreakEnumerator.cs index 1d81a2beb..36f1f57ff 100644 --- a/src/SixLabors.Fonts/Unicode/LineBreakEnumerator.cs +++ b/src/SixLabors.Fonts/Unicode/LineBreakEnumerator.cs @@ -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; diff --git a/src/UnicodeTrieGenerator/UnicodeTrieGenerator.csproj b/src/UnicodeTrieGenerator/UnicodeTrieGenerator.csproj index 5634e043f..8da793841 100644 --- a/src/UnicodeTrieGenerator/UnicodeTrieGenerator.csproj +++ b/src/UnicodeTrieGenerator/UnicodeTrieGenerator.csproj @@ -9,16 +9,16 @@ - net7.0;net6.0 + net9.0;net8.0 - net6.0 + net8.0 - + diff --git a/tests/SixLabors.Fonts.Benchmarks/SixLabors.Fonts.Benchmarks/SixLabors.Fonts.Benchmarks.csproj b/tests/SixLabors.Fonts.Benchmarks/SixLabors.Fonts.Benchmarks/SixLabors.Fonts.Benchmarks.csproj index e33b5b2a2..9d9d9cf57 100644 --- a/tests/SixLabors.Fonts.Benchmarks/SixLabors.Fonts.Benchmarks/SixLabors.Fonts.Benchmarks.csproj +++ b/tests/SixLabors.Fonts.Benchmarks/SixLabors.Fonts.Benchmarks/SixLabors.Fonts.Benchmarks.csproj @@ -15,20 +15,20 @@ CA1822 - + - net7.0;net6.0 + net9.0;net8.0 - net6.0 + net8.0 - + diff --git a/tests/SixLabors.Fonts.Tests/SixLabors.Fonts.Tests.csproj b/tests/SixLabors.Fonts.Tests/SixLabors.Fonts.Tests.csproj index 686eaa70e..598829bc8 100644 --- a/tests/SixLabors.Fonts.Tests/SixLabors.Fonts.Tests.csproj +++ b/tests/SixLabors.Fonts.Tests/SixLabors.Fonts.Tests.csproj @@ -14,12 +14,12 @@ - net7.0;net6.0 + net9.0;net8.0 - net6.0 + net8.0