Common Lisp Package: 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.

README:

FUNCTION

Public

BASELINE-TO-BASELINE (DRAWABLE FONT)

Returns distance between baselines of @var{font}. @var{drawable} must be window, pixmap or screen. ascent - descent + line gap

CACHE-FONT-FILE (PATHNAME)

Caches font file.

CACHE-FONTS

Caches fonts from @refvar{*font-dirs*} directories.

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.

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.

FONT-ASCENT (DRAWABLE FONT)

Returns ascent of @var{font}. @var{drawable} must be window, pixmap or screen.

FONT-DESCENT (DRAWABLE FONT)

Returns descent of @var{font}. @var{drawable} must be window, pixmap or screen.

FONT-LINE-GAP (DRAWABLE FONT)

Returns line gap of @var{font}. @var{drawable} must be window, pixmap or screen.

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.

GET-FONT-FAMILIES

Returns cached font families.

GET-FONT-SUBFAMILIES (FONT-FAMILY)

Returns font subfamilies for current @var{font-family}. For e.g. regular, italic, bold, etc.

SCREEN-DEFAULT-DPI (SCREEN)

Returns default dpi for @var{screen}. pixel width * 25.4/millimeters width

SCREEN-DPI (SCREEN)

Returns current dpi for @var{screen}.

SETFSCREEN-DPI (VALUE SCREEN)

Sets current dpi for @var{screen}.

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.

TEXT-HEIGHT (DRAWABLE FONT STRING &KEY START END)

Returns height of text bounding box. @var{drawable} must be window, pixmap or screen.

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.

TEXT-LINE-HEIGHT (DRAWABLE FONT STRING &KEY START END)

Returns height of text line bounding box. @var{drawable} must be window, pixmap or screen.

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.

TEXT-WIDTH (DRAWABLE FONT STRING &KEY START END)

Returns width of text bounding box. @var{drawable} must be window, pixmap or screen.

XMAX (BOUNDING-BOX)

Returns right side x of @var{bounding-box}

XMIN (BOUNDING-BOX)

Returns left side x of @var{bounding-box}

YMAX (BOUNDING-BOX)

Returns top side y of @var{bounding-box}

YMIN (BOUNDING-BOX)

Returns bottom side y of @var{bounding-box}

Undocumented

DRAWABLE-SCREEN (DRAWABLE)

Private

AA-BIN/UPDATE-STATE (STATE PATHS)

Update state for not antialiasing renderer.

CELLS-SWEEP (FONT STATE FUNCTION &OPTIONAL FUNCTION-SPAN)

Wrapper around antialising and not antialiasig renderers.

CLAMP (VALUE MIN MAX)

Clamps the value 'value' into the range [min,max].

FONT-UNITS->PIXELS-X (DRAWABLE FONT)

px = funits*coeff. Function returns coeff.

FONT-UNITS->PIXELS-Y (DRAWABLE FONT)

px = funits*coeff. Function returns coeff.

MAKE-STATE (FONT)

Wrapper around antialising and not antialiasing renderers.

TEXT-LINE-PIXARRAY (DRAWABLE FONT STRING)

Render a text line of 'face', returning a 2D (unsigned-byte 8) array suitable as an alpha mask, and dimensions. This function returns five values: alpha mask byte array, x-origin, y-origin (subtracted from position before rendering), horizontal and vertical advances. @var{drawable} must be window or pixmap.

TEXT-PIXARRAY (DRAWABLE FONT STRING)

Render a text string of 'face', returning a 2D (unsigned-byte 8) array suitable as an alpha mask, and dimensions. This function returns five values: alpha mask byte array, x-origin, y-origin (subtracted from position before rendering), horizontal and vertical advances. @var{drawable} must be window or pixmap.

TRGREY (I)

Visualize alpha mask using graphic characters

UPDATE-BACKGROUND (DRAWABLE GCONTEXT FONT X Y WIDTH HEIGHT)

Lazy updates background for drawable. @var{drawable} must be window or pixmap.

