Text Shaping

How to use text shaping in Wordize for .NET.
What is this page about?
This page describes how to enable advanced text shaping in Wordize using HarfBuzz to correctly render complex scripts, ligatures, and OpenType features in fixed-page formats.

Text shaping is the process of transforming a sequence of characters into a visually appealing representation, taking into account the specific features of the font being used. This is particularly important for complex scripts and languages that require precise placement of glyphs (visual representations of characters) to ensure correct rendering.

Text Shaping in Wordize

In the context of Wordize, text shaping is performed when exporting documents to fixed-page formats, such as PDF or XPS, utilizing advanced typography features provided by OpenType fonts. Wordize supports these OpenType features through the HarfBuzz text shaping engine.

The following code example shows how to enable text shaping globally, using the EnableTextShaping property:

Wordize.Settings.EnableTextShaping = true;

The following code example shows how to enable text shaping for concrete operation using the conversion example:

ConverterContext converterContext = new ConverterContext();
converterContext.LayoutOptions.EnableTextShaping = true;

Converter.Create(converterContext)
    .From(inPath)
    .To(outPath)
    .Execute();

How to Install HarfBuzz

For Windows platforms, no additional effort is required to install HarfBuzz, as Wordize already includes the compiled HarfBuzz library.

For other systems, Wordize relies on already installed HarfBuzz library. For instance, many Linux-based systems have HarfBuzz installed by default system-wide. If not, there is usually a package available for installation via package manager. For example, in the clear Ubuntu Docker image, it is required to additionally install Harfbuzz using the following command:

RUN apt-get update && apt-get install -y libharfbuzz-dev

FAQ

  1. Q: How can I enable text shaping for all conversions in Wordize?
    A: Set the global flag Wordize.Settings.EnableTextShaping to true before performing any conversion. This activates the HarfBuzz engine for every subsequent export operation.

  2. Q: How do I enable text shaping only for a specific conversion?
    A: Create a ConverterContext, set LayoutOptions.EnableTextShaping to true on that context, and use it when building the converter. This limits shaping to the current conversion call.

  3. Q: Do I need to install HarfBuzz manually on Windows?
    A: No. The Windows distribution of Wordize bundles the HarfBuzz library, so text shaping works out‑of‑the‑box without any extra installation steps.

  4. Q: What steps are required to install HarfBuzz on Linux or in a Docker container?
    A: Ensure the libharfbuzz-dev package (or the equivalent for your distribution) is installed. For example, on an Ubuntu‑based image you can run apt-get update && apt-get install -y libharfbuzz-dev before using Wordize.