-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to the CLX manual, with-gcontext "Changes the indicated
graphics context components to the specified values only within the
dynamic extent of the body"

However, in the specific case of fonts, this doesn't appear to be what
it actually does - when the with-gcontext form has finished, a call 
to gcontext-font returns the old local value, not the global one.  
An example might make this clearer.  

* (defpackage "ACCLAIM"  (:use "CL" "XLIB"))

#<The ACCLAIM package, 0/9 internal, 0/2 external>
* (in-package :acclaim)

#<The ACCLAIM package, 0/9 internal, 0/2 external>
* (defvar *display* (xlib:open-display "unix" ))

*DISPLAY*
* (defvar *screen* (xlib:display-default-screen *display*))

*SCREEN*
* (defvar *win*
  (xlib:create-window
   :parent (xlib:screen-root *screen*)
   :x 0
   :y 0
   :width 100
   :height 768
   :background (xlib:screen-white-pixel *screen*)))

*WIN*

* 
(defvar *gc*
  (create-gcontext
   :drawable *win*
   :fill-style :solid
   :background (xlib:screen-white-pixel *screen*)
   :foreground (xlib:screen-black-pixel *screen*)
   :font
   (xlib:open-font *display* "-*-helvetica-medium-r-*-*-*-240-*-*-*-*-*-*")))

*GC*
* (gcontext-font *gc*)

#<FONT -*-helvetica-medium-r-*-*-*-240-*-*-*-*-*-* unix:0 20971522>
* (with-gcontext (*gc* :font "fixed") (gcontext-font *gc*))

#<FONT fixed unix:0 20971524>
* (gcontext-font *gc*)

#<FONT fixed unix:0 20971524>


If it's not clear, I expected to get the helvetica font back as the
result of that last one.

If I draw-glyphs at this point, it does actually draw helvetica.
However, I need to call text-extents before I can draw anything, or I
don't know where to draw it...

Any ideas?  I tried force-gcontext-changes, but it doesn't seem to
make any difference.


- -dan

- -- 

   http://www.cliki.net/ - Link farm for free CL-on-Unix resources 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE/K7+MHDK5ZnWQiRMRAv57AJ4rQoMq1+Q7ES6MfMHGrMmpeQCBvwCePkyR
k15QY93b08NDPR18mJVBZDo=
=FTz5
-----END PGP SIGNATURE-----


Reply via email to