[Tkinter-discuss] Canvas.postscript() fails to render some fonts properly

Firat Ozgul ozgulfirat at gmail.com
Tue Aug 24 15:54:30 CEST 2010


Hello,

It looks like that postscript() function cannot render every font with no
obvious reason. "Renderable" fonts are rendered correctly regardless of
whether they contain spaces or not... However it seems that, alternatively,
we can achieve what we want through the Image, ImageDraw and ImageFont
modules. All we need to know is the name of the .ttf file to which the font
name corresponds.

Here is the code: http://paste-it.net/public/t66c5c0/

Please note that I wrote this code on an XP machine. Considering that you
are on Debian, this little how to might be of help to you for configuring
TrueType fonts:

http://www.faqs.org/docs/Linux-mini/TT-Debian.html

Firat

2010/8/24 Michael Lange <klappnase at web.de>

> Hi Firat,
>
> Thus spoketh Firat Ozgul <ozgulfirat at gmail.com>
> unto us on Tue, 24 Aug 2010 12:51:48 +0300:
>
> > Hello,
> >
> > I found some useful stuff at:
> > http://www.tcl.tk/man/tcl8.4/TkCmd/canvas.htm(Find<http://www.tcl.tk/man/tcl8.4/TkCmd/canvas.htm%28Find>"-fontmap" there)
> >
> > The above document recommends a notation like: *
> > -*-Courier-Bold-R-Normal--*-120-
> >
> > *I think this notation will be like this for those fonts that have
> > spaces:
> >
> > *"-*-DejaVu Serif Condensed-Bold-R-Normal--*-120-*"
>
> I have already seen this, too, however this does not change anything :(
> Using "-*-comic sans ms-Bold-R-Normal--*-240-*" the font is displayed
> correctly as always,but not in the postscript :(
>
> Thanks for all your efforts !
>
> Michael
>
>
> .-.. .. ...- .   .-.. --- -. --.   .- -. -..   .--. .-. --- ... .--. . .-.
>
> "I'm a doctor, not a mechanic."
>                -- "The Doomsday Machine", when asked if he had heard of
>                   the idea of a doomsday machine.
> "I'm a doctor, not an escalator."
>                -- "Friday's Child", when asked to help the very pregnant
>                   Ellen up a steep incline.
> "I'm a doctor, not a bricklayer."
>                -- Devil in the Dark", when asked to patch up the Horta.
> "I'm a doctor, not an engineer."
>                -- "Mirror, Mirror", when asked by Scotty for help in
>                   Engineering aboard the ISS Enterprise.
> "I'm a doctor, not a coalminer."
>                -- "The Empath", on being beneath the surface of Minara 2.
> "I'm a surgeon, not a psychiatrist."
>                -- "City on the Edge of Forever", on Edith Keeler's remark
>                   that Kirk talked strangely.
> "I'm no magician, Spock, just an old country doctor."
>                -- "The Deadly Years", to Spock while trying to cure the
>                   aging effects of the rogue comet near Gamma Hydra 4.
> "What am I, a doctor or a moonshuttle conductor?"
>                -- "The Corbomite Maneuver", when Kirk rushed off from a
>                   physical exam to answer the alert.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tkinter-discuss/attachments/20100824/627bd0f5/attachment.html>


More information about the Tkinter-discuss mailing list