Skip to content

Commit f4a74e7

Browse files
Merge branch 'main' into bp/cff2
2 parents ff606eb + eadc8db commit f4a74e7

File tree

175 files changed

+3650
-862
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

175 files changed

+3650
-862
lines changed

.github/workflows/build-and-test.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,9 @@ jobs:
155155
if: failure()
156156
with:
157157
name: actual_output_${{ runner.os }}_${{ matrix.options.framework }}${{ matrix.options.runtime }}.zip
158-
path: tests/Images/ActualOutput/
158+
path: |
159+
tests/Images/ActualOutput/
160+
**/msbuild.binlog
159161
160162
- name: Codecov Update
161163
uses: codecov/codecov-action@v4

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,8 @@ paket-files/
254254
*.sln.iml
255255
/samples/DrawWithImageSharp/Output
256256

257+
# Tests
258+
**/Images/ActualOutput
257259
/tests/CodeCoverage/OpenCover.*
258260
SixLabors.Shapes.Coverage.xml
259261
/SixLabors.Fonts.Coverage.xml

SixLabors.Fonts.sln

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ EndProject
5050
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ISSUE_TEMPLATE", "ISSUE_TEMPLATE", "{EC0F1812-C6AF-48D8-882B-5637730D2DB1}"
5151
ProjectSection(SolutionItems) = preProject
5252
.github\ISSUE_TEMPLATE\config.yml = .github\ISSUE_TEMPLATE\config.yml
53-
.github\ISSUE_TEMPLATE\oss-bug-report.md = .github\ISSUE_TEMPLATE\oss-bug-report.md
53+
.github\ISSUE_TEMPLATE\oss-bug-report.yml = .github\ISSUE_TEMPLATE\oss-bug-report.yml
5454
EndProjectSection
5555
EndProject
5656
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{CFCC940C-DEA3-42CC-9626-0B7D09289FF4}"

ci-build.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ dotnet clean -c Release
88
$repositoryUrl = "https://github.com/$env:GITHUB_REPOSITORY"
99

1010
# Building for a specific framework.
11-
dotnet build -c Release -f $targetFramework /p:RepositoryUrl=$repositoryUrl
11+
dotnet build -c Release -f $targetFramework /p:RepositoryUrl=$repositoryUrl -bl

samples/DrawWithImageSharp/DrawWithImageSharp.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
</ItemGroup>
4747

4848
<ItemGroup>
49-
<PackageReference Include="SixLabors.ImageSharp.Drawing" Version="2.0.1" />
49+
<PackageReference Include="SixLabors.ImageSharp.Drawing" Version="2.1.4" />
5050
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
5151
</ItemGroup>
5252

