1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <title>Getting started with HarfBuzz: 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="pt01.html" title="Part I. User's manual">
9 <link rel="prev" href="building.html" title="Building HarfBuzz">
10 <link rel="next" href="ch03s02.html" title="Terminology">
11 <meta name="generator" content="GTK-Doc V1.32.1 (XML mode)">
12 <link rel="stylesheet" href="style.css" type="text/css">
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="pt01.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
19 <td><a accesskey="p" href="building.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
20 <td><a accesskey="n" href="ch03s02.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
23 <div class="titlepage"><div><div><h2 class="title">
24 <a name="getting-started"></a>Getting started with HarfBuzz</h2></div></div></div>
25 <div class="toc"><dl class="toc">
26 <dt><span class="section"><a href="getting-started.html#id-1.2.4.2">An overview of the HarfBuzz shaping API</a></span></dt>
27 <dt><span class="section"><a href="ch03s02.html">Terminology</a></span></dt>
28 <dt><span class="section"><a href="ch03s03.html">A simple shaping example</a></span></dt>
31 <div class="titlepage"><div><div><h2 class="title" style="clear: both">
32 <a name="id-1.2.4.2"></a>An overview of the HarfBuzz shaping API</h2></div></div></div>
34 The core of the HarfBuzz shaping API is the function
35 <code class="function">hb_shape()</code>. This function takes a font, a
36 buffer containing a string of Unicode codepoints and
37 (optionally) a list of font features as its input. It replaces
38 the codepoints in the buffer with the corresponding glyphs from
39 the font, correctly ordered and positioned, and with any of the
40 optional font features applied.
43 In addition to holding the pre-shaping input (the Unicode
44 codepoints that comprise the input string) and the post-shaping
45 output (the glyphs and positions), a HarfBuzz buffer has several
46 properties that affect shaping. The most important are the
47 text-flow direction (e.g., left-to-right, right-to-left,
48 top-to-bottom, or bottom-to-top), the script tag, and the
52 For input string buffers, flags are available to denote when the
53 buffer represents the beginning or end of a paragraph, to
54 indicate whether or not to visibly render Unicode <code class="literal">Default
55 Ignorable</code> codepoints, and to modify the cluster-merging
56 behavior for the buffer. For shaped output buffers, the
57 individual X and Y offsets and <code class="literal">advances</code>
58 (the logical dimensions) of each glyph are
59 accessible. HarfBuzz also flags glyphs as
60 <code class="literal">UNSAFE_TO_BREAK</code> if breaking the string at
61 that glyph (e.g., in a line-breaking or hyphenation process)
62 would require re-shaping the text.
65 HarfBuzz also provides methods to compare the contents of
66 buffers, join buffers, normalize buffer contents, and handle
67 invalid codepoints, as well as to determine the state of a
68 buffer (e.g., input codepoints or output glyphs). Buffer
69 lifecycles are managed and all buffers are reference-counted.
72 Although the default <code class="function">hb_shape()</code> function is
73 sufficient for most use cases, a variant is also provide that
74 lets you specify which of HarfBuzz's shapers to use on a buffer.
77 HarfBuzz can read TrueType fonts, TrueType collections, OpenType
78 fonts, and OpenType collections. Functions are provided to query
79 font objects about metrics, Unicode coverage, available tables and
80 features, and variation selectors. Individual glyphs can also be
81 queried for metrics, variations, and glyph names. OpenType
82 variable fonts are supported, and HarfBuzz allows you to set
83 variation-axis coordinates on font objects.
86 HarfBuzz provides glue code to integrate with various other
87 libraries, including FreeType, GObject, and CoreText. Support
88 for integrating with Uniscribe and DirectWrite is experimental
94 <hr>Generated by GTK-Doc V1.32.1</div>