Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
210 lines (167 sloc) 6.52 KB
\input texinfo @c -*-texinfo-*-
@c %**start of header
@documentencoding UTF-8
@settitle CLX-TRUETYPE
@c %**end of header
@c for install-info
@dircategory Software development
* clx-truetype: Documentation String to CLX TrueType renderer
@end direntry
@macro project
@sc{clx-truetype }
@end macro
@title @project
@subtitle CLX TrueType Font Renderer
@end titlepage
@include include/sb-texinfo.texinfo
@node Top
@top Introduction
@project renders TrueType fonts over X11 drawable (window or pixmap)
using CLX, XRender, ZPB-TTF, CL-VECTORS.
@project was originally written for mcclim font rendering
by Gilbert Baumann and Andy Hefner.
@c Version control
@project is maintained in Git:
git clone git://
@end example
will get you a local copy.
@end example
is the GitHub project page, where the issue tracker is located.
* Overview::
* Examples::
* Dictionary::
* Concept Index::
* Function Index::
* Variable Index::
* Type Index::
* Colophon::
@end menu
@node Overview
@comment node-name, next, previous, up
@chapter Overview
@project is library for text rendering over X11 drawable using CLX, XRender,
TrueType font metrics
TrueType hints are not supported.
RGB antialiasing is not supported.
Text rendering do not use XRender glyph sets.
@end itemize
@node Examples
@comment node-name, next, previous, up
@chapter Examples
Drawing text is quite simple.
First and only one time step is loading font cache using
If you add font to your system, you should call it again.
@end lisp
Make instance of font:
(font (make-instance 'font :family "Times New Roman" :subfamily "Bold Italic"
:size 12 :antialiased t))
@end lisp
Draw it using @reffun{draw-text} or @reffun{draw-text-line} functions:
(draw-text window grackon font "The quick brown fox jumps over the lazy dog." 100 100)
@end lisp
Move <<cursor>> using @reffun{baseline-to-baseline} distance.
Here it is complete example. Just insert it into repl, and evaluate (show-window).
(defpackage #:clx-truetype-test
(:nicknames :xft-test)
(:use #:cl #:xft)
(:export show-window))
(in-package :clx-truetype-test)
(defvar *display* (xlib:open-default-display))
(defvar *screen* (xlib:display-default-screen *display*))
(defvar *root* (xlib:screen-root *screen*))
(defun show-window ()
(let* ((black (xlib:screen-black-pixel *screen*))
(white (xlib:screen-white-pixel *screen*))
(xlib:create-window :parent *root* :x 0 :y 0 :width 640 :height 480
:class :input-output
:background white
:event-mask '(:key-press :key-release :exposure :button-press
(grackon (xlib:create-gcontext
:drawable window
:foreground black
:background white))
(font (make-instance 'font :family "Times New Roman" :subfamily "Bold Italic"
:size 12 :antialiased t)))
(xlib:map-window window)
(setf (xlib:gcontext-foreground grackon) black)
(xlib:event-case (*display* :force-output-p t
:discard-p t)
(:exposure ()
(draw-text window grackon font "The quick brown fox jumps over the lazy dog." 100 100)
(when (= 0 (random 2))
(rotatef (xlib:gcontext-foreground grackon) (xlib:gcontext-background grackon)))
(draw-text window grackon font "Съешь же ещё этих мягких французских булок, да выпей чаю." 100 (+ 100 (baseline-to-baseline window font)))
(setf (font-antialiased font) (= 0 (random 2)))
(if (= 0 (random 2))
(setf (font-subfamily font) "Regular")
(setf (font-subfamily font) "Italic"))
(draw-text window grackon font "Жебракують філософи при ґанку церкви в Гадячі, ще й шатро їхнє п’яне знаємо." 100 (+ 100 (* 2 (baseline-to-baseline window font))))
(draw-text window grackon font "Press space to exit. Нажмите пробел для выхода." 100 (+ 100 (* 3 (baseline-to-baseline window font)))))
(:button-press () t)
(:key-press (code state) (char= #\Space (xlib:keycode->character *display* code state)))))
(xlib:free-gcontext grackon)
(xlib:destroy-window window)
(xlib:display-force-output *display*)))))
@end lisp
Result is
@node Dictionary
@comment node-name, next, previous, up
@chapter Dictionary
@include include/package-xft.texinfo
@include include/var-xft-star-font-dirs-star.texinfo
@include include/fun-xft-cache-fonts.texinfo
@include include/fun-xft-cache-font-file.texinfo
@include include/fun-xft-get-font-families.texinfo
@include include/fun-xft-get-font-subfamilies.texinfo
@include include/class-xft-font.texinfo
@include include/fun-xft-font-equal.texinfo
@include include/fun-xft-screen-default-dpi.texinfo
@include include/fun-xft-screen-dpi.texinfo
@include include/fun-xft-setf-screen-dpi.texinfo
@include include/fun-xft-font-ascent.texinfo
@include include/fun-xft-font-descent.texinfo
@include include/fun-xft-font-line-gap.texinfo
@include include/fun-xft-baseline-to-baseline.texinfo
@include include/fun-xft-text-bounding-box.texinfo
@include include/fun-xft-text-width.texinfo
@include include/fun-xft-text-height.texinfo
@include include/fun-xft-text-line-bounding-box.texinfo
@include include/fun-xft-text-line-width.texinfo
@include include/fun-xft-text-line-height.texinfo
@include include/fun-xft-xmin.texinfo
@include include/fun-xft-ymin.texinfo
@include include/fun-xft-xmax.texinfo
@include include/fun-xft-ymax.texinfo
@include include/fun-xft-draw-text.texinfo
@include include/fun-xft-draw-text-line.texinfo
@include include/fun-xft-font-lines-height.texinfo
@include include/backmatter.texinfo