Skip to content

Commit

Permalink
Revert "Brought back explicit font loading in example1"
Browse files Browse the repository at this point in the history
This reverts commit 56d5ace.
  • Loading branch information
alexander-gorshenev committed Feb 17, 2022
1 parent 7b12b14 commit 3fbd775
Showing 1 changed file with 7 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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,
Expand Down

0 comments on commit 3fbd775

Please sign in to comment.