clx-truetype

API Reference

clx-truetype

clx-truetype is pure common lisp solution for antialiased TrueType font rendering using CLX and XRender extension.

CLX-TRUETYPE

Package contains API for TrueType text rendering using CLX, XRender. Glyphs information is obtained by ZPB-TTF. Font rasterization is made by CL-VECTORS.
  • Function DRAWABLE-SCREEN (drawable)
  • Variable *FONT-DIRS*
    (list "/usr/share/fonts/"
          (namestring (merge-pathnames ".fonts/" (user-homedir-pathname))))
    List of directories, which contain TrueType fonts.
  • Function CACHE-FONT-FILE (pathname)
    Caches font file.
  • Function CACHE-FONTS
    Caches fonts from @refvar{*font-dirs*} directories.
  • Function GET-FONT-FAMILIES
    Returns cached font families.
  • Function GET-FONT-SUBFAMILIES (font-family)
    Returns font subfamilies for current @var{font-family}. For e.g. regular, italic, bold, etc.
  • Class FONT
    Class for representing font information.
    FAMILY   Accessor: FONT-FAMILY
    Font family.
    SUBFAMILY   Accessor: FONT-SUBFAMILY
    Font subfamily. For e.g. regular, italic, bold, bold italib.
    SIZE   Accessor: FONT-SIZE
    Font size in points.
    UNDERLINE   Accessor: FONT-UNDERLINE
    Draw line under text string.
    STRIKETHROUGH   Accessor: FONT-STRIKETHROUGH
    Draw strike through text string.
    OVERLINE   Accessor: FONT-OVERLINE
    Draw line over text string.
    BACKGROUND   Accessor: FONT-BACKGROUND
    Background color.
    FOREGROUND   Accessor: FONT-FOREGROUND
    Foreground color.
    OVERWRITE-GCONTEXT   Accessor: FONT-OVERWRITE-GCONTEXT
    Use font values for background and foreground colors.
    ANTIALIAS   Accessor: FONT-ANTIALIAS
    Antialias text string.
    STRING-BBOXES   Accessor: FONT-STRING-BBOXES
    Cache for text bboxes
    STRING-LINE-BBOXES   Accessor: FONT-STRING-LINE-BBOXES
    Cache for text line bboxes
    STRING-ALPHA-MAPS   Accessor: FONT-STRING-ALPHA-MAPS
    Cache for text alpha maps
    STRING-LINE-ALPHA-MAPS   Accessor: FONT-STRING-LINE-ALPHA-MAPS
    Cache for text line alpha maps
  • Method (setf FONT-FAMILY) (family (instance font))
  • Method (setf FONT-SUBFAMILY) (subfamily (instance font))
  • Method (setf FONT-FAMILY) (family (font font))
  • Method (setf FONT-SUBFAMILY) (subfamily (font font))
  • Method (setf FONT-SIZE) (value (font font))
  • Method (setf FONT-UNDERLINE) (value (font font))
  • Method (setf FONT-OVERLINE) (value (font font))
  • Generic-Function FONT-EQUAL (font1 font2)
    Returns t if two font objects are equal, else returns nil.
  • Method FONT-EQUAL ((font1 font) (font2 font))
  • Method FONT-EQUAL ((font1 font) (font2 font))
  • Method FONT-EQUAL ((font1 font) (font2 font))
  • Function SCREEN-DEFAULT-DPI (screen)
    Returns default dpi for @var{screen}. pixel width * 25.4/millimeters width
  • Function SCREEN-DPI (screen)
    Returns current dpi for @var{screen}.
  • Function (setf SCREEN-DPI) (value screen)
    Sets current dpi for @var{screen}.
  • Function FONT-ASCENT (drawable font)
    Returns ascent of @var{font}. @var{drawable} must be window, pixmap or screen.
  • Function FONT-DESCENT (drawable font)
    Returns descent of @var{font}. @var{drawable} must be window, pixmap or screen.
  • Function FONT-LINE-GAP (drawable font)
    Returns line gap of @var{font}. @var{drawable} must be window, pixmap or screen.
  • Function BASELINE-TO-BASELINE (drawable font)
    Returns distance between baselines of @var{font}. @var{drawable} must be window, pixmap or screen. ascent - descent + line gap
  • Function TEXT-BOUNDING-BOX (drawable font string &key start end)
    Returns text bounding box. @var{drawable} must be window, pixmap or screen. Text bounding box is only for contours. Bounding box for space (#x20) is zero.
  • Function TEXT-WIDTH (drawable font string &key start end)
    Returns width of text bounding box. @var{drawable} must be window, pixmap or screen.
  • Function TEXT-HEIGHT (drawable font string &key start end)
    Returns height of text bounding box. @var{drawable} must be window, pixmap or screen.
  • Function TEXT-LINE-BOUNDING-BOX (drawable font string &key start end)
    Returns text line bounding box. @var{drawable} must be window, pixmap or screen. Text line bounding box is bigger than text bounding box. It's height is ascent + descent, width is sum of advance widths minus sum of kernings.
  • Function TEXT-LINE-WIDTH (drawable font string &key start end)
    Returns width of text line bounding box. @var{drawable} must be window, pixmap or screen. It is sum of advance widths minus sum of kernings.
  • Function TEXT-LINE-HEIGHT (drawable font string &key start end)
    Returns height of text line bounding box. @var{drawable} must be window, pixmap or screen.
  • Function XMIN (bounding-box)
    Returns left side x of @var{bounding-box}
  • Function YMIN (bounding-box)
    Returns bottom side y of @var{bounding-box}
  • Function XMAX (bounding-box)
    Returns right side x of @var{bounding-box}
  • Function YMAX (bounding-box)
    Returns top side y of @var{bounding-box}
  • Function DRAW-TEXT (drawable gcontext font string x y &key start end draw-background-p)
    Draws text string using @var{font} on @var{drawable} with graphic context @var{gcontext}. @var{x}, @var{y} are the left point of base line. @var{start} and @var{end} are used for substring rendering. If @var{gcontext} has background color, text bounding box will be filled with it. Text line bounding box is bigger than text bounding box. @var{drawable} must be window or pixmap.
  • Function DRAW-TEXT-LINE (drawable gcontext font string x y &key start end draw-background-p)
    Draws text string using @var{font} on @var{drawable} with graphic context @var{gcontext}. @var{x}, @var{y} are the left point of base line. @var{start} and @var{end} are used for substring rendering. If @var{gcontext} has background color, text line bounding box will be filled with it. Text line bounding box is bigger than text bounding box. @var{drawable} must be window or pixmap.
  • Function FONT-LINES-HEIGHT (drawable font lines-count)
    Returns text lines height in pixels. For one line height is ascender+descender. For more than one line height is ascender+descender+linegap.