https://kotlinlang.org logo
#compose-android
Title
# compose-android
d

dazza5000

12/13/2023, 5:35 PM
Why is fontStyle hardcoded to Italic in the jetpack compose framework implementation?
Copy code
private fun buildStyledTypeface(fontWeight: FontWeight, fontStyle: FontStyle) =
        if (Build.VERSION.SDK_INT < 28) {
            Typeface.create(
                nativeTypeface,
                getAndroidTypefaceStyle(fontWeight, fontStyle)
            )
        } else {
            TypefaceHelperMethodsApi28.create(
                nativeTypeface,
                fontWeight.weight,
                fontStyle == FontStyle.Italic
            )
        }
s

Stylianos Gakis

12/13/2023, 5:36 PM
fontStyle == FontStyle.Italic
looks like a check if it’s italic, rather than a hardcoding of it? Where does this code exist?
d

dazza5000

12/13/2023, 5:37 PM
ah - you're right - thank you
i misread it
the code is correct
i don't often see that kind of syntax in codebases so it threw me off
2 Views