Custom fonts stopped working in 1.43

I have an app that uses custom fonts, its currently deployed to Azure using 1.41. I was about to push a new branch today and though it would be good time to update to 1.43 (I wanted that timezone support). I did a pip install --upgrade streamlit in my local venv. When i launched the app under 1.43 my custom font was gone. I used pip to go back to 1.41 and the font was correctly rendered again. When i launched in 1.43 i didn’t get the standard streamlit font, i instead got some ‘Time New Roman -like’ serif font, so i assume its trying to render my custom font but can’t and falling back to the browser default.

My code is:

css_path = 'assets/styles/style.css'
with open(css_path) as css:
        st.markdown(f'<style>{css.read()}</style>', unsafe_allow_html=True)

style.css:

@font-face {
    font-family: 'My Custom Font';
    src: url('../fonts/my_custom_font.otf') format('opentype');
}
h1 {
    font-family: 'My Custom Font', sans-serif !important;
}
h3 {
    font-family: 'My Custom Font', sans-serif !important;
}

Any ideas?

Confirmed that I have the same issue, but it only appears to be a problem in dataframe and data_editor views.

I can also confirm that pinning to 1.42 resolves the issue, so I’ll be doing that for now. Thanks in advance for any guidance, streamlit team, and let me know if you need additional info

You can get the default streamlit font back by adding the following to the config.toml in the streamlit folder in your app directory:

[theme]
font=“Source Sans Pro”

That should help for now, until they fix the bug.

1 Like

Hey there, commenting the line also worked fine for me (same as source sans pro)