PATH:
usr
/
share
/
gtk-doc
/
html
/
harfbuzz
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>The distinction between levels 0 and 1: HarfBuzz Manual</title> <meta name="generator" content="DocBook XSL Stylesheets V1.79.1"> <link rel="home" href="index.html" title="HarfBuzz Manual"> <link rel="up" href="clusters.html" title=""> <link rel="prev" href="reordering-in-levels-0-and-1.html" title="Reordering in levels 0 and 1"> <link rel="next" href="level-2.html" title="Level 2"> <meta name="generator" content="GTK-Doc V1.27.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="reordering-in-levels-0-and-1.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td> <td><a accesskey="n" href="level-2.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="the-distinction-between-levels-0-and-1"></a>The distinction between levels 0 and 1</h2></div></div></div> <p> So, the above is pretty much what cluster levels 0 and 1 do. The only difference between the two is this: in level 0, at the very beginning of the shaping process, we also merge clusters between base characters and all Unicode marks (combining or not) following them. E.g.: </p> <pre class="programlisting"> A,acute,B 0,1 ,2 </pre> <p> will become: </p> <pre class="programlisting"> A,acute,B 0,0 ,2 </pre> <p> This is the default behavior. We do it because Windows did it and old HarfBuzz did it, so this remained the default. But this behavior makes it impossible to color diacritic marks differently from their base characters. That's why in level 1 we do not perform this initial merging step. </p> <p> For clients, level 0 is more convenient if they rely on HarfBuzz clusters for cursor positioning. But that's wrong anyway: cursor positions should be determined based on Unicode grapheme boundaries, NOT shaping clusters. As such, level 1 clusters are preferred. </p> <p> One last note about levels 0 and 1. We currently don't allow a <code class="literal">MultipleSubst</code> lookup to replace a glyph with zero glyphs (i.e., to delete a glyph). But in some other situations, glyphs can be deleted. In those cases, if the glyph being deleted is the last glyph of its cluster, we make sure to merge the cluster with a neighboring cluster. </p> <p> This is, primarily, to make sure that the starting cluster of the text always has the cluster index pointing to the start of the text for the run; more than one client currently relies on this guarantee. </p> <p> Incidentally, Apple's CoreText does something else to maintain the same promise: it inserts a glyph with id 65535 at the beginning of the glyph string if the glyph corresponding to the first character in the run was deleted. HarfBuzz might do something similar in the future. </p> </div> <div class="footer"> <hr>Generated by GTK-Doc V1.27.1</div> </body> </html>
[-] api-index-0-9-39.html
[edit]
[-] api-index-0-9-10.html
[edit]
[-] harfbuzz-Buffers.html
[edit]
[-] harfbuzz-hb-shape-plan.html
[edit]
[-] harfbuzz-hb-ot-shape.html
[edit]
[-] reordering-in-levels-0-and-1.html
[edit]
[-] harfbuzz-hb-gobject.html
[edit]
[-] harfbuzz-hb-deprecated.html
[edit]
[-] up-insensitive.png
[edit]
[-] harfbuzz-hb-unicode.html
[edit]
[-] harfbuzz-hb-coretext.html
[edit]
[-] home.png
[edit]
[-] the-distinction-between-levels-0-and-1.html
[edit]
[+]
..
[-] harfbuzz-hb-ot-math.html
[edit]
[-] annotation-glossary.html
[edit]
[-] right-insensitive.png
[edit]
[-] left-insensitive.png
[edit]
[-] harfbuzz-hb-ot-layout.html
[edit]
[-] harfbuzz-hb-version.html
[edit]
[-] harfbuzz-hb-blob.html
[edit]
[-] api-index-1-1-3.html
[edit]
[-] up.png
[edit]
[-] api-index-1-2-3.html
[edit]
[-] why-is-it-called-harfbuzz.html
[edit]
[-] buffers-language-script-and-direction.html
[edit]
[-] right.png
[edit]
[-] what-about-the-other-scripts.html
[edit]
[-] api-index-0-9-31.html
[edit]
[-] deprecated-api-index.html
[edit]
[-] harfbuzz-hb-common.html
[edit]
[-] api-index-1-4-3.html
[edit]
[-] harfbuzz-hb-font.html
[edit]
[-] index.html
[edit]
[-] object-tree.html
[edit]
[-] harfbuzz-hb-icu.html
[edit]
[-] api-index-1-0-5.html
[edit]
[-] harfbuzz-hb-ot-font.html
[edit]
[-] api-index-full.html
[edit]
[-] using-your-own-font-functions.html
[edit]
[-] api-index-0-9-42.html
[edit]
[-] setting-buffer-properties.html
[edit]
[-] api-index-0-9-5.html
[edit]
[-] api-index-0-9-38.html
[edit]
[-] a-clustering-example-for-levels-0-and-1.html
[edit]
[-] harfbuzz-hb-glib.html
[edit]
[-] HarfBuzz.png
[edit]
[-] api-index-0-9-2.html
[edit]
[-] style.css
[edit]
[-] api-index-0-9-41.html
[edit]
[-] ch08.html
[edit]
[-] install-harfbuzz.html
[edit]
[-] pt02.html
[edit]
[-] api-index-0-9-28.html
[edit]
[-] adding-text-to-the-buffer.html
[edit]
[-] harfbuzz-hb-ot-tag.html
[edit]
[-] level-2.html
[edit]
[-] fonts-and-faces.html
[edit]
[-] api-index-0-9-8.html
[edit]
[-] harfbuzz-hb-graphite2.html
[edit]
[-] api-index-0-9-30.html
[edit]
[-] api-index-1-1-2.html
[edit]
[-] harfbuzz-hb-face.html
[edit]
[-] building.html
[edit]
[-] clusters.html
[edit]
[-] harfbuzz-hb-ft.html
[edit]
[-] api-index-0-9-11.html
[edit]
[-] hello-harfbuzz.html
[edit]
[-] api-index-0-9-20.html
[edit]
[-] api-index-1-6-0.html
[edit]
[-] plans-and-caching.html
[edit]
[-] api-index-1-5-0.html
[edit]
[-] pt01.html
[edit]
[-] api-index-1-4-2.html
[edit]
[-] harfbuzz-hb-set.html
[edit]
[-] left.png
[edit]
[-] api-index-0-9-7.html
[edit]
[-] harfbuzz.devhelp2
[edit]
[-] what-is-harfbuzz.html
[edit]
[-] harfbuzz-Shaping.html
[edit]
[-] HarfBuzz.svg
[edit]
[-] harfbuzz-hb-uniscribe.html
[edit]
[-] harfbuzz-hb-ot.html
[edit]
[-] api-index-1-3-3.html
[edit]
[-] api-index-0-9-22.html
[edit]
[-] customizing-unicode-functions.html
[edit]
[-] using-harfbuzzs-native-opentype-implementation.html
[edit]
[-] harfbuzz-hb.html
[edit]
[-] shaping-and-shape-plans.html
[edit]