@font-face not functioning properly on mobile devices using Webkit

Struggling with getting @font-face to function properly across various mobile Webkit browsers. So far, it's not working on Safari for iPhone 3GS, default Android 2.2 browser, and Dolphin browser on Android.

Interestingly, it does work seamlessly on all desktop browsers including IE7 to IE9, FF3.5, Safari 4, and Opera.

The fonts and CSS are sourced from FontSquirrel:

@font-face {
    font-family: 'LeagueGothicRegular';
    src: url('../fonts/League_Gothic-webfont.eot');
    src: local('☺'),
        url('../fonts/League_Gothic-webfont.woff') format('woff'),
        url('../fonts/League_Gothic-webfont.ttf') format('truetype'),
        url('../fonts/League_Gothic-webfont.svg#webfontFHzvtkso') format('svg');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'LatinModernRoman10Bold';
    src: url('../fonts/lmroman10-bold-webfont.eot');
    src: local('☺'),
        url('../fonts/lmroman10-bold-webfont.woff') format('woff'),
        url('../fonts/lmroman10-bold-webfont.ttf') format('truetype'),
        url('../fonts/lmroman10-bold-webfont.svg#webfonthCDr6KZk') format('svg');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'LatinModernRoman10BoldItalic';
    src: url('../fonts/lmroman10-bolditalic-webfont.eot');
    src: local('☺'),
        url('../fonts/lmroman10-bolditalic-webfont.woff') format('woff'),
        url('../fonts/lmroman10-bolditalic-webfont.ttf') format('truetype'),
        url('../fonts/lmroman10-bolditalic-webfont.svg#webfontegrLi3sm') format('svg');
    font-weight: normal;
    font-style: normal;
}

Verified the SVG ID in the SVG font source files which all appear to be correct.

Wondering if the issue could be related to letter-spacing rules applied later in the CSS?

Appreciate any insights or suggestions!

Answer №1

After some trial and error, I discovered that the issue was with the syntax. Surprisingly, I found a solution on Twitter:

Fortunately, it worked flawlessly. I tested it across all major browsers, and my fonts displayed correctly, even on Android and iOS.

Now, my CSS looks like this:

@font-face {
    font-family: 'LeagueGothicRegular';
    src: url('../fonts/League_Gothic-webfont.eot#') format('eot'),
        url('../fonts/League_Gothic-webfont.woff') format('woff'),
        url('../fonts/League_Gothic-webfont.ttf') format('truetype'),
        url('../fonts/League_Gothic-webfont.svg#webfontFHzvtkso') format('svg');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'LatinModernRoman10Bold';
    src: url('../fonts/lmroman10-bold-webfont.eot#') format('eot'),
        url('../fonts/lmroman10-bold-webfont.woff') format('woff'),
        url('../fonts/lmroman10-bold-webfont.ttf') format('truetype'),
        url('../fonts/lmroman10-bold-webfont.svg#webfonthCDr6KZk') format('svg');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'LatinModernRoman10BoldItalic';
    src: url('../fonts/lmroman10-bolditalic-webfont.eot#') format('eot'),
        url('../fonts/lmroman10-bolditalic-webfont.woff') format('woff'),
        url('../fonts/lmroman10-bolditalic-webfont.ttf') format('truetype'),
        url('../fonts/lmroman10-bolditalic-webfont.svg#webfontegrLi3sm') format('svg');
    font-weight: normal;
    font-style: normal;
}

I'm relieved to have found a more reliable solution than the emoji hack.

Hopefully, this information proves helpful to someone else!

Answer №2

As per the information available on http://caniuse.com/woff, it appears that Android versions 4.0, 4.1, 4.2, and 4.3 may not fully support woff fonts. To ensure compatibility, it might be necessary to include ttf fonts as well. Interestingly, in my tests on Android 4.1 and 4.2 devices, woff fonts worked fine, while I had to resort to adding tff fonts for Android 4.0.3.

To learn how to download ttf fonts directly from Google, you can refer to this link:

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Bootstrap 4 Tooltip Continues to Show, Appears Unsightly

Can you please execute the following HTML test case in order to help identify a solution for making a Bootstrap 4 tooltip disappear when a button is disabled while the tooltip is hovering over the button? The specific issues I am facing are outlined within ...

Creating a Stylish CSS Table Utilizing DIV Elements: Preventing the Top Row from Scrolling

Utilizing a pure DIV table with the display: table, table-row, table-cell format for styling, I have managed to make the entire table scroll except for the header row. However, I am in search of methods that can prevent the header row (1st row) from scroll ...

How can you achieve a seamless or infinite scrolling effect on a webpage?

