diff options
| author | 2023-10-05 16:43:08 +0900 | |
|---|---|---|
| committer | 2023-10-05 16:43:08 +0900 | |
| commit | 2c062da55a77bdb5284d0751a54e2d1309c9c9c4 (patch) | |
| tree | 8b254277c3fdf871b4f392c3870c9acaa96e1ef7 /graphics/java | |
| parent | f2701eb9dfc0cded20839cae744ea92f19ed11b4 (diff) | |
Add NoBreakSpan that prevent line break the portion of text
Bug: 283193586
Test: minikin_tests
Test: atest StaticLayoutLineBreakingNoBreakSpanTest
Change-Id: I9acd108537b73673316d0c126fff99a48a11f4ed
Diffstat (limited to 'graphics/java')
| -rw-r--r-- | graphics/java/android/graphics/text/LineBreakConfig.java | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/graphics/java/android/graphics/text/LineBreakConfig.java b/graphics/java/android/graphics/text/LineBreakConfig.java index e81525fb7d60..f5e5803d4796 100644 --- a/graphics/java/android/graphics/text/LineBreakConfig.java +++ b/graphics/java/android/graphics/text/LineBreakConfig.java @@ -134,10 +134,25 @@ public final class LineBreakConfig { */ public static final int LINE_BREAK_STYLE_STRICT = 3; + /** + * The line break style that used for preventing automatic line breaking. + * + * This is useful when you want to preserve some words in the same line by using + * {@link android.text.style.LineBreakConfigSpan} or + * {@link android.text.style.LineBreakConfigSpan.NoBreakSpan} as a shorthand. + * Note that even if this style is specified, the grapheme based line break is still performed + * for preventing clipping text. + * + * @see android.text.style.LineBreakConfigSpan + * @see android.text.style.LineBreakConfigSpan.NoBreakSpan + */ + @FlaggedApi(FLAG_NO_BREAK_NO_HYPHENATION_SPAN) + public static final int LINE_BREAK_STYLE_NO_BREAK = 4; + /** @hide */ @IntDef(prefix = { "LINE_BREAK_STYLE_" }, value = { LINE_BREAK_STYLE_NONE, LINE_BREAK_STYLE_LOOSE, LINE_BREAK_STYLE_NORMAL, - LINE_BREAK_STYLE_STRICT, LINE_BREAK_STYLE_UNSPECIFIED + LINE_BREAK_STYLE_STRICT, LINE_BREAK_STYLE_UNSPECIFIED, LINE_BREAK_STYLE_NO_BREAK }) @Retention(RetentionPolicy.SOURCE) public @interface LineBreakStyle {} |