CLIM mail archive

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

Buggy WITH-TEXT-STYLE Macro??



    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.

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,
")))))

Regards,

Markus Fischer, MF@SGER.UUCP              Mergenthalerallee 77-81
Statice Development Group                 W-6236 Eschborn, Germany
Symbolics Systemhaus GmbH                 Phone: +49 6196 47220, Fax 481116

0,,

Follow-Ups: References:

Main Index | Thread Index