The cl-fond Reference Manual

Table of Contents

Next: , Previous: , Up: (dir)   [Contents][Index]

The cl-fond Reference Manual

This is the cl-fond Reference Manual, version 1.0.0, generated automatically by Declt version 2.3 "Robert April" on Wed Mar 14 03:16:28 2018 GMT+0.


Next: , Previous: , Up: Top   [Contents][Index]

1 Introduction

About cl-fond

This is a bindings library to libfond, a simple OpenGL text rendering engine.

How To

Precompiled versions of the underlying library are included in this. If you want to build it manually however, refer to the libfond repository.

Load the system through ASDF or Quicklisp:

(ql:quickload :cl-fond)

Before you can create any of the objects, you need to have an OpenGL 3.3+ context current. Creating a context is outside of the scope of this library. Please refer to your framework. Once you do have a context handy, you can create a font object:

(defvar *font* (cl-fond:make-font #p"~/test.ttf" "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ .!?"))

The string there specifies the character set for which the font should be loaded. You will only be able to render characters from that set. Note that the more characters you have and the bigger you make the font size, the larger the texture it will have to allocate to map out the characters. If there is an error of some kind, like being unable to read the file or fit it into a texture atlas, a condition is signalled. Otherwise the font should be readily loaded and you can start working with it.

(compute-extent *font* "Hello there!")

If you actually want to render text, you are given two options:

  1. Using the readily provided buffer class
  2. Rendering the text manually

The former has the advantage of being much simpler, at the cost of rendering to an offscreen texture instead of directly to the screen. The latter gives you more control over how you place and render the text at the cost of having to write your own shaders to do it. Let's look at the easy way first:

(defvar *buffer* (cl-fond:make-buffer *font* 512 30))

With a default font size of 20px, 30px for the height should be enough room. This function may again error if it fails to properly allocate the resources it needs in the back. Once it is ready you can start rendering text to it.

(cl-fond:render *buffer* "Sup man." :y (height *font*))

We set the y coordinate to the height of the font here, as libfond sets 0,0 in the top left corner and x,y of the text on the left of its baseline. Thus in order to make the text visible on the buffer, we need to offset the y coordinate by at least the font's height. Once rendered, it returns the OpenGL texture that it rendered to. You can then render this texture onto a quad in your primary render code. Keep in mind that you need to respect the aspect ratio of the buffer, and that scaling its texture beyond the specified size will make things look blurry.

If you want to manually render the characters instead, you'll want to use compute-text as follows:

(cl-fond:compute-text *font* "Heyo.")

Returned by it will be an OpenGL vertex array to draw with and the number of elements it contains. After binding your shader program and setting things up properly, you can then draw the characters as follows:

(gl:bind-texture :texture-2d (cl-fond:texture *font*))
(gl:bind-vertex-array vao)
(%gl:draw-elements :triangles count :unsigned-int 0)

The VAO contains two vec2 inputs: the position and the texture coordinate. Note that the position is scaled to pixel size. You will likely want to adapt this in your vertex shader to fit appropriately. In your fragment shader you will only want to read out the r component of the texture. Every other component is 0.

See the default vertex and fragment shaders used by the buffer for an example.


Next: , Previous: , Up: Top   [Contents][Index]

2 Systems

The main system appears first, followed by any subsystem dependency.


Previous: , Up: Systems   [Contents][Index]

2.1 cl-fond

Maintainer

Nicolas Hafner <shinmera@tymoon.eu>

Author

Nicolas Hafner <shinmera@tymoon.eu>

Home Page

https://github.com/Shirakumo/cl-fond

License

Artistic

Description

Bindings to libfond, a simple text rendering engine for OpenGL

Version

1.0.0

Dependencies
Source

cl-fond.asd (file)

Components

Next: , Previous: , Up: Top   [Contents][Index]

3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


Previous: , Up: Files   [Contents][Index]

3.1 Lisp


Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.1 cl-fond.asd

Location

cl-fond.asd

Systems

cl-fond (system)


Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.2 cl-fond/package.lisp

Parent

cl-fond (system)

Location

package.lisp

Packages

Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.3 cl-fond/low-level.lisp

Dependency

package.lisp (file)

Parent

cl-fond (system)

Location

low-level.lisp

Exported Definitions
Internal Definitions

*here* (special variable)


Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.4 cl-fond/wrapper.lisp

Dependency

low-level.lisp (file)

Parent

cl-fond (system)

Location

wrapper.lisp

Exported Definitions
Internal Definitions

Previous: , Up: Lisp files   [Contents][Index]

3.1.5 cl-fond/documentation.lisp

Dependency

wrapper.lisp (file)

Parent

cl-fond (system)

Location

documentation.lisp


Next: , Previous: , Up: Top   [Contents][Index]

4 Packages

Packages are listed by definition order.


Next: , Previous: , Up: Packages   [Contents][Index]

4.1 cl-fond

Source

package.lisp (file)

Nickname

org.shirakumo.fraf.fond

Use List
Exported Definitions
Internal Definitions

Previous: , Up: Packages   [Contents][Index]

4.2 cl-fond-cffi

Source

package.lisp (file)

Nickname

org.shirakumo.fraf.fond.cffi

Use List
Exported Definitions
Internal Definitions

*here* (special variable)


Next: , Previous: , Up: Top   [Contents][Index]

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


Next: , Previous: , Up: Definitions   [Contents][Index]

5.1 Exported definitions


Next: , Previous: , Up: Exported definitions   [Contents][Index]

5.1.1 Special variables

Special Variable: *static*

Variable containing the path to the static directory. That directory contains the precompiled library binaries.

Package

cl-fond-cffi

Source

low-level.lisp (file)


Next: , Previous: , Up: Exported definitions   [Contents][Index]

5.1.2 Functions

Function: buffer-font POINTER-TO-BUFFER

Pointer to the font that it renders.

This can be exchanged for another font, if you should decide to want to render with a different font.

See BUFFER

Package

cl-fond-cffi

Source

low-level.lisp (file)

Writer

(setf buffer-font) (function)

Function: (setf buffer-font) VALUE POINTER-TO-BUFFER
Package

cl-fond-cffi

Source

low-level.lisp (file)

Reader

buffer-font (function)

Function: buffer-framebuffer POINTER-TO-BUFFER

This is an internal field.

See BUFFER

Package

cl-fond-cffi

Source

low-level.lisp (file)

Writer

(setf buffer-framebuffer) (function)

Function: (setf buffer-framebuffer) VALUE POINTER-TO-BUFFER
Package

cl-fond-cffi

Source

low-level.lisp (file)

Reader

buffer-framebuffer (function)

Function: buffer-height POINTER-TO-BUFFER

The height of the texture.

See BUFFER

Package

cl-fond-cffi

Source

low-level.lisp (file)

Writer

(setf buffer-height) (function)

Function: (setf buffer-height) VALUE POINTER-TO-BUFFER
Package

cl-fond-cffi

Source

low-level.lisp (file)

Reader

buffer-height (function)

Function: buffer-program POINTER-TO-BUFFER

This is an internal field.

See BUFFER

Package

cl-fond-cffi

Source

low-level.lisp (file)

Writer

(setf buffer-program) (function)

Function: (setf buffer-program) VALUE POINTER-TO-BUFFER
Package

cl-fond-cffi

Source

low-level.lisp (file)

Reader

buffer-program (function)

Function: buffer-texture POINTER-TO-BUFFER

The OpenGL texture ID to which this buffer renders to.

See BUFFER

Package

cl-fond-cffi

Source

low-level.lisp (file)

Writer

(setf buffer-texture) (function)

Function: (setf buffer-texture) VALUE POINTER-TO-BUFFER
Package

cl-fond-cffi

Source

low-level.lisp (file)

Reader

buffer-texture (function)

Function: buffer-width POINTER-TO-BUFFER

The width of the texture.

See BUFFER

Package

cl-fond-cffi

Source

low-level.lisp (file)

Writer

(setf buffer-width) (function)

Function: (setf buffer-width) VALUE POINTER-TO-BUFFER
Package

cl-fond-cffi

Source

low-level.lisp (file)

Reader

buffer-width (function)

Function: compute-extent FONT TEXT EXTENT

Compute the extent of the given text.

You must allocate the extent struct yourself and make sure it is zeroed out.

See FONT
See EXTENT

Package

cl-fond-cffi

Source

low-level.lisp (file)

Function: compute-extent-u FONT TEXT SIZE EXTENT

Same as COMPUTE-EXTENT but taking an UTF32 encoded string and its size.

See COMPUTE-EXTENT
See FONT
See EXTENT

Package

cl-fond-cffi

Source

low-level.lisp (file)

Function: compute-text FONT TEXT N VAO

Compute the Vertex Array Object to render the given text.

Here, n and vao are output arguments, containing the number of elements and the OpenGL VAO ID respectively. The text must be UTF8 encoded and null-terminated. The returned VAO contains two arrays, at location 0 and 1, with both being vec2s. The first being the vertex coordinates and the second being the texture coordinates. The vertex coordinates start at 0 and increase in x and y as per the font’s size. You are responsible for scaling it as appropriate for your display. The texture coordinates are for the font’s atlas texture. If the text contains a Linefeed character (U+000A) a new line is started automatically by resetting X to 0 and decreasing Y by the necessary height for a new line.

See FONT

Package

cl-fond-cffi

Source

low-level.lisp (file)

Function: compute-text-u FONT TEXT SIZE N VAO

Same as COMPUTE-EXTENT but taking an UTF32 encoded string and its size.

See COMPUTE-TEXT
See FONT

Package

cl-fond-cffi

Source

low-level.lisp (file)

Function: decode-utf8 STRING DECODED SIZE

Decode the given UTF8 string into an UTF32 string.

The resulting string is put into decoded, and its size is put into size. This is used by the non _u functions to decode the string. You may want to use this internally, if you need to re-use the same string often and don’t wnat to pay the conversion cost.

Package

cl-fond-cffi

Source

low-level.lisp (file)

Function: extent-b POINTER-TO-EXTENT

How far down the text extends from its baseline.

See EXTENT

Package

cl-fond-cffi

Source

low-level.lisp (file)

Writer

(setf extent-b) (function)

Function: (setf extent-b) VALUE POINTER-TO-EXTENT
Package

cl-fond-cffi

Source

low-level.lisp (file)

Reader

extent-b (function)

Function: extent-gap POINTER-TO-EXTENT

The gap between lines of the text.

See EXTENT

Package

cl-fond-cffi

Source

low-level.lisp (file)

Writer

(setf extent-gap) (function)

Function: (setf extent-gap) VALUE POINTER-TO-EXTENT
Package

cl-fond-cffi

Source

low-level.lisp (file)

Reader

extent-gap (function)

Function: extent-l POINTER-TO-EXTENT

How far to the left the text extends from zero.

See EXTENT

Package

cl-fond-cffi

Source

low-level.lisp (file)

Writer

(setf extent-l) (function)

Function: (setf extent-l) VALUE POINTER-TO-EXTENT
Package

cl-fond-cffi

Source

low-level.lisp (file)

Reader

extent-l (function)

Function: extent-r POINTER-TO-EXTENT

How far to the right the text extends from zero.

See EXTENT

Package

cl-fond-cffi

Source

low-level.lisp (file)

Writer

(setf extent-r) (function)

Function: (setf extent-r) VALUE POINTER-TO-EXTENT
Package

cl-fond-cffi

Source

low-level.lisp (file)

Reader

extent-r (function)

Function: extent-t POINTER-TO-EXTENT

How far up the text extends from its baseline.

See EXTENT

Package

cl-fond-cffi

Source

low-level.lisp (file)

Writer

(setf extent-t) (function)

Function: (setf extent-t) VALUE POINTER-TO-EXTENT
Package

cl-fond-cffi

Source

low-level.lisp (file)

Reader

extent-t (function)

Function: fond-error ()

Return the current error code.

Package

cl-fond-cffi

Source

low-level.lisp (file)

Function: fond-error-string ERROR

Return a string for a human-readable error message of the given error code.

Package

cl-fond-cffi

Source

low-level.lisp (file)

Function: font-atlas POINTER-TO-FONT

The OpenGL texture ID for the atlas.

See FONT

Package

cl-fond-cffi

Source

low-level.lisp (file)

Writer

(setf font-atlas) (function)

Function: (setf font-atlas) VALUE POINTER-TO-FONT
Package

cl-fond-cffi

Source

low-level.lisp (file)

Reader

font-atlas (function)

Function: font-characters POINTER-TO-FONT

A UTF8 encoded string of characters that this font instance will be able to render.

Must be null-terminated.

See FONT

Package

cl-fond-cffi

Source

low-level.lisp (file)

Writer

(setf font-characters) (function)

Function: (setf font-characters) VALUE POINTER-TO-FONT
Package

cl-fond-cffi

Source

low-level.lisp (file)

Reader

font-characters (function)

Function: font-chardata POINTER-TO-FONT

This is an internal field.

See FONT

Package

cl-fond-cffi

Source

low-level.lisp (file)

Writer

(setf font-chardata) (function)

Function: (setf font-chardata) VALUE POINTER-TO-FONT
Package

cl-fond-cffi

Source

low-level.lisp (file)

Reader

font-chardata (function)

Function: font-codepoints POINTER-TO-FONT

An array of Unicode codepoints that this font instance will be able to render.

Must be null-terminated. This is automatically filled in for
you if it is NULL and the characters field is provided instead.

See FONT

Package

cl-fond-cffi

Source

low-level.lisp (file)

Writer

(setf font-codepoints) (function)

Function: (setf font-codepoints) VALUE POINTER-TO-FONT
Package

cl-fond-cffi

Source

low-level.lisp (file)

Reader

font-codepoints (function)

Function: font-converted-codepoints POINTER-TO-FONT

This is an internal field.

See FONT

Package

cl-fond-cffi

Source

low-level.lisp (file)

Writer

(setf font-converted-codepoints) (function)

Function: (setf font-converted-codepoints) VALUE POINTER-TO-FONT
Package

cl-fond-cffi

Source

low-level.lisp (file)

Reader

font-converted-codepoints (function)

Function: font-file POINTER-TO-FONT

Accessor for the path to the TTF file.

See FONT

Package

cl-fond-cffi

Source

low-level.lisp (file)

Writer

(setf font-file) (function)

Function: (setf font-file) VALUE POINTER-TO-FONT
Package

cl-fond-cffi

Source

low-level.lisp (file)

Reader

font-file (function)

Function: font-fontdata POINTER-TO-FONT

This is an internal field.

See FONT

Package

cl-fond-cffi

Source

low-level.lisp (file)

Writer

(setf font-fontdata) (function)

Function: (setf font-fontdata) VALUE POINTER-TO-FONT
Package

cl-fond-cffi

Source

low-level.lisp (file)

Reader

font-fontdata (function)

Function: font-fontinfo POINTER-TO-FONT

This is an internal field.

See FONT

Package

cl-fond-cffi

Source

low-level.lisp (file)

Writer

(setf font-fontinfo) (function)

Function: (setf font-fontinfo) VALUE POINTER-TO-FONT
Package

cl-fond-cffi

Source

low-level.lisp (file)

Reader

font-fontinfo (function)

Function: font-height POINTER-TO-FONT

The height of the glyph texture atlas.

See FONT

Package

cl-fond-cffi

Source

low-level.lisp (file)

Writer

(setf font-height) (function)

Function: (setf font-height) VALUE POINTER-TO-FONT
Package

cl-fond-cffi

Source

low-level.lisp (file)

Reader

font-height (function)

Function: font-index POINTER-TO-FONT

Accessor for the index of the font within the TTF file.

You probably don’t need to set this.

See FONT

Package

cl-fond-cffi

Source

low-level.lisp (file)

Writer

(setf font-index) (function)

Function: (setf font-index) VALUE POINTER-TO-FONT
Package

cl-fond-cffi

Source

low-level.lisp (file)

Reader

font-index (function)

Function: font-oversample POINTER-TO-FONT

How much oversampling should be done.

Higher oversampling might improve the quality of the rendering, but will need a much bigger atlas size: width*oversampling,height*oversampling

See FONT

Package

cl-fond-cffi

Source

low-level.lisp (file)

Writer

(setf font-oversample) (function)

Function: (setf font-oversample) VALUE POINTER-TO-FONT
Package

cl-fond-cffi

Source

low-level.lisp (file)

Reader

font-oversample (function)

Function: font-size POINTER-TO-FONT

The vertical font size in pixels.

If you render it above this resolution, you’ll get blurring.

See FONT

Package

cl-fond-cffi

Source

low-level.lisp (file)

Writer

(setf font-size) (function)

Function: (setf font-size) VALUE POINTER-TO-FONT
Package

cl-fond-cffi

Source

low-level.lisp (file)

Reader

font-size (function)

Function: font-width POINTER-TO-FONT

The width of the glyph texture atlas.

See FONT

Package

cl-fond-cffi

Source

low-level.lisp (file)

Writer

(setf font-width) (function)

Function: (setf font-width) VALUE POINTER-TO-FONT
Package

cl-fond-cffi

Source

low-level.lisp (file)

Reader

font-width (function)

Function: free-buffer BUFFER

Free all the data that was allocated into the struct by fond_load_buffer.

This will /not/ free the font struct.

See BUFFER

Package

cl-fond-cffi

Source

low-level.lisp (file)

Function: free-font FONT

Free all the data that was allocated into the struct by LOAD-FONT*

This will /not/ free the characters array, the file
array, or the codepoints array if the codepoints
array was not computed by LOAD-FONT*

See FONT

Package

cl-fond-cffi

Source

low-level.lisp (file)

Function: load-buffer BUFFER

Load the buffer struct and allocate the necessary OpenGL data.

The following fields must be set in the struct:
font
width
height

See BUFFER

Package

cl-fond-cffi

Source

low-level.lisp (file)

Function: load-font FONT

Load the font struct and allocate the necessary OpenGL data.

The following fields must be set in the struct:
file
size
width
height
characters or codepoints

See FONT

Package

cl-fond-cffi

Source

low-level.lisp (file)

Function: load-font-fit FONT MAX-SIZE

Load the font struct, attempting to fit an atlas automatically.

This may not result in the most compact atlas possible. max_size is the maximum size of the width or height
that can be reached before it gives up.

The following fields must be set in the struct:
file
size
characters or codepoints

See FONT

Package

cl-fond-cffi

Source

low-level.lisp (file)

Function: make-buffer FONT WIDTH HEIGHT

Create a new buffer instance.

The font is the font instance to render with, and the width and height specify the dimensions of the texture that this buffer renders to.

See BUFFER
See FONT

Package

cl-fond

Source

wrapper.lisp (file)

Function: make-font FILE CHARSET &rest ARGS &key INDEX SIZE OVERSAMPLE WIDTH HEIGHT

Create a new font instance for the given TTF file and character set.

The charset should be a string containing all characters that the font should be able to draw. The index is the index of the font within the file. Some TTF files can contain multiple fonts in one. Usually, you won’t need to set this parameter. Oversample is the oversampling factor that should be used. Using oversampling might result in better quality rendering, at the cost of massively increasing the necessary size of the atlas. The necessary size is multiplied by the oversampling factor in both dimensions. The width and height are optional factors that when given specify the starting texture atlas size to use to attempt to fit the glyphs. If this size is too small, an error is signalled.

See FONT

Package

cl-fond

Source

wrapper.lisp (file)

Function: render-buffer BUFFER TEXT X Y COLOR

Render the given text to the buffer’s texture.

The text will be rendered at the given offset, with x and y being in pixels. color can be either 0 for white text, or an array of four floats, representing RGBA of the text’s colour in that order.

See BUFFER

Package

cl-fond-cffi

Source

low-level.lisp (file)

Function: render-buffer-u BUFFER TEXT SIZE X Y COLOR

Same as RENDER-BUFFER but taking an UTF32 encoded string and its size.

See RENDER-BUFFER
See BUFFER

Package

cl-fond-cffi

Source

low-level.lisp (file)

Function: update-text FONT TEXT N VBO EBO
Package

cl-fond-cffi

Source

low-level.lisp (file)

Function: update-text-u FONT TEXT SIZE N VBO EBO
Package

cl-fond-cffi

Source

low-level.lisp (file)


Next: , Previous: , Up: Exported definitions   [Contents][Index]

5.1.3 Generic functions

Generic Function: charset FONT

Returns a string containing all the characters this font instance is capable of drawing.

See FONT

Package

cl-fond

Methods
Method: charset (FONT font)
Source

wrapper.lisp (file)

Generic Function: compute-extent FONT TEXT

Compute the extent of the given text in pixels.

Returns a property list with the following entries: :L — The extent to the left from zero.
:R — The extent to the right from zero.
:T — The extent up from the baseline.
:B — The extent down from the baseline. :GAP — The gap between two lines of text.

See FONT

Package

cl-fond

Methods
Method: compute-extent (FONT font) TEXT
Source

wrapper.lisp (file)

Generic Function: compute-text FONT TEXT

Compute the vertex array object to draw the given text.

Returns two values: the OpenGL VAO ID, and the number of elements stored in the VAO.

In order to actually use this, you will need to bind the font’s texture and use a vertex and fragment shader that draw the VAO as appropriate. The VAO contains two arrays of vec2s for this purpose: the first being the vertex coordinates, and the second being the texture coordinates. The texture only contains a red component, with the other components being set to zero.

See FONT

Package

cl-fond

Methods
Method: compute-text (FONT font) TEXT
Source

wrapper.lisp (file)

Generic Function: error-code CONDITION

The error code that the condition carries.

See FOND-ERROR
See CL-FOND-CFFI:FOND-ERROR-STRING

Package

cl-fond

Writer

(setf error-code) (generic function)

Methods
Method: error-code (CONDITION fond-error)
Source

wrapper.lisp (file)

Generic Function: (setf error-code) NEW-VALUE CONDITION
Package

cl-fond

Reader

error-code (generic function)

Methods
Method: (setf error-code) NEW-VALUE (CONDITION fond-error)
Source

wrapper.lisp (file)

Generic Function: file FONT

Returns the pathname for the TTF file this font contains.

See FONT

Package

cl-fond

Methods
Method: file (FONT font)
Source

wrapper.lisp (file)

Generic Function: font OBJECT

Accessor to the font that this buffer uses to render with.

You can change this at any time to switch what to render with.

Package

cl-fond

Writer

(setf font) (generic function)

Methods
Method: font (BUFFER buffer)

automatically generated reader method

Source

wrapper.lisp (file)

Generic Function: (setf font) NEW-VALUE OBJECT
Package

cl-fond

Reader

font (generic function)

Methods
Method: (setf font) NEW-VALUE (BUFFER buffer)

automatically generated writer method

Source

wrapper.lisp (file)

Method: (setf font) FONT (BUFFER buffer) before
Source

wrapper.lisp (file)

Generic Function: free OBJECT

Immediately frees the foreign object associated with the instance.

Package

cl-fond

Methods
Method: free (OBJECT c-object)
Source

wrapper.lisp (file)

Generic Function: handle OBJECT

Accessor to the pointer to the foreign object.

See C-OBJECT

Package

cl-fond

Writer

(setf handle) (generic function)

Methods
Method: handle (C-OBJECT c-object)

automatically generated reader method

Source

wrapper.lisp (file)

Generic Function: (setf handle) NEW-VALUE OBJECT
Package

cl-fond

Reader

handle (generic function)

Methods
Method: (setf handle) NEW-VALUE (C-OBJECT c-object)

automatically generated writer method

Source

wrapper.lisp (file)

Generic Function: height FONT

Returns the height of the object’s texture.

See TEXTURE
See FONT
See BUFFER

Package

cl-fond

Methods
Method: height (BUFFER buffer)
Source

wrapper.lisp (file)

Method: height (FONT font)
Source

wrapper.lisp (file)

Generic Function: render BUFFER TEXT &key X Y COLOR

Render the given text to the buffer.

The X and Y coordinates are offsets inside the texture, counting from the top left, as is usual for graphical applications. Thus Y grows downwards, rather than upwards like in OpenGL. The color should be a list of floats in the range of [0,1] representing RGBA in that order, defaulting to 1 for each component.

Returns the OpenGL texture ID that we rendered to.

Package

cl-fond

Methods
Method: render (BUFFER buffer) TEXT &key X Y COLOR
Source

wrapper.lisp (file)

Generic Function: size FONT

Returns the font’s size in pixels.

See FONT

Package

cl-fond

Methods
Method: size (FONT font)
Source

wrapper.lisp (file)

Generic Function: text-height FONT

Returns the height of a text line from its baseline.

See FONT

Package

cl-fond

Methods
Method: text-height (FONT font)
Source

wrapper.lisp (file)

Generic Function: texture FONT

Returns the OpenGL texture ID for the texture contained in the object.

See WIDTH
See HEIGHT
See FONT
See BUFFER

Package

cl-fond

Methods
Method: texture (BUFFER buffer)
Source

wrapper.lisp (file)

Method: texture (FONT font)
Source

wrapper.lisp (file)

Generic Function: update-text FONT TEXT VBO EBO
Package

cl-fond

Methods
Method: update-text (FONT font) TEXT VBO EBO
Source

wrapper.lisp (file)

Generic Function: width FONT

Returns the width of the object’s texture.

See TEXTURE
See FONT
See BUFFER

Package

cl-fond

Methods
Method: width (BUFFER buffer)
Source

wrapper.lisp (file)

Method: width (FONT font)
Source

wrapper.lisp (file)


Next: , Previous: , Up: Exported definitions   [Contents][Index]

5.1.4 Conditions

Condition: fond-error ()

Condition signalled when an error occurs in the underlying libfond.

See ERROR-CODE

Package

cl-fond

Source

wrapper.lisp (file)

Direct superclasses

error (condition)

Direct methods
Direct slots
Slot: error-code
Initargs

:error-code

Initform

(quote :unknown)

Readers

error-code (generic function)

Writers

(setf error-code) (generic function)


Previous: , Up: Exported definitions   [Contents][Index]

5.1.5 Classes

Class: buffer ()

This is a representation of a text buffer.

The buffer allows you to conveniently draw text to a texture. You will then merely need to draw the texture to the screen, rather than needing to manually create a shader and handle the drawing yourself.

See C-OBJECT
See FONT
See MAKE-BUFFER
See RENDER
See WIDTH
See HEIGHT
See TEXTURE

Package

cl-fond

Source

wrapper.lisp (file)

Direct superclasses

c-object (class)

Direct methods
Direct slots
Slot: font
Initargs

:font

Readers

font (generic function)

Writers

(setf font) (generic function)

Class: buffer ()

This struct allows for convenience in rendering, as it will render text for you into a texture.

You must allocate this struct yourself and make sure that
it is zeroed out before you do anything with it. Not
zeroing out will land you in a world of pain.

See BUFFER-FONT
See BUFFER-TEXTURE
See BUFFER-WIDTH
See BUFFER-HEIGHT
See BUFFER-PROGRAM
See BUFFER-FRAMEBUFFER
See FREE-BUFFER
See LOAD-BUFFER
See RENDER-BUFFER
See RENDER-BUFFER-U

Package

cl-fond-cffi

Source

low-level.lisp (file)

Direct superclasses
  • translatable-foreign-type (class)
  • foreign-struct-type (class)
Class: c-object ()

Base class for all objects that are tied to a foreign object somehow.

See HANDLE
See ALLOCATE-HANDLE
See FREE-HANDLE
See FREE

Package

cl-fond

Source

wrapper.lisp (file)

Direct superclasses

standard-object (class)

Direct subclasses
Direct methods
  • free (method)
  • initialize-instance (method)
  • handle (method)
  • handle (method)
Direct slots
Slot: handle
Initargs

:handle

Readers

handle (generic function)

Writers

(setf handle) (generic function)

Class: extent ()

This struct contains information about the extents of a text.

You must allocate this struct yourself and make sure that it is zeroed out before you do anything with it. Not zeroing out will land you in a world of pain.

See EXTENT-L
See EXTENT-R
See EXTENT-T
See EXTENT-B
See EXTENT-GAP
See COMPUTE-EXTENT
See COMPUTE-EXTENT-U

Package

cl-fond-cffi

Source

low-level.lisp (file)

Direct superclasses
  • translatable-foreign-type (class)
  • foreign-struct-type (class)
Class: font ()

This is a representation of a font file.

Using this class you can draw and compute text for a specific font at a specific size. The library will take care of rendering the font glyphs to an atlas to allow fast rendering of text.

See C-OBJECT
See MAKE-FONT
See COMPUTE-TEXT
See COMPUTE-EXTENT
See FILE
See SIZE
See TEXT-HEIGHT
See WIDTH
See HEIGHT
See TEXTURE
See CHARSET

Package

cl-fond

Source

wrapper.lisp (file)

Direct superclasses

c-object (class)

Direct methods
Class: font ()

This is the primary struct that contains all relevant information about a font.

You must allocate this struct yourself and make sure that
it is zeroed out before you do anything with it. Not
zeroing out will land you in a world of pain.

See FONT-FILE
See FONT-INDEX
See FONT-SIZE
See FONT-CHARACTERS
See FONT-CODEPOINTS
See FONT-WIDTH
See FONT-HEIGHT
See FONT-OVERSAMPLE
See FONT-ATLAS
See FONT-FONTDATA
See FONT-CHARDATA
See FONT-FONTINFO
See FONT-CONVERTED-CODEPOINTS
See LOAD-FONT
See LOAD-FONT-FIT
See FREE-FONT
See COMPUTE-TEXT
See COMPUTE-TEXT-U
See COMPUTE-EXTENT
See COMPUTE-EXTENT-U

Package

cl-fond-cffi

Source

low-level.lisp (file)

Direct superclasses
  • translatable-foreign-type (class)
  • foreign-struct-type (class)

Previous: , Up: Definitions   [Contents][Index]

5.2 Internal definitions


Next: , Previous: , Up: Internal definitions   [Contents][Index]

5.2.1 Special variables

Special Variable: *here*

Variable containing the path to the low-level.lisp file.

Package

cl-fond-cffi

Source

low-level.lisp (file)


Next: , Previous: , Up: Internal definitions   [Contents][Index]

5.2.2 Functions

Function: calloc TYPE

Allocate memory for the given foreign type and zero it out.

Package

cl-fond

Source

wrapper.lisp (file)

Function: show-error ()

Check whether any errors occurred in the underlying library and signal an error if necessary.

See FOND-ERROR
See CL-FOND-CFFI:FOND-ERROR

Package

cl-fond

Source

wrapper.lisp (file)

Function: string->char* STRING

Convert the given string to an UTF8 encoded C-string.

Returns a pointer to the allocated data. You are responsible for freeing it when appropriate.

Package

cl-fond

Source

wrapper.lisp (file)


Previous: , Up: Internal definitions   [Contents][Index]

5.2.3 Generic functions

Generic Function: allocate-handle CLASS

Allocate and return a pointer to the foreign object for this class.

See C-OBJECT

Package

cl-fond

Source

wrapper.lisp (file)

Methods
Method: allocate-handle (BUFFER buffer)
Method: allocate-handle (FONT font)
Generic Function: free-handle CLASS HANDLE

Return a function that, when called, frees the given foreign object for this class.

See C-OBJECT

Package

cl-fond

Source

wrapper.lisp (file)

Methods
Method: free-handle (BUFFER buffer) HANDLE
Method: free-handle (FONT font) HANDLE

Previous: , Up: Top   [Contents][Index]

Appendix A Indexes


Next: , Previous: , Up: Indexes   [Contents][Index]

A.1 Concepts

Jump to:   C   F   L  
Index Entry  Section

C
cl-fond.asd: The cl-fond<dot>asd file
cl-fond/documentation.lisp: The cl-fond/documentation<dot>lisp file
cl-fond/low-level.lisp: The cl-fond/low-level<dot>lisp file
cl-fond/package.lisp: The cl-fond/package<dot>lisp file
cl-fond/wrapper.lisp: The cl-fond/wrapper<dot>lisp file

F
File, Lisp, cl-fond.asd: The cl-fond<dot>asd file
File, Lisp, cl-fond/documentation.lisp: The cl-fond/documentation<dot>lisp file
File, Lisp, cl-fond/low-level.lisp: The cl-fond/low-level<dot>lisp file
File, Lisp, cl-fond/package.lisp: The cl-fond/package<dot>lisp file
File, Lisp, cl-fond/wrapper.lisp: The cl-fond/wrapper<dot>lisp file

L
Lisp File, cl-fond.asd: The cl-fond<dot>asd file
Lisp File, cl-fond/documentation.lisp: The cl-fond/documentation<dot>lisp file
Lisp File, cl-fond/low-level.lisp: The cl-fond/low-level<dot>lisp file
Lisp File, cl-fond/package.lisp: The cl-fond/package<dot>lisp file
Lisp File, cl-fond/wrapper.lisp: The cl-fond/wrapper<dot>lisp file

Jump to:   C   F   L  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.2 Functions

Jump to:   (  
A   B   C   D   E   F   G   H   L   M   R   S   T   U   W  
Index Entry  Section

(
(setf buffer-font): Exported functions
(setf buffer-framebuffer): Exported functions
(setf buffer-height): Exported functions
(setf buffer-program): Exported functions
(setf buffer-texture): Exported functions
(setf buffer-width): Exported functions
(setf error-code): Exported generic functions
(setf error-code): Exported generic functions
(setf extent-b): Exported functions
(setf extent-gap): Exported functions
(setf extent-l): Exported functions
(setf extent-r): Exported functions
(setf extent-t): Exported functions
(setf font): Exported generic functions
(setf font): Exported generic functions
(setf font): Exported generic functions
(setf font-atlas): Exported functions
(setf font-characters): Exported functions
(setf font-chardata): Exported functions
(setf font-codepoints): Exported functions
(setf font-converted-codepoints): Exported functions
(setf font-file): Exported functions
(setf font-fontdata): Exported functions
(setf font-fontinfo): Exported functions
(setf font-height): Exported functions
(setf font-index): Exported functions
(setf font-oversample): Exported functions
(setf font-size): Exported functions
(setf font-width): Exported functions
(setf handle): Exported generic functions
(setf handle): Exported generic functions

A
allocate-handle: Internal generic functions
allocate-handle: Internal generic functions
allocate-handle: Internal generic functions

B
buffer-font: Exported functions
buffer-framebuffer: Exported functions
buffer-height: Exported functions
buffer-program: Exported functions
buffer-texture: Exported functions
buffer-width: Exported functions

C
calloc: Internal functions
charset: Exported generic functions
charset: Exported generic functions
compute-extent: Exported functions
compute-extent: Exported generic functions
compute-extent: Exported generic functions
compute-extent-u: Exported functions
compute-text: Exported functions
compute-text: Exported generic functions
compute-text: Exported generic functions
compute-text-u: Exported functions

D
decode-utf8: Exported functions

E
error-code: Exported generic functions
error-code: Exported generic functions
extent-b: Exported functions
extent-gap: Exported functions
extent-l: Exported functions
extent-r: Exported functions
extent-t: Exported functions

F
file: Exported generic functions
file: Exported generic functions
fond-error: Exported functions
fond-error-string: Exported functions
font: Exported generic functions
font: Exported generic functions
font-atlas: Exported functions
font-characters: Exported functions
font-chardata: Exported functions
font-codepoints: Exported functions
font-converted-codepoints: Exported functions
font-file: Exported functions
font-fontdata: Exported functions
font-fontinfo: Exported functions
font-height: Exported functions
font-index: Exported functions
font-oversample: Exported functions
font-size: Exported functions
font-width: Exported functions
free: Exported generic functions
free: Exported generic functions
free-buffer: Exported functions
free-font: Exported functions
free-handle: Internal generic functions
free-handle: Internal generic functions
free-handle: Internal generic functions
Function, (setf buffer-font): Exported functions
Function, (setf buffer-framebuffer): Exported functions
Function, (setf buffer-height): Exported functions
Function, (setf buffer-program): Exported functions
Function, (setf buffer-texture): Exported functions
Function, (setf buffer-width): Exported functions
Function, (setf extent-b): Exported functions
Function, (setf extent-gap): Exported functions
Function, (setf extent-l): Exported functions
Function, (setf extent-r): Exported functions
Function, (setf extent-t): Exported functions
Function, (setf font-atlas): Exported functions
Function, (setf font-characters): Exported functions
Function, (setf font-chardata): Exported functions
Function, (setf font-codepoints): Exported functions
Function, (setf font-converted-codepoints): Exported functions
Function, (setf font-file): Exported functions
Function, (setf font-fontdata): Exported functions
Function, (setf font-fontinfo): Exported functions
Function, (setf font-height): Exported functions
Function, (setf font-index): Exported functions
Function, (setf font-oversample): Exported functions
Function, (setf font-size): Exported functions
Function, (setf font-width): Exported functions
Function, buffer-font: Exported functions
Function, buffer-framebuffer: Exported functions
Function, buffer-height: Exported functions
Function, buffer-program: Exported functions
Function, buffer-texture: Exported functions
Function, buffer-width: Exported functions
Function, calloc: Internal functions
Function, compute-extent: Exported functions
Function, compute-extent-u: Exported functions
Function, compute-text: Exported functions
Function, compute-text-u: Exported functions
Function, decode-utf8: Exported functions
Function, extent-b: Exported functions
Function, extent-gap: Exported functions
Function, extent-l: Exported functions
Function, extent-r: Exported functions
Function, extent-t: Exported functions
Function, fond-error: Exported functions
Function, fond-error-string: Exported functions
Function, font-atlas: Exported functions
Function, font-characters: Exported functions
Function, font-chardata: Exported functions
Function, font-codepoints: Exported functions
Function, font-converted-codepoints: Exported functions
Function, font-file: Exported functions
Function, font-fontdata: Exported functions
Function, font-fontinfo: Exported functions
Function, font-height: Exported functions
Function, font-index: Exported functions
Function, font-oversample: Exported functions
Function, font-size: Exported functions
Function, font-width: Exported functions
Function, free-buffer: Exported functions
Function, free-font: Exported functions
Function, load-buffer: Exported functions
Function, load-font: Exported functions
Function, load-font-fit: Exported functions
Function, make-buffer: Exported functions
Function, make-font: Exported functions
Function, render-buffer: Exported functions
Function, render-buffer-u: Exported functions
Function, show-error: Internal functions
Function, string->char*: Internal functions
Function, update-text: Exported functions
Function, update-text-u: Exported functions

G
Generic Function, (setf error-code): Exported generic functions
Generic Function, (setf font): Exported generic functions
Generic Function, (setf handle): Exported generic functions
Generic Function, allocate-handle: Internal generic functions
Generic Function, charset: Exported generic functions
Generic Function, compute-extent: Exported generic functions
Generic Function, compute-text: Exported generic functions
Generic Function, error-code: Exported generic functions
Generic Function, file: Exported generic functions
Generic Function, font: Exported generic functions
Generic Function, free: Exported generic functions
Generic Function, free-handle: Internal generic functions
Generic Function, handle: Exported generic functions
Generic Function, height: Exported generic functions
Generic Function, render: Exported generic functions
Generic Function, size: Exported generic functions
Generic Function, text-height: Exported generic functions
Generic Function, texture: Exported generic functions
Generic Function, update-text: Exported generic functions
Generic Function, width: Exported generic functions

H
handle: Exported generic functions
handle: Exported generic functions
height: Exported generic functions
height: Exported generic functions
height: Exported generic functions

L
load-buffer: Exported functions
load-font: Exported functions
load-font-fit: Exported functions

M
make-buffer: Exported functions
make-font: Exported functions
Method, (setf error-code): Exported generic functions
Method, (setf font): Exported generic functions
Method, (setf font): Exported generic functions
Method, (setf handle): Exported generic functions
Method, allocate-handle: Internal generic functions
Method, allocate-handle: Internal generic functions
Method, charset: Exported generic functions
Method, compute-extent: Exported generic functions
Method, compute-text: Exported generic functions
Method, error-code: Exported generic functions
Method, file: Exported generic functions
Method, font: Exported generic functions
Method, free: Exported generic functions
Method, free-handle: Internal generic functions
Method, free-handle: Internal generic functions
Method, handle: Exported generic functions
Method, height: Exported generic functions
Method, height: Exported generic functions
Method, render: Exported generic functions
Method, size: Exported generic functions
Method, text-height: Exported generic functions
Method, texture: Exported generic functions
Method, texture: Exported generic functions
Method, update-text: Exported generic functions
Method, width: Exported generic functions
Method, width: Exported generic functions

R
render: Exported generic functions
render: Exported generic functions
render-buffer: Exported functions
render-buffer-u: Exported functions

S
show-error: Internal functions
size: Exported generic functions
size: Exported generic functions
string->char*: Internal functions

T
text-height: Exported generic functions
text-height: Exported generic functions
texture: Exported generic functions
texture: Exported generic functions
texture: Exported generic functions

U
update-text: Exported functions
update-text: Exported generic functions
update-text: Exported generic functions
update-text-u: Exported functions

W
width: Exported generic functions
width: Exported generic functions
width: Exported generic functions

Jump to:   (  
A   B   C   D   E   F   G   H   L   M   R   S   T   U   W  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.3 Variables

Jump to:   *  
E   F   H   S  
Index Entry  Section

*
*here*: Internal special variables
*static*: Exported special variables

E
error-code: Exported conditions

F
font: Exported classes

H
handle: Exported classes

S
Slot, error-code: Exported conditions
Slot, font: Exported classes
Slot, handle: Exported classes
Special Variable, *here*: Internal special variables
Special Variable, *static*: Exported special variables

Jump to:   *  
E   F   H   S  

Previous: , Up: Indexes   [Contents][Index]

A.4 Data types

Jump to:   B   C   E   F   P   S  
Index Entry  Section

B
buffer: Exported classes
buffer: Exported classes

C
c-object: Exported classes
cl-fond: The cl-fond system
cl-fond: The cl-fond package
cl-fond-cffi: The cl-fond-cffi package
Class, buffer: Exported classes
Class, buffer: Exported classes
Class, c-object: Exported classes
Class, extent: Exported classes
Class, font: Exported classes
Class, font: Exported classes
Condition, fond-error: Exported conditions

E
extent: Exported classes

F
fond-error: Exported conditions
font: Exported classes
font: Exported classes

P
Package, cl-fond: The cl-fond package
Package, cl-fond-cffi: The cl-fond-cffi package

S
System, cl-fond: The cl-fond system

Jump to:   B   C   E   F   P   S