gputext

GPU-accelerated vector text for Flutter. Glyphs are rasterized by an analytic coverage shader through Flutter GPU, with HarfBuzz for shaping (complex scripts and bidirectional text).

Pre-release. Requires a recent Flutter master / Impeller build with flutter_gpu. Widgets paint blank without Impeller.

Install

dependencies:
  gputext: ^0.1.0-dev.1
flutter pub get

The package build hook compiles shaders and a HarfBuzz amalgamation from third_party/harfbuzz (vendored; no separate system install).

Quick start

import 'package:gputext/gputext.dart';

GPURichText(
  text: TextSpan(
    text: 'Hello GPU text',
    style: TextStyle(fontSize: 24, color: Colors.white),
  ),
)

Register fonts with GPUFont / the engine APIs before layout when you are not using the bundled Lato default. See the example app for demos (RTL, variable fonts, benchmarks).

Hybrid rendering

GPURichText is not a single paint path:

  • GPU blit — glyphs covered by a registered GPUFont are rasterized into a cached ui.Image, then blitted.
  • Platform Text — color-emoji clusters and characters no registered font covers (often CJK) become baseline-aligned WidgetSpans with stock Flutter Text.
  • WidgetSpan children — measured in layout and painted on top of the text image, same as RichText.

Limits

  • Impeller / flutter_gpu only.
  • foreground Paint is flat color only.
  • Still evolving; APIs may change before 0.1.0.

License

MIT. HarfBuzz and bundled fonts carry their own licenses (see LICENSE and assets/).

Libraries

gputext
internal