Pango Reference Manual | ||||
---|---|---|---|---|
PangoEngineShape; PangoEngineShapeClass; #define PANGO_ENGINE_TYPE_SHAPE #define PANGO_ENGINE_SHAPE_DEFINE_TYPE (name, prefix, class_init, instance_init)
The shape engines are rendering-system dependent
engines that convert character strings into glyph strings.
These engines are used in pango_shape()
.
typedef struct _PangoEngineShape PangoEngineShape;
The PangoEngineShape class is implemented by engines that customize the rendering-system dependent part of the Pango pipeline for a particular script or language. A PangoEngineShape implementation is then specific to both a particular rendering system or group of rendering systems and to a particular script. For instance, there is one PangoEngineShape implementation to handle shaping Arabic for Fontconfig-based backends.
typedef struct { void (*script_shape) (PangoEngineShape *engine, PangoFont *font, const char *text, int length, const PangoAnalysis *analysis, PangoGlyphString *glyphs); PangoCoverageLevel (*covers) (PangoEngineShape *engine, PangoFont *font, PangoLanguage *language, gunichar wc); } PangoEngineShapeClass;
Class structure for PangoEngineShape
script_shape () |
Given a font, a piece of text, and a PangoAnalysis
structure, converts characters to glyphs and positions the
resulting glyphs. The results are stored in the PangoGlyphString
that is passed in. (The implementation should resize it
appropriately using pango_glyph_string_set_size() ). All fields
of the log_clusters and glyphs array must be filled in, with
the exception that Pango will automatically generate
glyphs->glyphs[i].attr.is_cluster_start
using the log_clusters array. Each input character must occur in one
of the output logical clusters;
if no rendering is desired for a character, this may involve
inserting glyphs with the PangoGlyph ID PANGO_GLYPH_EMPTY, which
is guaranteed never to render. If the shaping fails for any reason,
the shaper should return with an empty (zero-size) glyph string.
If the shaper has not set the size on the glyph string yet, simply
returning signals the failure too.
|
covers () |
Returns the characters that this engine can cover with a given font for a given language. If not overridden, the default implementation simply returns the coverage information for the font itself unmodified. |
#define PANGO_ENGINE_TYPE_SHAPE "PangoEngineShape"
A string constant defining the engine type for shaping engines. These engines derive from PangoEngineShape.
#define PANGO_ENGINE_SHAPE_DEFINE_TYPE(name, prefix, class_init, instance_init)
Outputs the necessary code for GObject type registration for a PangoEngineShape class defined in a module. Two static symbols are defined.
static GTypeprefix
_type; static voidprefix
_register_type (GTypeModule module);
The
function should be called in your prefix
, _register_type()
script_engine_init()
function for
each type that your module implements, and then your script_engine_create()
function can create instances of the object as follows:
PangoEngine *engine = g_object_new (prefix
_type, NULL);