This project has moved and is read-only. For the latest updates, please go here.

Pango Caption Bugs with Escaping and Long Text

Aug 12, 2016 at 6:41 PM
I'm seeing some really inconsistent behavior with Magick.NET and Pango image captioning.

One deals with encoding special characters when using Pango. In this example, "<>" has already been HTML encoded, yet it still crashes?
                var imageWithText = new MagickImage();
                var settings = new MagickReadSettings()
                {
                    FontPointsize = 42,
                     FontWeight = FontWeight.Thin,
                    Width = 980
                };

                imageWithText.Read("pango:<span font='Arial'>&lt;&gt;</span>", settings);
The same encoded string works fine from the command line.

Also, if you use a super long string with Pango, Magick.NET is also crashing. Attached is a VS 2015 console application project that demonstrates 3 crashes and 1 success. It doesn't make much sense.

https://drive.google.com/open?id=0B6zvIi1Z7g8ibjFQRmJpcDkyek0
Aug 12, 2016 at 9:55 PM
Thanks for providing me with such a great example program. Those exceptions are being raised by the Pango library. I have no idea why it is failing. I will need to take a deeper look at the Pango to get a better answer on why it fails. This looks like a bug in that library.
Mar 2 at 6:29 PM
I noticed that Pango is truncating a long text string to around 4000 characters. If this is related to what your experiencing, are there any ways to increase this limit?
Mar 4 at 10:01 AM
Thanks for your response adriangatto! It seems that you found a bug (missing feature) in the Magick.NET code. When reading "pango" the content is stored in a buffer that can only hold 4096 characters. In the ImageMagick code there is a trick that allows you to read "pango" content that exceeds that buffer. I'll make sure this gets fixed in the next version of Magick.NET.