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

Firat Ozgul ozgulfirat at gmail.com
Tue Aug 24 11:37:41 CEST 2010


Hello,

It seems to me that for the most part, you are having issues with font names
that have spaces between the words making up the font name. For example:
"DejaVu Sans Condensed"

If there are spaces between words, you should define self.font as a tuple:

self.font = ("DejaVu Sans Condensed",)

Note the trailing comma in accordance with the rules of creating a
one-element tuple...

Although it is not mandatory, you would better use the exact same cases
(uppercase vs lowercase) for the fonts as seen from the output of:

[code]
root = Tk()
root.tk.call("font", "families")
[/code]

Please try this way, and tell me if it solves the problem.

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

> Thanks Firat for the reply,
>
> Thus spoketh Firat Ozgul <ozgulfirat at gmail.com>
> unto us on Tue, 24 Aug 2010 09:16:41 +0300:
>
> > Hello,
> >
> > Unfortunately there are not enough documentation about Python-tk
> > postscript manipulation. Information is scattered here and there.
> >
> > A sample code could be like this:
> > [0] http://paste-it.net/public/l5a7036/
> >
>
> this example does basically the same as my tcl snippet; it works ok with
> verdana, but for some reason fails on comic sans ms and some other fonts,
> but I cannot see why some fonts work and some don't. For example, also
> "bitstream vera sans mono" fails wheras "andale mono" works. Maybe I
> should mention that all these fonts are displayed correctly in the
> canvas. For the "working" fonts I do not even need to pass a fontmap to
> postscript().
>
> > Some useful discussions on the topic:
> > [0]
> >
> http://www.velocityreviews.com/forums/t326920-tkinter-canvas-postscript-fontmap.html
> > [1] http://wiki.tcl.tk/8483
>
> I have already seen these, however they don't help me much, because of
> the strange problems described above. So I am still not sure if it's
> improper use of the fontmap or some other weird problem with either Tk or
> maybe my system's postscript engine.
>
> Regards
>
> Michael
>
> .-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-.
>
> The heart is not a logical organ.
>                -- Dr. Janet Wallace, "The Deadly Years", stardate 3479.4
> _______________________________________________
> Tkinter-discuss mailing list
> Tkinter-discuss at python.org
> http://mail.python.org/mailman/listinfo/tkinter-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tkinter-discuss/attachments/20100824/aa0993f7/attachment.html>


More information about the Tkinter-discuss mailing list