Blob Blame History Raw
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Level 2: 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="the-distinction-between-levels-0-and-1.html" title="The distinction between levels 0 and 1">
<link rel="next" href="shaping-and-shape-plans.html" title="Shaping and shape plans">
<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="the-distinction-between-levels-0-and-1.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="shaping-and-shape-plans.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="level-2"></a>Level 2</h2></div></div></div>
<p>
    Level 2 is a different beast from levels 0 and 1. It is simple to
    describe, but hard to make sense of. It simply doesn't do any
    cluster merging whatsoever. When things ligate or otherwise multiple
    glyphs turn into one, the cluster value of the first glyph is
    retained.
  </p>
<p>
    Here are a few examples of why processing cluster values produced at
    this level might be tricky:
  </p>
<div class="sect2">
<div class="titlepage"><div><div><h3 class="title">
<a name="ligatures-with-combining-marks"></a>Ligatures with combining marks</h3></div></div></div>
<p>
      Imagine capital letters are bases and lower case letters are
      combining marks. With an input sequence like this:
    </p>
<pre class="programlisting">
  A,a,B,b,C,c
  0,1,2,3,4,5
</pre>
<p>
      if <code class="literal">A,B,C</code> ligate, then here are the cluster
      values one would get under the various levels:
    </p>
<p>
      level 0:
    </p>
<pre class="programlisting">
  ABC,a,b,c
  0  ,0,0,0
</pre>
<p>
      level 1:
    </p>
<pre class="programlisting">
  ABC,a,b,c
  0  ,0,0,5
</pre>
<p>
      level 2:
    </p>
<pre class="programlisting">
  ABC,a,b,c
  0  ,1,3,5
</pre>
<p>
      Making sense of the last example is the hardest for a client,
      because there is nothing in the cluster values to suggest that
      <code class="literal">B</code> and <code class="literal">C</code> ligated with
      <code class="literal">A</code>.
    </p>
</div>
<div class="sect2">
<div class="titlepage"><div><div><h3 class="title">
<a name="reordering"></a>Reordering</h3></div></div></div>
<p>
      Another tricky case is when things reorder. Under level 2:
    </p>
<pre class="programlisting">
  A,B,C,D,E
  0,1,2,3,4
</pre>
<p>
      Now imagine <code class="literal">D</code> moves before
      <code class="literal">B</code>:
    </p>
<pre class="programlisting">
  A,D,B,C,E
  0,3,1,2,4
</pre>
<p>
      Now, if <code class="literal">D</code> ligates with <code class="literal">B</code>, we
      get:
    </p>
<pre class="programlisting">
  A,DB,C,E
  0,3 ,2,4
</pre>
<p>
      In a different scenario, <code class="literal">A</code> and
      <code class="literal">B</code> could have ligated
      <span class="emphasis"><em>before</em></span> <code class="literal">D</code> reordered; that
      would have resulted in:
    </p>
<pre class="programlisting">
  AB,D,C,E
  0 ,3,2,4   
</pre>
<p>
      There's no way to differentitate between these two scenarios based
      on the cluster numbers alone.
    </p>
<p>
      Another problem appens with ligatures under level 2 if the
      direction of the text is forced to opposite of its natural
      direction (e.g. left-to-right Arabic). But that's too much of a
      corner case to worry about.
    </p>
</div>
</div>
<div class="footer">
<hr>Generated by GTK-Doc V1.25.1</div>
</body>
</html>