Re: [Python] gdmodule true type font size

Discussion in 'Python' started by John Hunter, Sep 15, 2003.

  1. John Hunter

    John Hunter Guest

    >>>>> "Chris" == Chris Gonnerman <> writes:

    Chris> No. The underlying GD library assumes 1 point is exactly 1
    Chris> pixel. Font metrics are pretty fuzzy, so your mileage may
    Chris> vary slightly especially with script fonts.

    That helps thanks ...

    Chris> You've got me here. Perhaps if I knew what you were trying
    Chris> to accomplish at a bit higher level, I might be able to
    Chris> make a suggestion.

    That's OK, I think I have this figured out. The one point/one pixel
    info was enough to speed me on my way.

    JDH
     
    John Hunter, Sep 15, 2003
    #1
    1. Advertising

  2. John Hunter

    Eric Brunel Guest

    John Hunter wrote:
    >>>>>>"Chris" == Chris Gonnerman <> writes:
    >>>>>

    >
    > Chris> No. The underlying GD library assumes 1 point is exactly 1
    > Chris> pixel. Font metrics are pretty fuzzy, so your mileage may
    > Chris> vary slightly especially with script fonts.
    >
    > That helps thanks ...
    >
    > Chris> You've got me here. Perhaps if I knew what you were trying
    > Chris> to accomplish at a bit higher level, I might be able to
    > Chris> make a suggestion.
    >
    > That's OK, I think I have this figured out. The one point/one pixel
    > info was enough to speed me on my way.


    I just found a mail I sent a few time ago to Thomas Boutell, who created the gd
    library, and it seems there is a constant named GD_RESOLUTION in file gd.h that
    may help you to solve your problem (if you haven't already solved it). In former
    versions of gd, this constant was set by default to 96, which means that a pixel
    was not 1/72 inch, but 1/96 inch. Since font size units are supposed to be
    printer points (= 1/72 inch), setting a font size 12 in gd results in an actual
    size 12 * 96 / 72 = 16 pixels, and not 12 as you would expect.

    This problem happened in gd 1.8, and I haven't tried the new version. If it
    wasn't corrected, changing this constant to 72 may help to get the size you want.

    HTH
    --
    - Eric Brunel <> -
    PragmaDev : Real Time Software Development Tools - http://www.pragmadev.com
     
    Eric Brunel, Sep 17, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Michael Glavitsch
    Replies:
    1
    Views:
    798
    Roedy Green
    Jul 15, 2003
  2. John Hunter

    gdmodule true type font size

    John Hunter, Sep 13, 2003, in forum: Python
    Replies:
    0
    Views:
    339
    John Hunter
    Sep 13, 2003
  3. wial
    Replies:
    2
    Views:
    864
  4. bdb112
    Replies:
    45
    Views:
    1,423
    jazbees
    Apr 29, 2009
  5. mttc
    Replies:
    2
    Views:
    2,464
    Roedy Green
    Jul 3, 2009
Loading...

Share This Page