<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Customizing font functions: HarfBuzz Manual</title>
-<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
+<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="index.html" title="HarfBuzz Manual">
<link rel="up" href="fonts-and-faces.html" title="Fonts, faces, and output">
<link rel="prev" href="fonts-and-faces.html" title="Fonts, faces, and output">
<link rel="next" href="fonts-and-faces-native-opentype.html" title="Font objects and HarfBuzz's native OpenType implementation">
-<meta name="generator" content="GTK-Doc V1.32.1 (XML mode)">
+<meta name="generator" content="GTK-Doc V1.32 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<code class="function">hb_font_get_glyph_from_name_func_t</code>: returns
the glyph index that corresponds to a given glyph name.
</p></li>
+<li class="listitem"><p>
+ <code class="function">hb_font_draw_glyph_func_t</code>: gets the outlines
+ of a glyph (by calling #hb_draw_funcs_t callbacks).
+ </p></li>
+<li class="listitem"><p>
+ <code class="function">hb_font_paint_glyph_func_t</code>: paints a glyph
+ (by calling #hb_paint_funcs_t callbacks).
+ </p></li>
</ul></div>
<p>
- You can fetch the font-functions configuration for a font object
- by calling <code class="function">hb_font_get_font_funcs()</code>:
+ You can create new font-functions by calling
+ <code class="function">hb_font_funcs_create()</code>:
</p>
<pre class="programlisting">
- hb_font_funcs_t *ffunctions;
- ffunctions = hb_font_get_font_funcs (font);
+ hb_font_funcs_t *ffunctions = hb_font_funcs_create ();
+ hb_font_set_funcs (font, ffunctions, font_data, destroy);
</pre>
<p>
- The individual methods can each be replaced with their own setter
+ The individual methods can each be set with their own setter
function, such as
- <code class="function">hb_font_funcs_set_nominal_glyph_func(*ffunctions,
- func, *user_data, destroy)</code>.
+ <code class="function">hb_font_funcs_set_nominal_glyph_func(ffunctions,
+ func, user_data, destroy)</code>.
</p>
<p>
Font-functions structures can be reused for multiple font
programs from changing the configuration and introducing
inconsistencies and errors downstream.
</p>
+<p>
+ To override only some functions while using the default implementation
+ for the others, you will need to create a sub-font. By default, the
+ sub-font uses the font functions of its parent except for the functions
+ that were explicitly set. The following code will override only the
+ <code class="function">hb_font_get_nominal_glyph_func_t</code> for the sub-font:
+ </p>
+<pre class="programlisting">
+ hb_font_t *subfont = hb_font_create_sub_font (font)
+ hb_font_funcs_t *ffunctions = hb_font_funcs_create ();
+ hb_font_funcs_set_nominal_glyph_func (ffunctions, func, user_data, destroy);
+ hb_font_set_funcs (subfont, ffunctions, font_data, destroy);
+ hb_font_funcs_destroy (ffunctions);
+ </pre>
</div>
<div class="footer">
-<hr>Generated by GTK-Doc V1.32.1</div>
+<hr>Generated by GTK-Doc V1.32</div>
</body>
</html>
\ No newline at end of file