Skip to content

Drawing multiple types of text (bold, colored, etc) in a single call? #1723

Answered by dlemstra
QuantumToasted asked this question in Help
Discussion options

You must be logged in to vote

You could use pango for this. You can read the text as an image and then composite this on top of another image.

        var readSettings = new MagickReadSettings
        {
            Font = "Courier New Ultra-Bold",
            FontPointsize = 42,
            BackgroundColor = MagickColors.None,
        };

        using var image = new MagickImage("pango:<span foreground='#ffac1c'>Trix</span><span foreground='#fff'> destroys</span><span foreground='#ffac1c'> Nimbus</span><span foreground='#fff'>'s supplies while he is asleep.</span>", readSettings);

You can find some docs about the syntax here: https://docs.gtk.org/Pango/pango_markup.html

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by QuantumToasted
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants