[ab] A final functionality restoration hack for lispbuilder-sdl-ttf

Samium Gromoff _deepfire at feelingofgreen.ru
Sat Feb 3 04:15:10 CST 2007


This is an ugly hack, but without it i failed to whip things into obedience.

The reason i post it here is purely informational -- this was the last
piece i had to do to make sdl-ttf work at the same level of functionality
(i.e. any font rasterisation at all) as before the API change.

Here it goes, following the suggestion by Tomi Neste:

diff -urN lispbuilder-new/trunk/lispbuilder-sdl-ttf/cffi/ttf.lisp lispbuilder-ultranew/trunk/lispbuilder-sdl-ttf/cffi/ttf.lisp
--- lispbuilder-new/trunk/lispbuilder-sdl-ttf/cffi/ttf.lisp	2007-02-02 22:51:50.000000000 +0300
+++ lispbuilder-ultranew/trunk/lispbuilder-sdl-ttf/cffi/ttf.lisp	2007-02-03 03:33:54.000000000 +0300
@@ -275,6 +275,11 @@
   (text :string)
   (fg sdl-color))
 
+(defcfun ("TTF_RenderUTF8_Blended" ttf-Render-UTF8-Blended-bypass) sdl-cffi::sdl-surface
+  (font ttf-font)
+  (text :string)
+  (fg :unsigned-int))
+
 ;; extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderUNICODE_Blended(TTF_Font *font,
 ;; 				const Uint16 *text, SDL_Color fg);
 (defcfun ("TTF_glue_RenderUNICODE_Blended" ttf-Render-UNICODE-Blended) sdl-cffi::sdl-surface
diff -urN lispbuilder-new/trunk/lispbuilder-sdl-ttf/sdl-ttf/sdl-util-ttf.lisp lispbuilder-ultranew/trunk/lispbuilder-sdl-ttf/sdl-ttf/sdl-util-ttf.lisp
--- lispbuilder-new/trunk/lispbuilder-sdl-ttf/sdl-ttf/sdl-util-ttf.lisp	2007-02-02 22:51:51.000000000 +0300
+++ lispbuilder-ultranew/trunk/lispbuilder-sdl-ttf/sdl-ttf/sdl-util-ttf.lisp	2007-02-03 04:18:06.000000000 +0300
@@ -569,6 +569,12 @@
        (setf (cached-surface font) (sdl:surface (sdl-ttf-cffi::ttf-Render-UTF8-blended (fp-font font) text color))))
      (sdl:set-surface-* (cached-surface font) :x x :y y)
      (sdl:blit-surface (cached-surface font) surface))
+    (:UTF8-bypass
+     (let (surf)
+     	(setf surf (sdl:surface (sdl-ttf-cffi::ttf-Render-UTF8-blended-bypass (fp-font font) text (+ (ash (sdl:b color) 16) (ash (sdl:g color) 8) (sdl:r color)))))
+        (sdl:set-surface-* surf :x x :y y)
+        (sdl:blit-surface surf surface)
+	(when surf (sdl:free-surface surf))))
     (:GLYPH
      (when (cached-surface font)
        (sdl:free-surface (cached-surface font)))
 


More information about the application-builder mailing list