manpagez: man pages & more
html files: pango
Home | html | info | man


PangoEngineShape — Rendering-system dependent script engines

Stability Level

Unstable, unless otherwise indicated


struct              PangoEngineShapeClass;
#define             PANGO_ENGINE_TYPE_SHAPE
#define             PANGO_ENGINE_SHAPE_DEFINE_TYPE      (name,

Object Hierarchy



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.

struct PangoEngineShapeClass

struct PangoEngineShapeClass {
  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);

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 GType prefix_type;
 static void prefix_register_type (GTypeModule module);

The prefix, _register_type() function should be called in your 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 (<em class="replaceable"><code>prefix</code></em>_type, NULL);

name :

Name of the the type to register (for example:, ArabicEngineFc

prefix :

Prefix for symbols that will be defined (for example:, arabic_engine_fc

class_init :

Class initialization function for the new type, or NULL

instance_init :

Instance initialization function for the new type, or NULL
© 2000-2021
Individual documents may contain additional copyright information.