ImageSharp.Drawing icon indicating copy to clipboard operation
ImageSharp.Drawing copied to clipboard

Incorrect render of Thai characters when ascii characters are present in rendered text

Open eangelov opened this issue 3 years ago • 1 comments

Prerequisites

  • [x] I have written a descriptive issue title
  • [x] I have verified that I am running the latest version of ImageSharp.Drawing
  • [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

When using DrawText on the test image to draw "ดวันโอวัน" everything is as expected resultImage_1

When we draw "Test ดวันโอวัน" we get image

Test Image: testImage

Steps to Reproduce

using SixLabors.Fonts;
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.Drawing.Processing;
using SixLabors.ImageSharp.Processing;

var fonts = new FontCollection();
fonts.AddSystemFonts();

string textToDraw = "ดวันโอวัน";

TextOptions textOpts = new TextOptions( fonts.Get( "Microsoft Sans Serif" ).CreateFont( 60, SixLabors.Fonts.FontStyle.Regular ) ){
    Origin = new SixLabors.ImageSharp.PointF( 10, 10 )
};

using Image image = Image.Load( "testImage.jpg" );
image.Mutate( 
    x => x.DrawText( 
        textOpts, textToDraw, Color.ParseHex( "#000000" ) 
    ) 
);
image.SaveAsJpeg( "resultImage_1.jpg" );


using Image image2 = Image.Load( "testImage.jpg" );
image2.Mutate( 
    x => x.DrawText( 
        textOpts, $"Test {textToDraw}", Color.ParseHex( "#000000" ) 
    ) 
);
image2.SaveAsJpeg( "resultImage_2.jpg" );

System Configuration

  • ImageSharp.Drawing version: 1.0.0-beta15
  • Other ImageSharp packages and versions: SixLabors.Fonts 1.0.0-beta18, SixLabors.ImageSharp 2.1.3
  • Environment (Operating system, version and so on): Windows 11 Pro Version: 21H2 OS build: 22000.856
  • .NET Framework version: .NET 6
  • Additional information:

eangelov avatar Aug 11 '22 06:08 eangelov