[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Graphing and right-justified text



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
?