TextDirection doesn't work

Magick.NET is an object-oriented C# interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning Magick.NET
Post Reply
Eilonitis
Posts: 2
Joined: 2019-11-05T02:11:16-07:00
Authentication code: 1152

TextDirection doesn't work

Post by Eilonitis »

According to the website Magick.NET supposed to have bidirectional text support, but It doesn't work for me.
All I need is to create a simple rectangle with text on it.

This is my code -

Code: Select all

using (MagickImage image = new MagickImage(new MagickColor(0, 0, 255), 500, 200))
{
    new Drawables()
      .FontPointSize(30)
      .Font("Arial")
      .StrokeColor(new MagickColor("white"))
      .TextAlignment(TextAlignment.Right)
      .TextDirection(TextDirection.RightToLeft)
      .Text(500, 30, text)
      .Draw(image);
}
The problem is if the text contains right to left language, it write it in the opposite direction.
For example the word שלום will be written like this - םולש.

What am I doing wrong? Do I need to add another package to my project?

User avatar
dlemstra
Posts: 1610
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: TextDirection doesn't work

Post by dlemstra »

It looks like the text is written correctly? Dont understand why it is incorrect.
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate

Eilonitis
Posts: 2
Joined: 2019-11-05T02:11:16-07:00
Authentication code: 1152

Re: TextDirection doesn't work

Post by Eilonitis »

The problem is the order of the letters.
I know the example I gave is in Hebrew and you probably can't read it but the order of the letters is wrong, the letters are being typed from left to right instead of right to left.
I thought that the TextDirection supposed to fix it but it doesn't make a different, all of the text is being typed from left to right.

Think of that in a completely opposite situation, if all of the text would be from right to left, English word like "Hello" would be "olleH".

Post Reply