Possible memory leak

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Post by magick »

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.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Post by magick »

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"
    />
You can also use the MagickLib::GetTypeInfoByFamily() method whose signature is
  • const TypeInfo *GetTypeInfoByFamily(const char *family,
    const StyleType style,const StretchType stretch,
    const unsigned long weight,ExceptionInfo *exception)
then use MagickLib::GetTypeInfoByFamily()->name as the image->font() parameter.
Post Reply