From 0956ab41851d30f50c39c28730cf30ea0bbc5466 Mon Sep 17 00:00:00 2001 From: Nathan Willis Date: Fri, 28 Sep 2018 17:15:59 -0500 Subject: [PATCH] Docs: Move What-HarfBuzz-doesnt-do to Usermanual-what-is-HarfBuzz. --- docs/usermanual-hello-harfbuzz.xml | 98 +++------------------------------ docs/usermanual-what-is-harfbuzz.xml | 101 +++++++++++++++++++++++++++++++++-- 2 files changed, 104 insertions(+), 95 deletions(-) diff --git a/docs/usermanual-hello-harfbuzz.xml b/docs/usermanual-hello-harfbuzz.xml index 716b2f2..221692c 100644 --- a/docs/usermanual-hello-harfbuzz.xml +++ b/docs/usermanual-hello-harfbuzz.xml @@ -90,94 +90,10 @@ hb_buffer_destroy(buf); hb_font_destroy(hb_ft_font); -
- What HarfBuzz doesn't do - - The code above will take a UTF8 string, shape it, and give you the - information required to lay it out correctly on a single - horizontal (or vertical) line using the font provided. That is the - extent of HarfBuzz's responsibility. - - - If you are implementing a text layout engine you may have other - responsibilities, that HarfBuzz will not help you with: - - - - - HarfBuzz won't help you with bidirectionality. If you want to - lay out text with mixed Hebrew and English, you will need to - ensure that the buffer provided to HarfBuzz has those - characters in the correct layout order. This will be different - from the logical order in which the Unicode text is stored. In - other words, the user will hit the keys in the following - sequence: - - -A B C [space] ג ב א [space] D E F - - - but will expect to see in the output: - - -ABC אבג DEF - - - This reordering is called bidi processing - ("bidi" is short for bidirectional), and there's an - algorithm as an annex to the Unicode Standard which tells you how - to reorder a string from logical order into presentation order. - Before sending your string to HarfBuzz, you may need to apply the - bidi algorithm to it. Libraries such as ICU and fribidi can do - this for you. - - - - - HarfBuzz won't help you with text that contains different font - properties. For instance, if you have the string "a - huge breakfast", and you expect - "huge" to be italic, you will need to send three - strings to HarfBuzz: a, in your Roman font; - huge using your italic font; and - breakfast using your Roman font again. - Similarly if you change font, font size, script, language or - direction within your string, you will need to shape each run - independently and then output them independently. HarfBuzz - expects to shape a run of characters sharing the same - properties. - - - - - HarfBuzz won't help you with line breaking, hyphenation or - justification. As mentioned above, it lays out the string - along a single line of, notionally, - infinite length. If you want to find out where the potential - word, sentence and line break points are in your text, you - could use the ICU library's break iterator functions. - - - HarfBuzz can tell you how wide a shaped piece of text is, which is - useful input to a justification algorithm, but it knows nothing - about paragraphs, lines or line lengths. Nor will it adjust the - space between words to fit them proportionally into a line. If you - want to layout text in paragraphs, you will probably want to send - each word of your text to HarfBuzz to determine its shaped width - after glyph substitutions, then work out how many words will fit - on a line, and then finally output each word of the line separated - by a space of the correct size to fully justify the paragraph. - - - - - As a layout engine implementor, HarfBuzz will help you with the - interface between your text and your font, and that's something - that you'll need - what you then do with the glyphs that your font - returns is up to you. The example we saw above enough to get us - started using HarfBuzz. Now we are going to use the remainder of - HarfBuzz's API to refine that example and improve our text shaping - capabilities. - -
- \ No newline at end of file + + + This example shows enough to get us started using HarfBuzz. Now we + are going to use the remainder of HarfBuzz's API to refine that + example and improve our text shaping capabilities. + + diff --git a/docs/usermanual-what-is-harfbuzz.xml b/docs/usermanual-what-is-harfbuzz.xml index 59df9e3..3a98b53 100644 --- a/docs/usermanual-what-is-harfbuzz.xml +++ b/docs/usermanual-what-is-harfbuzz.xml @@ -1,13 +1,13 @@ What is HarfBuzz? - HarfBuzz is a text shaping engine. If you + HarfBuzz is a text-shaping engine. 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. + system. HarfBuzz can properly shape all of the world's major writing @@ -21,7 +21,7 @@ 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 a document. + final output form for inclusion in a document. The shaping process is dependent on the input string, the active @@ -66,6 +66,7 @@ tags are defined by OpenType. +
Why do I need a shaping engine? @@ -212,6 +213,98 @@ implementor of a text-layout engine.
+ +
+ What HarfBuzz doesn't do + + HarfBuzz will take a Unicode string, shape it, and give you the + information required to lay it out correctly on a single + horizontal (or vertical) line using the font provided. That is the + extent of HarfBuzz's responsibility. + + + It is important to note that if you are implementing a + text-layout engine you may have other responsibilities that + HarfBuzz will not help you with. For example: + + + + + HarfBuzz won't help you with bidirectionality. If you want to + lay out text that includes a mix of Hebrew and English, you + will need to ensure that each buffer provided to HarfBuzz has its + characters in the correct layout order. This will be different + from the logical order in which the Unicode text is stored. In + other words, the user will hit the keys in the following + sequence: + + +A B C [space] ג ב א [space] D E F + + + but will expect to see in the output: + + +ABC אבג DEF + + + This reordering is called bidi processing + ("bidi" is short for bidirectional), and there's an + algorithm as an annex to the Unicode Standard which tells you how + to reorder a string from logical order into presentation order. + Before sending your string to HarfBuzz, you may need to apply the + bidi algorithm to it. Libraries such as ICU and fribidi can do + this for you. + + + + + HarfBuzz won't help you with text that contains different font + properties. For instance, if you have the string "a + huge breakfast", and you expect + "huge" to be italic, then you will need to send three + strings to HarfBuzz: a, in your Roman font; + huge using your italic font; and + breakfast using your Roman font again. + + + Similarly, if you change the font, font size, script, + language, or direction within your string, then you will + need to shape each run independently and output them + independently. HarfBuzz expects to shape a run of characters + that all share the same properties. + + + + + HarfBuzz won't help you with line breaking, hyphenation, or + justification. As mentioned above, HarfBuzz lays out the string + along a single line of, notionally, + infinite length. If you want to find out where the potential + word, sentence and line break points are in your text, you + could use the ICU library's break iterator functions. + + + HarfBuzz can tell you how wide a shaped piece of text is, which is + useful input to a justification algorithm, but it knows nothing + about paragraphs, lines or line lengths. Nor will it adjust the + space between words to fit them proportionally into a line. If you + want to layout text in paragraphs, you will probably want to send + each word of your text to HarfBuzz to determine its shaped width + after glyph substitutions, then work out how many words will fit + on a line, and then finally output each word of the line separated + by a space of the correct size to fully justify the paragraph. + + + + + As a layout-engine implementor, HarfBuzz will help you with the + interface between your text and your font, and that's something + that you'll need—what you then do with the glyphs that your font + returns is up to you. + +
+
Why is it called HarfBuzz? @@ -220,7 +313,7 @@ within the source code copyright declarations), but was then extracted out to its own project. This project is maintained by Behdad Esfahbod, and named HarfBuzz. Originally, it was a shaping - engine for OpenType fonts - "HarfBuzz" is the Persian + engine for OpenType fonts—"HarfBuzz" is the Persian for "open type".
-- 2.7.4