Error: Invalid glyph format when performing FontCollection.Install
See original GitHub issuePrerequisites
- 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
andRELEASE
mode - I have searched open and closed issues to ensure it has not already been reported
Description
When executing the lines of code below, on my development environment (.net5.0 on macOS with Rider), the below happens.
Exception
InvalidFontFileException: Invalid glyph format, only TTF glyph outlines supported
Callstack
SixLabors.Fonts.FontReader..ctor(Stream stream, TableLoader loader)
SixLabors.Fonts.FontReader..ctor(Stream stream)
SixLabors.Fonts.FontDescription.LoadDescription(string path)
SixLabors.Fonts.FileFontInstance..ctor(string path, long offset)
SixLabors.Fonts.FileFontInstance..ctor(string path)
SixLabors.Fonts.FontCollection.InstallInternal(string path, CultureInfo culture, out FontDescription fontDescription)
SixLabors.Fonts.FontCollection.InstallInternal(string path, CultureInfo culture)
SixLabors.Fonts.FontCollection.Install(string path)
Steps to Reproduce
Code
var fonts = new FontCollection();
var lightFamily = fonts.Install(Path.Combine(_hostingEnvironment.WebRootPath, "fonts/merkury_bold.otf"));
System Configuration
- Fonts version: nuget 1.0.0-beta15
- Other Six Labors packages and versions: SixLabors.ImageSharp==1.0.4, SixLabors.ImageSharp.Drawing==1.0.0-beta13, SixLabors.ImageSharp.Web==1.0.4
- Environment (Operating system, version and so on): macOS Big Sur (11.6)
- .NET Framework version: 5.0
- Additional information: Similar issue reported #29 , but that was with SystemFonts, as was closed as fixed.
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Mac error: Invalid glyph format, only TTF glyph outlines ...
Trying to get any font from the system collection results in the above error on a Mac. Windows is working fine.
Read more >Troubleshooting a font that does not export
Sometimes, you want to export a font and you get weird error messages instead. Here is how to fix that.
Read more >How to install OS X *.TTC font on Windows? Error
"Cannot install (FONTNAME).ttc - The file '(FONTNAME).ttc' does not appear to be a valid font." Can *.TTC format font files be installed ......
Read more >View topic - Private fonts sample for asp.net?
It seems no matter what I try, I always get the error "Font with the specified family name does not exist" on the...
Read more >Character Formatting Extensions with DirectWrite
This is a display of all the glyphs in the selected font file. These glyphs are directly addressable by index if you use...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
So, that probably means, you can close this issue, as it is related to my lack of understanding/knowledge on font-specifics. Thanks for your feedback and help!
And appreciating the work you guys deliver ❤️
The fact its an
*.otf
rather than*.ttf
is the big give away that its unlikely to be a compatible font. *.ttf is technically a subset of *.otf fonts with a very specific way of storing the glyph outlines.That font contains CFF outline data (as can be determined by looking at the first 4 bytes of the file spelling
OTTO
in ascii) which we do not have support for.