Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > gdmodule true type font size

Reply
Thread Tools

gdmodule true type font size

 
 
John Hunter
Guest
Posts: n/a
 
      09-13-2003

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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Swing Font, it's Java Font? ot native? how install new font? mttc Java 2 07-03-2009 07:29 PM
[False,True] and [True,True] --> [True, True]????? bdb112 Python 45 04-29-2009 02:35 AM
Printing with specific font-type and font-size wial Java 2 11-27-2008 05:30 PM
Re: [Python] gdmodule true type font size John Hunter Python 1 09-17-2003 02:11 PM
physical font specified but true type font file not available Michael Glavitsch Java 1 07-15-2003 07:09 PM



Advertisments