src/SixLabors.Fonts/BigEndianBinaryReader.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ namespace SixLabors.Fonts;
1212
/// BinaryReader using big-endian encoding.
1313
/// </summary>
1414
[DebuggerDisplay("Start: {StartOfStream}, Position: {BaseStream.Position}")]
15-
internal class BigEndianBinaryReader : IDisposable
15+
internal sealed class BigEndianBinaryReader : IDisposable
1616
{
1717
/// <summary>
1818
/// Buffer used for temporary storage before conversion into primitives

src/SixLabors.Fonts/Buffer{T}.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public Buffer(int length)
2626
this.buffer = ArrayPool<byte>.Shared.Rent(bufferSizeInBytes);
2727
this.length = length;
2828

29-
ByteMemoryManager<T> manager = new(this.buffer);
29+
using ByteMemoryManager<T> manager = new(this.buffer);
3030
this.Memory = manager.Memory.Slice(0, this.length);
3131
this.span = this.Memory.Span;
3232

src/SixLabors.Fonts/FileFontMetrics.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,10 @@ internal override bool TryGetGlyphId(
108108
out bool skipNextCodePoint)
109109
=> this.fontMetrics.Value.TryGetGlyphId(codePoint, nextCodePoint, out glyphId, out skipNextCodePoint);
110110

111+
/// <inheritdoc/>
112+
internal override bool TryGetCodePoint(ushort glyphId, out CodePoint codePoint)
113+
=> this.fontMetrics.Value.TryGetCodePoint(glyphId, out codePoint);
114+
111115
/// <inheritdoc/>
112116
internal override bool TryGetGlyphClass(ushort glyphId, [NotNullWhen(true)] out GlyphClassDef? glyphClass)
113117
=> this.fontMetrics.Value.TryGetGlyphClass(glyphId, out glyphClass);
@@ -153,8 +157,8 @@ internal override void ApplySubstitution(GlyphSubstitutionCollection collection)
153157
=> this.fontMetrics.Value.ApplySubstitution(collection);
154158

155159
/// <inheritdoc/>
156-
internal override bool TryGetKerningOffset(ushort previousId, ushort currentId, out Vector2 vector)
157-
=> this.fontMetrics.Value.TryGetKerningOffset(previousId, currentId, out vector);
160+
internal override bool TryGetKerningOffset(ushort currentId, ushort nextId, out Vector2 vector)
161+
=> this.fontMetrics.Value.TryGetKerningOffset(currentId, nextId, out vector);
158162

159163
/// <inheritdoc/>
160164
internal override void UpdatePositions(GlyphPositioningCollection collection)
@@ -169,7 +173,7 @@ public static FileFontMetrics[] LoadFontCollection(string path)
169173
{
170174
using FileStream fs = File.OpenRead(path);
171175
long startPos = fs.Position;
172-
BigEndianBinaryReader reader = new(fs, true);
176+
using BigEndianBinaryReader reader = new(fs, true);
173177
TtcHeader ttcHeader = TtcHeader.Read(reader);
174178
FileFontMetrics[] fonts = new FileFontMetrics[(int)ttcHeader.NumFonts];
175179

src/SixLabors.Fonts/Font.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -253,11 +253,11 @@ public bool TryGetGlyphs(
253253
}
254254

255255
/// <summary>
256-
/// Gets the amount, in px units, the <paramref name="current"/> glyph should be offset if it is proceeded by
257-
/// the <paramref name="previous"/> glyph.
256+
/// Gets the amount, in px units, the <paramref name="current"/> glyph should be offset if it is followed by
257+
/// the <paramref name="next"/> glyph.
258258
/// </summary>
259-
/// <param name="previous">The previous glyph.</param>
260259
/// <param name="current">The current glyph.</param>
260+
/// <param name="next">The next glyph.</param>
261261
/// <param name="dpi">The DPI (Dots Per Inch) to render/measure the kerning offset at.</param>
262262
/// <param name="vector">
263263
/// When this method returns, contains the offset, in font units, that should be applied to the
@@ -267,12 +267,12 @@ public bool TryGetGlyphs(
267267
/// <returns>
268268
/// <see langword="true"/> if the face contains and offset for the glyph combination; otherwise, <see langword="false"/>.
269269
/// </returns>
270-
public bool TryGetKerningOffset(Glyph previous, Glyph current, float dpi, out Vector2 vector)
270+
public bool TryGetKerningOffset(Glyph current, Glyph next, float dpi, out Vector2 vector)
271271
{
272-
if (this.FontMetrics.TryGetKerningOffset(previous.GlyphMetrics.GlyphId, current.GlyphMetrics.GlyphId, out vector))
272+
if (this.FontMetrics.TryGetKerningOffset(current.GlyphMetrics.GlyphId, next.GlyphMetrics.GlyphId, out vector))
273273
{
274274
// Scale the result
275-
Vector2 scale = new Vector2(this.Size * dpi) / current.GlyphMetrics.ScaleFactor;
275+
Vector2 scale = new Vector2(this.Size * dpi) / next.GlyphMetrics.ScaleFactor;
276276
vector *= scale;
277277
return true;
278278
}
@@ -290,7 +290,7 @@ private string LoadFontName()
290290
return metrics;
291291
}
292292

293-
if (this.RequestedStyle.HasFlag(FontStyle.Italic))
293+
if ((this.RequestedStyle & FontStyle.Italic) == FontStyle.Italic)
294294
{
295295
// Can't find style requested and they want one that's at least partial italic.
296296
// Try the regular italic.
@@ -300,7 +300,7 @@ private string LoadFontName()
300300
}
301301
}
302302

303-
if (this.RequestedStyle.HasFlag(FontStyle.Bold))
303+
if ((this.RequestedStyle & FontStyle.Bold) == FontStyle.Bold)
304304
{
305305
// Can't find style requested and they want one that's at least partial bold.
306306
// Try the regular bold.

0 commit comments

Comments
 (0)