Page 1 of 1

Draw text into center(TextAlignment)

Posted: 2019-11-08T05:49:28-07:00
by pablobhz
Hello.
I'm trying to draw some text in the center of an image, however, it never goes to the center ; stays on the left always.
I would like to know what can i do. The only way i've found to center my text was using Gravity.Center and then calculating offset pixels. But since TextAlignment is there, i believe there might be an easier way.

Here's my code:

Code: Select all

var h1FontMagick = new Drawables().FontPointSize(14).Font("Tahoma", FontStyleType.Bold, FontWeight.Bold, FontStretch.Condensed);
h1FontMagick.Text(0 ,varAltura, "Documento Auxiliar da Nota Fiscal de Consumidor EletrĂ´nica").TextAlignment(TextAlignment.Center).Draw(imgNota);
Also, is there any way to wrap text using Magick Drawable ?
Thanks !

Re: Draw text into center(TextAlignment)

Posted: 2019-11-25T13:42:41-07:00
by dlemstra
What happens when you use the `Gravity` method of the `Drawables` class?