Is it possible to specify that a text should use t...
# compose
z
Is it possible to specify that a text should use the condensed style, similar to how you might specify its font-weight; or do I need to specify a completely different TextStyle which points to the condensed variant?
a
sans-serif-condensed
is a different font family. Using a custom system font family isn't possible using public API now (issue). If you are ok with using internal API, you can use:
Copy code
@Suppress("INVISIBLE_MEMBER")
GenericFontFamily("sans-serif-condensed")
z
Id like to use a custom font familys condensed variant, to make things worse blob sweat smile
a
You mean your own font? That is actually much easier, as you can just create another font family.
z
Yeah, Im using OpenSans. I guess Ill need to create a separate FontFamily with the condensed variant, and specify it either in a TextStyle, or directly in the fontFamily parameter in Text?
a
Yes.
z
Gotcha 👍🏽 Thank you. Its not perfect, but Ill take it!
a
Well this is how font works on all platforms. Fonts in a family only differ in font weights and styles(normal/italic/oblique). Width is not one of these.
z
I wasnt aware of that, thinking about it though - thats what youre doing in XML as well, I just never thought about it that way.