opensubscriber
   Find in this group all groups
 
Unknown more information…

g : gs-devel@ghostscript.com 19 December 2009 • 1:58AM -0500

[gs-devel] PostScript Question
by Levi

REPLY TO AUTHOR
 
REPLY TO GROUP




I apologize if this is the wrong place to ask, but I'm sure someone
will know this very quickly.

How can you calculate the height of a line of text based upon the
current font?  I have an application that drops items in certain
locations on an image.  The coordinate system for this has 0,0 at the
upper left, while PostScript has it's coordinate system at the bottom
left.  Therefore when I draw the string at a specific location, it is
vertically off by the height of the text.  I would like to be able to
calculate this offset and do a:

[x-coord] [y-coord] [line height] sub moveto
(This is my text at the proper location) show

I've seen the following postscript that purports to do this, but it
didn't seem to work for me:

/fontheight { currentfont /FontMatrix get 3 get } bind def

Therefore I did:

/Helvetica-Bold-ISOLatin1 findfont 11 scalefont setfont
[x-coord] [y-coord] fontheight sub moveto
(This is my text at the proper location) show

Any help would be greatly appreciated.

Kind regards,

Levi
_______________________________________________
gs-devel mailing list
gs-devel@ghos...
http://ghostscript.com/cgi-bin/mailman/listinfo/gs-devel

Bookmark with:

Delicious   Digg   reddit   Facebook   StumbleUpon

Related Messages

opensubscriber is not affiliated with the authors of this message nor responsible for its content.