CLIM mail archive

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

Re: postscript output with scaling and draw-text* in CLIM 1.1



    Date: Thu, 10 Sep 1992 13:38 EDT
    From: gmw@cypress.mitre.org (Gregory M. Whittaker)

    Scott,

    In the previous response regarding :size,

    >Um, 1.0 and 0.5 are pretty small point sizes (1/72 and 1/144 inch high,
    >respectively, I think)...  What is the size of the text in this output?
    >Also, the PostScript port has had very little use or testing, so it
    >would not surprise me if there was a bug establishing the font.

    the 1.0 and 0.5 were :size keyword values in the code included below, not
    in the previous version which used with-text-size.

We are talking past each other.  I am simply going ignore everything each
of us has said and try again.

The transform *never affects the text size*, only its placement.  It
affects the placement of the text by transforming the x/y and towards-x/y
arguments to DRAW-TEXT*.  The line drawn along the direction from (the
transformed) x/y to towards-x/y serves as the baseline for the placement
of the glyphs.  Additionally some ports might (or might not) rotate the
glyphs along that baseline when the transform-glyphs argument is T.

It might be a good idea to make the selection of the text size depend on
the amount of scaling supplied by the transformation.  Then again, it
might not.  I haven't thought enough to decide.  But the fact remains
that *the transformation does not currently affect the size of the text*.

So, at the very least your code must do *both of*
 - set the scaling, and
 - choose the appropriate size for the text style in printer's points.
This code only does one of those things.

	Here is the code:

	(defmethod print-scaled-subclass-tree ((name symbol) &optional (size 1.0))
	  (let* ((class (find-class name))
		 (filename (concatenate 'string (string (class-name class))
					"-subclass-tree.ps")))
	    (with-open-file (file filename :direction :output :if-exists :supersede)
	      (clim:with-output-to-postscript-stream (stream file :multi-page t)
		(let ((transform (clim:make-scaling-transformation size size)))
		  (clim:with-drawing-options (stream :transformation transform)
		    (clim:format-graph-from-root 
		     class
		     #'(lambda (object s)
			 (multiple-value-call
			     #'clim:draw-text* 
			   s
			   (string (class-name object))
			   (clim:stream-cursor-position* s)
			   :align-y :center
			   :transformation transform))
		     #'clos:class-direct-subclasses :stream stream))))
	      )))
	;;;(excl:run-shell-command (concatenate 'string "lpr " filename)))))
	;;; if you actually want to print out the results, uncomment the above
	;;; line and delete the preceding three close-parens. I've been simply
	;;; using pageview to examine the results of the tests, and only print-
	;;; hardcopy when necesary for documentation.

	 --------
	Cordially,
	 Gregory M. Whittaker,	    The MITRE Corporation
				     Center for Advanced Aviation 
					  System Development

	Internet: greg@mitre.org	 7525 Colshire Drive 
	   Phone: (703) 883-5549	 McLean Virginia 22102-3481
	     FAX: (703) 883-1226	 Mail Stop: W215      





0,,

References:

Main Index | Thread Index