pdf_harfbuzz 0.1.0 copy "pdf_harfbuzz: ^0.1.0" to clipboard
pdf_harfbuzz: ^0.1.0 copied to clipboard

A companion package for dart_pdf that provides HarfBuzz text shaping for complex scripts.

pdf_harfbuzz #

A companion package for pdf that provides HarfBuzz text shaping for complex scripts.

This package provides a HarfBuzzText widget that can be used to render text using the HarfBuzz shaping engine. This is particularly useful for rendering complex scripts like Arabic, Khmer, Thai, and Indic scripts correctly in PDF documents.

Usage #

Add pdf_harfbuzz as a dependency in your pubspec.yaml file.

dependencies:
  pdf_harfbuzz: ^0.1.0

Then you can use HarfBuzzText just like you would use a regular Text widget in pdf:

import 'package:pdf/widgets.dart' as pw;
import 'package:pdf_harfbuzz/pdf_harfbuzz.dart';

// ...

pdf.addPage(
  pw.Page(
    build: (pw.Context context) {
      return pw.Center(
        child: pw.HarfBuzzText(
          'សួស្តីពិភពលោក', // Khmer for "Hello World"
          style: pw.TextStyle(
            font: khmerFont,
            fontSize: 24,
          ),
        ),
      );
    },
  ),
);
0
likes
40
points
10
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A companion package for dart_pdf that provides HarfBuzz text shaping for complex scripts.

Topics

#pdf #harfbuzz #shaping #text #typography

License

Apache-2.0 (license)

Dependencies

ffi, meta, pdf

More

Packages that depend on pdf_harfbuzz