Imported Upstream version 2.3.1
[platform/upstream/harfbuzz.git] / docs / html / what-is-harfbuzz.html
index aff2f7d..a3eb0a2 100644 (file)
@@ -7,8 +7,8 @@
 <link rel="home" href="index.html" title="HarfBuzz Manual">
 <link rel="up" href="pt01.html" title="Part I. User's manual">
 <link rel="prev" href="pt01.html" title="Part I. User's manual">
-<link rel="next" href="why-is-it-called-harfbuzz.html" title="Why is it called HarfBuzz?">
-<meta name="generator" content="GTK-Doc V1.27.1 (XML mode)">
+<link rel="next" href="why-do-i-need-a-shaping-engine.html" title="Why do I need a shaping engine?">
+<meta name="generator" content="GTK-Doc V1.25 (XML mode)">
 <link rel="stylesheet" href="style.css" type="text/css">
 </head>
 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
 <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="pt01.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
 <td><a accesskey="p" href="pt01.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
-<td><a accesskey="n" href="why-is-it-called-harfbuzz.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
+<td><a accesskey="n" href="why-do-i-need-a-shaping-engine.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
 </tr></table>
 <div class="chapter">
 <div class="titlepage"><div><div><h2 class="title">
 <a name="what-is-harfbuzz"></a>What is HarfBuzz?</h2></div></div></div>
 <div class="toc"><dl class="toc">
-<dt><span class="section"><a href="what-is-harfbuzz.html#why-do-i-need-it">Why do I need it?</a></span></dt>
+<dt><span class="section"><a href="what-is-harfbuzz.html#what-is-text-shaping">What is text shaping?</a></span></dt>
+<dt><span class="section"><a href="why-do-i-need-a-shaping-engine.html">Why do I need a shaping engine?</a></span></dt>
+<dt><span class="section"><a href="ch01s03.html">What does HarfBuzz do?</a></span></dt>
+<dt><span class="section"><a href="what-harfbuzz-doesnt-do.html">What HarfBuzz doesn't do</a></span></dt>
 <dt><span class="section"><a href="why-is-it-called-harfbuzz.html">Why is it called HarfBuzz?</a></span></dt>
 </dl></div>
 <p>
-    HarfBuzz is a <span class="emphasis"><em>text shaping engine</em></span>. It solves
-    the problem of selecting and positioning glyphs from a font given a
-    Unicode string.
+    HarfBuzz is a <span class="emphasis"><em>text-shaping engine</em></span>. If you
+    give HarfBuzz a font and a string containing a sequence of Unicode
+    codepoints, HarfBuzz selects and positions the corresponding
+    glyphs from the font, applying all of the necessary layout rules
+    and font features. HarfBuzz then returns the string to you in the
+    form that is correctly arranged for the language and writing
+    system. 
+  </p>
+<p>
+    HarfBuzz can properly shape all of the world's major writing
+    systems. It runs on all major operating systems and software
+    platforms and it supports the major font formats in use
+    today.
   </p>
 <div class="section">
 <div class="titlepage"><div><div><h2 class="title" style="clear: both">
-<a name="why-do-i-need-it"></a>Why do I need it?</h2></div></div></div>
+<a name="what-is-text-shaping"></a>What is text shaping?</h2></div></div></div>
+<p>
+      Text shaping is the process of translating a string of character
+      codes (such as Unicode codepoints) into a properly arranged
+      sequence of glyphs that can be rendered onto a screen or into
+      final output form for inclusion in a document.
+    </p>
+<p>
+      The shaping process is dependent on the input string, the active
+      font, the script (or writing system) that the string is in, and
+      the language that the string is in.
+    </p>
+<p>
+      Modern software systems generally only deal with strings in the
+      Unicode encoding scheme (although legacy systems and documents may
+      involve other encodings).
+    </p>
+<p>
+      There are several font formats that a program might
+      encounter, each of which has a set of standard text-shaping
+      rules.
+    </p>
+<p>The dominant format is <a class="ulink" href="http://www.microsoft.com/typography/otspec/" target="_top">OpenType</a>. The
+    OpenType specification defines a series of <a class="ulink" href="https://github.com/n8willis/opentype-shaping-documents" target="_top">shaping models</a> for
+    various scripts from around the world. These shaping models depend on
+    the font incorporating certain features as
+    <span class="emphasis"><em>lookups</em></span> in its <code class="literal">GSUB</code> 
+    and <code class="literal">GPOS</code> tables.
+    </p>
 <p>
