diff --git a/components/resources/demo/shared/src/commonMain/composeResources/font/Workbench-Regular.ttf b/components/resources/demo/shared/src/commonMain/composeResources/font/Workbench-Regular.ttf new file mode 100644 index 0000000000..3714a82c5f Binary files /dev/null and b/components/resources/demo/shared/src/commonMain/composeResources/font/Workbench-Regular.ttf differ diff --git a/components/resources/demo/shared/src/commonMain/kotlin/org/jetbrains/compose/resources/demo/shared/FontRes.kt b/components/resources/demo/shared/src/commonMain/kotlin/org/jetbrains/compose/resources/demo/shared/FontRes.kt index 593bdbc0ae..c2a3e4551a 100644 --- a/components/resources/demo/shared/src/commonMain/kotlin/org/jetbrains/compose/resources/demo/shared/FontRes.kt +++ b/components/resources/demo/shared/src/commonMain/kotlin/org/jetbrains/compose/resources/demo/shared/FontRes.kt @@ -29,13 +29,37 @@ fun FontRes(paddingValues: PaddingValues) { Text( modifier = Modifier.padding(8.dp), text = """ - val fontAwesome = FontFamily(Font(Res.fonts.font_awesome)) - val symbols = arrayOf(0xf1ba, 0xf238, 0xf21a, 0xf1bb, 0xf1b8, 0xf09b, 0xf269, 0xf1d0, 0xf15a, 0xf293, 0xf1c6) Text( modifier = Modifier.padding(16.dp), - fontFamily = fontAwesome, + fontFamily = FontFamily(Font(Res.font.workbench_regular)), style = MaterialTheme.typography.headlineLarge, - text = symbols.joinToString(" ") { it.toChar().toString() } + text = "brown fox jumps over the lazy dog" + ) + """.trimIndent(), + color = MaterialTheme.colorScheme.onPrimaryContainer, + softWrap = false + ) + } + Text( + modifier = Modifier.padding(16.dp), + fontFamily = FontFamily(Font(Res.font.workbench_regular)), + style = MaterialTheme.typography.headlineLarge, + text = "brown fox jumps over the lazy dog" + ) + + OutlinedCard( + modifier = Modifier.padding(16.dp).fillMaxWidth(), + shape = RoundedCornerShape(4.dp), + colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.primaryContainer) + ) { + Text( + modifier = Modifier.padding(8.dp), + text = """ + Text( + modifier = Modifier.padding(16.dp), + fontFamily = FontFamily(Font(Res.font.font_awesome)), + style = MaterialTheme.typography.headlineLarge, + text ="\uf1ba \uf238 \uf21a \uf1bb \uf1b8 \uf09b \uf269 \uf1d0 \uf15a \uf293 \uf1c6" ) """.trimIndent(), color = MaterialTheme.colorScheme.onPrimaryContainer, @@ -43,13 +67,11 @@ fun FontRes(paddingValues: PaddingValues) { ) } - val fontAwesome = FontFamily(Font(Res.font.font_awesome)) - val symbols = arrayOf(0xf1ba, 0xf238, 0xf21a, 0xf1bb, 0xf1b8, 0xf09b, 0xf269, 0xf1d0, 0xf15a, 0xf293, 0xf1c6) Text( modifier = Modifier.padding(16.dp), - fontFamily = fontAwesome, + fontFamily = FontFamily(Font(Res.font.font_awesome)), style = MaterialTheme.typography.headlineLarge, - text = symbols.joinToString(" ") { it.toChar().toString() } + text ="\uf1ba \uf238 \uf21a \uf1bb \uf1b8 \uf09b \uf269 \uf1d0 \uf15a \uf293 \uf1c6" ) } } \ No newline at end of file diff --git a/components/resources/demo/shared/src/commonMain/kotlin/org/jetbrains/compose/resources/demo/shared/StringRes.kt b/components/resources/demo/shared/src/commonMain/kotlin/org/jetbrains/compose/resources/demo/shared/StringRes.kt index 7de1a70d86..08aef674b6 100644 --- a/components/resources/demo/shared/src/commonMain/kotlin/org/jetbrains/compose/resources/demo/shared/StringRes.kt +++ b/components/resources/demo/shared/src/commonMain/kotlin/org/jetbrains/compose/resources/demo/shared/StringRes.kt @@ -1,30 +1,16 @@ package org.jetbrains.compose.resources.demo.shared -import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.PaddingValues -import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.* import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.foundation.verticalScroll -import androidx.compose.material3.CardDefaults -import androidx.compose.material3.MaterialTheme -import androidx.compose.material3.OutlinedCard -import androidx.compose.material3.OutlinedTextField -import androidx.compose.material3.Text -import androidx.compose.material3.TextFieldDefaults -import androidx.compose.runtime.Composable -import androidx.compose.runtime.LaunchedEffect -import androidx.compose.runtime.getValue -import androidx.compose.runtime.mutableStateOf -import androidx.compose.runtime.remember -import androidx.compose.runtime.setValue +import androidx.compose.material3.* +import androidx.compose.runtime.* import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp import components.resources.demo.shared.generated.resources.Res -import org.jetbrains.compose.resources.stringResource import org.jetbrains.compose.resources.stringArrayResource -import org.jetbrains.compose.resources.readResourceBytes +import org.jetbrains.compose.resources.stringResource @Composable fun StringRes(paddingValues: PaddingValues) { @@ -56,7 +42,7 @@ fun StringRes(paddingValues: PaddingValues) { modifier = Modifier.padding(16.dp).fillMaxWidth(), value = stringResource(Res.string.app_name), onValueChange = {}, - label = { Text("Text(stringResource(Res.string.app_name)") }, + label = { Text("Text(stringResource(Res.string.app_name))") }, enabled = false, colors = TextFieldDefaults.colors( disabledTextColor = MaterialTheme.colorScheme.onSurface, @@ -68,7 +54,7 @@ fun StringRes(paddingValues: PaddingValues) { modifier = Modifier.padding(16.dp).fillMaxWidth(), value = stringResource(Res.string.hello), onValueChange = {}, - label = { Text("Text(stringResource(Res.string.hello)") }, + label = { Text("Text(stringResource(Res.string.hello))") }, enabled = false, colors = TextFieldDefaults.colors( disabledTextColor = MaterialTheme.colorScheme.onSurface, @@ -80,7 +66,7 @@ fun StringRes(paddingValues: PaddingValues) { modifier = Modifier.padding(16.dp).fillMaxWidth(), value = stringResource(Res.string.multi_line), onValueChange = {}, - label = { Text("Text(stringResource(Res.string.multi_line)") }, + label = { Text("Text(stringResource(Res.string.multi_line))") }, enabled = false, colors = TextFieldDefaults.colors( disabledTextColor = MaterialTheme.colorScheme.onSurface, @@ -92,7 +78,7 @@ fun StringRes(paddingValues: PaddingValues) { modifier = Modifier.padding(16.dp).fillMaxWidth(), value = stringResource(Res.string.str_template, "User_name", 100), onValueChange = {}, - label = { Text("Text(stringResource(Res.string.str_template, \"User_name\", 100)") }, + label = { Text("Text(stringResource(Res.string.str_template, \"User_name\", 100))") }, enabled = false, colors = TextFieldDefaults.colors( disabledTextColor = MaterialTheme.colorScheme.onSurface,