[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Graphing and right-justified text
- To: gat@robotics.jpl.nasa.gov (Erann Gat)
- Subject: Re: Graphing and right-justified text
- From: bill@cambridge.apple.com (Bill St. Clair)
- Date: Mon, 30 Jan 1995 12:04:12 -0400
- Cc: info-mcl@digitool.com, bill@cambridge.apple.com
- Sender: owner-info-mcl@digitool.com
At 3:41 PM 1/26/95, Erann Gat wrote:
>1. I need to graph a function in MCL with nice looking axes, labels,
>etc. Has anyone written code to do this?
>
>2. How do I draw right-justified text? i.e. how do I determine how big
>my text image is going to be before I draw it so I can figure out where
>to start drawing it? (This is for drawing axis labels.)
You could use a static-text-dialog-item with right justification:
(make-instance 'static-text-dialog-item :dialog-item-text "Right"
:text-justification #$tejustRight
...)
Or, you can use #_stringWidth to find the size of the string
you want to right justify and then set the pen position (#_MoveTo ...)
before calling #_DrawText (or princ) to draw the label:
? (with-pstrs ((c "foo")) (#_stringwidth c))
18
? (with-pstrs ((c "food")) (#_stringwidth c))
24
?