GithubHelp home page GithubHelp logo

matthieupeeters / cl-freetype2 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rpav/cl-freetype2

0.0 2.0 0.0 264 KB

Common Lisp bindings for Freetype 2

License: BSD 3-Clause "New" or "Revised" License

Common Lisp 99.81% C 0.19%

cl-freetype2's Introduction

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)


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

cl-freetype2's People

Contributors

rpav avatar wahjava avatar juanjosegarciaripoll avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.