question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Woff font loading broken in latest beta - Could not read compressed data!

See original GitHub issue

Prerequisites

  • I have written a descriptive issue title
  • I have verified that I am running the latest version of Fonts
  • I have verified if the problem exist in both DEBUG and RELEASE mode
  • I have searched open and closed issues to ensure it has not already been reported

Description

I have code that loads WOFF fonts from files on disk, then renders them to a bitmap. This worked fine in version 1. I updated to the latest Nuget betas, and now I get an error when calling TextMeasurer.Measure with a reference to the font. The error is Could not read compressed data! Expected bytes: 35776, bytes read: 14988 which implies to me that the font loading has failed. Full stack is:

at SixLabors.Fonts.Tables.Woff.WoffTableHeader.CreateReader(Stream stream) at SixLabors.Fonts.FontReader.GetReaderAtTablePosition(String tableName) at SixLabors.Fonts.Tables.TrueType.Glyphs.GlyphTable.Load(FontReader reader) at SixLabors.Fonts.Tables.TableLoader.Load[TTable](FontReader reader) at SixLabors.Fonts.FontReader.TryGetTable[TTableType]() at SixLabors.Fonts.FontReader.GetTable[TTableType]() at SixLabors.Fonts.StreamFontMetrics.LoadTrueTypeFont(FontReader reader) at SixLabors.Fonts.StreamFontMetrics.LoadFont(String path, Int64 offset) at System.Lazy1.ViaFactory(LazyThreadSafetyMode mode) at System.Lazy1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor) at System.Lazy1.CreateValue() at SixLabors.Fonts.FileFontMetrics.TryGetGlyphId(CodePoint codePoint, Nullable1 nextCodePoint, UInt16& glyphId, Boolean& skipNextCodePoint) at SixLabors.Fonts.TextLayout.DoFontRun(ReadOnlySpan1 text, Int32 start, IReadOnlyList1 textRuns, Int32& textRunIndex, Int32& codePointIndex, Int32& bidiRunIndex, Boolean isFallbackRun, Font font, BidiRun[] bidiRuns, Dictionary2 bidiMap, GlyphSubstitutionCollection substitutions, GlyphPositioningCollection positionings) at SixLabors.Fonts.TextLayout.ProcessText(ReadOnlySpan1 text, TextOptions options) at SixLabors.Fonts.TextMeasurer.Measure(String text, TextOptions options) at MultiRender.RenderGraphic.RenderSplits(List1 items, String outputFile) in C:\src\bvcs-obs-controller\RenderText\MultiRender\RenderGraphic.cs:line 105`

Steps to Reproduce

This probably depends on a specific woff font file, I can’t upload for general access, but can supply to someone working on this. The code is quite simple so nothing special, but could supply that too if needed.

System Configuration

  • Fonts version: 1.0.0-beta18
  • Other Six Labors packages and versions: ImageSharp 2.1.3, ImageSharp.Drawing 1.0.0-beta15
  • Environment (Operating system, version and so on): Windows 10
  • .NET Framework version: .Net 6
  • Additional information:

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
mj2015commented, Aug 19, 2022

@brianpopow The font is in the sample project - fully self contained as the code loads it from the assembly-relative directory.

The “old” version works fine built with .Net5 and then linked into the code which runs on Windows and Linux. The new one I’ve only tried on Windows as it doesn’t work…

0reactions
brianpopowcommented, Aug 19, 2022

Closing via #297

Read more comments on GitHub >

github_iconTop Results From Across the Web

Failed to decode downloaded font
Sometimes this problem happens when you upload/download the fonts using the wrong FTP method. Fonts must be FTP-ed using binary method, not ......
Read more >
Compress/gzip not compressing woff font - Go Forum
NobbZ is correct. WOFF fonts are compressed with “Brotli” compression and won't benefit from further compression.
Read more >
uploading custom font to assets folder not working
2. The .woff and .woff2 versions of the font are being corrupted when uploading to the assets folder, I am seeing these warnings...
Read more >
Font support on Internet Explorer, WOFF v.s. WOFF 2.0
A little workaround I found was that by opening the link to the font family, say Muli, in IE, you would get a...
Read more >
Best practices for fonts - web.dev
This article discusses performance best practices for fonts. There are a variety of ways in which web fonts impact performance:.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found