glyph_path_flutter 1.0.0 copy "glyph_path_flutter: ^1.0.0" to clipboard
glyph_path_flutter: ^1.0.0 copied to clipboard

Flutter integration for glyph_path — converts TextPathResult into a dart:ui Path for direct Canvas rendering.

glyph_path_flutter #

Flutter integration for glyph_path — converts a TextPathResult into a dart:ui Path for direct Canvas rendering.

pub package Dart SDK CI

Screenshot of the example app showing stroke-rendered glyph paths above a regular Text widget for comparison

glyph_path itself is pure Dart and has no Flutter dependency, so it can be used in server-side or CLI tools. This package adds the one extra step needed to draw its output on a Flutter Canvas.

Install #

dependencies:
  glyph_path: '>=2.0.0 <3.0.0'
  glyph_path_flutter: ^1.0.0

Requires glyph_path >=2.0.0. Earlier releases ship their own toUiPath() (via a dart:ui conditional export), which collides with this package's extension of the same name.

Usage #

import 'package:glyph_path/glyph_path.dart';
import 'package:glyph_path_flutter/glyph_path_flutter.dart';

class GlyphPainter extends CustomPainter {
  const GlyphPainter({required this.result});

  final TextPathResult result;

  @override
  void paint(Canvas canvas, Size size) {
    // Font coordinates grow upward; Canvas coordinates grow downward.
    canvas.translate(0, size.height);
    canvas.scale(1, -1);
    canvas.drawPath(result.toUiPath(), Paint()..color = Colors.black);
  }

  @override
  bool shouldRepaint(GlyphPainter oldDelegate) => oldDelegate.result != result;
}

See example/flutter_canvas.dart for a complete CustomPainter example, and example/flutter_demo for a runnable app with font selection and fill/stroke drawing modes.

License #

BSD 3-Clause. See LICENSE.

0
likes
160
points
115
downloads

Documentation

API reference

Publisher

verified publishercrossapplication.members.co.jp

Weekly Downloads

Flutter integration for glyph_path — converts TextPathResult into a dart:ui Path for direct Canvas rendering.

Repository (GitHub)
View/report issues

Topics

#font #text #flutter #canvas

License

BSD-3-Clause (license)

Dependencies

flutter, glyph_path

More

Packages that depend on glyph_path_flutter