The OpenD Programming Language

cairo_user_scaled_font_init_func_t

cairo_user_scaled_font_init_func_t is the type of function which is called when a scaled-font needs to be created for a user font-face.

The cairo context cr is not used by the caller, but is prepared in font space, similar to what the cairo contexts passed to the render_glyph method will look like. The callback can use this context for extents computation for example. After the callback is called, cr is checked for any error status.

The extents argument is where the user font sets the font extents for scaled_font. It is in font space, which means that for most cases its ascent and descent members should add to 1.0. extents is preset to hold a value of 1.0 for ascent, height, and max_x_advance, and 0.0 for descent and max_y_advance members.

The callback is optional. If not set, default font extents as described in the previous paragraph will be used.

Note that scaled_font is not fully initialized at this point and trying to use it for text operations in the callback will result in deadlock.

import cairo.c.cairo;
extern (C)
alias cairo_user_scaled_font_init_func_t = cairo_status_t function(cairo_scaled_font_t* scaled_font, cairo_t* cr, cairo_font_extents_t* extents)

Return Value

CAIRO_STATUS_SUCCESS upon success, or an error status on error.

Meta