Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1c9fb693 authored by Helen Qin's avatar Helen Qin
Browse files

Turn on hyphen auto for word breaks.

Before, if a word like "Continue" has to be broken into separate lines,
there was no hyphen. This turn on hyphenation.

Bug: 329786214
Test: See bug for screenshots.
Change-Id: Ide788ff263f11ee2faea77101d40597343352f63
parent 17f2d47a
Loading
Loading
Loading
Loading
+11 −10
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.TextLayoutResult
import androidx.compose.ui.text.style.Hyphens
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.style.TextOverflow
import com.android.compose.theme.LocalAndroidColorScheme
@@ -39,7 +40,7 @@ fun HeadlineText(text: String, modifier: Modifier = Modifier) {
        text = text,
        color = LocalAndroidColorScheme.current.onSurface,
        textAlign = TextAlign.Center,
        style = MaterialTheme.typography.headlineSmall,
        style = MaterialTheme.typography.headlineSmall.copy(hyphens = Hyphens.Auto),
    )
}

@@ -52,7 +53,7 @@ fun BodyMediumText(text: String, modifier: Modifier = Modifier) {
        modifier = modifier.wrapContentSize(),
        text = text,
        color = LocalAndroidColorScheme.current.onSurfaceVariant,
        style = MaterialTheme.typography.bodyMedium,
        style = MaterialTheme.typography.bodyMedium.copy(hyphens = Hyphens.Auto),
    )
}

@@ -70,7 +71,7 @@ fun BodySmallText(
        modifier = modifier.wrapContentSize(),
        text = text,
        color = LocalAndroidColorScheme.current.onSurfaceVariant,
        style = MaterialTheme.typography.bodySmall,
        style = MaterialTheme.typography.bodySmall.copy(hyphens = Hyphens.Auto),
        overflow = TextOverflow.Ellipsis,
        maxLines = if (enforceOneLine) 1 else Int.MAX_VALUE,
        onTextLayout = onTextLayout,
@@ -86,7 +87,7 @@ fun LargeTitleText(text: String, modifier: Modifier = Modifier) {
        modifier = modifier.wrapContentSize(),
        text = text,
        color = LocalAndroidColorScheme.current.onSurface,
        style = MaterialTheme.typography.titleLarge,
        style = MaterialTheme.typography.titleLarge.copy(hyphens = Hyphens.Auto),
    )
}

@@ -104,7 +105,7 @@ fun SmallTitleText(
        modifier = modifier.wrapContentSize(),
        text = text,
        color = LocalAndroidColorScheme.current.onSurface,
        style = MaterialTheme.typography.titleSmall,
        style = MaterialTheme.typography.titleSmall.copy(hyphens = Hyphens.Auto),
        overflow = TextOverflow.Ellipsis,
        maxLines = if (enforceOneLine) 1 else Int.MAX_VALUE,
        onTextLayout = onTextLayout,
@@ -120,7 +121,7 @@ fun SectionHeaderText(text: String, modifier: Modifier = Modifier, color: Color)
        modifier = modifier.wrapContentSize(),
        text = text,
        color = color,
        style = MaterialTheme.typography.titleSmall,
        style = MaterialTheme.typography.titleSmall.copy(hyphens = Hyphens.Auto),
    )
}

@@ -133,7 +134,7 @@ fun SnackbarContentText(text: String, modifier: Modifier = Modifier) {
        modifier = modifier.wrapContentSize(),
        text = text,
        color = MaterialTheme.colorScheme.inverseOnSurface,
        style = MaterialTheme.typography.bodyMedium,
        style = MaterialTheme.typography.bodyMedium.copy(hyphens = Hyphens.Auto),
    )
}

@@ -146,7 +147,7 @@ fun SnackbarActionText(text: String, modifier: Modifier = Modifier) {
        modifier = modifier.wrapContentSize(),
        text = text,
        color = MaterialTheme.colorScheme.inversePrimary,
        style = MaterialTheme.typography.labelLarge,
        style = MaterialTheme.typography.labelLarge.copy(hyphens = Hyphens.Auto),
    )
}

@@ -160,7 +161,7 @@ fun LargeLabelTextOnSurfaceVariant(text: String, modifier: Modifier = Modifier)
        text = text,
        textAlign = TextAlign.Center,
        color = LocalAndroidColorScheme.current.onSurfaceVariant,
        style = MaterialTheme.typography.labelLarge,
        style = MaterialTheme.typography.labelLarge.copy(hyphens = Hyphens.Auto),
    )
}

@@ -173,6 +174,6 @@ fun LargeLabelText(text: String, modifier: Modifier = Modifier) {
        modifier = modifier.wrapContentSize(),
        text = text,
        textAlign = TextAlign.Center,
        style = MaterialTheme.typography.labelLarge,
        style = MaterialTheme.typography.labelLarge.copy(hyphens = Hyphens.Auto),
    )
}
 No newline at end of file