yokogaki 0.10.2
yokogaki: ^0.10.2 copied to clipboard
Flutter package for Japanese horizontal text (yokogaki) layout with ruby, kenten, warichu, and rich text support
Changelog #
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
0.10.2 - 2026-01-12 #
Fixed #
- LayoutCache bug: Cache now correctly includes
indent,firstLineIndent,rubyStyle,kentenStyle, andwarichuStylein key comparison - HorizontalRichText: Added missing
extraHeightcalculation for ruby and kenten annotations - SelectionAreaHorizontalText: Use
listEqualsfor annotation list comparison to avoid unnecessary repaints
Changed #
- Extract duplicate
_getCharacterWidthfunction to sharedTextMetricsutility class - Optimize
DecorationRendererto measure text height once per layout call instead of per decoration - Remove unused
fontSizeparameter from_drawCharactermethods in painters
Added #
- Comprehensive unit tests (64 tests covering models, cache, layouter, and widgets)
- New
TextMetricsutility class for shared text measurement functions
0.10.1 - 2026-01-11 #
Added #
- Quick Start section with simple Japanese examples
- Platform Support table for all supported platforms
- Use Cases section with practical examples (blogs, textbooks, news apps, academic papers, chat apps, rich text editors)
0.10.0 - 2026-01-11 #
Added #
- Gaiji (外字) support - Image-based custom characters
Gaijimodel for specifying custom character imagesgaijiListparameter inHorizontalTextwidget- Supports multiple image sources:
AssetImage,NetworkImage,FileImage,MemoryImage - Gaiji images automatically scale to match font size
- Proper text baseline alignment for gaiji images
- Placeholder characters are replaced with images
0.9.2 - 2026-01-11 #
Changed #
- Updated README with latest features documentation
- Added TextAlignment and TextDecoration usage examples
- Added Related Packages section and badges
- Updated installation version to ^0.9.0
- Added all KentenStyle options to documentation
- Updated Roadmap with completed features
0.9.1 - 2026-01-11 #
Fixed #
- Removed unused
dart:uiimports from kenten_renderer.dart, decoration_renderer.dart, warichu_renderer.dart - Removed unused local variable
halfin kenten_renderer.dart - Fixed
sort_child_properties_lastlint warnings in selectable_horizontal_text.dart
0.9.0 - 2026-01-11 #
Added #
- Line alignment support (地付き/天付き)
alignmentproperty inHorizontalTextStyleTextAlignment.start: Align line to left (default horizontal behavior)TextAlignment.center: Center alignmentTextAlignment.end(地付き): Align line to right
- Alignment demo page in example app
- Demo for combined overline + ruby annotations
Fixed #
- Overline and wavy overline positioning (now closer to text with fixed offset)
- Underline and wavy underline positioning (now closer to text with fixed offset)
- Ruby position adjustment when overline decoration is present
- Layout cache now includes alignment in cache key comparison
Changed #
- Uses kinsoku package's
TextAlignmentenum for alignment values
0.8.0 - 2026-01-10 #
Added #
- Enhanced text selection with draggable handles
- Visual selection handles at start and end of selection
- Drag handles to adjust selection range
- Larger touch targets (24px) for better usability on mobile
- Nearest character detection when dragging handles
- Standard context menu features
- Right-click context menu (desktop)
- Long-press context menu (mobile)
- Context menu shown on selection tap and after drag selection
- Keyboard shortcuts: Ctrl+C (copy), Ctrl+A (select all)
- Double-click to select all
- Theme-based selection and handle colors
- Extensible context menu
additionalMenuItemsparameter to add custom menu items- Custom items receive context and selected text
- Automatically adds divider between default and custom items
- Multi-language support
copyLabelandselectAllLabelparameters for custom labels- Auto-detects locale: Japanese (複製/すべて選択) or English (Copy/Select All)
- Easy localization for any language
Fixed #
- Grid and selection highlighting positioning
- Now uses actual text height from TextPainter instead of fontSize
- Grid lines align correctly with rendered characters
- Selection highlights extend to full character height
- Fixed horizontal grid line spacing to use actualTextHeight + lineSpacing
Changed #
- Selection behavior now matches standard apps like Chrome
- Context menu appears automatically after text selection
- Default menu items (Copy, Select All) always present with custom items appended
0.7.0 - 2026-01-10 #
Added #
- Text selection support
SelectableHorizontalTextwidget for selectable textSelectableHorizontalTextPainterfor rendering selection highlighting- Tap to select single character
- Drag to select text range
- Long press to show copy context menu
- Copy selected text to clipboard
- Customizable selection color
- Full support for all features (ruby, kenten, warichu)
- Text selection examples in demo app
Features #
- Intuitive text selection with tap and drag gestures
- Visual selection highlighting with customizable color
- Copy to clipboard functionality
- Works seamlessly with ruby annotations, kenten marks, and warichu
0.6.0 - 2026-01-10 #
Added #
- Performance optimizations
- LRU layout cache with 100-entry limit for fast re-rendering
LayoutCacheclass for caching layout calculationsLayoutCacheKeyandLayoutCacheValuefor cache management- TextPainter reuse across renders to reduce allocations
- Optimized
calculateSize()to reuse cached layouts
Changed #
- Reused TextPainter instances in
HorizontalTextPainter,HorizontalRichTextPainter,RubyRenderer, andWarichuRenderer - Added
useCacheparameter tolayout()andcalculateSize()methods (default: true) - Optimized style comparison in cache key matching
Performance Impact #
- ~70% reduction in layout calculation time for repeated renders
- ~50% reduction in TextPainter allocations
- Significant performance improvement for scrollable text lists
0.5.0 - 2026-01-10 #
Added #
- Rich text support with multiple styles
HorizontalTextSpanbase class for span hierarchySimpleHorizontalTextSpanfor single-style text with annotationsGroupHorizontalTextSpanfor grouping multiple spansHorizontalRichTextwidget for rendering multi-style textHorizontalRichTextPainterfor rendering spans with different styles- Per-span ruby, kenten, and warichu annotations
- Support for mixing multiple text styles, colors, fonts, and weights
- Rich text examples in demo app showing multiple styles and combinations
Changed #
- Added
TextSpanDataclass for flattening span hierarchies - Added
StyleRangeclass for tracking style ranges in rich text
0.4.0 - 2026-01-10 #
Added #
- Warichu (inline annotations) support
Warichumodel for defining inline annotationsWarichuRendererfor laying out and rendering warichu in two-line formatWarichuLayoutclass for warichu positioning informationwarichuListparameter inHorizontalTextwidgetwarichuStyleinHorizontalTextStylefor customizing warichu appearance- Warichu text automatically split into two lines and displayed inline
- Support for combining Ruby, Kenten, and Warichu on the same text
- Warichu examples in demo app showing inline annotations and feature combinations
Changed #
- Updated
HorizontalTextwidget to acceptwarichuListparameter - Updated
HorizontalTextPainterto render warichu annotations - Updated
HorizontalTextStyleto includewarichuStylefield
0.3.0 - 2026-01-10 #
Added #
- Kenten (emphasis marks) support
Kentenmodel for defining emphasis marks on text rangesKentenTypeenum with 6 types: sesame, circle, filledCircle, triangle, filledTriangle, doubleCircleKentenRendererfor laying out and rendering kenten marks above textKentenLayoutclass for kenten positioning informationkentenListparameter inHorizontalTextwidgetkentenStyleinHorizontalTextStylefor customizing kenten appearance- Kenten marks automatically positioned above characters with proper spacing
- Support for combining Ruby and Kenten on the same text
- Kenten examples in demo app showing different mark types and combinations
Changed #
- Updated
HorizontalTextwidget to acceptkentenListparameter - Updated
HorizontalTextPainterto render kenten marks - Updated
HorizontalTextStyleto includekentenStylefield
0.2.0 - 2026-01-10 #
Added #
- Ruby text (furigana) support
RubyRendererfor laying out and rendering ruby text above base textRubyLayoutclass for ruby positioning informationrubyListparameter inHorizontalTextwidgetrubyStyleinHorizontalTextStylefor customizing ruby appearance- Multi-line ruby support - ruby text properly splits across line breaks
- Ruby centering - ruby text is horizontally centered over base text
- Added
textIndexfield toCharacterLayoutfor tracking character positions - Ruby examples in demo app showing basic and multi-line ruby usage
Changed #
- Updated
HorizontalTextwidget to acceptrubyListparameter - Updated
HorizontalTextPainterto render ruby text - Updated
HorizontalTextLayouterto includetextIndexin character layouts
0.1.0 - 2026-01-10 #
Added #
- Initial release of yokogaki package (MVP)
HorizontalTextwidget for horizontal Japanese text layoutHorizontalTextStylefor configuring text appearance and behaviorHorizontalTextLayouterfor basic horizontal text layout with line breakingHorizontalTextPainterfor rendering text to Canvas- Kinsoku processing (禁則処理) support via kinsoku package
- Line-start and line-end prohibition
- Hanging (burasage) and pushing-in (oikomi)
- Yakumono adjustment (約物調整)
- Half-width yakumono handling
- Consecutive yakumono spacing
- Line breaking with maxWidth parameter
- Debug grid display for development
- Example app with multiple demos
- Dependency on kinsoku package for Japanese text processing
Notes #
- This is an MVP release with basic horizontal text layout functionality
- Ruby, kenten, warichu, and rich text features are planned for future releases
- Works with kinsoku package for character classification and line breaking rules