kashida 0.1.2
kashida: ^0.1.2 copied to clipboard
Flutter kashida (tatweel) for Arabic and Syriac: find insertion points and justify text with KashidaText, layoutParagraphStyled, and TextWidthCache.
/// Minimal example for [package:kashida](https://pub.flutter-io.cn/packages/kashida).
///
/// For the full interactive demo (fonts, justify / find / rules tabs):
/// `cd example && flutter run`
library;
import 'package:flutter/material.dart';
import 'package:kashida/kashida.dart';
void main() {
final set = requiredBuiltinPatternSet('arabic-naskh');
// Find points and insert a fixed count (not line justification).
final found = findKashidaPoints('بيت', set);
for (final point in found.points) {
debugPrint('${point.priority} @ grapheme ${point.index}');
}
debugPrint(insertKashida('بيت', set));
runApp(
MaterialApp(
home: Scaffold(
body: Padding(
padding: const EdgeInsets.all(16),
child: KashidaText(
'بسم الله الرحمن الرحيم',
patternSet: set,
width: 280,
style: const TextStyle(fontSize: 22),
// justifyLastLine: true,
),
),
),
),
);
}