From jc at itsec.co.kr Sun Apr 1 23:00:01 2007 From: jc at itsec.co.kr (Jong-won Choi) Date: Mon, 02 Apr 2007 08:00:01 +0900 Subject: [cl-gd-devel] :convert-chars of draw-freetype-string In-Reply-To: References: <460C3A66.6080702@itsec.co.kr> <460CCF04.4060900@itsec.co.kr> Message-ID: <46103971.3080306@itsec.co.kr> Edi Weitz wrote: > > Or your locale is the culprit. > Yes the locale causes the problem. Thanks. From jc at itsec.co.kr Sun Apr 1 23:05:21 2007 From: jc at itsec.co.kr (Jong-won Choi) Date: Mon, 02 Apr 2007 08:05:21 +0900 Subject: [cl-gd-devel] :do-not-draw of draw-freetype-string In-Reply-To: References: <460C3A6D.4030301@itsec.co.kr> <460CD2AE.1030409@itsec.co.kr> Message-ID: <46103AB1.3090702@itsec.co.kr> Edi Weitz wrote: > Yes, it looks like you're right and my recent update broke things. > I'm on my way to Cambridge for the ILC now, though, so I probably > won't be able to fix this before the end of next week. > I'm not in a hurry. Thanks. Have a good time in ILC Jong-won From edi at agharta.de Thu Apr 5 23:58:58 2007 From: edi at agharta.de (Edi Weitz) Date: Fri, 06 Apr 2007 01:58:58 +0200 Subject: [cl-gd-devel] New release 0.5.4 (Was: :do-not-draw of draw-freetype-string) In-Reply-To: (Edi Weitz's message of "Sat, 31 Mar 2007 12:51:04 +0200") References: <460C3A6D.4030301@itsec.co.kr> <460CD2AE.1030409@itsec.co.kr> Message-ID: On Sat, 31 Mar 2007 12:51:04 +0200, Edi Weitz wrote: > Yes, it looks like you're right and my recent update broke things. I've released 0.5.4 which hopefully fixes this. From jc at itsec.co.kr Tue Apr 10 00:57:06 2007 From: jc at itsec.co.kr (Jong-won Choi) Date: Tue, 10 Apr 2007 09:57:06 +0900 Subject: [cl-gd-devel] New release 0.5.4 In-Reply-To: References: <460C3A66.6080702@itsec.co.kr> <460CCF04.4060900@itsec.co.kr> Message-ID: <461AE0E2.7030104@itsec.co.kr> Edi Weitz wrote: > I've released 0.5.4 which hopefully fixes this. The bug in draw-freetype-string is still there. Now when _image_ is *default-image* and _do-not-draw_ is T, gd-image-string-ft* function will be called with an image instead of *null-image* Following code - put the code for _do-not-draw_ into inside of with-transformed-alternative - seems working (on my local machine): (defun draw-freetype-string (x y string &key (anti-aliased t) (point-size 12.0d0) (angle 0.0d0) (convert-chars t) line-spacing (font-name *default-font*) do-not-draw (color *default-color*) (image *default-image*)) "Draws the string STRING in color COLOR at position \(X,Y) using the FreeType library. FONT-NAME is the full path \(a pathname or a string) to a TrueType font file, or a font face name if the GDFONTPATH environment variable or FreeType's DEFAULT_FONTPATH variable have been set intelligently. The string may be arbitrarily scaled \(POINT-SIZE) and rotated \(ANGLE in radians). The direction of rotation is counter-clockwise, with 0 radians \(0 degrees) at 3 o'clock and PI/2 radians \(90 degrees) at 12 o'clock. Note that the ANGLE argument is purposefully _not_ affected by WITH-TRANSFORMATION. If ANTI-ALIASED if false, anti-aliasing is disabled. It is enabled by default. To output multiline text with a specific line spacing, provide a value for LINE-SPACING, expressed as a multiple of the font height. The default is to use 1.05. The string may contain XML character entity references like \"À\". If CONVERT-CHARS is true \(which is the default) characters of STRING with CHAR-CODE greater than 127 are converted accordingly. This of course pre-supposes that your Lisp's CHAR-CODE function returns ISO/IEC 10646 (Unicode) character codes. The return value is an array containing 8 elements representing the 4 corner coordinates \(lower left, lower right, upper right, upper left) of the bounding rectangle around the string that was drawn. The points are relative to the text regardless of the angle, so \"upper left\" means in the top left-hand corner seeing the text horizontally. Set DO-NOT-DRAW to true to get the bounding rectangle without rendering. This is a relatively cheap operation if followed by a rendering of the same string, because of the caching of the partial rendering during bounding rectangle calculation." (check-type string string) (check-type font-name (or pathname string)) (with-transformed-alternative ((x x-transformer) (y y-transformer) ((deref-array c-bounding-rectangle '(:array :int) i) x-inv-transformer) ((deref-array c-bounding-rectangle '(:array :int) (1+ i)) y-inv-transformer)) (cond (do-not-draw (setq color 0 image *null-image*)) (t (check-type color integer) (check-type image image))) (when (pathnamep font-name) (setq font-name (namestring font-name))) (when convert-chars (setq string (convert-to-char-references string))) (with-cstring (c-font-name font-name) (with-cstring (c-string string) (with-safe-alloc (c-bounding-rectangle (allocate-foreign-object :int 8) (free-foreign-object c-bounding-rectangle)) (let ((msg (convert-from-cstring (cond (line-spacing (with-foreign-object (strex 'gd-ft-string-extra) (setf (get-slot-value strex 'gd-ft-string-extra 'flags) +gd-ftex-linespace+ (get-slot-value strex 'gd-ft-string-extra 'line-spacing) (coerce line-spacing 'double-float)) (gd-image-string-ft-ex (img image) c-bounding-rectangle (if anti-aliased color (- color)) c-font-name (coerce point-size 'double-float) (coerce angle 'double-float) x y c-string strex))) (t (gd-image-string-ft (img image) c-bounding-rectangle (if anti-aliased color (- color)) c-font-name (coerce point-size 'double-float) (coerce angle 'double-float) x y c-string)))))) (when msg (error "Error in FreeType library: ~A" msg)) (let ((bounding-rectangle (make-array 8))) ;; strange iteration due to WITH-TRANSFORMED-ALTERNATIVE (loop for i below 8 by 2 do (setf (aref bounding-rectangle i) (deref-array c-bounding-rectangle '(:array :int) i)) (setf (aref bounding-rectangle (1+ i)) (deref-array c-bounding-rectangle '(:array :int) (1+ i)))) bounding-rectangle))))))) From edi at agharta.de Tue Apr 24 09:04:31 2007 From: edi at agharta.de (Edi Weitz) Date: Tue, 24 Apr 2007 11:04:31 +0200 Subject: [cl-gd-devel] New release 0.5.5 In-Reply-To: <461AE0E2.7030104@itsec.co.kr> (Jong-won Choi's message of "Tue, 10 Apr 2007 09:57:06 +0900") References: <460C3A66.6080702@itsec.co.kr> <460CCF04.4060900@itsec.co.kr> <461AE0E2.7030104@itsec.co.kr> Message-ID: On Tue, 10 Apr 2007 09:57:06 +0900, Jong-won Choi wrote: > The bug in draw-freetype-string is still there. Sorry for the delay and thanks for your fix. I've made a new release and I hope I didn't botch it again. Unfortunately, I'm pretty busy at the moment and I don't have enough time to play with CL-GD myself. Cheers, Edi.