@@ -41,7 +41,12 @@ import androidx.compose.ui.res.painterResource
4141import androidx.compose.ui.res.stringResource
4242import androidx.compose.ui.semantics.semantics
4343import androidx.compose.ui.semantics.testTagsAsResourceId
44+ import androidx.compose.ui.text.AnnotatedString
45+ import androidx.compose.ui.text.SpanStyle
46+ import androidx.compose.ui.text.buildAnnotatedString
47+ import androidx.compose.ui.text.withStyle
4448import androidx.compose.ui.tooling.preview.Preview
49+ import androidx.compose.ui.unit.TextUnit
4550import androidx.navigation.NavHostController
4651import androidx.navigation.compose.rememberNavController
4752import ee.ria.DigiDoc.R
@@ -106,9 +111,14 @@ fun InitScreen(
106111 },
107112 )
108113 }
109-
114+ val baseStyle = MaterialTheme .typography.displaySmall
110115 Text (
111- text = stringResource(id = R .string.ria),
116+ text =
117+ smallCapsText(
118+ text = stringResource(id = R .string.ria),
119+ normalSize = baseStyle.fontSize,
120+ smallCapsSize = baseStyle.fontSize * 0.8f ,
121+ ),
112122 style = MaterialTheme .typography.displaySmall,
113123 modifier =
114124 modifier
@@ -120,6 +130,29 @@ fun InitScreen(
120130 }
121131}
122132
133+ fun smallCapsText (
134+ text : String ,
135+ normalSize : TextUnit ,
136+ smallCapsSize : TextUnit ,
137+ ): AnnotatedString =
138+ buildAnnotatedString {
139+ text.forEach { ch ->
140+ if (ch.isLowerCase()) {
141+ withStyle(
142+ SpanStyle (fontSize = smallCapsSize),
143+ ) {
144+ append(ch.uppercaseChar())
145+ }
146+ } else {
147+ withStyle(
148+ SpanStyle (fontSize = normalSize),
149+ ) {
150+ append(ch)
151+ }
152+ }
153+ }
154+ }
155+
123156@Preview(showBackground = true )
124157@Preview(showBackground = true , uiMode = Configuration .UI_MODE_NIGHT_YES )
125158@Composable
0 commit comments