My idea is as follows: Imagine a long web page where, instead of the scrolling coming to an abrupt stop when the user reaches the end, I want the page to reload from the bottom and allow the scrolling to continue seamlessly. Specifics Picture this - as ...

Prevent CSS3 columns from reverting back to their original state after being rendered

Utilizing css3 columns, I have created a layout with an unordered list displayed in 3 columns. Each list item contains another list that can be toggled to show or hide by clicking on the title using jQuery. The structure of the html is as follows (with ex ...

Ellipsis not displaying correctly in a paragraph class with text overflow issue

I'm currently tackling a project that prioritizes mobile-first design. While I have a list of elements to work with, I've encountered an issue with one in particular. In this project, I want the "h3" element to always be fully visible for easy re ...

Does vuetify offer a card footer or card deck feature in its designs?

I'm trying to achieve a layout similar to this: https://getbootstrap.com/docs/4.0/components/card/#card-groups https://i.sstatic.net/HxKEh.png The goal is to keep the height of the box consistent even when the description varies Here's my code ...

Nested Recycler View Not Scrolling Properly

Within one Recycler View is another Recycler View that both need to scroll vertically. While the outer Recycler View scrolls properly, the inner Recycler View does not. Here is the code snippet: LinearLayoutManager mLayoutManager = new LinearLayoutManage ...

Creating a dynamic image gallery with varying image dimensions using JavaScript and Bootstrap

Struggling with aligning an image gallery featuring images of varying sizes? I don't want to set the size programmatically as it may not look good on different screens. The additional challenge is dealing with white spaces between images and not knowi ...

Display a custom View (Button) on top of an Android AlertDialog

After setting up an AlertDialog in my app, I am now looking to overlay a View (specifically a floating action button from a library) on top of it. new AlertDialog.Builder(getActivity()) .setTitle("Last Day of School Description") .setMessage(...) .sho ...

Exploring the world of nested selectors in conjunction with Vue.js CSS modules

Can nested css selectors be used with Vue.js css modules? For example, I am trying to scope this css (to avoid affecting child components): .list { ... .item { ... } } The documentation only provides examples without nesting, but is ...

Missing CSS in dynamically loaded content on IE

I have been searching everywhere, but I just can't seem to find a satisfactory answer to this particular question. Whenever I load a few items on the page, they are displayed correctly at first. However, if a user decides to change the language, the ...

What could be causing the disappearance of the border around this `<li>` element?

I am currently redesigning the Kotaku website and facing difficulties in creating a list for the footer. Below is an image illustrating my issue. The 'Popular tags' section has been created using the <ul> and <li> elements, with an & ...

flexible design using flexbox with image overflow and responsive footer

I created a website and utilized flexbox for designing the layout. The page structure is quite simple, consisting of only 3 tags: <header> <section> <footer> [index.html] <html> <head> <link rel="stylesheet" type="t ...

Make sure to have a timer still active even after exiting the unity3d application

Currently working on developing a Unity game with a counter that resets every 5 hours. I am facing a challenge in keeping this timer active even when the application is closed. For example, if it's the first time opening the app, the timer starts at 0 ...

What is the best way to incorporate padding into an Angular mat tooltip?

I've been attempting to enhance the appearance of the tooltip dialog window by adding padding. While adjusting the width and background color was successful, I'm encountering difficulties when it comes to styling the padding: https://i.sstatic.ne ...

Adjust the width of the first image on the slider

On my homepage, I am trying to set a fixed width for the first image in my slider code. Is it possible to achieve this using CSS or HTML? I have attempted to make it work but haven't had any success so far. Below is the current CSS code for my slider: ...

Issue with Bootstrap dropdown menu not closing correctly when clicked on mobile devices

On my Bootstrap website, I have a mobile menu that looks like this: <a class="nav-link" href="#" id="shop_submenu" role="button" data-bs-toggle="dropdown" aria-expanded="true" data-bs-auto-close="true"> Rent Costumes ...

"Exploring the possibility of using an accessibility service to capture a photo in a camera app programmatically through a Bluetooth BLE

I am trying to figure out how to use my Bluetooth (BLE) device to trigger the default camera app to capture a photo or video with a single button click. Many Bluetooth devices, especially those from China, have a feature that allows them to remotely take p ...

Creating unique image control buttons for each image within a div using a combination of CSS and JavaScript

How can I create image control buttons, such as close, resize, and rotate, for each individual image when hovering over it? Each image is contained within a draggable div. I want to display an image control button next to each image. This button should on ...

Display the button if the interstitial Ad has been loaded, otherwise showcase a TextView instead

I am working on implementing a button that will display an AdMob interstitial ad and navigate the user to the next activity upon closing. I want the button to only be visible once the interstitial ad is loaded, and until then, I would like to show a TextVi ...