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


13 User Fonts

Font support with font data provided by the user

13.1 Overview

The user-font feature allows the cairo user to provide drawings for glyphs in a font. This is most useful in implementing fonts in non-standard formats, like SVG fonts and Flash fonts, but can also be used by games and other application to draw "funky" fonts.

13.2 Usage

Function: cairo-user-font-face-create ⇒  (ret <cairo-font-face-t >)

Creates a new user font-face.

Use the setter functions to associate callbacks with the returned user font. The only mandatory callback is render_glyph.

After the font-face is created, the user can attach arbitrary data (the actual font data) to it using cairo-font-face-set-user-data and access it from the user-font callbacks by using cairo-scaled-font-get-font-face followed by cairo-font-face-get-user-data.

ret

a newly created <cairo-font-face-t>. Free with cairo-font-face-destroy when you are done using it.

Since 1.8

Function: cairo-user-font-face-set-init-func (font-face <cairo-font-face-t>) (init-func <cairo-user-scaled-font-init-func-t>)

Sets the scaled-font initialization function of a user-font. See <cairo-user-scaled-font-init-func-t> for details of how the callback works.

The font-face should not be immutable or a ‘CAIRO_STATUS_USER_FONT_IMMUTABLE’ error will occur. A user font-face is immutable as soon as a scaled-font is created from it.

font-face

A user font face

init-func

The init callback, or ‘#f

Since 1.8