@@ -1967,6 +1967,7 @@ Int32List _encodeParagraphStyle(
19671967 String ? ellipsis,
19681968 Locale ? locale,
19691969 Hyphens ? hyphens,
1970+ String ? hyphenCharacter,
19701971) {
19711972 final result = Int32List (8 ); // also update paragraph_builder.cc
19721973 if (textAlign != null ) {
@@ -2023,6 +2024,10 @@ Int32List _encodeParagraphStyle(
20232024 result[0 ] | = 1 << 13 ;
20242025 result[7 ] = hyphens.index;
20252026 }
2027+ if (hyphenCharacter != null ) {
2028+ result[0 ] | = 1 << 14 ;
2029+ // Passed separately to native.
2030+ }
20262031 return result;
20272032}
20282033
@@ -2092,6 +2097,15 @@ class ParagraphStyle {
20922097 ///
20932098 /// * `hyphens` : Whether to render a hyphen glyph for soft hyphens (U+00AD)
20942099 /// that fall at a line break. Defaults to [Hyphens.manual] .
2100+ ///
2101+ /// * `hyphenCharacter` : The string drawn at the end of a line that breaks
2102+ /// at a soft hyphen (U+00AD). If null, a hyphen-minus ("-") is drawn. Line
2103+ /// breaking leaves room for the string when it can, so a longer string can
2104+ /// move a break earlier. The empty string draws nothing, but the line
2105+ /// still breaks there. Has no effect when `hyphens` is [Hyphens.hidden] .
2106+ /// The string is shaped as a single run in the style of the text before
2107+ /// it, so it should be short, typically one character, and supported by
2108+ /// that text's font.
20952109 ParagraphStyle ({
20962110 TextAlign ? textAlign,
20972111 TextDirection ? textDirection,
@@ -2106,6 +2120,7 @@ class ParagraphStyle {
21062120 String ? ellipsis,
21072121 Locale ? locale,
21082122 Hyphens ? hyphens,
2123+ String ? hyphenCharacter,
21092124 }) : _encoded = _encodeParagraphStyle (
21102125 textAlign,
21112126 textDirection,
@@ -2120,13 +2135,15 @@ class ParagraphStyle {
21202135 ellipsis,
21212136 locale,
21222137 hyphens,
2138+ hyphenCharacter,
21232139 ),
21242140 _fontFamily = fontFamily,
21252141 _fontSize = fontSize,
21262142 _height = height,
21272143 _strutStyle = strutStyle,
21282144 _ellipsis = ellipsis,
21292145 _locale = locale,
2146+ _hyphenCharacter = hyphenCharacter,
21302147 _leadingDistribution =
21312148 textHeightBehavior? .leadingDistribution ?? TextLeadingDistribution .proportional;
21322149
@@ -2137,6 +2154,7 @@ class ParagraphStyle {
21372154 final StrutStyle ? _strutStyle;
21382155 final String ? _ellipsis;
21392156 final Locale ? _locale;
2157+ final String ? _hyphenCharacter;
21402158 final TextLeadingDistribution _leadingDistribution;
21412159
21422160 @override
@@ -2154,6 +2172,7 @@ class ParagraphStyle {
21542172 other._strutStyle == _strutStyle &&
21552173 other._ellipsis == _ellipsis &&
21562174 other._locale == _locale &&
2175+ other._hyphenCharacter == _hyphenCharacter &&
21572176 other._leadingDistribution == _leadingDistribution &&
21582177 _listEquals <int >(other._encoded, _encoded);
21592178 }
@@ -2166,6 +2185,7 @@ class ParagraphStyle {
21662185 _height,
21672186 _ellipsis,
21682187 _locale,
2188+ _hyphenCharacter,
21692189 _leadingDistribution,
21702190 );
21712191
@@ -2184,7 +2204,8 @@ class ParagraphStyle {
21842204 'strutStyle: ${_encoded [0 ] & 0x400 == 0x400 ? _strutStyle : "unspecified" }, '
21852205 'ellipsis: ${_encoded [0 ] & 0x800 == 0x800 ? '"$_ellipsis "' : "unspecified" }, '
21862206 'locale: ${_encoded [0 ] & 0x1000 == 0x1000 ? _locale : "unspecified" }, '
2187- 'hyphens: ${_encoded [0 ] & 0x2000 == 0x2000 ? Hyphens .values [_encoded [7 ]] : "unspecified" }'
2207+ 'hyphens: ${_encoded [0 ] & 0x2000 == 0x2000 ? Hyphens .values [_encoded [7 ]] : "unspecified" }, '
2208+ 'hyphenCharacter: ${_encoded [0 ] & 0x4000 == 0x4000 ? '"$_hyphenCharacter "' : "unspecified" }'
21882209 ')' ;
21892210 }
21902211}
@@ -3609,12 +3630,13 @@ base class _NativeParagraphBuilder extends NativeFieldWrapperClass1 implements P
36093630 style._height ?? 0 ,
36103631 style._ellipsis ?? '' ,
36113632 _encodeLocale (style._locale),
3633+ style._hyphenCharacter ?? '' ,
36123634 );
36133635 }
36143636
3615- @Native < Void Function ( Handle , Handle , Handle , Handle , Handle , Double , Double , Handle , Handle ) > (
3616- symbol : 'ParagraphBuilder::Create' ,
3617- )
3637+ @Native <
3638+ Void Function ( Handle , Handle , Handle , Handle , Handle , Double , Double , Handle , Handle , Handle )
3639+ > (symbol : 'ParagraphBuilder::Create' )
36183640 external void _constructor (
36193641 Int32List encoded,
36203642 ByteData ? strutData,
@@ -3624,6 +3646,7 @@ base class _NativeParagraphBuilder extends NativeFieldWrapperClass1 implements P
36243646 double height,
36253647 String ellipsis,
36263648 String locale,
3649+ String hyphenCharacter,
36273650 );
36283651
36293652 @override
0 commit comments