CLIM mail archive

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

Buggy WITH-TEXT-STYLE Macro??



    Date: Thu, 3 Dec 1992 14:23 EST
    From: Mark Nahabedian <naha@riverside.scrc.symbolics.com>

	Date: Thu, 3 Dec 1992 09:08 EST
	From: Markus Fischer <MF@sun4.sger>

	    Date: Thu, 3 Dec 1992 08:25+0100
	    From: berni@iml.fhg.de

	    I'm using CLIM 1.1 with MCL 2.0
	    and CLIM 1.1 under Genera 8.1.

	    If I'm using a text style with :bold face inside an enviromnent of 
	    :italic face, the text gets formatted in (:bold :italic) face.
	    As all text-styles are fully specified, I assume it's a bug.
	    If I misunderstand the Documentation and it's a feature, 
	    how can I do what I want (i.e. formatting the
	    text :bold, but NOT :italic??

	The problem is that WITH-TEXT-STYLE always merges the new text style with
	the existing one. The exact behavior is documented for the function 
	MERGE-TEXT-STYLES.

    The question is about what should happen when a text style specifying
    the face :bold is merged with a text style specifying the face :italic.
    What berni expects is a text style with a face of :bold.  That is what I
    would expect since the face of :bold that he asked for is fully
    specified (i.e. not NIL).  That's what I would expect.  What he is
    getting is a text face of (:bold :italic).

Another way to look at this is that there is a text face :bold-italic,
and Berni did NOT want that one, he wanted some text in :italic and
some in :bold.  Both interpretations (to merge or not to merge) are
possible and each makes sense in some contexts.  I think Markus's
suggestion of a keyword bears looking into.

	However, you seem to want NO merging at all, since your test code
	always specifies the text-style completely. I wrote a kludge to get
	the behavior you're probably looking for. It temporarliy (for the extent
	of the body) binds the medium's text-style to the medium's default text
	style. 

	But maybe it would be desirable to have an additional keyword like
	(:MERGE-P T) in the WITH-TEXT-XXX macros of CLIM 2.0 ?



	(defmacro with-unmerged-text-style ((text-style stream) &body body)
	  `(clim-utils:letf-globally (((medium-text-style ,stream) (medium-default-text-style ,stream)))
	     (with-text-style (,text-style ,stream)
	       ,@body)))

	Then your test case is as follows:

	(let ((stream *standard-output*))
	  (clim:with-text-style  
	       ((clim:make-text-style :sans-serif :roman :large) stream)
	    (format stream "~%Here is text with sans-serif normal large")
	    (clim:with-text-style  
	       ((clim:make-text-style :sans-serif :italic :large) stream)
	      (format stream "~%Here is text with sans-serif italic large")
	      (WITH-UNMERGED-TEXT-STYLE
		   ((clim:make-text-style :sans-serif :bold :large) stream)
		(format stream "~%This text is sans-serif, bold AND ITALIC, large,
	")))))



0,,

References:

Main Index | Thread Index