Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Font is not being applied #9

Open
jrcacd opened this issue Mar 20, 2018 · 2 comments
Open

Font is not being applied #9

jrcacd opened this issue Mar 20, 2018 · 2 comments

Comments

@jrcacd
Copy link

jrcacd commented Mar 20, 2018

Kotlin:

val texto = Spanner()
texto.append(text, font("Roboto Slab"))

It must be my mistake.

@neworld
Copy link
Owner

neworld commented Mar 21, 2018

Probably, Android doesn't support this font family. This lib is a just simple wrapper for android spans. This font(...) is using TypefaceSpan. I don't think there are a solution through spans. You could try to apply this font directly to the TextView, or try this lib: https://github.com/johnkil/Android-RobotoTextView

@taila-teq
Copy link

taila-teq commented Jul 14, 2020

Kotlin:

val texto = Spanner()
texto.append(text, font("Roboto Slab"))

It must be my mistake.

You can define your Font Family in package Font and it will work.

Example:
<?xml version="1.0" encoding="utf-8"?>
<font-family xmlns:app="http://schemas.android.com/apk/res-auto">
//Regular
<font
app:font="@font/Roboto Slab"
app:fontStyle="normal"
app:fontWeight="400" />
//Bold
<font
app:font="@font/Roboto Slab"
app:fontStyle="normal"
app:fontWeight="700" />

Then:
//It will use Roboto Slab with font weight 700
texto.append(text, font("Roboto Slab"), bold())

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants