comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Vertical text alignment in postscript
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Vertical text alignment in postscript [message #54861] Tue, 17 July 2007 02:59 Go to next message
Andy Heaps is currently offline  Andy Heaps
Messages: 22
Registered: March 2006
Junior Member
I'm trying to align text vertically in postscript but have some extra
space
above where the text finishes.Using !D.Y_CH_SIZE/2.0 as the mid-point
means that the text is now not vertically aligned.

Has anyone an explanation/solution for this problem?
Attached is a small program to show the problem.

Many thanks
Andy


PRO ll

SET_PLOT, 'ps'
DEVICE, FILE='ll.ps', XSIZE=8.27, YSIZE=11.69, $
XOFFSET=0.5, YOFFSET=0.5, /INCHES, /COLOR
!P.COLOR=1
!P.FONT=0
!P.POSITION=[0.1,0.3,0.9,0.6]
r = [255,0]
g = [255,0]
b = [255,0]
TVLCT,r,g,b

mysize=6.0 ;Size of our text
ypix=!D.Y_CH_SIZE*mysize ;Height of text in pixels
xstart=1000 ;X start of plotting
xfinish=20000 ;X finish of plotting
ystart=5000 ;Y start of plotting

XYOUTS, xstart, ystart, CHARSIZE=mysize, 'Testing 123', /DEVICE
PLOTS, [xstart, xfinish], [ystart, ystart], /DEVICE ;Bottom of text
PLOTS, [xstart, xfinish], [ystart+ypix, ystart+ypix], /DEVICE ;Top of text

DEVICE, /CLOSE

END
Re: Vertical text alignment in postscript [message #54930 is a reply to message #54861] Wed, 18 July 2007 06:39 Go to previous message
Andy Heaps is currently offline  Andy Heaps
Messages: 22
Registered: March 2006
Junior Member
Many thanks for the replies - they were very useful.

The space that I was referring to is the spacing between text lines.
As I don't use more than one line of text at a time this wasn't
something I'd thought of.

To get a fairly decent approximation of the true height of true type
fonts in postscript I used the formula:
ypixels=!D.Y_CH_SIZE*charsize*0.84

Where ypixels is the height in pixels and charsize is size of the
characters passed to the xyouts procedure.
The scaling factor of 0.84 to get the best fit changes according to
the font used but 0.84 looks pretty good for Helvetica and Times.


Cheers
Andy
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: why is amoeba not working ??
Next Topic: Windows IDL in Parallels on a MacBook

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 10:19:43 PDT 2025

Total time taken to generate the page: 0.24261 seconds