question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Custom Fonts not loaded, default font loaded

See original GitHub issue

I have defined the default font which loads fine:

        CalligraphyConfig.initDefault("fonts/Roboto-Regular.ttf", R.attr.fontPath);

and also:

    @Override
    protected void attachBaseContext(Context newBase) {
        super.attachBaseContext(new CalligraphyContextWrapper(newBase));
    }

This works fine. The Roboto-Regular font is then applied.

I am then trying to set a custom font to a TextView, however it doesn’t get loaded:

<TextView
   android:id="@+id/titleDrawer"
   android:layout_width="match_parent"
   android:layout_height="wrap_content"
   fontPath="fonts/Roboto-LightItalic.ttf"
   android:textColor="@color/white"
   android:textSize="18sp"
 />

No build issues or comments in the log.

What’s strange is, I looked at my app before and the custom font was loaded. I didn’t change any code, went to rebuild my app and now the custom fonts have gone. Not really sure what’s happening here!

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
chrisjenxcommented, Oct 18, 2014

Closing. If you still have an issue please re-open, thanks.

0reactions
chrisjenxcommented, Sep 2, 2014

@greghesp Did you manage to get this working?

Read more comments on GitHub >

github_iconTop Results From Across the Web

How To Load and Use Custom Fonts with CSS | DigitalOcean
You can use the @font-face rule to load a custom font on a web page. The history of loading custom fonts has lead...
Read more >
A New Way To Reduce Font Loading Impact: CSS Font ...
Web fonts are often terrible for web performance and none of the font loading strategies are particularly effective to address that.
Read more >
Custom font not loading in CSS font-face - Stack Overflow
So I have a production project in laravel. The problem I'm facing is when I upload custom font to ...
Read more >
How to load web fonts to avoid performance issues and speed ...
If text is still not ready, it will use a system font until the custom font is ready. Safari hides text until the...
Read more >
The Best Font Loading Strategies and How to Execute Them
We only show the text when web fonts are loaded. FOUT means flash of unstyled text. When web fonts are loading, we show...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found