Replace SixLabors.Fonts with SkiaSharp for text measurement#1717
Merged
Conversation
… like B Nazanin Co-authored-by: tonyqus <772561+tonyqus@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix System.NullReferenceException with BNazanin font
Handle NullReferenceException from SixLabors.Fonts 1.0.1 during AutoSizeColumn
Mar 6, 2026
…handling Co-authored-by: tonyqus <772561+tonyqus@users.noreply.github.com>
…0 not SemiBold=600) Co-authored-by: tonyqus <772561+tonyqus@users.noreply.github.com>
Copilot
AI
changed the title
Handle NullReferenceException from SixLabors.Fonts 1.0.1 during AutoSizeColumn
Replace SixLabors.Fonts with SkiaSharp for cross-platform font measurement
Mar 6, 2026
Copilot
AI
changed the title
Replace SixLabors.Fonts with SkiaSharp for cross-platform font measurement
Replace SixLabors.Fonts with SkiaSharp for text measurement
Mar 6, 2026
This was referenced Apr 6, 2026
This was referenced Apr 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SixLabors.Fonts1.0.1 has unfixed bugs with certain fonts (e.g.NullReferenceExceptionin the GSUB substitution engine for fonts like "B Nazanin"), and upgrading to 2.x is blocked because 2.x dropped .NET Standard 2.0/2.1 support.Replacement: SkiaSharp 2.88.9
SkiaSharpreplacesSixLabors.Fontsfor all text measurement and font resolutionSkiaSharp.NativeAssets.Linux.NoDependenciesadded explicitly —SkiaSharpauto-includes Win32 and macOS native assets as transitive deps but deliberately omits Linux; this variant requires only standard glibc components and works on all Linux distributions including minimal containersKey API changes
SheetUtil.IFont2Font(IFont)now returnsSKFont(disposable — callers must useusing). Font size is stored in pixels (pointSize × dpi / 72); typeface resolution is cached separately keyed by(fontName, bold, italic).Files changed
SheetUtil.cs—IFont2Font→SKFont;TextMeasurer→SKPaint.MeasureText; height usesSKFont.Size(em-square) to match priorMeasureAdvanceline-height semantics; empty strings return0heightEscherGraphics.cs—Font/FontFamily/SystemFonts→SKFont/SKTypeface;Fontproperty type updatedHSSFSheet.cs—HSSFFont2Font()delegates toSheetUtil.IFont2FontXSSFSheet.cs,XSSFClientAnchor.cs— inlineTextMeasurer.MeasureSize("0", …)→SKPaint.MeasureText("0")FormulaParser.cs—SixLabors.Fonts.Unicode.CodePointremoved; replaced withchar.IsLetter/IsDigit/IsLetterOrDigitviachar.ConvertFromUtf32Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.