Imported Upstream version 8.2.2
[platform/upstream/harfbuzz.git] / docs / html / glyphs-and-rendering.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <html>
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <title>Glyphs and rendering: HarfBuzz Manual</title>
6 <meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
7 <link rel="home" href="index.html" title="HarfBuzz Manual">
8 <link rel="up" href="fonts-and-faces.html" title="Fonts, faces, and output">
9 <link rel="prev" href="fonts-and-faces-variable.html" title="Working with OpenType Variable Fonts">
10 <link rel="next" href="shaping-and-shape-plans.html" title="Shaping and shape plans">
11 <meta name="generator" content="GTK-Doc V1.32 (XML mode)">
12 <link rel="stylesheet" href="style.css" type="text/css">
13 </head>
14 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
15 <table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
16 <td width="100%" align="left" class="shortcuts"></td>
17 <td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
18 <td><a accesskey="u" href="fonts-and-faces.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
19 <td><a accesskey="p" href="fonts-and-faces-variable.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
20 <td><a accesskey="n" href="shaping-and-shape-plans.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
21 </tr></table>
22 <div class="section">
23 <div class="titlepage"><div><div><h2 class="title" style="clear: both">
24 <a name="glyphs-and-rendering"></a>Glyphs and rendering</h2></div></div></div>
25 <p>
26       The main purpose of HarfBuzz is shaping, which creates a list of positioned
27       glyphs as output. The remaining task for text layout is to convert this list
28       into rendered output. While HarfBuzz does not handle rasterization of glyphs
29       per se, it does have APIs that provide access to the font data that is needed
30       to perform this task.
31     </p>
32 <p>
33       Traditionally, the shapes of glyphs in scalable fonts are provided as quadratic
34       or cubic BeziĆ©r curves defining outlines to be filled. To obtain the outlines
35       for a glyph, call <code class="function">hb_font_draw_glyph()</code> and pass a
36       <span class="type">hb_draw_funcs_t</span> struct. The callbacks in that struct will be called
37       for each segment of the outline. Note that this API provides access to outlines
38       as they are defined in the font, without applying hinting to fit the curves
39       to the pixel grid.
40     </p>
41 <p>
42       Fonts may provide pre-rendered images for glyphs instead of or in addition to
43       outlines. This is most common for fonts that contain colored glyphs, such as
44       Emoji. To access these images, use <code class="function">hb_ot_color_reference_png()</code>
45       or <code class="function">hb_ot_color_reference_svg()</code>.
46     </p>
47 <p>
48       Another way in which fonts provide colored glyphs is via paint graphs that
49       combine glyph outlines with gradients and allow for transformations and
50       compositing. In its simplest form, this can be presented as a series of
51       layers that are rendered on top of each other, each with its own color.
52       HarfBuzz has the <code class="function">hb_ot_color_glyph_get_layers()</code> to
53       access glyph data in this form.
54     </p>
55 <p>
56       In the general case, you have to use <code class="function">hb_font_paint_glyph()</code>
57       and pass a <span class="type">hb_paint_funcs_t</span> struct with callbacks to obtain paint
58       graphs for glyphs that have them. The <code class="function">hb_font_paint_glyph()</code>
59       API can handle outline and image glyphs as well, so it provides a unified API for
60       access to glyph rendering information.
61     </p>
62 </div>
63 <div class="footer">
64 <hr>Generated by GTK-Doc V1.32</div>
65 </body>
66 </html>