1 <refentry id="PangoEngineShape">
3 <refentrytitle role="top_of_page" id="PangoEngineShape.top_of_page">PangoEngineShape</refentrytitle>
4 <manvolnum>3</manvolnum>
5 <refmiscinfo>PANGO Library</refmiscinfo>
9 <refname>PangoEngineShape</refname>
10 <refpurpose>Rendering-system dependent script engines</refpurpose>
12 <refsect1 id="PangoEngineShape.stability-level">
13 <title>Stability Level</title>
14 Unstable, unless otherwise indicated
17 <refsynopsisdiv id="PangoEngineShape.synopsis" role="synopsis">
18 <title role="synopsis.title">Synopsis</title>
21 <link linkend="PangoEngineShape-struct">PangoEngineShape</link>;
22 <link linkend="PangoEngineShapeClass">PangoEngineShapeClass</link>;
23 #define <link linkend="PANGO-ENGINE-TYPE-SHAPE--CAPS">PANGO_ENGINE_TYPE_SHAPE</link>
24 #define <link linkend="PANGO-ENGINE-SHAPE-DEFINE-TYPE--CAPS">PANGO_ENGINE_SHAPE_DEFINE_TYPE</link> (name, prefix, class_init, instance_init)
28 <refsect1 id="PangoEngineShape.object-hierarchy" role="object_hierarchy">
29 <title role="object_hierarchy.title">Object Hierarchy</title>
31 <link linkend="GObject">GObject</link>
32 +----<link linkend="PangoEngine">PangoEngine</link>
44 <refsect1 id="PangoEngineShape.description" role="desc">
45 <title role="desc.title">Description</title>
47 The <firstterm>shape engines</firstterm> are rendering-system dependent
48 engines that convert character strings into glyph strings.
49 These engines are used in <link linkend="pango-shape"><function>pango_shape()</function></link>.
53 <refsect1 id="PangoEngineShape.details" role="details">
54 <title role="details.title">Details</title>
55 <refsect2 id="PangoEngineShape-struct" role="struct">
56 <title>PangoEngineShape</title>
57 <indexterm zone="PangoEngineShape-struct"><primary sortas="PangoEngineShape">PangoEngineShape</primary></indexterm><programlisting>typedef struct _PangoEngineShape PangoEngineShape;</programlisting>
59 The <link linkend="PangoEngineShape"><type>PangoEngineShape</type></link> class is implemented by engines that
60 customize the rendering-system dependent part of the
61 Pango pipeline for a particular script or language.
62 A <link linkend="PangoEngineShape"><type>PangoEngineShape</type></link> implementation is then specific to both
63 a particular rendering system or group of rendering systems
64 and to a particular script. For instance, there is one
65 <link linkend="PangoEngineShape"><type>PangoEngineShape</type></link> implementation to handle shaping Arabic
66 for Fontconfig-based backends.</para>
69 <refsect2 id="PangoEngineShapeClass" role="struct">
70 <title>PangoEngineShapeClass</title>
71 <indexterm zone="PangoEngineShapeClass"><primary sortas="PangoEngineShapeClass">PangoEngineShapeClass</primary></indexterm><programlisting>typedef struct {
72 void (*script_shape) (PangoEngineShape *engine,
76 const PangoAnalysis *analysis,
77 PangoGlyphString *glyphs);
78 PangoCoverageLevel (*covers) (PangoEngineShape *engine,
80 PangoLanguage *language,
82 } PangoEngineShapeClass;
85 Class structure for <link linkend="PangoEngineShape"><type>PangoEngineShape</type></link></para>
87 </para><variablelist role="struct">
89 <term><structfield>script_shape</structfield> ()</term>
90 <listitem><simpara> Given a font, a piece of text, and a <link linkend="PangoAnalysis"><type>PangoAnalysis</type></link>
91 structure, converts characters to glyphs and positions the
92 resulting glyphs. The results are stored in the <link linkend="PangoGlyphString"><type>PangoGlyphString</type></link>
93 that is passed in. (The implementation should resize it
94 appropriately using <link linkend="pango-glyph-string-set-size"><function>pango_glyph_string_set_size()</function></link>). All fields
95 of the <parameter>log_clusters</parameter> and <parameter>glyphs</parameter> array must be filled in, with
96 the exception that Pango will automatically generate
97 <literal>glyphs->glyphs[i].attr.is_cluster_start</literal>
98 using the <parameter>log_clusters</parameter> array. Each input character must occur in one
99 of the output logical clusters;
100 if no rendering is desired for a character, this may involve
101 inserting glyphs with the <link linkend="PangoGlyph"><type>PangoGlyph</type></link> ID <link linkend="PANGO-GLYPH-EMPTY--CAPS"><type>PANGO_GLYPH_EMPTY</type></link>, which
102 is guaranteed never to render. If the shaping fails for any reason,
103 the shaper should return with an empty (zero-size) glyph string.
104 If the shaper has not set the size on the glyph string yet, simply
105 returning signals the failure too.
106 </simpara></listitem>
109 <term><structfield>covers</structfield> ()</term>
110 <listitem><simpara> Returns the characters that this engine can cover
111 with a given font for a given language. If not overridden, the default
112 implementation simply returns the coverage information for the
113 font itself unmodified.
114 </simpara></listitem>
116 </variablelist></refsect2>
117 <refsect2 id="PANGO-ENGINE-TYPE-SHAPE--CAPS" role="macro">
118 <title>PANGO_ENGINE_TYPE_SHAPE</title>
119 <indexterm zone="PANGO-ENGINE-TYPE-SHAPE--CAPS"><primary sortas="PANGO_ENGINE_TYPE_SHAPE">PANGO_ENGINE_TYPE_SHAPE</primary></indexterm><programlisting>#define PANGO_ENGINE_TYPE_SHAPE "PangoEngineShape"
122 A string constant defining the engine type
124 These engines derive from <link linkend="PangoEngineShape"><type>PangoEngineShape</type></link>.
126 <refsect2 id="PANGO-ENGINE-SHAPE-DEFINE-TYPE--CAPS" role="macro">
127 <title>PANGO_ENGINE_SHAPE_DEFINE_TYPE()</title>
128 <indexterm zone="PANGO-ENGINE-SHAPE-DEFINE-TYPE--CAPS"><primary sortas="PANGO_ENGINE_SHAPE_DEFINE_TYPE">PANGO_ENGINE_SHAPE_DEFINE_TYPE</primary></indexterm><programlisting>#define PANGO_ENGINE_SHAPE_DEFINE_TYPE(name, prefix, class_init, instance_init)</programlisting>
130 Outputs the necessary code for GObject type registration for a
131 <link linkend="PangoEngineShape"><type>PangoEngineShape</type></link> class defined in a module. Two static symbols
136 static GType <replaceable>prefix</replaceable>_type;
137 static void <replaceable>prefix</replaceable>_register_type (GTypeModule module);
141 The <function><replaceable>prefix</replaceable><link linkend="register-type"><function>_register_type()</function></link></function>
142 function should be called in your <link linkend="script-engine-init"><function>script_engine_init()</function></link> function for
143 each type that your module implements, and then your <link linkend="script-engine-create"><function>script_engine_create()</function></link>
144 function can create instances of the object as follows:
147 <informalexample><programlisting>
148 PangoEngine *engine = g_object_new (<replaceable>prefix</replaceable>_type, NULL);
149 </programlisting></informalexample></para>
151 </para><variablelist role="params">
152 <varlistentry><term><parameter>name</parameter> :</term>
153 <listitem><simpara> Name of the the type to register (for example:, <literal>ArabicEngineFc</literal>
154 </simpara></listitem></varlistentry>
155 <varlistentry><term><parameter>prefix</parameter> :</term>
156 <listitem><simpara> Prefix for symbols that will be defined (for example:, <literal>arabic_engine_fc</literal>
157 </simpara></listitem></varlistentry>
158 <varlistentry><term><parameter>class_init</parameter> :</term>
159 <listitem><simpara> Class initialization function for the new type, or <link linkend="NULL--CAPS"><literal>NULL</literal></link>
160 </simpara></listitem></varlistentry>
161 <varlistentry><term><parameter>instance_init</parameter> :</term>
162 <listitem><simpara> Instance initialization function for the new type, or <link linkend="NULL--CAPS"><literal>NULL</literal></link>
163 </simpara></listitem></varlistentry>
164 </variablelist></refsect2>