-
-
Notifications
You must be signed in to change notification settings - Fork 43
Closed
Labels
bugSomething isn't workingSomething isn't working
Milestone
Description
Description
ImageSharp crashes when trying to render a glyph that does not exist in the loaded font.
Stack trace:
SixLabors.ImageSharp.ImageProcessingException: An error occurred when processing the image using DrawTextProcessor`1. See the inner exception for more detail.
---> System.ArgumentOutOfRangeException: Parameter "bufferAlignment" (System.Int32) must be greater than or equal to 0, was -2147483643 (Parameter 'bufferAlignment')
at SixLabors.ThrowHelper.ThrowArgumentOutOfRangeException(String name, String message)
at SixLabors.ThrowHelper.ThrowArgumentOutOfRangeExceptionForMustBeGreaterThanOrEqualTo[T](T value, T minimum, String name)
at SixLabors.ImageSharp.Memory.MemoryGroup`1.Allocate(MemoryAllocator allocator, Int64 totalLength, Int32 bufferAlignment, AllocationOptions options)
at SixLabors.ImageSharp.Memory.MemoryAllocatorExtensions.AllocateGroup[T](MemoryAllocator memoryAllocator, Int64 totalLength, Int32 bufferAlignment, AllocationOptions options)
at SixLabors.ImageSharp.Memory.MemoryAllocatorExtensions.Allocate2D[T](MemoryAllocator memoryAllocator, Int32 width, Int32 height, AllocationOptions options)
at SixLabors.ImageSharp.Drawing.Processing.Processors.Text.DrawTextProcessor`1.CachingGlyphRenderer.Render(IPath path)
at SixLabors.ImageSharp.Drawing.Processing.Processors.Text.DrawTextProcessor`1.CachingGlyphRenderer.EndGlyph()
at SixLabors.Fonts.GlyphInstance.RenderTo(IGlyphRenderer surface, Single pointSize, Vector2 location, Vector2 dpi, Single lineHeight)
at SixLabors.Fonts.Glyph.RenderTo(IGlyphRenderer surface, Vector2 location, Single dpiX, Single dpiY, Single lineHeight)
at SixLabors.Fonts.TextRenderer.RenderText(ReadOnlySpan`1 text, RendererOptions options)
at SixLabors.Fonts.TextRenderer.RenderText(String text, RendererOptions 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()
--- End of inner exception stack trace ---
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, TextGraphicsOptions options, String text, Font font, IBrush brush, IPen pen, PointF location)
at SixLabors.ImageSharp.Drawing.Processing.DrawTextExtensions.DrawText(IImageProcessingContext source, TextGraphicsOptions options, String text, Font font, Color color, PointF location)
at SixLabors.ImageSharp.Drawing.Processing.DrawTextExtensions.DrawText(IImageProcessingContext source, String text, Font font, Color color, PointF location)
Steps to Reproduce
Run this code:
var im = new Image<Rgba32>(50, 20);
FontCollection fc = new FontCollection();
// font is from https://fonts.google.com/specimen/Sunflower?preview.text=%C3%AD%C3%ADsad%C3%AD%C3%A9%C3%A1p&preview.text_type=custom#standard-styles
var ff = fc.Install(Path.Combine(AppContext.BaseDirectory, "Assets", "Fonts", "Sunflower-Medium.ttf"));
im.Mutate<Rgba32>(ctx =>
{
ctx.DrawText("í", ff.CreateFont(10), Color.Aqua, new PointF());
});
System Configuration
- ImageSharp.Drawing version: 1.0.0-beta0010
- Other ImageSharp packages and versions: 1.0.1
- Environment (Operating system, version and so on): latest Windows 10
- .NET Framework version: .NET Core 3.0
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working