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

How to turn off Calligraphy for a specific style/textAppearance/view? #379

Open
TWiStErRob opened this issue Apr 13, 2017 · 1 comment
Open

Comments

@TWiStErRob
Copy link

TWiStErRob commented Apr 13, 2017

The current resolution path doesn't allow for exceptions. If I define the font in the theme to get it across the app, it's not possible to disable it on lower levels (textAppearance, style, view).

<style name="MyTextAppearance" parent="TextAppearance.AppCompat">
    ... other customizations
    <item name="fontPath">fonts/MyFont.ttf</item>
</style>

Which is used in the theme (as shown in #319 (comment)).

I want to be able to say:

<style name="MyTextAppearance.NoCustomFont">
    <item name="fontPath">@null</item>
</style>

<TextView
        android:textAppearance="@style/MyTextAppearance.NoCustomFont"
    />

but this obviously doesn't work, because CalligraphyFactory is using TextUtils.isEmpty to check and fall back to more and more global values.

Would it be possible to include some magic value like fontPath="android:font-family" to break out of font resolution in onViewCreatedInternal and prevent calling applyFontToTextView?

@OsmanYalin
Copy link

OsmanYalin commented Mar 20, 2019

yangjieK gave the trick:

#388 (comment)

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

2 participants