|
Packit |
874993 |
|
|
Packit |
874993 |
<html>
|
|
Packit |
874993 |
<head>
|
|
Packit |
874993 |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
|
Packit |
874993 |
<title>: HarfBuzz Manual</title>
|
|
Packit |
874993 |
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
|
|
Packit |
874993 |
<link rel="home" href="index.html" title="HarfBuzz Manual">
|
|
Packit |
874993 |
<link rel="up" href="pt01.html" title="Part I. User's manual">
|
|
Packit |
874993 |
<link rel="prev" href="using-your-own-font-functions.html" title="Using your own font functions">
|
|
Packit |
874993 |
<link rel="next" href="a-clustering-example-for-levels-0-and-1.html" title="A clustering example for levels 0 and 1">
|
|
Packit |
874993 |
<meta name="generator" content="GTK-Doc V1.25.1 (XML mode)">
|
|
Packit |
874993 |
<link rel="stylesheet" href="style.css" type="text/css">
|
|
Packit |
874993 |
</head>
|
|
Packit |
874993 |
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
|
Packit |
874993 |
|
|
Packit |
874993 |
|
|
Packit |
874993 |
|
|
Packit |
874993 |
|
|
Packit |
874993 |
|
|
Packit |
874993 |
|
|
Packit |
874993 |
|
|
Packit |
874993 |
|
|
Packit |
874993 |
|
|
Packit |
874993 |
|
|
Packit |
874993 |
Clusters
|
|
Packit |
874993 |
A clustering example for levels 0 and 1
|
|
Packit |
874993 |
Reordering in levels 0 and 1
|
|
Packit |
874993 |
The distinction between levels 0 and 1
|
|
Packit |
874993 |
Level 2
|
|
Packit |
874993 |
|
|
Packit |
874993 |
Ligatures with combining marks
|
|
Packit |
874993 |
Reordering
|
|
Packit |
874993 |
|
|
Packit |
874993 |
|
|
Packit |
874993 |
|
|
Packit |
874993 |
|
|
Packit |
874993 |
Clusters
|
|
Packit |
874993 |
|
|
Packit |
874993 |
In shaping text, a cluster is a sequence of
|
|
Packit |
874993 |
code points that needs to be treated as a single, indivisible unit.
|
|
Packit |
874993 |
|
|
Packit |
874993 |
|
|
Packit |
874993 |
When you add text to a HB buffer, each character is associated with
|
|
Packit |
874993 |
a cluster value. This is an arbitrary number as
|
|
Packit |
874993 |
far as HB is concerned.
|
|
Packit |
874993 |
|
|
Packit |
874993 |
|
|
Packit |
874993 |
Most clients will use UTF-8, UTF-16, or UTF-32 indices, but the
|
|
Packit |
874993 |
actual number does not matter. Moreover, it is not required for the
|
|
Packit |
874993 |
cluster values to be monotonically increasing, but pretty much all
|
|
Packit |
874993 |
of HB's tests are performed on monotonically increasing cluster
|
|
Packit |
874993 |
numbers. Nevertheless, there is no such assumption in the code
|
|
Packit |
874993 |
itself. With that in mind, let's examine what happens with cluster
|
|
Packit |
874993 |
values during shaping under each cluster-level.
|
|
Packit |
874993 |
|
|
Packit |
874993 |
|
|
Packit |
874993 |
HarfBuzz provides three levels of clustering
|
|
Packit |
874993 |
support. Level 0 is the default behavior and reproduces the behavior
|
|
Packit |
874993 |
of the old HarfBuzz library. Level 1 tweaks this behavior slightly
|
|
Packit |
874993 |
to produce better results, so level 1 clustering is recommended for
|
|
Packit |
874993 |
code that is not required to implement backward compatibility with
|
|
Packit |
874993 |
the old HarfBuzz.
|
|
Packit |
874993 |
|
|
Packit |
874993 |
|
|
Packit |
874993 |
Level 2 differs significantly in how it treats cluster values.
|
|
Packit |
874993 |
Levels 0 and 1 both process ligatures and glyph decomposition by
|
|
Packit |
874993 |
merging clusters; level 2 does not.
|
|
Packit |
874993 |
|
|
Packit |
874993 |
|
|
Packit |
874993 |
The conceptual model for what the cluster values mean, in levels 0
|
|
Packit |
874993 |
and 1, is this:
|
|
Packit |
874993 |
|
|
Packit |
874993 |
|
|
Packit |
874993 |
|
|
Packit |
874993 |
the sequence of cluster values will always remain monotone
|
|
Packit |
874993 |
|
|
Packit |
874993 |
|
|
Packit |
874993 |
each value represents a single cluster
|
|
Packit |
874993 |
|
|
Packit |
874993 |
|
|
Packit |
874993 |
each cluster contains one or more glyphs and one or more
|
|
Packit |
874993 |
characters
|
|
Packit |
874993 |
|
|
Packit |
874993 |
|
|
Packit |
874993 |
|
|
Packit |
874993 |
Assuming that initial cluster numbers were monotonically increasing
|
|
Packit |
874993 |
and distinct, then all adjacent glyphs having the same cluster
|
|
Packit |
874993 |
number belong to the same cluster, and all characters belong to the
|
|
Packit |
874993 |
cluster that has the highest number not larger than their initial
|
|
Packit |
874993 |
cluster number. This will become clearer with an example.
|
|
Packit |
874993 |
|
|
Packit |
874993 |
|
|
Packit |
874993 |
|
|
Packit |
874993 |
|
|
Packit |
874993 |
Generated by GTK-Doc V1.25.1
|
|
Packit |
874993 |
</body>
|
|
Packit |
874993 |
</html>
|