The cl-fond Reference Manual

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

The cl-fond Reference Manual

This is the cl-fond Reference Manual, version 1.1.0, generated automatically by Declt version 4.0 beta 2 "William Riker" on Thu Sep 15 03:45:26 2022 GMT+0.

Table of Contents


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.

Also See


2 Systems

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


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

2.1 cl-fond

Bindings to libfond, a simple text rendering engine for OpenGL

Maintainer

Nicolas Hafner <shinmera@tymoon.eu>

Author

Nicolas Hafner <shinmera@tymoon.eu>

Home Page

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

Source Control

(GIT https://github.com/Shirakumo/cl-fond.git)

Bug Tracker

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

License

zlib

Version

1.1.0

Dependencies
  • alexandria (system).
  • cffi (system).
  • trivial-features (system).
  • trivial-garbage (system).
  • documentation-utils (system).
  • cl-opengl (system).
Source

cl-fond.asd.

Child Components

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   [Contents][Index]

3.1.1 cl-fond/cl-fond.asd

Source

cl-fond.asd.

Parent Component

cl-fond (system).

ASDF Systems

cl-fond.


3.1.2 cl-fond/package.lisp

Source

cl-fond.asd.

Parent Component

cl-fond (system).

Packages

3.1.3 cl-fond/low-level.lisp

Dependency

package.lisp (file).

Source

cl-fond.asd.

Parent Component

cl-fond (system).

Public Interface
Internals

*here* (special variable).


3.1.4 cl-fond/wrapper.lisp

Dependency

low-level.lisp (file).

Source

cl-fond.asd.

Parent Component

cl-fond (system).

Public Interface
Internals

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

3.1.5 cl-fond/documentation.lisp

Dependency

wrapper.lisp (file).

Source

cl-fond.asd.

Parent Component

cl-fond (system).


4 Packages

Packages are listed by definition order.


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

4.1 cl-fond

Source

package.lisp.

Nickname

org.shirakumo.fraf.fond

Use List
  • cffi.
  • common-lisp.
Public Interface
Internals

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

4.2 cl-fond-cffi

Source

package.lisp.

Nickname

org.shirakumo.fraf.fond.cffi

Use List
  • cffi.
  • common-lisp.
Public Interface
Internals

*here* (special variable).


5 Definitions

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


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

5.1 Public Interface


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.


5.1.2 Ordinary 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.

Function: (setf buffer-font) (pointer-to-buffer)
Package

cl-fond-cffi.

Source

low-level.lisp.

Function: buffer-framebuffer (pointer-to-buffer)

This is an internal field.

See BUFFER

Package

cl-fond-cffi.

Source

low-level.lisp.

Function: (setf buffer-framebuffer) (pointer-to-buffer)
Package

cl-fond-cffi.

Source

low-level.lisp.

Function: buffer-height (pointer-to-buffer)

The height of the texture.

See BUFFER

Package

cl-fond-cffi.

Source

low-level.lisp.

Function: (setf buffer-height) (pointer-to-buffer)
Package

cl-fond-cffi.

Source

low-level.lisp.

Function: buffer-program (pointer-to-buffer)

This is an internal field.

See BUFFER

Package

cl-fond-cffi.

Source

low-level.lisp.

Function: (setf buffer-program) (pointer-to-buffer)
Package

cl-fond-cffi.

Source

low-level.lisp.

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.

Function: (setf buffer-texture) (pointer-to-buffer)
Package

cl-fond-cffi.

Source

low-level.lisp.

Function: buffer-width (pointer-to-buffer)

The width of the texture.

See BUFFER

Package

cl-fond-cffi.

Source

low-level.lisp.

Function: (setf buffer-width) (pointer-to-buffer)
Package

cl-fond-cffi.

Source

low-level.lisp.

Function: charset (font)

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

See FONT

Package

cl-fond.

Source

wrapper.lisp.

Function: compute-extent (font text &key start end)

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.

Source

wrapper.lisp.

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.

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.

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.

Source

wrapper.lisp.

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.

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.

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.

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.

Function: (setf extent-b) (pointer-to-extent)
Package

cl-fond-cffi.

Source

low-level.lisp.

Function: extent-gap (pointer-to-extent)

The gap between lines of the text.

See EXTENT

Package

cl-fond-cffi.

Source

low-level.lisp.

Function: (setf extent-gap) (pointer-to-extent)
Package

cl-fond-cffi.

Source

low-level.lisp.

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.

Function: (setf extent-l) (pointer-to-extent)
Package

cl-fond-cffi.

Source

low-level.lisp.

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.

Function: (setf extent-r) (pointer-to-extent)
Package

cl-fond-cffi.

Source

low-level.lisp.

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.

Function: (setf extent-t) (pointer-to-extent)
Package

cl-fond-cffi.

Source

low-level.lisp.

Function: file (font)

Returns the pathname for the TTF file this font contains.

See FONT

Package

cl-fond.

Source

wrapper.lisp.

Function: fond-error ()

Return the current error code.

Package

cl-fond-cffi.

Source

low-level.lisp.

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.

Function: font-atlas (pointer-to-font)

The OpenGL texture ID for the atlas.

See FONT

Package

cl-fond-cffi.

Source

low-level.lisp.

Function: (setf font-atlas) (pointer-to-font)
Package

cl-fond-cffi.

Source

low-level.lisp.

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.

Function: (setf font-characters) (pointer-to-font)
Package

cl-fond-cffi.

Source

low-level.lisp.

Function: font-chardata (pointer-to-font)

This is an internal field.

See FONT

Package

cl-fond-cffi.

Source

low-level.lisp.

Function: (setf font-chardata) (pointer-to-font)
Package

cl-fond-cffi.

Source

low-level.lisp.

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.

Function: (setf font-codepoints) (pointer-to-font)
Package

cl-fond-cffi.

Source

low-level.lisp.

Function: font-converted-codepoints (pointer-to-font)

This is an internal field.

See FONT

Package

cl-fond-cffi.

Source

low-level.lisp.

Function: (setf font-converted-codepoints) (pointer-to-font)
Package

cl-fond-cffi.

Source

low-level.lisp.

Function: font-file (pointer-to-font)

Accessor for the path to the TTF file.

See FONT

Package

cl-fond-cffi.

Source

low-level.lisp.

Function: (setf font-file) (pointer-to-font)
Package

cl-fond-cffi.

Source

low-level.lisp.

Function: font-fontdata (pointer-to-font)

This is an internal field.

See FONT

Package

cl-fond-cffi.

Source

low-level.lisp.

Function: (setf font-fontdata) (pointer-to-font)
Package

cl-fond-cffi.

Source

low-level.lisp.

Function: font-fontinfo (pointer-to-font)

This is an internal field.

See FONT

Package

cl-fond-cffi.

Source

low-level.lisp.

Function: (setf font-fontinfo) (pointer-to-font)
Package

cl-fond-cffi.

Source

low-level.lisp.

Function: font-height (pointer-to-font)

The height of the glyph texture atlas.

See FONT

Package

cl-fond-cffi.

Source

low-level.lisp.

Function: (setf font-height) (pointer-to-font)
Package

cl-fond-cffi.

Source

low-level.lisp.

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.

Function: (setf font-index) (pointer-to-font)
Package

cl-fond-cffi.

Source

low-level.lisp.

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.

Function: (setf font-oversample) (pointer-to-font)
Package

cl-fond-cffi.

Source

low-level.lisp.

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.

Function: (setf font-size) (pointer-to-font)
Package

cl-fond-cffi.

Source

low-level.lisp.

Function: font-width (pointer-to-font)

The width of the glyph texture atlas.

See FONT

Package

cl-fond-cffi.

Source

low-level.lisp.

Function: (setf font-width) (pointer-to-font)
Package

cl-fond-cffi.

Source

low-level.lisp.

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.

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.

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.

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.

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.

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.

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.

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.

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.

Function: size (font)

Returns the font’s size in pixels.

See FONT

Package

cl-fond.

Source

wrapper.lisp.

Function: text-height (font)

Returns the height of a text line from its baseline.

See FONT

Package

cl-fond.

Source

wrapper.lisp.

Function: update-text (font text vbo ebo)
Package

cl-fond.

Source

wrapper.lisp.

Function: update-text (font text n vbo ebo)
Package

cl-fond-cffi.

Source

low-level.lisp.

Function: update-text-u (font text size n vbo ebo)
Package

cl-fond-cffi.

Source

low-level.lisp.


5.1.3 Generic functions

Generic Reader: error-code (condition)

The error code that the condition carries.

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

Package

cl-fond.

Methods
Reader Method: error-code ((condition fond-error))
Source

wrapper.lisp.

Target Slot

error-code.

Generic Writer: (setf error-code) (condition)
Package

cl-fond.

Methods
Writer Method: (setf error-code) ((condition fond-error))
Source

wrapper.lisp.

Target Slot

error-code.

Generic Reader: 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.

Methods
Reader Method: font ((buffer buffer))

automatically generated reader method

Source

wrapper.lisp.

Target Slot

font.

Generic Function: (setf font) (object)
Package

cl-fond.

Methods
Writer Method: (setf font) :before ((buffer buffer))
Source

wrapper.lisp.

Target Slot

font.

Method: (setf font) ((buffer buffer))

automatically generated writer method

Source

wrapper.lisp.

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.

Generic Reader: handle (object)

Accessor to the pointer to the foreign object.

See C-OBJECT

Package

cl-fond.

Methods
Reader Method: handle ((c-object c-object))

automatically generated reader method

Source

wrapper.lisp.

Target Slot

handle.

Generic Writer: (setf handle) (object)
Package

cl-fond.

Methods
Writer Method: (setf handle) ((c-object c-object))

automatically generated writer method

Source

wrapper.lisp.

Target Slot

handle.

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.

Method: height ((font font))
Source

wrapper.lisp.

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.

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.

Method: texture ((font font))
Source

wrapper.lisp.

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.

Method: width ((font font))
Source

wrapper.lisp.


5.1.4 Standalone methods

Method: initialize-instance :after ((font font) &key file index size oversample charset width height)
Source

wrapper.lisp.

Method: initialize-instance :after ((buffer buffer) &key font width height)
Source

wrapper.lisp.

Method: initialize-instance :after ((c-object c-object) &key)
Source

wrapper.lisp.


5.1.5 Conditions

Condition: fond-error

Condition signalled when an error occurs in the underlying libfond.

See ERROR-CODE

Package

cl-fond.

Source

wrapper.lisp.

Direct superclasses

error.

Direct methods
Direct slots
Slot: error-code
Initform

(quote :unknown)

Initargs

:error-code

Readers

error-code.

Writers

(setf error-code).


Previous: , Up: Public Interface   [Contents][Index]

5.1.6 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.

Direct superclasses

c-object.

Direct methods
Direct slots
Slot: font
Initargs

:font

Readers

font.

Writers

(setf font).

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.

Direct superclasses
  • foreign-struct-type.
  • translatable-foreign-type.
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.

Direct subclasses
Direct methods
Direct slots
Slot: handle
Initargs

:handle

Readers

handle.

Writers

(setf handle).

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.

Direct superclasses
  • foreign-struct-type.
  • translatable-foreign-type.
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.

Direct superclasses

c-object.

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.

Direct superclasses
  • foreign-struct-type.
  • translatable-foreign-type.

5.2 Internals


Next: , Previous: , Up: Internals   [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.


5.2.2 Ordinary functions

Function: calloc (type)

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

Package

cl-fond.

Source

wrapper.lisp.

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.

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.


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.

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.

Methods
Method: free-handle ((buffer buffer) handle)
Method: free-handle ((font font) handle)

Appendix A Indexes


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

A.1 Concepts


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

A.2 Functions

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

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

A
allocate-handle: Private generic functions
allocate-handle: Private generic functions
allocate-handle: Private generic functions

B
buffer-font: Public ordinary functions
buffer-framebuffer: Public ordinary functions
buffer-height: Public ordinary functions
buffer-program: Public ordinary functions
buffer-texture: Public ordinary functions
buffer-width: Public ordinary functions

C
calloc: Private ordinary functions
charset: Public ordinary functions
compute-extent: Public ordinary functions
compute-extent: Public ordinary functions
compute-extent-u: Public ordinary functions
compute-text: Public ordinary functions
compute-text: Public ordinary functions
compute-text-u: Public ordinary functions

D
decode-utf8: Public ordinary functions

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

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

G
Generic Function, (setf error-code): Public generic functions
Generic Function, (setf font): Public generic functions
Generic Function, (setf handle): Public generic functions
Generic Function, allocate-handle: Private generic functions
Generic Function, error-code: Public generic functions
Generic Function, font: Public generic functions
Generic Function, free: Public generic functions
Generic Function, free-handle: Private generic functions
Generic Function, handle: Public generic functions
Generic Function, height: Public generic functions
Generic Function, render: Public generic functions
Generic Function, texture: Public generic functions
Generic Function, width: Public generic functions

H
handle: Public generic functions
handle: Public generic functions
height: Public generic functions
height: Public generic functions
height: Public generic functions

I
initialize-instance: Public standalone methods
initialize-instance: Public standalone methods
initialize-instance: Public standalone methods

L
load-buffer: Public ordinary functions
load-font: Public ordinary functions
load-font-fit: Public ordinary functions

M
make-buffer: Public ordinary functions
make-font: Public ordinary functions
Method, (setf error-code): Public generic functions
Method, (setf font): Public generic functions
Method, (setf font): Public generic functions
Method, (setf handle): Public generic functions
Method, allocate-handle: Private generic functions
Method, allocate-handle: Private generic functions
Method, error-code: Public generic functions
Method, font: Public generic functions
Method, free: Public generic functions
Method, free-handle: Private generic functions
Method, free-handle: Private generic functions
Method, handle: Public generic functions
Method, height: Public generic functions
Method, height: Public generic functions
Method, initialize-instance: Public standalone methods
Method, initialize-instance: Public standalone methods
Method, initialize-instance: Public standalone methods
Method, render: Public generic functions
Method, texture: Public generic functions
Method, texture: Public generic functions
Method, width: Public generic functions
Method, width: Public generic functions

R
render: Public generic functions
render: Public generic functions
render-buffer: Public ordinary functions
render-buffer-u: Public ordinary functions

S
show-error: Private ordinary functions
size: Public ordinary functions
string->char*: Private ordinary functions

T
text-height: Public ordinary functions
texture: Public generic functions
texture: Public generic functions
texture: Public generic functions

U
update-text: Public ordinary functions
update-text: Public ordinary functions
update-text-u: Public ordinary functions

W
width: Public generic functions
width: Public generic functions
width: Public generic functions

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