Quantcast
Channel: magick Discussions Rss Feed
Viewing all articles
Browse latest Browse all 3693

New Post: Using FontTypeMetrics While Wrapping Text Possible?

$
0
0
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);
                                }

Viewing all articles
Browse latest Browse all 3693

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>