UPDATE-FOREGROUND (DRAWABLE GCONTEXT FONT)

Lazy updates foreground for drawable. @var{drawable} must be window or pixmap.

UPDATE-STATE (FONT STATE PATHS)

Wrapper around antialising and not antialiasing renderers.

Undocumented

CHECK-VALID-FONT-FAMILIES (FAMILY SUBFAMILY)

DISPLAY-ALPHA-PICTURE-FORMAT (DISPLAY)

GET-DRAWABLE-PEN-PICTURE (DRAWABLE)

GET-DRAWABLE-PICTURE (DRAWABLE)

GET-FONT-PATHNAME (FONT)

TTF-PATHNAME-TEST (PATHNAME)

MACRO

Private

Undocumented

WITH-FONT-LOADER ((LOADER FONT) &BODY BODY)

GENERIC-FUNCTION

Public

FONT-EQUAL (FONT1 FONT2)

Returns t if two font objects are equal, else returns nil.

SLOT-ACCESSOR

Public

FONT-ANTIALIAS (OBJECT)

Antialias text string.

SETFFONT-ANTIALIAS (NEW-VALUE OBJECT)

Antialias text string.

FONT-BACKGROUND (OBJECT)

Background color.

SETFFONT-BACKGROUND (NEW-VALUE OBJECT)

Background color.

FONT-FAMILY (OBJECT)

Font family.

SETFFONT-FAMILY (NEW-VALUE OBJECT)

Font family.

FONT-FOREGROUND (OBJECT)

Foreground color.

SETFFONT-FOREGROUND (NEW-VALUE OBJECT)

Foreground color.

FONT-OVERLINE (OBJECT)

Draw line over text string.

SETFFONT-OVERLINE (NEW-VALUE OBJECT)

Draw line over text string.

FONT-OVERWRITE-GCONTEXT (OBJECT)

Use font values for background and foreground colors.

SETFFONT-OVERWRITE-GCONTEXT (NEW-VALUE OBJECT)

Use font values for background and foreground colors.

FONT-SIZE (OBJECT)

Font size in points.

SETFFONT-SIZE (NEW-VALUE OBJECT)

Font size in points.

FONT-STRIKETHROUGH (OBJECT)

Draw strike through text string.

SETFFONT-STRIKETHROUGH (NEW-VALUE OBJECT)

Draw strike through text string.

FONT-SUBFAMILY (OBJECT)

Font subfamily. For e.g. regular, italic, bold, bold italib.

SETFFONT-SUBFAMILY (NEW-VALUE OBJECT)

Font subfamily. For e.g. regular, italic, bold, bold italib.

FONT-UNDERLINE (OBJECT)

Draw line under text string.

SETFFONT-UNDERLINE (NEW-VALUE OBJECT)

Draw line under text string.

Private

FONT-STRING-ALPHA-MAPS (OBJECT)

Cache for text alpha maps

SETFFONT-STRING-ALPHA-MAPS (NEW-VALUE OBJECT)

Cache for text alpha maps

FONT-STRING-BBOXES (OBJECT)

Cache for text bboxes

SETFFONT-STRING-BBOXES (NEW-VALUE OBJECT)

Cache for text bboxes

FONT-STRING-LINE-ALPHA-MAPS (OBJECT)

Cache for text line alpha maps

SETFFONT-STRING-LINE-ALPHA-MAPS (NEW-VALUE OBJECT)

Cache for text line alpha maps

FONT-STRING-LINE-BBOXES (OBJECT)

Cache for text line bboxes

SETFFONT-STRING-LINE-BBOXES (NEW-VALUE OBJECT)

Cache for text line bboxes

VARIABLE

Public

*FONT-DIRS*

List of directories, which contain TrueType fonts.

Private

*FONT-CACHE*

Hashmap for caching font families, subfamilies and files.

Undocumented

*FONT-LOADER-CACHE*

+FONT-CACHE-FILENAME+

CLASS

Public

FONT

Class for representing font information.