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

Firat Ozgul ozgulfirat at gmail.com
Tue Aug 24 08:16:41 CEST 2010


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/

Some useful discussions on the topic:
[0]
http://www.velocityreviews.com/forums/t326920-tkinter-canvas-postscript-fontmap.html
[1] http://wiki.tcl.tk/8483

Firat

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

> Hello all,
>
> I am stuck here with a strange  problem creating postscript from a
> Tkinter Canvas (the OS is debian linux).
> I found that Canvas.postscript() fails to render some fonts correctly and
> uses something like helvetica or courier (I guess) instead. From what the
> canvas man page says, I thought I should try to add a fontmap to the
> postscript() command, but I cannot seem to get it working, and I am not
> sure if it is because of improper use of the fontmap option or if
> something else is wrong.
> >From the few Tcl resources I could find I tried to set up a minimal tcl
> example, trying to find out how the "fontmap" works, because I could not
> find any useful Python resources:
>
> canvas .c -width 300 -height 300 -bg white
> pack .c
> set fonty [font create -family "comic sans ms" -size 16]
> .c create text 20 20 -font $fonty -text "ich wollt ich waer ein huhn"
> -anchor nw
> set fontMap($fonty) [list "comic sans ms" 16]
> update idletasks
> .c postscript -file "~/test.ps" -fontmap fontMap
>
> However this produces an obviously broken postscript file that cannot be
> opened.
> If I omit the -fontmap option, the file can be opened, but I get a font
> like
> helvetica or so.
>
> Does anyone have a clue on this?
>
> Regards
>
> Michael
>
>
> .-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-.
>
>        "Life and death are seldom logical."
>        "But attaining a desired goal always is."
>                -- McCoy and Spock, "The Galileo Seven", stardate 2821.7
> _______________________________________________
> 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/34e6df5a/attachment.html>


More information about the Tkinter-discuss mailing list