material-components / material-components-android-compose-theme-adapter

A library that enables reuse of Material themes defined in XML for theming in Jetpack Compose.
https://material-components.github.io/material-components-android-compose-theme-adapter/
Apache License 2.0
415 stars 40 forks source link

Can not use serif-monospace #80

Closed wiryadev closed 3 years ago

wiryadev commented 3 years ago

MDC Adapter can not display serif-monospace, but works with other fontFamily like monospace and sans-serif-black.

Monospace Sans Serif Black

And here is Serif Monospace in Compose and Views XML:

Compose with MDC Views XML (how it should looks like)


The fact that it doesnt exist in google fonts make it harder to use this font manually in Compose:

image

Additional Info Sample app to reproduce that is available here.

ricknout commented 3 years ago

Compose currently only supports a subset of the fontFamily constants, and serif-monospace is unfortunately not one of them: https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/font/FontFamily.kt;l=31

Also see the TODO in this library: https://github.com/material-components/material-components-android-compose-theme-adapter/blob/develop/lib/src/main/java/com/google/android/material/composethemeadapter/TypedArrayUtils.kt#L216

wiryadev commented 3 years ago

Understood, thanks for explanation