[cffi-devel] Something is definitely wrong...

Dmitri Hrapof hrapof at common-lisp.ru
Wed Dec 20 06:55:24 UTC 2006


Hello!

I continued to experiment with my Freetype bindings
http://www.common-lisp.ru/cleft.asd
http://www.common-lisp.ru/cleft.lisp
and more strange behaviour was found.

Firstly, as I said earlier, 
FT_Load_Char(face, char, FT_LOAD_RENDER) 
doesn't work when called from Lisp. However, 
FT_Load_Char(face, char, FT_LOAD_DEFAULT) + 
FT_Render_Glyph(glyph, FT_RENDER_MODE_NORMAL)
work.

Secondly, the following code

(with-freetype lib
	 (with-face lib (face "/usr/share/fonts/truetype/ttf-bitstream-vera/Vera.ttf")
	   (set-char-size face 64 0 600 0)
	   (with-foreign-object (matrix 'ft-matrix)
	     (setf (foreign-slot-value matrix 'ft-matrix 'xx) (cos (deg->rad 22.5))
		   (foreign-slot-value matrix 'ft-matrix 'xy) (- (sin (deg->rad 22.5)))
		   (foreign-slot-value matrix 'ft-matrix 'yx) (sin (deg->rad 22.5))
		   (foreign-slot-value matrix 'ft-matrix 'yy) (cos (deg->rad 22.5)))
	     (ft-set-transform face matrix (null-pointer))
	     (glyph-pixarray face (char-code #\a)))))

rotates glyph and returns rendered bitmap, but this bitmap is always
of the same size (for the given character), no matter what the resolution
and height are (set by set-char-size)

Tested on Ubuntu 6.10 PPC + SBCL 1.0 or Clisp 2.41 
and Fedora Core 3 i386 + SBCL 0.9.15

Looks like some C functions work and some other do not... Why?

Thank you for answers and Happy Christmas!
Dmitri




More information about the cffi-devel mailing list