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

Michael Lange klappnase at web.de
Tue Aug 24 20:44:01 CEST 2010


Thus spoketh Firat Ozgul <ozgulfirat at gmail.com> 
unto us on Tue, 24 Aug 2010 16:54:30 +0300:

> 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... 

I guess you are right, and using the fontmap option does not seem to make
any difference; when I use e.g. times in the canvas and override it
through the fontmap with verdana, I get verdana in the postscript. If I
use e.g. "clean" instead of verdana I get something that looks like
courier. So it looks like the good news is that I don't need to bother
trying to get the fontmap working when the font name contains white
space :)

> 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/

Nice, i did not know that this is possible, but unfortunately this is no
option for me. I want that my app can be run on any linux machine, so I
would have to ship my own fonts to know where exactly the files are.

I wonder if there is some way to determine from within Tkinter which
fonts can't be used with postscript; if yes I could simply remove these
from the menu where the font can be selected, I could live very well with
that. What's bad is that the font that is printed is not the one the user
sees on the screen.



.-.. .. ...- .   .-.. --- -. --.   .- -. -..   .--. .-. --- ... .--. . .-.

There's a way out of any cage.
		-- Captain Christopher Pike, "The Menagerie" ("The Cage"),
		   stardate unknown.

More information about the Tkinter-discuss mailing list