It'll save a lot of trouble by installing FontConfig, FreeType & Ghostscript. You probably already have X11 sitting in your systems /opt
directory. If not, jump over to XQuartz and run the .dmg install. DejaVu & Window's fonts are nice to have, but not needed. After installing the font libraries, you'll need to re-configure ImageMagick (remember to make clean
), and re-install.
For the Magick++ tutorial, the following line is a bit confusing, as it involves a few wildcards that you may not be familiar with.
DrawableFont("-misc-fixed-medium-o-semicondensed—13-*-*-*-c-60-iso8859-1")
From the API, it may be a better introduction to initialize a font directly.
Magick::DrawableFont::DrawableFont ( const std::string & family_,
Magick::StyleType style_,
const unsigned int weight_,
Magick::StretchType stretch_
)
Find a typeface you wish to use by running identify -list font
Font: Helvetica-Narrow
family: Helvetica Narrow
style: Normal
stretch: Condensed
weight: 400
glyphs: /usr/local/share/ghostscript/fonts/n019043l.pfb
Then it's just a matter of applying the correct parameters
DrawableFont font = DrawableFont("Helvetica Narrow",
NormalStyle,
400,
SemiCondensedStretch
);
text_draw_list.push_back(font);
text_draw_list.push_back(DrawableText(101, 50, "text to write on the canvas"));
text_draw_list.push_back(DrawableStrokeColor(Color("black")));
text_draw_list.push_back(DrawableFillColor(Color(0, 0, 0, MaxRGB)));
my_image.draw(text_draw_list);