[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Inverted text in Ruby Tk canvas postscript

Len Lawrence

6/14/2008 9:36:00 PM

A new problem with ruby-tk, specific to ruby1.8.7. The underlying tk
version has not changed but now text in a postscript file generated from
a tk canvas is mirror imaged about both horizontal and vertical axes.
Line by line comparison with a corresponding file output from tcl
shows that the prolog code is exactly the same. The text however is
handled differently. Ruby treats lines belonging to the same block as
a single group, which is good, but now inserts a minus sign in front
of the fontsize in each findfont line, e.g.

/URWGothicL-Book findfont -17 scalefont ISOEncode setfont

whereas Tcl has:

/URWGothicL-Book findfont 17 scalefont ISOEncode setfont

which works as expected.

The workaround for this is to preprocess the postscript output before
writing to a file, easy enough to do but hopefully unecessary in later
versions of ruby-tk.

changes = 0
screed.each { |line|
if i = line.index( "findfont -" ) :
line.sub!( "findfont -", "findfont " )
changes += 1
end
}

It looks like it might be an internationalization issue given that not
all nations read from left to right and top to bottom and it may come
out in the wash once the tk canvas is absorbed into the ttk themed
widget set.

Len