From 3fbd775007164912b34a1d59a923ad3387028b97 Mon Sep 17 00:00:00 2001 From: Alexander Gorshenev Date: Thu, 17 Feb 2022 19:37:17 +0300 Subject: [PATCH] Revert "Brought back explicit font loading in example1" This reverts commit 56d5aceb4b3fc6c1d50880bbc1e72683ae170d23. --- .../desktop/examples/example1/Main.jvm.kt | 35 ++++--------------- 1 file changed, 7 insertions(+), 28 deletions(-) diff --git a/compose/desktop/desktop/samples/src/jvmMain/kotlin/androidx/compose/desktop/examples/example1/Main.jvm.kt b/compose/desktop/desktop/samples/src/jvmMain/kotlin/androidx/compose/desktop/examples/example1/Main.jvm.kt index 0f3141264adfc..958831c1ae520 100644 --- a/compose/desktop/desktop/samples/src/jvmMain/kotlin/androidx/compose/desktop/examples/example1/Main.jvm.kt +++ b/compose/desktop/desktop/samples/src/jvmMain/kotlin/androidx/compose/desktop/examples/example1/Main.jvm.kt @@ -100,7 +100,6 @@ import androidx.compose.ui.input.pointer.pointerHoverIcon import androidx.compose.ui.input.pointer.pointerInput import androidx.compose.ui.platform.LocalUriHandler import androidx.compose.ui.res.painterResource -import androidx.compose.ui.text.ExperimentalTextApi import androidx.compose.ui.text.Placeholder import androidx.compose.ui.text.PlaceholderVerticalAlign import androidx.compose.ui.text.SpanStyle @@ -109,7 +108,6 @@ import androidx.compose.ui.text.buildAnnotatedString import androidx.compose.ui.text.font.FontFamily import androidx.compose.ui.text.font.FontStyle import androidx.compose.ui.text.platform.Font -import androidx.compose.ui.text.platform.FontLoader import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.text.style.TextDecoration import androidx.compose.ui.text.style.TextDecoration.Companion.Underline @@ -130,33 +128,14 @@ import kotlin.random.Random private const val title = "Desktop Compose Elements" -val italicFont = try { - FontFamily( - Font("NotoSans-Italic.ttf").also { - // Check that font is loadable. - @OptIn(ExperimentalTextApi::class) - FontLoader().load(it)!! - } - ) -} catch (e: Exception) { - FontFamily.SansSerif -} +val italicFont = FontFamily( + Font("NotoSans-Italic.ttf") +) -val dispatchedFonts = try { - FontFamily( - Font("NotoSans-Italic.ttf", style = FontStyle.Italic).also { - @OptIn(ExperimentalTextApi::class) - FontLoader().load(it)!! - }, - Font("NotoSans-Regular.ttf", style = FontStyle.Normal).also { - @OptIn(ExperimentalTextApi::class) - FontLoader().load(it)!! - } - ) -} catch (e: Exception) { - println("Failed to load font $e") - null -} +val dispatchedFonts = FontFamily( + Font("NotoSans-Italic.ttf", style = FontStyle.Italic), + Font("NotoSans-Regular.ttf", style = FontStyle.Normal) +) fun main() = singleWindowApplication( title = title,