[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Graphing and right-justified text
- To: firstname.lastname@example.org
- Subject: Re: Graphing and right-justified text
- From: email@example.com (Richard Lynch)
- Date: 28 Jan 1995 05:04:12 GMT
- Organization: ILS
- References: <firstname.lastname@example.org>
- Sender: email@example.com
In article <firstname.lastname@example.org>, email@example.com
(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?
I *THINK* there's some graphing code at ftp.combridge.apple.com, but
that's just from posts I've seen here.
|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.)
;;;;by hand calculation...
STRING-WIDTH string &optional font-spec
returns the width in pixels of string, as if it were displayed using the
font, size and style of font-spec.
FONT-INFO &optional font-spec
returns four values, giving the ascent, descent, max-width, and leading
for font-spec , which defaults to the current font of the current
font-line-height will give you the full height of a font, although its
on-line documentation seems to have gone walkabout in my MCL. :-?
Also, the trivial definitions for font-ascent, font-descent, font-widmax,
font-leading, and font-height can be found in Lynch Lib which is also on
Be careful with font-line-height versus font-height...it's real easy to
think you've got it right until you try larger fonts, and you realize
you've got too much vertical space. :-)
;;;;skanky hacker way
(rlet ((rect :rect :topleft #@(-30000 <top>) :botright #@(<right> 30000)))
(with-pstrs ((s <string>))
(let ((len (%get-byte s)))
(#_TextBox (%incf-macptr s) len rect #$TEJustRight))))
-- "TANSTAAFL" Rich firstname.lastname@example.org