-      Text shaping is an integral part of preparing text for display. It
-      is a fairly low level operation; HarfBuzz is used directly by
-      graphic rendering libraries such as Pango, and the layout engines
-      in Firefox, LibreOffice and Chromium. Unless you are
-      <span class="emphasis"><em>writing</em></span> one of these layout engines yourself,
-      you will probably not need to use HarfBuzz - normally higher level
-      libraries will turn text into glyphs for you.
+      Alternatively, OpenType fonts can include shaping features for
+      the <a class="ulink" href="https://graphite.sil.org/" target="_top">Graphite</a> shaping model.
     </p>
 <p>
-      However, if you <span class="emphasis"><em>are</em></span> writing a layout engine
-      or graphics library yourself, you will need to perform text
-      shaping, and this is where HarfBuzz can help you. Here are some
-      reasons why you need it:
+      TrueType fonts can also include OpenType shaping
+      features. Alternatively, TrueType fonts can also include <a class="ulink" href="https://developer.apple.com/fonts/TrueType-Reference-Manual/RM09/AppendixF.html" target="_top">Apple
+      Advanced Typography</a> (AAT) tables to implement shaping
+      support. AAT fonts are generally only found on macOS and iOS systems.
     </p>
-<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
-<li class="listitem"><p>
-          OpenType fonts contain a set of glyphs, indexed by glyph ID.
-          The glyph ID within the font does not necessarily relate to a
-          Unicode codepoint. For instance, some fonts have the letter
-          "a" as glyph ID 1. To pull the right glyph out of
-          the font in order to display it, you need to consult a table
-          within the font (the "cmap" table) which maps
-          Unicode codepoints to glyph IDs. Text shaping turns codepoints
-          into glyph IDs.
-        </p></li>
-<li class="listitem"><p>
-          Many OpenType fonts contain ligatures: combinations of
-          characters which are rendered together. For instance, it's
-          common for the <code class="literal">fi</code> combination to appear in
-          print as the single ligature "fi". Whether you should
-          render text as <code class="literal">fi</code> or "fi" does not
-          depend on the input text, but on the capabilities of the font
-          and the level of ligature application you wish to perform.
-          Text shaping involves querying the font's ligature tables and
-          determining what substitutions should be made.
-        </p></li>
-<li class="listitem"><p>
-          While ligatures like "fi" are typographic
-          refinements, some languages <span class="emphasis"><em>require</em></span> such
-          substitutions to be made in order to display text correctly.
-          In Tamil, when the letter "TTA" (ட) letter is
-          followed by "U" (உ), the combination should appear
-          as the single glyph "டு". The sequence of Unicode
-          characters "டஉ" needs to be rendered as a single
-          glyph from the font - text shaping chooses the correct glyph
-          from the sequence of characters provided.
-        </p></li>
-<li class="listitem"><p>
-          Similarly, each Arabic character has four different variants:
-          within a font, there will be glyphs for the initial, medial,
-          final, and isolated forms of each letter. Unicode only encodes
-          one codepoint per character, and so a Unicode string will not
-          tell you which glyph to use. Text shaping chooses the correct
-          form of the letter and returns the correct glyph from the font
-          that you need to render.
-        </p></li>
-<li class="listitem"><p>
-          Other languages have marks and accents which need to be
-          rendered in certain positions around a base character. For
-          instance, the Moldovan language has the Cyrillic letter
-          "zhe" (ж) with a breve accent, like so: ӂ. Some
-          fonts will contain this character as an individual glyph,
-          whereas other fonts will not contain a zhe-with-breve glyph
-          but expect the rendering engine to form the character by
-          overlaying the two glyphs ж and ˘. Where you should draw the
-          combining breve depends on the height of the preceding glyph.
-          Again, for Arabic, the correct positioning of vowel marks
-          depends on the height of the character on which you are
-          placing the mark. Text shaping tells you whether you have a
-          precomposed glyph within your font or if you need to compose a
-          glyph yourself out of combining marks, and if so, where to
-          position those marks.
-        </p></li>
-</ul></div>
 <p>
-      If this is something that you need to do, then you need a text
-      shaping engine: you could use Uniscribe if you are using Windows;
-      you could use CoreText on OS X; or you could use HarfBuzz. In the
-      rest of this manual, we are going to assume that you are the
-      implementor of a text layout engine.
+      Text strings will usually be tagged with a script and language
+      tag that provide the context needed to perform text shaping
+      correctly.  The necessary <a class="ulink" href="https://docs.microsoft.com/en-us/typography/opentype/spec/scripttags" target="_top">script</a> 
+      and <a class="ulink" href="https://docs.microsoft.com/en-us/typography/opentype/spec/languagetags" target="_top">language</a>
+      tags are defined by OpenType.
     </p>
 </div>
 </div>
 <div class="footer">
-<hr>Generated by GTK-Doc V1.27.1</div>
+<hr>Generated by GTK-Doc V1.25</div>
 </body>
 </html>
\ No newline at end of file