The best path forward would be post a working program that illustrates the possible memory leak so that we can run it, reproduce the problem, and offer a solution. We do run a memory leak detector on ImageMagick code but its possible a leak went undetected.
Magick++ has the DrawableFont() method where you can set the family, style, weight, and stretch.
Possible memory leak
In the image class you can use a font filename to identify a particular font file (e.g. arial.ttf) but you can also use font handles. A font handle searches the type.xml configuration file for a matching font. In this file you can set the font style, weight, etc. For example, you will find Helvetica defined in type-ghostscript.xml as
- <type
name="Helvetica"
fullname="Helvetica Regular"
family="Helvetica"
foundry="URW"
weight="400"
style="normal"
stretch="normal"
format="type1"
metrics="/usr/local/share/ghostscript/fonts/n019003l.afm"
glyphs="/usr/local/share/ghostscript/fonts/n019003l.pfb"
/>
- const TypeInfo *GetTypeInfoByFamily(const char *family,
const StyleType style,const StretchType stretch,
const unsigned long weight,ExceptionInfo *exception)