Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

@Font-face not working on mobile

Here's my code it works perfectly fine on desktop and tablet but not on mobile. Is it the code or do some fonts just not work on mobile

@font-face {
    font-family: 'Out';
    src: url('http://location/Outstanding.otf');
}
like image 594
Reece Avatar asked Apr 10 '17 15:04

Reece


People also ask

Is font face deprecated?

According to Apple's documentation, @font-face is deprecated for use on the iPhone version of Safari.

How do I use Google Fonts face?

Google Fonts provides free fonts to use in an HTML file with the <link> tag or the @font-face property in CSS. Add local fonts to a document with @font-face and the path to the font's source. Then use the named font-family rules as you please (along with a web-safe fallback font), and you're good to go!

How do I change my font face?

You can use a <basefont> tag to set all of your text to the same size, face, and color. The font tag is having three attributes called size, color, and face to customize your fonts. To change any of the font attributes at any time within your webpage, simply use the <font> tag.

Does Gmail support font face?

Gmail does not support @font-face. Note: must be a font we have natively on Windows or Mac.


2 Answers

You need to add all src needed to @font-face like this example:

@font-face {
  font-family: 'MyWebFont';
  src: url('webfont.eot'); /* IE9 Compat Modes */
  src: url('webfont.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
       url('webfont.woff2') format('woff2'), /* Super Modern Browsers */
       url('webfont.woff') format('woff'), /* Pretty Modern Browsers */
       url('webfont.ttf')  format('truetype'), /* Safari, Android, iOS */
       url('webfont.svg#svgFontName') format('svg'); /* Legacy iOS */
}

Source: https://css-tricks.com/snippets/css/using-font-face/
Hope it helps, cheers.

(If you need to convert the font you gonna need this font-generator )

like image 96
Roy Bogado Avatar answered Oct 12 '22 12:10

Roy Bogado


You haven't included (assuming you have them) all the necessary font files:

@font-face {
  font-family: 'Out';
  src: url('out.eot'); /* IE9 Compat Modes */
  src: url('out.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
       url('out.woff2') format('woff2'), /* Super Modern Browsers */
       url('out.woff') format('woff'), /* Pretty Modern Browsers */
       url('out.ttf')  format('truetype'), /* Safari, Android, iOS */
       url('out.svg#svgFontName') format('svg'); /* Legacy iOS */
}

So *.ttf is missing for Safari/IOS etc.

like image 36
Dan Avatar answered Oct 12 '22 12:10

Dan