Skip to content

Conversation

@JimBobSquarePants
Copy link
Member

Prerequisites

  • I have written a descriptive pull-request title
  • I have verified that there are no overlapping pull-requests open
  • I have verified that I am following matches the existing coding patterns and practice as demonstrated in the repository. These follow strict Stylecop rules 👮.
  • I have provided test coverage for my change (where applicable)

Description

Fixes #469

I also fixed additional rendering issues spotted during debugging.

Test_Issue_469-

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request fixes issue #469 where glyphs were being incorrectly overwritten by fallback glyphs during font rendering. The fix addresses multiple rendering issues discovered during debugging and updates the codebase to support ImageSharp.Drawing v3.0.0-alpha.0.6.

Key changes:

  • Fixed incorrect indexing in HorizontalMetricsTable to use the last record instead of the first when glyph index exceeds available records
  • Added bounds checking in GPosTable to prevent out-of-bounds access during glyph positioning
  • Enhanced glyph positioning logic to properly handle vertical glyphs and prevent fallback glyphs from overwriting valid glyphs

Reviewed changes

Copilot reviewed 11 out of 21 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/SixLabors.Fonts/Tables/General/HorizontalMetricsTable.cs Fixed to return last record instead of first for out-of-bounds glyph indices, per OpenType spec
src/SixLabors.Fonts/Tables/AdvancedTypographic/GPosTable.cs Added bounds check before accessing collection to prevent potential exceptions
src/SixLabors.Fonts/GlyphPositioningCollection.cs Enhanced vertical glyph detection, fixed fallback glyph handling, modernized collection initialization
tests/SixLabors.Fonts.Tests/Issues/Issues_469.cs New comprehensive test covering multiple writing systems with fallback fonts
tests/SixLabors.Fonts.Tests/TestFonts.cs Added helper properties for additional test fonts and made GetFullPath public
tests/SixLabors.Fonts.Tests/TextLayoutTestUtilities.cs Updated to use new ImageSharp.Drawing v3 API (GenerateGlyphs)
tests/SixLabors.Fonts.Tests/SixLabors.Fonts.Tests.csproj Enabled SUPPORTS_DRAWING tests and updated to ImageSharp.Drawing v3.0.0-alpha.0.6
samples/DrawWithImageSharp/Program.cs Updated API call from GenerateGlyphs to GeneratePaths for ImageSharp.Drawing v3
samples/DrawWithImageSharp/DrawWithImageSharp.csproj Updated to ImageSharp.Drawing v3.0.0-alpha.0.6, removed obsolete System.ValueTuple reference
SixLabors.Fonts.sln Added DrawWithImageSharp sample project to solution
tests/SixLabors.Fonts.Tests/Fonts/Sarabun-Regular.ttf Binary font file added for test coverage
tests/Images/ReferenceOutput/Test_Issue_469-.png Reference image for visual regression test

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

@JimBobSquarePants JimBobSquarePants merged commit 09ca137 into main Nov 25, 2025
23 checks passed
@JimBobSquarePants JimBobSquarePants deleted the js/fix-469 branch November 25, 2025 04:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Regression: Font fallback with 3.0.0-alpha.0.6 drawing squares

2 participants