fontfamily doesn't work
FunnyDevs opened this issue · comments
is it normal?
I'm sorry, but you have to be a little bit more specific. If you mean the carbon_fontFamily
attribute, I just checked it and it's working fine for me.
Usually i do
<item name="android:fontFamily">@font/font</item>
<item name="fontFamily">@font/font</item>
carbon_fontFamily
works same as fontFamily
?
@font
resources used as fontFamily
are the feature of AppCompatTextView. Carbon's widgets don't derive after AppCompat, so this feature is not available.
The name fontFamily
is misleading - you're specifying a specific font. I thought about adding support for font resources, but under a different attribute. I would also like it to work on API 14+. The Support Library backports it to API 16 only.
Carbon backports the original attribute, which allows to specify a font family name. Here you can find a question about this attribute and an example: https://stackoverflow.com/questions/12128331/how-to-change-fontfamily-of-textview-in-android
Here's how it works in Carbon:
carbon_fontFamily="sans-serif" // roboto regular
carbon_fontFamily="sans-serif-light" // roboto light
carbon_fontFamily="sans-serif-condensed" // roboto condensed
carbon_fontFamily="sans-serif-black" // roboto black
carbon_fontFamily="sans-serif-thin" // roboto thin
carbon_fontFamily="sans-serif-medium" // roboto medium
Carbon also supports .ttf
and .otf
fonts. To use that feature, paste a file with a font to /assets/carbon
and reference them by name using the carbon_fontPath
attribute.
ok, thank you for explanation
I just added support for font resources to Carbon. I don't like reusing of fontFamily
, so there's a new attribute for that - carbon_font
.
Thanks a lot!! I'll find it in next release 0.15.4?
It's currently in the repo, so if you wish, you can test it using jitpack. I didn't have much time to play with the new changes, so it may still have some bugs. I don't want to release unchecked version to Maven. Here are the instructions: https://jitpack.io/#zieiony/carbon/baefcfb194
I'm also working on a larger update, so the following version may be numbered 0.16.0. It's gonna contain cut and rounded corners like in the new Material Design guidelines: https://material.io/design/material-studies/shrine.html#about-shrine
ok, thank you so much! I'll get it from jitpack