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

New Post: Drawing Italic / Different font text

$
0
0
Thank you for the quick response. However, that still didn't work - see image. It is not using the specified font family and it is not honoring the italics, font weight etc.
using (var working = new MagickImage(@"c:\temp\filename.jpg"))
{
    // Draw text
    working.StrokeColor = new MagickColor("#FFFFFF");
    working.FillColor = working.StrokeColor;
    working.Font = "Tahoma";
    working.FontPointsize = 24f;

    using (var piFont = new DrawableFont("Tahoma", FontStyleType.Italic, FontWeight.Weight700, FontStretch.Normal))
    {
        var list = new List<Drawable>();
        list.Add(piFont);
        var metrics = working.FontTypeMetrics("Why hello there!");
        using (var piText = new DrawableText(10, working.Height - metrics.TextHeight - 10, "Why hello there!"))
        {
            list.Add(piText);
            working.Draw(list);
        }
    }
}
Also when doing it as a list like that, how do you measure text (FontTypeMetrics) with the correct font? An italic, heavy font will be wider than a non-italic light font.

Image

Viewing all articles
Browse latest Browse all 3693

Trending Articles



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