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

Using FontTypeMetrics While Wrapping Text Possible?

Aug 1, 2016 at 5:53 PM
Is there a way to measure the height that is produced from a string with the specified font, pointsize, and font-weight with word wrapping enabled?

Right now, I get a width of 6000px and a height of 57px from a long paragraph of text because there is no word wrapping in the measurement. I'm guessing this functionality doesn't wrap since only a caption word wraps.

Here is my current code
var image = new Bitmap(width, height);
var ms = new MemoryStream();
image.Save(ms, ImageFormat.Jpeg);

using (MagickImage g = new MagickImage(ms, new MagickReadSettings() { Font = fontForImageMagick, FontPointsize = font.Size, FontWeight = FontWeight.Thin, Width = width }))
                    // Get the metrics of the text the user has typed in
                    TypeMetric fontInfo = g.FontTypeMetrics(textToFit);
Aug 1, 2016 at 8:49 PM
It is currently not possible to get the FontTypeMetrics with word wrapping enabled. I might be able to add this by looking at the source code of caption. I will get back to this topic when I know more.