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 complete 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 all of its characters in the same order and that the directionality of the buffer is set correctly. This may mean segmenting the text before it is placed into HarfBuzz buffers. 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 process a string of mixed directionality. 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.
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.