<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>A clustering example for levels 0 and 1: HarfBuzz Manual</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
<link rel="home" href="index.html" title="HarfBuzz Manual">
<link rel="up" href="clusters.html" title="">
<link rel="prev" href="clusters.html" title="">
<link rel="next" href="reordering-in-levels-0-and-1.html" title="Reordering in levels 0 and 1">
<meta name="generator" content="GTK-Doc V1.25.1 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
<td width="100%" align="left" class="shortcuts"></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
<td><a accesskey="u" href="clusters.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
<td><a accesskey="p" href="clusters.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="reordering-in-levels-0-and-1.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
</tr></table>
<div class="sect1">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="a-clustering-example-for-levels-0-and-1"></a>A clustering example for levels 0 and 1</h2></div></div></div>
<p>
Let's say we start with the following character sequence and cluster
values:
</p>
<pre class="programlisting">
A,B,C,D,E
0,1,2,3,4
</pre>
<p>
We then map the characters to glyphs. For simplicity, let's assume
that each character maps to the corresponding, identical-looking
glyph:
</p>
<pre class="programlisting">
A,B,C,D,E
0,1,2,3,4
</pre>
<p>
Now if, for example, <code class="literal">B</code> and <code class="literal">C</code>
ligate, then the clusters to which they belong "merge".
This merged cluster takes for its cluster number the minimum of all
the cluster numbers of the clusters that went in. In this case, we
get:
</p>
<pre class="programlisting">
A,BC,D,E
0,1 ,3,4
</pre>
<p>
Now let's assume that the <code class="literal">BC</code> glyph decomposes
into three components, and <code class="literal">D</code> also decomposes into
two. The components each inherit the cluster value of their parent:
</p>
<pre class="programlisting">
A,BC0,BC1,BC2,D0,D1,E
0,1 ,1 ,1 ,3 ,3 ,4
</pre>
<p>
Now if <code class="literal">BC2</code> and <code class="literal">D0</code> ligate, then
their clusters (numbers 1 and 3) merge into
<code class="literal">min(1,3) = 1</code>:
</p>
<pre class="programlisting">
A,BC0,BC1,BC2D0,D1,E
0,1 ,1 ,1 ,1 ,4
</pre>
<p>
At this point, cluster 1 means: the character sequence
<code class="literal">BCD</code> is represented by glyphs
<code class="literal">BC0,BC1,BC2D0,D1</code> and cannot be broken down any
further.
</p>
</div>
<div class="footer">
<hr>Generated by GTK-Doc V1.25.1</div>
</body>
</html>