diff options
author | David Lichteblau <dlichteblau@common-lisp.net> | 2008-01-30 19:44:42 +0000 |
---|---|---|
committer | David Lichteblau <dlichteblau@common-lisp.net> | 2008-01-30 19:44:42 +0000 |
commit | 639909d1c2c6e4b2213cb72eb99d7dec73aa184c (patch) | |
tree | 0d1e95628ffff48ffa7c14bd4f6c27ec71f847b0 /Experimental | |
parent | e06aaf3212ae05211d11b718af6458cd5b9ccdf3 (diff) |
restored cffi freetype code
Diffstat (limited to 'Experimental')
-rw-r--r-- | Experimental/freetype/mcclim-freetype.asd | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/Experimental/freetype/mcclim-freetype.asd b/Experimental/freetype/mcclim-freetype.asd index 485d0645..7a6648db 100644 --- a/Experimental/freetype/mcclim-freetype.asd +++ b/Experimental/freetype/mcclim-freetype.asd @@ -42,7 +42,46 @@ your lisp's init file: (:file "freetype-fonts-cffi"))) +#+sbcl (defmethod perform :after ((o load-op) (s (eql (asdf:find-system :mcclim-freetype)))) "Detect fonts using fc-match" (funcall (find-symbol (symbol-name '#:autoconfigure-fonts) :mcclim-freetype))) + +;;; Freetype autodetection +#-sbcl +(progn + (defun parse-fontconfig-output (s) + (let* ((match-string (concatenate 'string (string #\Tab) "file:")) + (matching-line + (loop for l = (read-line s nil nil) + while l + if (= (mismatch l match-string) (length match-string)) + do (return l))) + (filename (when matching-line + (probe-file + (subseq matching-line + (1+ (position #\" matching-line :from-end nil :test #'char=)) + (position #\" matching-line :from-end t :test #'char=)))))) + (when filename + (make-pathname :directory (pathname-directory filename))))) + + (defun warn-about-unset-font-path () + (warn "~%~%NOTE:~%~ +* Remember to set mcclim-freetype:*freetype-font-path* to the + location of the Bitstream Vera family of fonts on disk. If you + don't have them, get them from http://www.gnome.org/fonts/~%~%~%")) + + (defmethod perform :after ((o load-op) (s (eql (asdf:find-system :mcclim-freetype)))) + (unless + (setf (symbol-value (intern "*FREETYPE-FONT-PATH*" :mcclim-freetype)) + (find-bitstream-fonts)) + (warn-about-unset-font-path))) + + (defun find-bitstream-fonts () + (with-input-from-string + (s (with-output-to-string (asdf::*verbose-out*) + (let ((code (asdf:run-shell-command "fc-match -v Bitstream Vera"))) + (unless (zerop code) + (warn "~&fc-match failed with code ~D.~%" code))))) + (parse-fontconfig-output s)))) |