Inverted text in Ruby Tk canvas postscript

L

Len Lawrence

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top