arabic_text_justification 0.0.2
arabic_text_justification: ^0.0.2 copied to clipboard
Flutter FFI plugin for Arabic text justification using HarfBuzz shaping and FreeType rasterization.
arabic_text_justification #
A Flutter FFI plugin for Arabic text rendering with kashida-based justification using HarfBuzz and FreeType.
Supports two rendering modes: bitmap and vector outline.
Demo #
How It Works #
- Text shaping — HarfBuzz applies Arabic letter forms, ligatures, and optional kashida justification.
- Glyph processing — FreeType either rasterizes glyphs to bitmap or extracts vector bezier outlines.
- Word mapping — per-word bounding rectangles and glyph-to-word indices for hit-testing and animation.
Usage #
import 'package:arabic_text_justification/arabic_text_justification.dart';
// Bitmap rendering
final result = await ArabicTextJustification.renderLine(
fontPath, text, fontSize, availableWidth,
justify: true,
);
RawImage(image: result.image, fit: BoxFit.fill);
// Vector outline rendering
final outline = ArabicTextJustification.getOutline(
fontPath, text, fontSize, availableWidth,
justify: true,
);
CustomPaint(painter: ArabicOutlinePainter(outline: outline));
Acknowledgments #
- DigitalKhatt — Arabic justification and font technology
- HarfBuzz — Text shaping engine (justification branch by DigitalKhatt)
- FreeType — Font rendering library
Portions of this software are copyright (c) 2023 The FreeType Project (https://freetype.org). All rights reserved.
See THIRD_PARTY_NOTICES for full license details.
License #
MIT — see LICENSE for details.