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.
flutter_canvas.dart #
A minimal CustomPainter that loads a .ttf from an asset bundle, generates a
TextPathResult
via glyph_path, converts it with toUiPath(), and draws it on a Canvas.
Copy the file into an existing Flutter project's lib/ directory — it can't
be run with dart run since it depends on dart:ui and package:flutter.
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) {
canvas.drawPath(result.toUiPath(), Paint()..color = Colors.black);
}
@override
bool shouldRepaint(GlyphPainter oldDelegate) => oldDelegate.result != result;
}
flutter_demo/ #
A runnable Flutter app (flutter run from inside example/flutter_demo/)
with font selection, fill/stroke drawing modes, and a side-by-side comparison
against Flutter's built-in Text widget.