Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Common Lisp bindings for Freetype 2

branch: master
README.md

cl-freetype2

This is a general Freetype 2 wrapper for Common Lisp using CFFI. It's geared toward both using Freetype directly by providing a simplified API, as well as providing access to the underlying C structures and functions for use with other libraries which may also use Freetype.

Platform

Confirmed working:

  • SBCL
  • Clozure
  • CLISP (with CVS libffcall only, otherwise callbacks don't work)

Confirmed not working:

  • ECL (CFFI doesn't load)
  • ABCL (CFFI loads, but can't grovel?)

Documentation

See doc/cl-freetype2.html for complete documentation.

Example

An example using the toy interface:

(defparameter *face* (new-face "/usr/share/fonts/corefonts/times.ttf"))

;; Set the size to 24 points and 72 DPI
(set-char-size *face* (* 24 64) 0 72 72)

;; Trivial output:
(print-with-face *face* "Hello")

;; Output (if this doesn't display, make sure your encoding is
;; set to UTF-8):
                                                        ▒▒▓▓██      ▒▒▓▓██                            
████████████      ████████████                        ████████    ████████                            
  ▒▒████░░          ▒▒████░░                              ████        ████                            
    ████              ████                                ████        ████                            
    ████              ████                                ████        ████                            
    ████              ████                                ████        ████                            
    ████              ████            ░░██████▓▓          ████        ████          ░░▓▓████▓▓░░      
    ████              ████          ▒▒██░░  ░░████        ████        ████        ░░██░░    ▓▓██▒▒    
    ██████████████████████        ░░██▒▒      ░░██▒▒      ████        ████        ██▒▒        ████░░  
    ████              ████        ▓▓██          ████      ████        ████      ▒▒██          ▒▒██▓▓  
    ████              ████        ██████████████████      ████        ████      ████            ████  
    ████              ████        ████                    ████        ████      ████            ████  
    ████              ████        ████░░          ░░      ████        ████      ████░░          ████  
    ████              ████        ▓▓██▓▓        ░░▓▓      ████        ████      ▓▓██▒▒          ██▒▒  
    ████              ████        ░░████▓▓    ░░██░░      ████        ████      ░░████        ░░██    
  ░░████░░          ░░████░░        ▓▓██████████▒▒      ▒▒████▒▒    ▒▒████▒▒      ▒▒████    ░░██░░    
████████████      ████████████        ▒▒██████░░      ████████████████████████      ░░▓▓████▓▓░░      


;; Trivial output:
(print-with-face *face* "Hello" :right-left)



                         ▒▒▓▓██      ▒▒▓▓██                                                            
                       ████████    ████████                            ████████████      ████████████  
                           ████        ████                              ▒▒████░░          ▒▒████░░    
                           ████        ████                                ████              ████      
                           ████        ████                                ████              ████      
                           ████        ████                                ████              ████      
     ░░▓▓████▓▓░░          ████        ████          ░░██████▓▓            ████              ████      
   ░░██░░    ▓▓██▒▒        ████        ████        ▒▒██░░  ░░████          ████              ████      
   ██▒▒        ████░░      ████        ████      ░░██▒▒      ░░██▒▒        ██████████████████████      
 ▒▒██          ▒▒██▓▓      ████        ████      ▓▓██          ████        ████              ████      
 ████            ████      ████        ████      ██████████████████        ████              ████      
 ████            ████      ████        ████      ████                      ████              ████      
 ████░░          ████      ████        ████      ████░░          ░░        ████              ████      
 ▓▓██▒▒          ██▒▒      ████        ████      ▓▓██▓▓        ░░▓▓        ████              ████      
 ░░████        ░░██        ████        ████      ░░████▓▓    ░░██░░        ████              ████      
   ▒▒████    ░░██░░      ▒▒████▒▒    ▒▒████▒▒      ▓▓██████████▒▒        ░░████░░          ░░████░░    
     ░░▓▓████▓▓░░      ████████████████████████      ▒▒██████░░        ████████████      ████████████  


;; Trivial output:
(print-with-face *face* "XY" :up-down)


░░████████████▓▓      ▓▓████████▓▓              
    ▒▒██████░░          ░░████░░                
      ░░████▒▒          ▒▒██                    
        ░░████        ░░██                      
          ▓▓████      ██░░                      
            ████▒▒  ▓▓▒▒                        
            ░░████▒▒▓▓                          
              ▒▒████                            
                ████▒▒                          
              ▒▒▒▒████                          
            ░░▓▓  ▒▒████                        
            ██      ▓▓██▒▒                      
          ▓▓░░        ████░░                    
        ▓▓▒▒          ░░████                    
    ░░████              ██████░░                
  ██████████░░      ▓▓████████████              






  ████████████▒▒      ▒▒██████████              
    ▒▒████▓▓              ████░░                
      ░░████              ██                    
        ▒▒██▓▓          ▓▓░░                    
          ████░░      ░░▓▓                      
          ░░████      ██                        
            ▓▓██▒▒  ▒▒▒▒                        
              ████░░██                          
              ▒▒████░░                          
                ████                            
                ████                            
                ████                            
                ████                            
                ████                            
              ░░████░░                          
            ████████████
Something went wrong with that request. Please try again.