diff --git a/Directory.Build.props b/Directory.Build.props index 72f15d8e..c06828d2 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -20,36 +20,20 @@ - $(DefineConstants);SUPPORTS_CULTUREINFO_LCID;NULLABLE_ATTRIBUTES - - - $(DefineConstants)SUPPORTS_CULTUREINFO_LCID - - - $(DefineConstants)SUPPORTS_CULTUREINFO_LCID + $(DefineConstants);NULLABLE_ATTRIBUTES - $(DefineConstants);SUPPORTS_CULTUREINFO_LCID;NULLABLE_ATTRIBUTES - - - $(DefineConstants);SUPPORTS_CULTUREINFO_LCID - - - $(DefineConstants);SUPPORTS_CULTUREINFO_LCID + $(DefineConstants);NULLABLE_ATTRIBUTES diff --git a/src/SixLabors.Fonts/Buffer{T}.cs b/src/SixLabors.Fonts/Buffer{T}.cs index 14781521..bc8c0fab 100644 --- a/src/SixLabors.Fonts/Buffer{T}.cs +++ b/src/SixLabors.Fonts/Buffer{T}.cs @@ -39,7 +39,7 @@ public Span GetSpan() ref byte r0 = ref MemoryMarshal.GetReference(this.buffer); return MemoryMarshal.CreateSpan(ref Unsafe.As(ref r0), this.length); #else - return MemoryMarshal.Cast(this.buffer.AsSpan()).Slice(0, this.length); + return MemoryMarshal.Cast(this.buffer).Slice(0, this.length); #endif } diff --git a/src/SixLabors.Fonts/FontCollection.cs b/src/SixLabors.Fonts/FontCollection.cs index 84ebf998..de487f20 100644 --- a/src/SixLabors.Fonts/FontCollection.cs +++ b/src/SixLabors.Fonts/FontCollection.cs @@ -61,7 +61,6 @@ public FontFamily Get(string name) public bool TryGet(string name, out FontFamily family) => this.TryGetImpl(name, CultureInfo.InvariantCulture, out family); -#if SUPPORTS_CULTUREINFO_LCID /// public FontFamily Add(string path, CultureInfo culture) => this.AddImpl(path, culture, out _); @@ -111,7 +110,6 @@ public FontFamily Get(string name, CultureInfo culture) /// public bool TryGet(string name, CultureInfo culture, out FontFamily family) => this.TryGetImpl(name, culture, out family); -#endif /// FontFamily IFontMetricsCollection.AddMetrics(FontMetrics metrics, CultureInfo culture) diff --git a/src/SixLabors.Fonts/FontReader.cs b/src/SixLabors.Fonts/FontReader.cs index e01f6194..6b135ae9 100644 --- a/src/SixLabors.Fonts/FontReader.cs +++ b/src/SixLabors.Fonts/FontReader.cs @@ -70,7 +70,7 @@ internal FontReader(Stream stream, TableLoader loader) // This is a woff2 file. this.TableFormat = TableFormat.Woff2; -#if NETSTANDARD2_0 || NETSTANDARD1_3 +#if NETSTANDARD2_0 throw new NotSupportedException("Brotli compression is not available and is required for decoding woff2"); #else diff --git a/src/SixLabors.Fonts/IFontCollection.cs b/src/SixLabors.Fonts/IFontCollection.cs index b45934c1..00071377 100644 --- a/src/SixLabors.Fonts/IFontCollection.cs +++ b/src/SixLabors.Fonts/IFontCollection.cs @@ -2,9 +2,7 @@ // Licensed under the Apache License, Version 2.0. using System.Collections.Generic; -#if SUPPORTS_CULTUREINFO_LCID using System.Globalization; -#endif using System.IO; namespace SixLabors.Fonts @@ -75,7 +73,6 @@ public interface IFontCollection : IReadOnlyFontCollection /// The new . public IEnumerable AddCollection(Stream stream, out IEnumerable descriptions); -#if SUPPORTS_CULTUREINFO_LCID /// /// Adds a font to the collection. /// @@ -149,6 +146,5 @@ public IEnumerable AddCollection( Stream stream, CultureInfo culture, out IEnumerable descriptions); -#endif } } diff --git a/src/SixLabors.Fonts/IReadonlyFontCollection.cs b/src/SixLabors.Fonts/IReadonlyFontCollection.cs index 07d76224..5d505d32 100644 --- a/src/SixLabors.Fonts/IReadonlyFontCollection.cs +++ b/src/SixLabors.Fonts/IReadonlyFontCollection.cs @@ -3,9 +3,7 @@ using System; using System.Collections.Generic; -#if SUPPORTS_CULTUREINFO_LCID using System.Globalization; -#endif namespace SixLabors.Fonts { @@ -45,7 +43,6 @@ public interface IReadOnlyFontCollection /// is bool TryGet(string name, out FontFamily family); -#if SUPPORTS_CULTUREINFO_LCID /// /// Gets the collection of in this /// using the given culture. @@ -80,6 +77,5 @@ public interface IReadOnlyFontCollection /// /// is bool TryGet(string name, CultureInfo culture, out FontFamily family); -#endif } } diff --git a/src/SixLabors.Fonts/SixLabors.Fonts.csproj b/src/SixLabors.Fonts/SixLabors.Fonts.csproj index 92b8ea83..7b61d3dc 100644 --- a/src/SixLabors.Fonts/SixLabors.Fonts.csproj +++ b/src/SixLabors.Fonts/SixLabors.Fonts.csproj @@ -9,9 +9,9 @@ Apache-2.0 https://github.com/SixLabors/Fonts/ $(RepositoryUrl) - font;truetype;opentype;woff + font;truetype;opentype;woff;woff2 A cross-platform library for loading and laying out fonts for processing and measuring; written in C# - netcoreapp3.1;netstandard2.1;netstandard2.0;netstandard1.3 + netcoreapp3.1;netstandard2.1;netstandard2.0 enable latest @@ -39,7 +39,7 @@ - + diff --git a/src/SixLabors.Fonts/StringComparerHelpers.cs b/src/SixLabors.Fonts/StringComparerHelpers.cs index 545ca77a..73463d5d 100644 --- a/src/SixLabors.Fonts/StringComparerHelpers.cs +++ b/src/SixLabors.Fonts/StringComparerHelpers.cs @@ -10,12 +10,11 @@ internal static class StringComparerHelpers { public static StringComparer GetCaseInsensitiveStringComparer(CultureInfo culture) { -#if SUPPORTS_CULTUREINFO_LCID if (culture != null) { return StringComparer.Create(culture, true); } -#endif + return StringComparer.OrdinalIgnoreCase; } } diff --git a/src/SixLabors.Fonts/SystemFontCollection.cs b/src/SixLabors.Fonts/SystemFontCollection.cs index f95d8d5c..78409e0a 100644 --- a/src/SixLabors.Fonts/SystemFontCollection.cs +++ b/src/SixLabors.Fonts/SystemFontCollection.cs @@ -87,7 +87,6 @@ public SystemFontCollection(IEnumerable paths) public bool TryGet(string name, out FontFamily family) => this.collection.TryGet(name, out family); -#if SUPPORTS_CULTUREINFO_LCID /// public IEnumerable GetByCulture(CultureInfo culture) => this.collection.GetByCulture(culture); @@ -99,7 +98,6 @@ public FontFamily Get(string name, CultureInfo culture) /// public bool TryGet(string name, CultureInfo culture, out FontFamily family) => this.collection.TryGet(name, culture, out family); -#endif /// bool IReadOnlyFontMetricsCollection.TryGetMetrics(string name, CultureInfo culture, FontStyle style, [NotNullWhen(true)] out FontMetrics? metrics) diff --git a/src/SixLabors.Fonts/SystemFonts.cs b/src/SixLabors.Fonts/SystemFonts.cs index e54c1b82..8daefdda 100644 --- a/src/SixLabors.Fonts/SystemFonts.cs +++ b/src/SixLabors.Fonts/SystemFonts.cs @@ -3,9 +3,7 @@ using System; using System.Collections.Generic; -#if SUPPORTS_CULTUREINFO_LCID using System.Globalization; -#endif namespace SixLabors.Fonts { @@ -52,7 +50,6 @@ public static Font CreateFont(string name, float size) public static Font CreateFont(string name, float size, FontStyle style) => Collection.Get(name).CreateFont(size, style); -#if SUPPORTS_CULTUREINFO_LCID /// public static IEnumerable GetByCulture(CultureInfo culture) => Collection.GetByCulture(culture); @@ -85,6 +82,5 @@ public static Font CreateFont(string name, CultureInfo culture, float size) /// The new . public static Font CreateFont(string name, CultureInfo culture, float size, FontStyle style) => Collection.Get(name, culture).CreateFont(size, style); -#endif } } diff --git a/src/SixLabors.Fonts/Tables/General/NameTable.cs b/src/SixLabors.Fonts/Tables/General/NameTable.cs index 1fda3393..38b151d2 100644 --- a/src/SixLabors.Fonts/Tables/General/NameTable.cs +++ b/src/SixLabors.Fonts/Tables/General/NameTable.cs @@ -59,11 +59,7 @@ public string FontSubFamilyName(CultureInfo culture) public string GetNameById(CultureInfo culture, KnownNameIds nameId) { -#if SUPPORTS_CULTUREINFO_LCID int languageId = culture.LCID; -#else - int languageId = 0x0409; -#endif NameRecord? usaVersion = null; NameRecord? firstWindows = null; NameRecord? first = null;