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

Declaration

alias cairo_user_scaled_font_init_func_t = extern(C) cairo_status_t function(cairo_scaled_font_t*, cairo_t*, cairo_font_extents_t*);

Parameters

NameDescription
scaled_font the scaled-font being created
cr a cairo context, in font space
extents font extents to fill in, in font space

Returns

CAIRO_STATUS_SUCCESS upon success, or an error status on error.

Since

1.8

Authors

Johannes Pfau cairoD
cairo team cairo

Copyright

License

cairoD wrapper/bindings Boost License 1.0
cairo LGPL 2.1 / MPL 1.1