Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

@font-face declarations don't work in Android 4.3 Internet browser?

My Samsung Galaxy S3 phone recently upgraded from Android 4.1.3 to Android 4.3. Now several websites I designed which I tested in the Android internet browser are not displaying fonts I have declared with @font-face. What do I need to do to fix this?

One of the sites (development version): http://beta.kdfansite.com

Here is some of the related CSS for Open Sans:

@font-face {
    font-family: 'OpenSansSemibold';
    src: url('http://beta.kdfansite.com/wp-content/themes/scrollider/scrollider/webfonts/Open-Sans/OpenSans-Semibold-webfont.eot');
    src: url('http://beta.kdfansite.com/wp-content/themes/scrollider/scrollider/webfonts/Open-Sans/OpenSans-Semibold-webfont.eot?#iefix') format('embedded-opentype'),
         url('http://beta.kdfansite.com/wp-content/themes/scrollider/scrollider/webfonts/Open-Sans/OpenSans-Semibold-webfont.woff') format('woff'),
         url('http://beta.kdfansite.com/wp-content/themes/scrollider/scrollider/webfonts/Open-Sans/OpenSans-Semibold-webfont.ttf') format('truetype'),
         url('http://beta.kdfansite.com/wp-content/themes/scrollider/scrollider/webfonts/Open-Sans/OpenSans-Semibold-webfont.svg#OpenSansSemibold') format('svg');
    font-weight: normal;
    font-style: normal;
}

/* ... */

h2 {
    font-family: 'OpenSansSemibold', Arial, sans-serif;
    /* ... */
}

Each font I use on the site is declared in a similar way. The Great Vibes declaration (also in custom.css) for the "enjoy your ride" message is another one to compare. All fonts display properly in Chrome for Android and Firefox for Android on the same device, but not in Android Internet.

I need to finalize this CSS as soon as possible and am working on this project as a volunteer (not paid). So I am looking for a quick fix rather than a code review. I'm also a UX designer, not a web developer. Thanks in advance.

Edit: I did some additional debugging today in Edge Inspect CC and weinre, connecting both my Android phone and my iPad to my laptop. In Weinre, I am able to change the font families on the iPad but not on the phone. I can change the font colors on both devices. So it appears the underlying issue is related to the fact that I can't change the fonts off of the defaults when I use a remote debugger.

like image 866
David Avatar asked Jan 02 '14 19:01

David


3 Answers

I have the same issue here how i solve it.

I only use svg on mobile with media queries.

@media only screen and (max-width: 320px) {
@font-face {
    font-family: 'open_sansbold';
    src: url('OpenSans-Bold-webfont.svg#open_sansbold') format('svg');
    font-weight: normal;
    font-style: normal;
}
}
@media only screen and (max-device-width: 720px) and (orientation:portrait) {
    @font-face {
        font-family: 'open_sansbold';
        src: url('OpenSans-Bold-webfont.svg#open_sansbold') format('svg');
        font-weight: normal;
        font-style: normal;
    }

}
@media only screen and (max-device-width: 1280px) and (orientation:landscape) {
    @font-face {
        font-family: 'open_sansbold';
        src: url('OpenSans-Bold-webfont.svg#open_sansbold') format('svg');
        font-weight: normal;
        font-style: normal;
    }
}

Hope it's help you.

like image 69
Beauceron Avatar answered Sep 19 '22 08:09

Beauceron


We were running into a similar issue, and it was caused by our use of text-rendering: optimizeLegibility - removing that from our CSS made our fonts start working on 4.3 again.

like image 38
BenV Avatar answered Sep 20 '22 08:09

BenV


I create jsfiddle with only svg and woff fonts and test it on my Android 4.3 device in default browser. All works.

I just remove all unnecessary fonts for mobile. All mobile supports svg fonts, FF and IE10 needs woff. So you can use media queries for separate font-face defenition: for mobile and for desktop.

If you need all types of fonts check your Content-Type header for font files, it's always text/plain which is wrong:

  • eot has application/vnd.ms-fontobject type
  • otf and ttf have application/octet-stream type
  • woff has application/font-woff type
  • svg has image/svg+xml type

Also check this page to read known common problems with font face.

like image 35
Pinal Avatar answered Sep 18 '22 08:09

Pinal