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.

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

See original GitHub issue

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

Issue Analytics

  • State:open
  • Created 5 months ago
  • Comments:14 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
gokeiyoucommented, Apr 11, 2023

First of all thank you very much for your patience in answering. It’s my first time to raise Issues on GitHub. I don’t have a good experience. I’m very sorry for the inconvenience. I have successfully solved my problem by carefully reading the API documentation. Thanks again for your help. Thank you so much!

1reaction
brianpopowcommented, Jul 13, 2023

@JimBobSquarePants I think it would be good, if we open a WIP PR for the cff2 branch and gather all info and what needs to be done there. I will do that tomorrow.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error: Specified method is not supported?
Net Core. The below code will always work fine in the compile time, but this was failing at the run time and was...
Read more >
NotSupportedException: Specified method is not supported ...
I've got some projects using the shared interface without issue, one project keeps throwing this error. I thought it was missing setups, ...
Read more >
NotSupportedException Class (System)
The exception that is thrown when an invoked method is not supported, or when there is an attempt to read, seek, or write...
Read more >
NotSupportedException: Specified method is not supported.
Every time code is compiled and domain is reloaded, I am getting this error in the console- NotSupportedException: Specified method is not ......
Read more >
"Specified Method Not Supported" Linq Query to return ...
I faced this problem today in Client Object Model, it seems like it doesn't support comparing to strings either with == or Equals...
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