DocWright.ComplexText 2.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package DocWright.ComplexText --version 2.0.1
                    
NuGet\Install-Package DocWright.ComplexText -Version 2.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DocWright.ComplexText" Version="2.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DocWright.ComplexText" Version="2.0.1" />
                    
Directory.Packages.props
<PackageReference Include="DocWright.ComplexText" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add DocWright.ComplexText --version 2.0.1
                    
#r "nuget: DocWright.ComplexText, 2.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package DocWright.ComplexText@2.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=DocWright.ComplexText&version=2.0.1
                    
Install as a Cake Addin
#tool nuget:?package=DocWright.ComplexText&version=2.0.1
                    
Install as a Cake Tool

DocWright.ComplexText

HarfBuzz text shaping for DocWright, for the complex scripts the built-in engine does not shape: Devanagari and the rest of Indic, Thai, Khmer and others.

Part of DocWright, managed .NET libraries for Word documents, Excel workbooks, PDF and SSRS reports, with no Office, no interop and no native binaries.

An add-on, and the one DocWright package with native code. You do not need it for Latin, Cyrillic, Greek, Arabic or Hebrew: DocWright shapes Arabic and Hebrew itself, from the face's own OpenType tables (joining forms, lam-alef and other ligatures, mark positioning, kerning). Any other complex script is drawn one glyph per cluster without this package, which is wrong for those scripts, and DocWright reports it as DXP2002:

DXP2002 Complex-script shaping fallback is active for a script or face the built-in shaper does
not cover (simple cmap shaping only: Arabic and Hebrew are shaped natively when the face has
GSUB/GPOS tables for them). Supply DocWright.ComplexText.HarfBuzzTextShaper for other scripts.

Install

dotnet add package DocWright
dotnet add package DocWright.ComplexText

Depends on DocWright.Core, DocWright.Fonts and HarfBuzzSharp. Targets .NET Framework 4.8, .NET Standard 2.0, .NET 8 and .NET 10.

HarfBuzzSharp ships native binaries for Windows and macOS. A Linux host also needs HarfBuzzSharp.NativeAssets.Linux; that is the application's choice, so this package does not force it. Without the native library a conversion that uses the shaper fails with DllNotFoundException (possibly inside a TypeInitializationException).

Features

  • HarfBuzzTextShaper, an ITextShaper you set once on ConvertOptions.TextShaper.
  • Shapes every face a conversion uses: installed files, fonts embedded in the document, and the bundled fallback faces.
  • Applies the run's language system, kerning and ligature features (liga, clig, hlig, dlig, with locl) as the layout engine requests them.
  • Glyph placements (offsets and advances) reach both renderers, so PDF and page images agree.

Usage

using DocWright;
using DocWright.ComplexText;

var converter = new DocWrightConverter();

var options = new ConvertOptions
{
    TextShaper = new HarfBuzzTextShaper(),
};

using FileStream input = File.OpenRead("hindi.docx");
using FileStream output = File.Create("hindi.pdf");

converter.Convert(input, output, options);

The same option works for ConvertToImages and Layout. FontEngine.CanShape(face, "deva") tells you whether the built-in engine would shape a script in a given face without this package.

Limits

  • It shapes every run once set, Latin and Arabic included, not only the scripts that need it. Pair kerning then comes from whichever table HarfBuzz chooses, while the built-in engine follows the document's Word compatibility mode, so Latin lines can differ slightly from the default.
  • It applies to Word documents. Spreadsheet rendering and report pagination do not take a shaper.
  • With the shaper set, fonts embedded in a document are parsed by native HarfBuzz code. For untrusted documents, read the HarfBuzz note in DocWright's SECURITY.md first.
  • An in-memory face whose glyph mapping or advances disagree with DocWright's own reading is laid out without HarfBuzz for that run.

Where it fits

References DocWright.Core and DocWright.Fonts, and plugs into the DocWright facade (or DocWright.Word.Layout's LayoutEngine) through ITextShaper. Nothing depends on it. nuget.org/packages/DocWright.ComplexText

Documentation

DocWright documentation · Fonts and complex scripts · API reference

Contact

Questions, support or licensing: salwan@albahadly.com · www.albahadly.com

License

MIT. HarfBuzzSharp and HarfBuzz carry their own licenses (MIT). See LICENSE and THIRD-PARTY-NOTICES.md in the package.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 is compatible.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.2 76 11/26/2026
2.0.1 75 11/26/2026
2.0.0 91 11/25/2026
1.12.0 148 11/16/2026
1.11.0 129 11/14/2026
1.10.0 102 11/10/2026
1.9.0 117 11/3/2026
1.8.0 116 11/2/2026
1.7.0 137 10/24/2026
1.6.0 118 10/19/2026
1.5.0 116 10/18/2026
1.4.0 122 10/18/2026
1.3.1 117 10/16/2026
1.3.0 111 10/15/2026
1.2.0 116 10/14/2026
1.1.4 124 9/28/2026
1.1.3 115 9/28/2026
1.1.2 139 9/3/2026
1.1.1 130 8/22/2026
1.1.0 134 8/22/2026

Guides, tutorials and API reference: https://docs.albahadly.com/docwright/