glyph_path_flutter 1.0.0
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.

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 owntoUiPath()(via adart:uiconditional 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.