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.

anchorFormat 2 not supported. Should be '1'.

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

After upgrading from beta15 to beta16 (via SixLabors.ImageSharp.Drawing), I often see this error in my log files. For now I have rolled back to beta15. I noticed that the font API has changed slightly in beta16, so maybe this is now intended but my code is no longer using fonts correctly?

Any pointers as to what I might be doing wrong or what I can do to work around it would be appreciated.

anchorFormat 2 not supported. Should be ‘1’.

System.NotSupportedException:
   at SixLabors.Fonts.Tables.AdvancedTypographic.GPos.AnchorTable.Load (SixLabors.Fonts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d998eea7b14cab13)
   at SixLabors.Fonts.Tables.AdvancedTypographic.GPos.MarkArrayTable..ctor (SixLabors.Fonts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d998eea7b14cab13)
   at SixLabors.Fonts.Tables.AdvancedTypographic.GPos.LookupType4SubTable+LookupType4Format1SubTable.Load (SixLabors.Fonts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d998eea7b14cab13)
   at SixLabors.Fonts.Tables.AdvancedTypographic.GPos.LookupType4SubTable.Load (SixLabors.Fonts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d998eea7b14cab13)
   at SixLabors.Fonts.Tables.AdvancedTypographic.GPos.LookupTable.LoadLookupSubTable (SixLabors.Fonts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d998eea7b14cab13)
   at SixLabors.Fonts.Tables.AdvancedTypographic.GPos.LookupTable.Load (SixLabors.Fonts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d998eea7b14cab13)
   at SixLabors.Fonts.Tables.AdvancedTypographic.GPos.LookupListTable.Load (SixLabors.Fonts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d998eea7b14cab13)
   at SixLabors.Fonts.Tables.AdvancedTypographic.GPosTable.Load (SixLabors.Fonts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d998eea7b14cab13)
   at SixLabors.Fonts.Tables.AdvancedTypographic.GPosTable.Load (SixLabors.Fonts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d998eea7b14cab13)
   at SixLabors.Fonts.Tables.TableLoader.Load (SixLabors.Fonts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d998eea7b14cab13)
   at SixLabors.Fonts.FontReader.TryGetTable (SixLabors.Fonts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d998eea7b14cab13)
   at SixLabors.Fonts.StreamFontMetrics.LoadFont (SixLabors.Fonts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d998eea7b14cab13)
   at SixLabors.Fonts.StreamFontMetrics.LoadFont (SixLabors.Fonts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d998eea7b14cab13)
   at SixLabors.Fonts.StreamFontMetrics.LoadFont (SixLabors.Fonts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d998eea7b14cab13)
   at SixLabors.Fonts.FileFontMetrics+<>c__DisplayClass3_0.<.ctor>b__0 (SixLabors.Fonts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d998eea7b14cab13)
   at System.Lazy`1.ViaFactory (System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
   at System.Lazy`1.CreateValue (System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
   at SixLabors.Fonts.FileFontMetrics.TryGetGlyphId (SixLabors.Fonts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d998eea7b14cab13)
   at SixLabors.Fonts.TextLayout.DoFontRun (SixLabors.Fonts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d998eea7b14cab13)
   at SixLabors.Fonts.TextLayout.ProcessText (SixLabors.Fonts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d998eea7b14cab13)
   at SixLabors.Fonts.TextLayout.GenerateLayout (SixLabors.Fonts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d998eea7b14cab13)
   at ...userland...

Steps to Reproduce

var fontFamily = default(FontFamily);
if (!SystemFonts.TryGet("DejaVu Sans", out fontFamily))
{
    throw new Exception($"Unable to find a suitable font. Available options are: {String.Join(", ", SystemFonts.Families.Select(x => x.Name))}");
}
var badgeFont = new Font(fontFamily, 12, FontStyle.Regular);
var badgeTextSize = TextMeasurer.Measure("100", new TextOptions(badgeFont));

System Configuration

  • Fonts version: beta16
  • Other Six Labors packages and versions: ImageSharp 2.0, ImageSharp.Drawing 2.0
  • Environment (Operating system, version and so on): Linux
  • .NET Framework version: 6.0
  • Additional information: Azure App Service

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
brianpopowcommented, Feb 17, 2022

@JimBobSquarePants maybe we should consider skipping over the data of Anchor Type 3, which we can not handle yet instead of throwing an exception? I think in most cases rendering of the font will be fine.

1reaction
LeaFrockcommented, Feb 17, 2022

I’ve met a similar exception, NotSupportedException: anchorFormat 3 not supported. Should be '1'.

OS: Win10 Font: Microsoft Sans Serif

Maybe the stacks below makes sense.

SixLabors.Fonts.Tables.AdvancedTypographic.GPos.AnchorTable.Load(BigEndianBinaryReader reader, long offset)
SixLabors.Fonts.Tables.AdvancedTypographic.GPos.BaseRecord..ctor(BigEndianBinaryReader reader, ushort classCount, long offset)
SixLabors.Fonts.Tables.AdvancedTypographic.GPos.BaseArrayTable..ctor(BigEndianBinaryReader reader, long offset, ushort classCount)
SixLabors.Fonts.Tables.AdvancedTypographic.GPos.LookupType4SubTable+LookupType4Format1SubTable.Load(BigEndianBinaryReader reader, long offset, LookupFlags lookupFlags)
SixLabors.Fonts.Tables.AdvancedTypographic.GPos.LookupType4SubTable.Load(BigEndianBinaryReader reader, long offset, LookupFlags lookupFlags)
SixLabors.Fonts.Tables.AdvancedTypographic.GPos.LookupTable.LoadLookupSubTable(ushort lookupType, LookupFlags lookupFlags, BigEndianBinaryReader reader, long offset)
SixLabors.Fonts.Tables.AdvancedTypographic.GPos.LookupType9Format1SubTable.Load(BigEndianBinaryReader reader, long offset, LookupFlags lookupFlags, Func<ushort, LookupFlags, BigEndianBinaryReader, long, LookupSubTable> subTableLoader)
SixLabors.Fonts.Tables.AdvancedTypographic.GPos.LookupType9SubTable.Load(BigEndianBinaryReader reader, long offset, LookupFlags lookupFlags, Func<ushort, LookupFlags, BigEndianBinaryReader, long, LookupSubTable> subTableLoader)
SixLabors.Fonts.Tables.AdvancedTypographic.GPos.LookupTable.LoadLookupSubTable(ushort lookupType, LookupFlags lookupFlags, BigEndianBinaryReader reader, long offset)
SixLabors.Fonts.Tables.AdvancedTypographic.GPos.LookupTable.Load(BigEndianBinaryReader reader, long offset)
SixLabors.Fonts.Tables.AdvancedTypographic.GPos.LookupListTable.Load(BigEndianBinaryReader reader, long offset)
SixLabors.Fonts.Tables.AdvancedTypographic.GPosTable.Load(BigEndianBinaryReader reader)
SixLabors.Fonts.Tables.AdvancedTypographic.GPosTable.Load(FontReader fontReader)
SixLabors.Fonts.Tables.TableLoader.Load<TTable>(FontReader reader)
SixLabors.Fonts.FontReader.TryGetTable<TTableType>()
SixLabors.Fonts.StreamFontMetrics.LoadFont(FontReader reader)
SixLabors.Fonts.StreamFontMetrics.LoadFont(string path, long offset)
System.Lazy<T>.ViaFactory(LazyThreadSafetyMode mode)
System.Lazy<T>.ExecutionAndPublication(LazyHelper executionAndPublication, bool useDefaultConstructor)
System.Lazy<T>.CreateValue()
SixLabors.Fonts.FileFontMetrics.TryGetGlyphId(CodePoint codePoint, Nullable<CodePoint> nextCodePoint, out ushort glyphId, out bool skipNextCodePoint)
SixLabors.Fonts.TextLayout.DoFontRun(ReadOnlySpan<char> text, TextOptions options, FontMetrics fontMetrics, BidiRun[] bidiRuns, Dictionary<int, int> bidiMap, GlyphSubstitutionCollection substitutions, GlyphPositioningCollection positionings)
SixLabors.Fonts.TextLayout.ProcessText(ReadOnlySpan<char> text, TextOptions options)
SixLabors.Fonts.TextLayout.GenerateLayout(ReadOnlySpan<char> text, TextOptions options)
SixLabors.Fonts.TextRenderer.RenderText(ReadOnlySpan<char> text, TextOptions options)
SixLabors.ImageSharp.Drawing.Processing.Processors.Text.DrawTextProcessor<TPixel>.BeforeImageApply()
SixLabors.ImageSharp.Processing.Processors.ImageProcessor<TPixel>.SixLabors.ImageSharp.Processing.Processors.IImageProcessor<TPixel>.Execute()
SixLabors.ImageSharp.Processing.DefaultImageProcessorContext<TPixel>.ApplyProcessor(IImageProcessor processor, Rectangle rectangle)
SixLabors.ImageSharp.Processing.DefaultImageProcessorContext<TPixel>.ApplyProcessor(IImageProcessor processor)
SixLabors.ImageSharp.Drawing.Processing.DrawTextExtensions.DrawText(IImageProcessingContext source, string text, Font font, Color color, PointF location)
...(User codes)
Read more comments on GitHub >

github_iconTop Results From Across the Web

SixLabors ImageSharp.Drawing · Discussions
After installing 1.0.0-beta14, I get an "anchorFormat 2 not supported" exception when using some fonts with IImageProcessingContext.DrawText().
Read more >
Unable to load font for use with ImageSharp in Xamarin ...
Fonts NuGet package, I'm trying to load this font to use it for watermarking. However, trying to install the font using the asset...
Read more >
Font can be selected in MS Word, but text does not change
Someone is having trouble with a font I made. They are using Windows 10 with Microsoft Office 16. In Word, my font name...
Read more >
[Solved] Footnote Anchor Format - (View topic)
In Open Office 4.1.7 on Windows 10. How does one change the format of the footnote anchor from default font (style and size)...
Read more >
GPOS — Glyph Positioning Table (OpenType 1.9)
This is done so that the default instance of a variable font can be compatible with applications that do not support Font Variations....
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