Page 1 of 1

Apply font style to portion of caption text

Posted: 2019-06-24T20:59:13-07:00
by KristyStevens
Hi everyone,

I'm a relatively new ImageMagick user so I hope my question makes sense. What I would like to know is if it is possible to style a portion of text in a caption. More specifically, I want to be able to create a multi-line caption representing a series of questions and answers, where the questions are bolded. Is this possible, and if so, how? I'm using RMagick.

So for example, I might have the following string of text:

var string = "This is a question?\nThis is an answer.\nThis is another question?\nThis is another answer."

Which should yield a caption like this:
This is a question?
This is an answer.

This is another question?
This is another answer.
'I'm open to other approaches other than a caption as long as they support multiple lines of text and auto font sizing.

Thanks!

Re: Apply font style to portion of caption text

Posted: 2019-06-24T22:13:15-07:00
by fmw42
You cannot change the style or font in the same caption: text. You would either have to use Pango styling (probably the most direct method) or write each line separately with label: and append or just use -annotate, once per line. See https://imagemagick.org/Usage/text/