CLIM mail archive


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


Perhaps I'm not being clear enough about this problem; there are really two
separate issues involved. First, why isn't the start-point of the text glyph
being transformed, and second, why aren't the glyphs themselves transformed.
You have, I think, explained away the second problem, although I think that
CLIM ought to supply some vector-based font for this kind of thing; but I
still don't understand why the starting point for the draw-text* is not being
transformed uniformly with the graph arcs. I'd be happy if the "nodes" 
remained fat or whatever font-size I specified, as long as they actually were
planted in the right positions relative to the graph arcs. This is in fact
what happens in the previous version that I sent when I use with-text-size.

Previous version:

(defmethod print-subclass-tree ((name symbol) &optional (size :tiny))
  (let* ((class (find-class name))
	 (filename (concatenate 'string (string (class-name class))
    (with-open-file (file filename :direction :output :if-exists :supersede)
      (clim:with-output-to-postscript-stream (stream file :multi-page t)
        (clim:with-text-size (size stream)
	  (clim:format-graph-from-root class
	    #'(lambda (object s)
		(write-string (string (class-name object)) s))
	    #'clos:class-direct-subclasses :stream stream))))
    (excl:run-shell-command (concatenate 'string "lpr " filename))))

The trouble with this approach is that the degree of compaction or expansion
of the graph is determined by the text-size and does not cover the range of
contraction that I need. 

If the starting points of the transformed arcs began at the end-points of the 
textual-nodes, and the start-points of the textual-nodes were at the end-points
of the arcs then I could live with "untransformed" glyphs, but the way things
stand now, the postscript output for the textual-nodes portion of the graph is
identical no matter what I put in for a transformation size (using the code
included below). I think that this much at least is a bug in the CLIM implemen-
tation of 1.1. I only have documentation for CLIM 1.0 and 2.0.alpha.  There is
no mention of towards-x or towards-y in the 1.0 documentation, and the 2.0
documentation is irrelevant at this point since 2.0.alpha dose not yet include

Finally, I think it would be very useful for the with-output-to-postscript-stream
to accept an additional keyword (:eps nil) for the purposes of including these
views into standard document preparation software. I'm not grossly offended by 
the earlier suggestion you made of offering a kludgey :scale keyword also, but 
it does seem to clash with the overall transformation protocol.

 Gregory M. Whittaker,		 The MITRE Corporation
				 Center for Advanced Aviation 
				    System Development
Internet:	 7525 Colshire Drive 
   Phone: (703) 883-5549	 McLean Virginia 22102-3481
     FAX: (703) 883-1226	 Mail Stop: W215      

----- Begin Included Message -----

>From SWM@STONY-BROOK.SCRC.Symbolics.COM Thu Sep 10 10:03:14 1992
Received: from by (4.1/SMI-4.1)
	id AA00759; Thu, 10 Sep 92 10:03:14 EDT
Return-Path: <SWM@STONY-BROOK.SCRC.Symbolics.COM>
Received: from by (5.61/SMI-2.2)
	id AA01773; Thu, 10 Sep 92 09:55:10 -0400
Received: from STONY-BROOK.SCRC.Symbolics.COM by (911016.SGI/4.7)
	id AA06479; Thu, 10 Sep 92 09:57:26 -0400
Posted-From: The MITRE Corporation, Bedford, MA
Received: from SUMMER.SCRC.Symbolics.COM by STONY-BROOK.SCRC.Symbolics.COM via INTERNET with SMTP id 1139470; 10 Sep 1992 09:58:14-0400
Date: Thu, 10 Sep 1992 09:59-0400
From: Scott McKay <SWM@STONY-BROOK.SCRC.Symbolics.COM>
Subject: postscript output with scaling and draw-text* in CLIM 1.1
In-Reply-To: <>
Message-Id: <19920910135905.1.SWM@SUMMER.SCRC.Symbolics.COM>
Status: R

    Date: Wed, 9 Sep 1992 17:37 EDT
    From: "Gregory M. Whittaker" <>

    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))
	(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)
		 #'(lambda (object 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.

     Gregory M. Whittaker,		 The MITRE Corporation
				     Center for Advanced Aviation 
					System Development
    Internet:	 7525 Colshire Drive 
       Phone: (703) 883-5549	 McLean Virginia 22102-3481
	 FAX: (703) 883-1226	 Mail Stop: W215      

----- End Included Message -----



Main Index | Thread Index