Skip to content

DrawText throws System.NotSupportedException: Specified method is not supported. #331

Open
@gokeiyou

Description

@gokeiyou

Prerequisites

  • I have bought a Commercial License
  • I have written a descriptive issue title
  • I have verified that I am running the latest version of ImageSharp
  • 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

ImageSharp version

SixLabors.ImageSharp/2.1.3

Other ImageSharp packages and versions

SixLabors.ImageSharp.Drawing/1.0.0-beta15;Fonts/1.0.0-beta18

Environment (Operating system, version and so on)

macOS Ventura 13.1

.NET Framework version

.NET 7

Description

Specified method is not supported.      
      ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
      System.NotSupportedException: Specified method is not supported.
         at SixLabors.Fonts.Tables.Cff.CffParser.ReadFDArray(BigEndianBinaryReader reader, CidFontInfo cidFontInfo)
         at SixLabors.Fonts.Tables.Cff.CffParser.Load(BigEndianBinaryReader reader, Int64 offset)
         at SixLabors.Fonts.Tables.Cff.Cff1Table.Load(BigEndianBinaryReader reader)
         at SixLabors.Fonts.Tables.Cff.Cff1Table.Load(FontReader fontReader)
         at SixLabors.Fonts.Tables.TableLoader.Load[TTable](FontReader reader)
         at SixLabors.Fonts.FontReader.TryGetTable[TTableType]()
         at SixLabors.Fonts.StreamFontMetrics.LoadCompactFont(FontReader reader)
         at SixLabors.Fonts.StreamFontMetrics.LoadFont(FontReader reader)
         at SixLabors.Fonts.StreamFontMetrics.LoadFont(Stream stream)
         at SixLabors.Fonts.StreamFontMetrics.LoadFont(String path, Int64 offset)
         at SixLabors.Fonts.FileFontMetrics.<>c__DisplayClass3_0.<.ctor>b__0()
         at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
      --- End of stack trace from previous location ---
         at System.Lazy`1.CreateValue()
         at SixLabors.Fonts.FileFontMetrics.TryGetGlyphId(CodePoint codePoint, Nullable`1 nextCodePoint, UInt16& glyphId, Boolean& skipNextCodePoint)
         at SixLabors.Fonts.TextLayout.DoFontRun(ReadOnlySpan`1 text, Int32 start, IReadOnlyList`1 textRuns, Int32& textRunIndex, Int32& codePointIndex, Int32& bidiRunIndex, Boolean isFallbackRun, Font font, BidiRun[] bidiRuns, Dictionary`2 bidiMap, GlyphSubstitutionCollection substitutions, GlyphPositioningCollection positionings)
         at SixLabors.Fonts.TextLayout.ProcessText(ReadOnlySpan`1 text, TextOptions options)
         at SixLabors.Fonts.TextLayout.GenerateLayout(ReadOnlySpan`1 text, TextOptions options)
         at SixLabors.Fonts.TextRenderer.RenderText(ReadOnlySpan`1 text, TextOptions options)
         at SixLabors.Fonts.TextRenderer.RenderText(String text, TextOptions options)
         at SixLabors.ImageSharp.Drawing.Processing.Processors.Text.DrawTextProcessor`1.BeforeImageApply()
         at SixLabors.ImageSharp.Processing.Processors.ImageProcessor`1.SixLabors.ImageSharp.Processing.Processors.IImageProcessor<TPixel>.Execute()
         at SixLabors.ImageSharp.Processing.DefaultImageProcessorContext`1.ApplyProcessor(IImageProcessor processor, Rectangle rectangle)
         at SixLabors.ImageSharp.Processing.DefaultImageProcessorContext`1.ApplyProcessor(IImageProcessor processor)
         at SixLabors.ImageSharp.Drawing.Processing.DrawTextExtensions.DrawText(IImageProcessingContext source, DrawingOptions drawingOptions, TextOptions textOptions, String text, IBrush brush, IPen pen)
         at SixLabors.ImageSharp.Drawing.Processing.DrawTextExtensions.DrawText(IImageProcessingContext source, TextOptions textOptions, String text, IPen pen)

Steps to Reproduce

IPen pen = new Pen(Color.Black, 2);
var img = new Image<Rgba32>(2000, 180);
            img.Mutate(g =>
            {
                var textFont = font.CreateFont(128);
                var options = new TextOptions(textFont)
                {
                    VerticalAlignment = VerticalAlignment.Center,
                    HorizontalAlignment = HorizontalAlignment.Center,
                    Font = textFont
                };
                
                g.DrawText(options, text, pen);
            });

Images

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions