PangoEngineShape

PangoEngineShape — Rendering-system dependent script engines

Stability Level

Unstable, unless otherwise indicated

Synopsis

                    PangoEngineShape;
                    PangoEngineShapeClass;
#define             PANGO_ENGINE_TYPE_SHAPE
#define             PANGO_ENGINE_SHAPE_DEFINE_TYPE      (name,
                                                         prefix,
                                                         class_init,
                                                         instance_init)

Object Hierarchy

  GObject
   +----PangoEngine
         +----PangoEngineShape

Description

The shape engines are rendering-system dependent engines that convert character strings into glyph strings. These engines are used in pango_shape().

Details

PangoEngineShape

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.


PangoEngineShapeClass

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.

PANGO_ENGINE_TYPE_SHAPE

#define PANGO_ENGINE_TYPE_SHAPE "PangoEngineShape"

A string constant defining the engine type for shaping engines. These engines derive from PangoEngineShape.


PANGO_ENGINE_SHAPE_DEFINE_TYPE()

#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:

1
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