material icon indicating copy to clipboard operation
material copied to clipboard

Override Roboto font with provider

Open ByJC opened this issue 10 years ago • 6 comments

Hi everyone,

I wanted to know if there is a way to override completely the default font Roboto ? I looked for a provider to configure the default font but it seems that the font-familly attribute is hard-coded in the scss.

Could we imagine such a service ? I know that material design specifies only Roboto and Noto but it could be a great feature. if not do you have a way to do so in my app ? (override css md-* {} etc ... ? )

Bye.

ByJC avatar Jan 06 '16 14:01 ByJC

Anybody ?

sderosiaux avatar Jan 11 '16 09:01 sderosiaux

Just include a font-family override in your application stylesheets, which need to be included in your build after your Angular Material dependencies. This is what I use and haven't had any issues:

body {
  font-family: "Comic Sans MS";
}

input,
button,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
}

Demo: http://codepen.io/mattdanna/pen/pgwVzX

And don't worry, I'm not actually using Comic Sans in my app... ;)

mattdanna avatar Jan 12 '16 08:01 mattdanna

Hi @mattdanna ! Thank you for your reply and the codepen. Currently that is what I did in my app and it works pretty well. I was just looking for another way to handle thing.

ByJC avatar Jan 12 '16 08:01 ByJC

The codepen with Comic Sans MS is awesome!

shprink avatar Jan 13 '16 03:01 shprink

button,select,html,textarea,input,md-bottom-sheet .md-subheader,.md-chips{ font-family: Roboto, "Helvetica Neue", sans-serif; } *:not(.fa){ font-family: BrandonRegular,sans-serif !important; }

sujithsj avatar Jul 16 '16 09:07 sujithsj

No font family variable to change it at compile time ? It's better to avoid !important annotations...

maximelafarie avatar Jul 26 '17 08:07 maximelafarie