gdmodule true type font size

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

  1. John Hunter

    John Hunter Guest

    When using gdmodule to draw text using true type fonts

    im.string_ttf(font, fontsize, angle, (x,y), s, color)

    the docs say 'draw string s at (x,y) using the TrueType font at the
    given pointsize and angle.' It is not clear to me how gd handles
    point size. A fontsize of 12 should be 12/72 = 1/6 inches tall but
    how does gd decide what an inch is? 72 pixels? Is there some scale
    parameter or constant that allows gd to make the conversion from
    pixels to points?

    I want my text to scale with image resolution which is determined by a
    dpi parameter, and I tried doing

    scale = dpi/72.0
    im.string_ttf(font, scale*fontsize, angle, (x,y), s, color)

    but the fonts are larger than they should be, at least according to my
    calculations.

    Thanks,
    John Hunter
    John Hunter, Sep 13, 2003
    #1
    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:
    741
    Roedy Green
    Jul 15, 2003
  2. John Hunter
    Replies:
    1
    Views:
    302
    Eric Brunel
    Sep 17, 2003
  3. wial
    Replies:
    2
    Views:
    798
  4. bdb112
    Replies:
    45
    Views:
    1,313
    jazbees
    Apr 29, 2009
  5. mttc
    Replies:
    2
    Views:
    2,363
    Roedy Green
    Jul 3, 2009
Loading...

Share This Page