I am trying to use draw-freetype-string to output the multiline text.<br>Here I go:<br><br>(defun get-bounding-rect (text font font-size)<br> (with-image* (0 0)<br> (let ((rect (draw-freetype-string 0 0 text<br> :do-not-draw t
<br> :font-name font<br> :angle 0<br> :line-spacing 1.05d0<br> :color (find-color 0 0 255 :resolve t)<br> :point-size font-size)))<br> (values (- (aref rect 2) (aref rect 0)) (- (aref rect 3) (aref rect 5)) (aref rect 0) (aref rect 1) rect))))
<br><br>When I call it (get-bounding-rect "Some #\Newline text" "arial" 50)<br>I get an error:<br><br>Type-error in KERNEL::OBJECT-NOT-TYPE-ERROR-HANDLER:<br> #S(CL-GD::IMAGE<br> :IMG #<Alien (* #) at #x00000000>) is not of type (OR NULL
<br> SYSTEM:SYSTEM-AREA-POINTER<br> (ALIEN:ALIEN<br> (* #)))
<br> [Condition of type TYPE-ERROR]<br><br>Restarts:<br> 0: [ABORT] Return to SLIME's top level.<br> 1: [ABORT] Return to Top-Level.<br><br>Backtrace:<br> 0: (CL-GD::GD-IMAGE-STRING-FT-EX<br> #S(CL-GD::IMAGE :IMG #<Alien # at #x00000000>)
<br> #<Alien (* #) at #x0808DF88><br> 0<br> "arial"<br> ...)<br> 1: (DRAW-FREETYPE-STRING 0 0 "Some #Newline text" :ANTI-ALIASED ...)<br> 2: (GET-BOUNDING-RECT "Some #Newline text" "arial" 50)
<br> 3: (GET-BOUNDING-RECT "Some #Newline text" "arial" 50)<br><br>I think it doesn't like my :line-spacing 1.05d0 parameter. Also I am not sure that I can provide a string with #Newline. What's the proper way to do it?
<br><br>Thank you,<br>Andrew<br>