Imported Upstream version 2.6.7
[platform/upstream/harfbuzz.git] / docs / html / fonts-and-faces-native-opentype.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>Font objects and HarfBuzz's native OpenType implementation: HarfBuzz Manual</title>
6 <meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
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-custom-functions.html" title="Customizing font functions">
10 <link rel="next" href="fonts-and-faces-variable.html" title="Working with OpenType Variable Fonts">
11 <meta name="generator" content="GTK-Doc V1.32.1 (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-custom-functions.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
20 <td><a accesskey="n" href="fonts-and-faces-variable.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="fonts-and-faces-native-opentype"></a>Font objects and HarfBuzz's native OpenType implementation</h2></div></div></div>
25 <p>
26       By default, whenever HarfBuzz creates a font object, it will
27       configure the font to use a built-in set of font functions that
28       supports contemporary OpenType font internals. If you want to
29       work with OpenType or TrueType fonts, you should be able to use
30       these functions without difficulty.
31     </p>
32 <p>
33       Many of the methods in the font-functions structure deal with
34       the fundamental properties of glyphs that are required for
35       shaping text: extents (the maximums and minimums on each axis),
36       origins (the <code class="literal">(0,0)</code> coordinate point which
37       glyphs are drawn in reference to), and advances (the amount that
38       the cursor needs to be moved after drawing each glyph, including
39       any empty space for the glyph's side bearings).
40     </p>
41 <p>
42       As you can see in the list of functions, there are separate "horizontal"
43       and "vertical" variants depending on whether the text is set in
44       the horizontal or vertical direction. For some scripts, fonts
45       that are designed to support text set horizontally or vertically (for
46       example, in Japanese) may include metrics for both text
47       directions. When fonts don't include this information, HarfBuzz
48       does its best to transform what the font provides.
49     </p>
50 <p>
51       In addition to the direction-specific functions, HarfBuzz
52       provides some higher-level functions for fetching information
53       like extents and advances for a glyph. If you call
54     </p>
55 <pre class="programlisting">
56       hb_font_get_glyph_advance_for_direction(font, direction, extents);
57     </pre>
58 <p>
59       then you can provide any <span class="type">hb_direction_t</span> as the
60       <em class="parameter"><code>direction</code></em> parameter, and HarfBuzz will
61       use the correct function variant for the text direction. There
62       are similar higher-level versions of the functions for fetching
63       extents, origin coordinates, and contour-point
64       coordinates. There are also addition and subtraction functions
65       for moving points with respect to the origin.
66     </p>
67 <p>
68       There are also methods for fetching the glyph ID that
69       corresponds to a Unicode code point (possibly when followed by a
70       variation-selector code point), fetching the glyph name from the
71       font, and fetching the glyph ID that corresponds to a glyph name
72       you already have.
73     </p>
74 <p>
75       HarfBuzz also provides functions for converting between glyph
76       names and string
77       variables. <code class="function">hb_font_glyph_to_string(font, glyph, s,
78       size)</code> retrieves the name for the glyph ID
79       <em class="parameter"><code>glyph</code></em> from the font object. It generates a
80       generic name of the form <code class="literal">gidDDD</code> (where DDD is
81       the glyph index) if there is no name for the glyph in the
82       font. The <code class="function">hb_font_glyph_from_string(font, s, len,
83       glyph)</code> takes an input string <em class="parameter"><code>s</code></em>
84       and looks for a glyph with that name in the font, returning its
85       glyph ID in the <em class="parameter"><code>glyph</code></em>
86       output parameter. It automatically parses
87       <code class="literal">gidDDD</code> and <code class="literal">uniUUUU</code> strings.
88     </p>
89 </div>
90 <div class="footer">
91 <hr>Generated by GTK-Doc V1.32.1</div>
92 </body>
93 </html>