GitHub user VasilijeBursac edited a discussion: Recommended approach to add 
custom fonts with the new theming system and frontend structure

Hi everyone,

I'm customizing the Superset UI and I’d like to add custom fonts so that they 
can be used globally via the `fontFamily` Ant Design token in the theme JSON 
(within general and dashboard themes).

I’ve found older threads suggesting the use of `fonts.less` or similar 
approaches, such as the one shown in the image below:
<img width="2606" height="1384" alt="Screenshot 2023-08-11 at 16 21 51" 
src="https://github.com/user-attachments/assets/842df85e-da98-4778-b5ce-443fb3af9e6a";
 />

**Since Superset is moving away from LESS and global CSS toward Ant Design v5 
tokens and more JS-based theming, I’d like to ask:**
- What is the most future-proof and currently recommended way to load and 
register custom fonts so they can be used in Ant Design  `fontFamily` tokens 
across all components?
- Can this be done without maintaining a custom fork of Superset's frontend?
- If some changes to the frontend code are unavoidable, what’s the minimal set 
of modifications needed?
- Ideally, I want a solution that can be easily integrated into multiple 
Superset projects with minimal additional work.


I'd be very thankful if both cases could be explained, i.e.:
- Hosting fonts locally, e.g., placing font files in `/static/assets/fonts/`
- Loading fonts from external sources, such as Google Fonts CDN or using the 
@fontsource package.
Where would the imports ideally go in each case? For example, is `Theme.tsx` 
the right place to load them globally?

I’d really appreciate clarification or confirmation on the best practice, 
especially regarding how Superset expects custom fonts to be loaded in this new 
setup. 

Apologies if tagging is inappropriate, but I've seen the following folks be 
especially active in theming and frontend customization PRs, so I hope it’s 
okay to mention you for insights: @gabotorresruiz @msyavuz @eschutho @geido 
@mistercrunch @rusackas @EnxDev 

Thanks in advance for your time and help.
Best regards!

GitHub link: https://github.com/apache/superset/discussions/34397

----
This is an automatically sent email for notifications@superset.apache.org.
To unsubscribe, please send an email to: 
notifications-unsubscr...@superset.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org
For additional commands, e-mail: notifications-h...@superset.apache.org

Reply via email to