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

New Post: Issue with custom fonts

$
0
0
It seems you found a bug in the DrawableFont class. I just pushed a patch to the GIT repository to make sure this is fixed in the next release. The next release will be published tomorrow. That release will also include some syntax-sugar for the drawable classes. Your code can be rewritten to this:
privatevoid OutputFont(Char output)
{
  MagickImage fontTest = new MagickImage(Color.Transparent, Int32.Parse(Width_Text_Box.Text), Int32.Parse(Height_Text_Box.Text))
  {
    Format = MagickFormat.Png
  };

  fontTest.Draw(new Drawables()
    // Font parameters
    .Font($@"{AppDomain.CurrentDomain.BaseDirectory}\FontsFonts\28_Days_Later.ttf")
    .FontPointSize(Int32.Parse(FontSize_TxtBox.Text))
    .FillColor(_FillColour)
    // Outline
    .StrokeColor(_OutlineColour)
    .StrokeWidth(1)
    // Antialiasing
    .StrokeAntialias(true)
    .TextAntialias(true)
    // Text output
    .Text(0, 0, $"{output}")
    .Gravity(Gravity.Center));

  String upper = Char.IsUpper(output) ? "u" : "";
  fontTest.Write($"Output/{output}{upper}.png");
}

Viewing all articles
Browse latest Browse all 3693

Trending Articles



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