Imagesharp: Wrapped text "wandering" from baseline on successive lines.

Created on 27 Aug 2018  路  5Comments  路  Source: SixLabors/ImageSharp

Prerequisites

  • [x] I have written a descriptive issue title
  • [x] I have verified that I am running the latest version of ImageSharp
  • [x] I have verified if the problem exist in both DEBUG and RELEASE mode
  • [x] I have searched open and closed issues to ensure it has not already been reported

Description

Wrapped text appears to "wander" on successive "wraps"

Steps to Reproduce

Following code:

``` c#
public static void DrawWrappedText()
{
Console.WriteLine($"Executing {System.Reflection.MethodBase.GetCurrentMethod().Name}");

// White filled "4 x 6" (if measured as 200 DPI).
Image<Rgba32> TestImage = new Image<Rgba32>(800, 1200);
TestImage.Mutate(x => x.Fill(Rgba32.White));

// Font F = SystemFonts.CreateFont("Arial", 30, FontStyle.Regular);
Font F = SystemFonts.CreateFont("Baskerville Old Face", 30, FontStyle.Regular);

string T = "鈥橳was brillig, and the slithy toves Did gyre and gimble in the wabe: All mimsy were the borogoves, And the mome raths outgrabe.\"Beware the Jabberwock, my son!  The jaws that bite, the claws that catch!  Beware the Jubjub bird, and shun The frumious Bandersnatch!\"";

TextGraphicsOptions TGO = new TextGraphicsOptions(true)
{
    WrapTextWidth = TestImage.Width
};

TestImage.Mutate(x => x.DrawText(TGO, T, F, Rgba32.Black, new PointF(10, 50)));

TestImage.Save("WrappedText.jpg");

}
```
Produced the following:

wandering-text

Zoom into the 4th line of text. The characters are "wandering" vertically off the baseline.

1st line seems OK, and each successive line seems to get "worse".

Other fonts tried (Arial), but the Baskerville shows issue clearly.,

System Configuration

  • ImageSharp version: 1.0.0-beta0005
  • Other ImageSharp packages and versions: SixLabors.ImageSharp; SixLabors.ImageSharp.Drawing
  • Environment (Operating system, version and so on): Win10; Visual Studio 2017 v 15.8.0
  • .NET Framework version: .Net Core 2.1
  • Additional information:
bug

All 5 comments

@3itao8 Thanks for raising this.

Not related to the issue at hand but I notice you are not disposing of images after use. Image<TPixel> implements IDisposable

JimBob, no disposal, this is simply evaluation/test code.

@JimBobSquarePants
Just noticed this now has a milestone.

Guesstimate on RC1 timeframe?

@JimBobSquarePants

Sorry about confusion on last comment. Was simply saying that Dispose() wan't called as code sample was simply for test/evaluation/demonstration purposes; obviously not "finished" code.

Thx

My guess is that it's most likely a SixLabors.Fonts issue. An isolated/simplified, glyph-level reproduction would help a lot.

@tocsoft any idea what goes wrong & why it's more visible with this font?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

xakep139 picture xakep139  路  3Comments

QuantumToasted picture QuantumToasted  路  3Comments

jarroda picture jarroda  路  3Comments

olivif picture olivif  路  3Comments

vad3x picture vad3x  路  4Comments