Imported Upstream version 1.7.6
[platform/upstream/harfbuzz.git] / docs / html / level-2.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>Level 2: 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="clusters.html" title="">
9 <link rel="prev" href="the-distinction-between-levels-0-and-1.html" title="The distinction between levels 0 and 1">
10 <link rel="next" href="shaping-and-shape-plans.html" title="Shaping and shape plans">
11 <meta name="generator" content="GTK-Doc V1.27.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="clusters.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
19 <td><a accesskey="p" href="the-distinction-between-levels-0-and-1.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="sect1">
23 <div class="titlepage"><div><div><h2 class="title" style="clear: both">
24 <a name="level-2"></a>Level 2</h2></div></div></div>
25 <p>
26     Level 2 is a different beast from levels 0 and 1. It is simple to
27     describe, but hard to make sense of. It simply doesn't do any
28     cluster merging whatsoever. When things ligate or otherwise multiple
29     glyphs turn into one, the cluster value of the first glyph is
30     retained.
31   </p>
32 <p>
33     Here are a few examples of why processing cluster values produced at
34     this level might be tricky:
35   </p>
36 <div class="sect2">
37 <div class="titlepage"><div><div><h3 class="title">
38 <a name="ligatures-with-combining-marks"></a>Ligatures with combining marks</h3></div></div></div>
39 <p>
40       Imagine capital letters are bases and lower case letters are
41       combining marks. With an input sequence like this:
42     </p>
43 <pre class="programlisting">
44   A,a,B,b,C,c
45   0,1,2,3,4,5
46 </pre>
47 <p>
48       if <code class="literal">A,B,C</code> ligate, then here are the cluster
49       values one would get under the various levels:
50     </p>
51 <p>
52       level 0:
53     </p>
54 <pre class="programlisting">
55   ABC,a,b,c
56   0  ,0,0,0
57 </pre>
58 <p>
59       level 1:
60     </p>
61 <pre class="programlisting">
62   ABC,a,b,c
63   0  ,0,0,5
64 </pre>
65 <p>
66       level 2:
67     </p>
68 <pre class="programlisting">
69   ABC,a,b,c
70   0  ,1,3,5
71 </pre>
72 <p>
73       Making sense of the last example is the hardest for a client,
74       because there is nothing in the cluster values to suggest that
75       <code class="literal">B</code> and <code class="literal">C</code> ligated with
76       <code class="literal">A</code>.
77     </p>
78 </div>
79 <div class="sect2">
80 <div class="titlepage"><div><div><h3 class="title">
81 <a name="reordering"></a>Reordering</h3></div></div></div>
82 <p>
83       Another tricky case is when things reorder. Under level 2:
84     </p>
85 <pre class="programlisting">
86   A,B,C,D,E
87   0,1,2,3,4
88 </pre>
89 <p>
90       Now imagine <code class="literal">D</code> moves before
91       <code class="literal">B</code>:
92     </p>
93 <pre class="programlisting">
94   A,D,B,C,E
95   0,3,1,2,4
96 </pre>
97 <p>
98       Now, if <code class="literal">D</code> ligates with <code class="literal">B</code>, we
99       get:
100     </p>
101 <pre class="programlisting">
102   A,DB,C,E
103   0,3 ,2,4
104 </pre>
105 <p>
106       In a different scenario, <code class="literal">A</code> and
107       <code class="literal">B</code> could have ligated
108       <span class="emphasis"><em>before</em></span> <code class="literal">D</code> reordered; that
109       would have resulted in:
110     </p>
111 <pre class="programlisting">
112   AB,D,C,E
113   0 ,3,2,4   
114 </pre>
115 <p>
116       There's no way to differentiate between these two scenarios based
117       on the cluster numbers alone.
118     </p>
119 <p>
120       Another problem happens with ligatures under level 2 if the
121       direction of the text is forced to opposite of its natural
122       direction (e.g. left-to-right Arabic). But that's too much of a
123       corner case to worry about.
124     </p>
125 </div>
126 </div>
127 <div class="footer">
128 <hr>Generated by GTK-Doc V1.27.1</div>
129 </body>
130 </html>