Google Web Fonts don't load in Chrome for iOS

12,223

Solution 1

I'm seeing the same issue. Hosting the font files on my own server and rewriting the @font-face rules to match solved the issue for me, both with my local dev server and in prod.

I don't know the cause; my best guess would be some same-origin issue that's enforced differently in UIWebViews (iOS Chrome being a UIWebView due to App Store rules).

Solution 2

IOS devices use TTF formats only (or OTF if they follow the developer guidelines below). That font is being served as WOFF, EOT and OTF (assumably not following the guidelines) . There are some services that will give you other versions. Try specifying the font using @font-face and see if that fixes the issue! Fontsquirrel has an @font-face generator to do the heavy lifting.

In regards to the follow up question. There are some developer documentation from Apple on their implementation of TrueType Fonts. It can be found here. Essentially, TTF formats store the font as sfnt resources. The only other font format that can do this is OpenType's offset table sfnt wrapper. Because IOS reads fonts using sfnt wrappers, you will run into issues with fonts that are not stored in this way. (Sorry for all the jargonny talk).

Solution 3

You can use the Google Fonts API Loader which will detect the user's browser and send back appropriately formatted CSS.

Sample code is available in the first response on this Stack Overflow question.

This will allow both Safari and Chrome (and other UIWebView-based browsers) to display the font correctly.

Note: if you want to store the fonts locally, as @Dave suggested, this CSS should work.

Solution 4

In the CSS you may use

!important

Example:

@font-face {
  font-family: 'Monda' !important;
  font-style: normal !important;
  font-weight: 400 !important;
  src: local('Monda Regular'), local('Monda-Regular'), url(http://themes.googleusercontent.com/static/fonts/monda/v1/sk05J8GA1NvUxDnk43EgAQ.woff) format('woff') !important;
}
Share:
12,223
andrewpthorp
Author by

andrewpthorp

Rubyist, rails, HTML, and js developer. I desire to be an 80 percenter (www.handcraftedcss.com)

Updated on June 17, 2022

Comments

  • andrewpthorp
    andrewpthorp almost 2 years

    When I use Google Webfonts, they load fine on every browser I care about, EXCEPT Chrome/iOS. This seems odd, as it works fine on Chrome for Mac and Safari for iOS, so I don't think it's an iOS problem or a Google Chrome problem. It seems to be specific to Chrome/iOS.

    Any ideas, or ideas on HOW to troubleshoot this, would be great!

    Thanks!

    EDIT

    I am using Google Web Fonts hosted on Google, with the following:

    <link href="http://fonts.googleapis.com/css?family=Leckerli+One" rel="stylesheet" type="text/css" />
    

    In my font (SASS), I am using the following:

    h1
      font-family: "Leckerli One", cursive