rpav / cl-freetype2 Goto Github PK
View Code? Open in Web Editor NEWCommon Lisp bindings for Freetype 2
License: BSD 3-Clause "New" or "Revised" License
Common Lisp bindings for Freetype 2
License: BSD 3-Clause "New" or "Revised" License
In order to get cl-freetype2 to work with my MacOS setup, I had to do the following. I would think that far more MacOS users have homebrew installed than MacPorts these days, BICBW.
diff --git i/src/ffi/grovel/grovel-freetype2.lisp w/src/ffi/grovel/grovel-freetype2.lisp
index a3aaa3d..84037ad 100644
--- i/src/ffi/grovel/grovel-freetype2.lisp
+++ w/src/ffi/grovel/grovel-freetype2.lisp
@@ -1,6 +1,8 @@
(in-package :freetype2-types)
(cc-flags #+darwin "-I/opt/local/include/freetype2"
#+darwin "-I/usr/local/Cellar/freetype/2.9.1/include/freetype2/"
#+darwin "-I/usr/local/Cellar/freetype/2.9.1/include/freetype2/freetype"
#+freebsd "-I/usr/local/include/freetype2"
#+(and windows x86-64) "-I/mingw64/include/freetype2"
#+(and windows x86-64) "-Ic:/msys64/mingw64/include/freetype2"
Compiling with CFFI 0.11 results in many warnings about deprecated bare references to structs. While this:
sed -i "s/',foreign-type-name/'(:struct ,foreign-type-name)/g" src/ffi/cffi-cwrap.lisp
will correct the majority of the warnings, fixing the remainder has me stumped. They seem to be caused by foreign structure types, as defined by define-foreign-type
, being used.
Freetype is holding pointers to native memory and because of that compiled image is not working.
The fix is to make sure this form is being evaluated after the program started and not during the compile or load time.
Currently it is possible to workaround this by adding this in the toplevel form which is passed to save-lisp-and-die
Problematic form:
(setf freetype2:*library* (freetype2:make-freetype))
the other problem is loading the shared library (use-foreign-library) which also should happen at runtime
When creating a vector using MAKE-VECTOR
, the following error is returned:
Unknown CFFI type (:STRUCT FREETYPE2-TYPES:FT-VECTOR)
[Condition of type CFFI::UNDEFINED-FOREIGN-TYPE-ERROR]
The reason for this is a typo in that function. The following:
(let ((vector (make-collected-foreign 'ft-vector
'(:struct ft-vector))))
Should be replaced by:
(let ((vector (make-collected-foreign 'ft-vector
'(:struct foreign-ft-vector))))
Hi,
I'm trying to implement a cache for the load-render in order to improve rendering speed. The full implementation is here:
https://github.com/dbjergaard/clx-ft2-renderer/blob/master/render.lisp
If your inclined to try to run the code, check it out to ${HOME}/quicklisp/local-projects/ and quickload it, then run (clx-freetype2-renderer:render-test)
, the code will fail with:
:NONE fell through ECASE expression.
Wanted one of (:LCD-V :LCD :GRAY :MONO).
[Condition of type SB-KERNEL:CASE-FAILURE]
Restarts:
0: [RETRY] Retry SLIME REPL evaluation request.
1: [*ABORT] Return to SLIME's top level.
2: [ABORT] Abort thread (#<THREAD "repl-thread" RUNNING {1003EB0083}>)
Backtrace:
0: (SB-KERNEL:CASE-FAILURE ECASE :NONE (:LCD-V :LCD :GRAY :MONO))
1: (FREETYPE2:BITMAP-TO-ARRAY #<FREETYPE2-TYPES:FT-BITMAP {#X7FFFF0009978}>)
2: (CLX-FREETYPE2-RENDERER::STRING-TO-ARRAY #<FREETYPE2-TYPES:FT-FACE "DejaVu Sans Oblique" {#x7FFFF000D520}> "⚡" :LEFT-RIGHT 11 19)
My load-render function looks like:
(defun load-render (face char vertical-p)
(ft2:load-char face char (if vertical-p '(:vertical-layout) '(:default)))
(let ((char-list (cache-char face char vertical-p *ft2-face-cache*)))
(when char-list
(values (aref char-list 0)
(aref char-list 1)
(aref char-list 2)
(aref char-list 3)))))
cache-char is a wrapper of default-load-render that first checks if the char has been cached in *ft2-face-cache*
Could you give me any hints on how to correctly implement this method?
Hi,
Small issue with the incorrect cc-flags for OSX. I have a patch if you would like it
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.