Question

I'm working on windows 7 64bit system using clozure cl (version 1.8-r15286m) with quicklisp installed.

I need some freetype2 bindings for common lisp. (map characters to glyphs + kerning info)

I've tried to install "cl-freetype2" using

(ql:quickload "cl-freetype")

from 32bit clozure cl, and I've run into several problems.

  1. "grovel.lisp" (located in quicklisp/software/cffi_0.11.1/grovel/grovel.lisp) assumes that I have gcc installed at "c:/msys/1.0/bin/gcc.exe" (I have mingw-gcc in path, but not there). Fixed by replacing "c:/msys/1.0/bin/gcc.exe" with "gcc" in "grovel.lisp".
  2. When trying to compile cffi bindings for freetype2, same file does not include drive letters when passing include directories to compiler (i.e. instead of -i"d:/somedir" it passes -i"/somedir" to gcc`).
  3. "grovel.lisp" tries to include unix include directories.

I cannot fix #2 myself. I found this discussions, tried both listed patches, and neither of them worked. (first one breaks cffi, because ccl can't find neither "namestring-prefix" function nor "pathname-prefix" function), second one does not fix the problem.

What can I do in this situation? I'd prefer to avoid fixing "groveller" myself, I simply need some bindings for freetype2. Basically, I need to be able to

  1. Load truetype font.
  2. Map unicode char to glyph.
  3. Get kerning information for pair of glyphs.
  4. Load glyph bitmap.

Any ideas?

Was it helpful?

Solution

Figured it out.

Installing cl-freetype2 via quicklisp requires fully functional installation of MinGW.

  1. Ensure that mingw-gmp is installed. (mingw-get install gmp)
  2. Ensure that mingw/bin directory is within system path (right click on "My Computer"->Properties->Advanced->Environment Variables). Is Set. Should be something like "D:/development/MinGW/bin " (assuming MinGW is installed in "d:/development").
  3. Locate "grovel.lisp" within your ccl installation, and replace ""c:/msys/1.0/bin/gcc.exe" with "gcc". You don't have to do that if gcc is installed at this location.
  4. Launch mingw shell.
  5. download unpack and install latest Freetype2 tarball using ".configure && make && make install", similarly to unix enviornment.
  6. Locate freetype-6.dll copy it into freetype.dll and move freetype.dll into location within system path.
  7. (Assuming that MinGW is installed in "d:/development/MinGW"), create CPATH user environment variable with following context: D:\development\MinGW\msys\1.0\local\include\freetype2;D:\development\MinGW\msys\1.0\local\include. That is - if you didn't specify "/usr" prefix during freetype2 compilation.
  8. From within mingw shell, launch wx86cl and try (ql:quickload "cl-freetype2"). It should work properly.
  9. If it still doesn't work, in all your root drives create directory junctions to directory in which mingw is installed. (i.e. "c:/development" linking to "d:/development", etc).

I must admit that this was much hassle, so I still think that it'll be a better idea to make a small dll that provides minimal set of functions I need while using freetype internally, then load this dll using cffi. This should be much easier.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top