CLIM mail archive

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

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



    Date: Wed, 9 Sep 1992 17:37 EDT
    From: "Gregory M. Whittaker" <gmw@cypress.mitre.org>

    Dear Lois,

    I'm re-sending my current version of a postscript grapher for 
    class hierarchies. I have dropped the with-scaling macro and 
    gone to the with-drawing-options equivalent since I need to 
    explicitly pass the transform to the draw-text* function as well.
    Unfortunately the entire combination results in no improvement
    over the original. It appears that draw-text* generic-function
    ignores the passed in transform after checking that it is indeed
    a transform. Text is identical in size and placement no matter
    what I supply for a size. The tree links only match up with the
    textual node positions when the size = 1.0.

    I'm back to using CLIM 1.1 because with-output-to-postscript-stream
    is not yet supported in CLIM 2.0.alpha. I'm using the Franz version
    on a SPARCstation 2. Surely someone out there has done this before!
    What am I doing wrong?

CLIM:DRAW-TEXT* is defined to obey transformations only insofar as the
placement of the glyphs along a particular baseline, and then only when
you suppy TOWARDS-X/Y.  Furthermore, it is allowed to ignore size and
rotation information.  This restricted behavior is specified because
most ports do not support general fonts (i.e., created from mathematical
descriptions descibing the path that outlines each glyph).  PostScript
is the only port general enough to support this, but the necessary work
has not been done to make it work properly.  In the meanwhile, you
should choose a font size (which you can specify in printer's points)
that matches the desired scaling transformation.

    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