Alias cairo_user_scaled_font_unicode_to_glyph_func_t

cairo_user_scaled_font_unicode_to_glyph_func_t is the type of function which is called to convert an input Unicode character to a single glyph. This is used by the cairo_show_text() operation.

This callback is used to provide the same functionality as the text_to_glyphs callback does (see cairo_user_scaled_font_text_to_glyphs_func_t) but has much less control on the output, in exchange for increased ease of use. The inherent assumption to using this callback is that each character maps to one glyph, and that the mapping is context independent. It also assumes that glyphs are positioned according to their advance width. These mean no ligatures, kerning, or complex scripts can be implemented using this callback.

The callback is optional, and only used if text_to_glyphs callback is not set or fails to return glyphs. If this callback is not set or if it returns CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED, an identity mapping from Unicode code-points to glyph indices is assumed.

Declaration

alias cairo_user_scaled_font_unicode_to_glyph_func_t = extern(C) cairo_status_t function(cairo_scaled_font_t*, ulong, ulong*);

Note

While cairo does not impose any limitation on glyph indices, some applications may assume that a glyph index fits in a 16-bit unsigned integer. As such, it is advised that user-fonts keep their glyphs in the 0 to 65535 range. Furthermore, some applications may assume that glyph 0 is a special glyph-not-found glyph. User-fonts are advised to use glyph 0 for such purposes and do not use that glyph value for other purposes.

Parameters

NameDescription
scaled_font the scaled-font being created
unicode input unicode character code-point
glyph_index output glyph index

Returns

CAIRO_STATUS_SUCCESS upon success, CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED if fallback options should be tried, or CAIRO_STATUS_USER_FONT_ERROR or any other 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