Reputation: 18183
I can see from the Material UI documentation that the user is responsible for loading the Roboto font :
I tried one of their example projects (the vitejs one). I can't see any loading of the Roboto font in this project.
When starting it using npm run dev
, I can see the text is correctly displayed with the Roboto font despite the fact that I can't see any trace of this font in the index HTML page.
I didn't see any <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap"/>
in the header. I also tried to find any @font-face
in the inline styles without any success.
I'm wondering where does the Roboto font come from? Is it included by default in modern computers (I'm currently using Firefox on a Ubuntu laptop) ?
Upvotes: 1
Views: 3297
Reputation: 13462
No -- you do need to install the Roboto font to use MUI, since it is configured with fallbacks (and you can override the Roboto usage globally), but if you want to conform to the used version of Google's Material Design guidelines or have a more consistent cross-platform UI, you may want to.
What you're most likely seeing is the fallback font (your system's version of Helvetica or another sans serif font, if Roboto is not installed locally). They do look somewhat similar, but upon closer inspection of the subtleties, you can see that the fonts differ. (Rounding, spacing, etc.)
CodeSandbox - MUI with Roboto loaded
CodeSandbox - MUI without Roboto loaded
As far as I'm aware, Android is the only OS where Roboto is a pre-installed font.
Not installed by default:
(I couldn't reasonably find a list of Ubuntu pre-installed fonts)
On Firefox the rendered (used) font can be seen by inspecting an element, then viewing the "Fonts Used" section of the "Fonts" panel.
On Chrome the rendered (used) font can be seen by inspecting an element, then viewing the "Rendered Fonts" section of the "Computed" tab.
Fun side note -- Firefox used to have quite a few font loading/rendering problems which is why I still have trust issues using Firefox for dev.
Upvotes: 3