justinNEE has asked for the wisdom of the Perl Monks concerning the following question:

I'm using GD to get an image from a file, add text to it, and save it to another file. All of this works fine except when I try to use a font other than one of the built in ones. stringTTF() returnds an array of bounds and no errors or warning are generated. However, it prints those small boxes that I thought meant "nonprintable character". It will change the size of the boxes and it appears the font also... but it just doesn't print out the right characters... maybe there's some kind of encoding problem?

Replies are listed 'Best First'.
Re: GD!
by Anonymous Monk on May 01, 2001 at 23:06 UTC
    what? This is from the docs for gd: "There are four built-in fonts, available in global variables gdGiantFont, gdLargeFont, gdMediumBoldFont, gdSmallFont and gdTinyFont. " also stringTTF() is for using true type fonts(which is what I'm trying to do)
      Note to Lincoln: There are five built-in fonts...
      1. gdGiantFont
      2. gdLargeFont
      3. gdMediumBoldFont
      4. gdSmallFont
      5. gdTinyFont.
      But ++ for the note on built in fonts... I was *this* close to a duplicate post.

      Greetz
      Beatnik
      ... Quidquid perl dictum sit, altum viditur.
Re: GD!
by Jouke (Curate) on May 02, 2001 at 11:55 UTC
    I have no experience with using TTF fonts in GD, but I can imagine something like this to happen when you chose a non-existing font or a font that does not have the characters you want to print out.

    It even happens in M$ Word sometimes when you load a document created on another PC where the creator selected a font that does not exist on your system. Even then you get those 'small boxes' you refer to...

    Jouke Visser, Perl 'Adept'
Re: GD!
by BMaximus (Chaplain) on May 01, 2001 at 22:57 UTC
    GD has only one text font. If you want to use more than one font type you need to install Image::Magick, its better for annotating pics.

    Update: I stand corrected. Refer to the posts below. Though I do like using Image::Magick better. :)

    BMaximus