Pomax / lib-font

This library adds a new Font() object to the JavaScript toolbox, similar to new Image() for images
MIT License
734 stars 72 forks source link

trouble with remote icon font #25

Closed toddgeist closed 4 years ago

toddgeist commented 10 years ago

Hello,

Does font.js work with icon fonts?

I am trying to use Font.js to detect if a remote icon font is loaded or not. The font family is "Ionicons" and I am loading it through a stylesheet. I know that the font is getting loaded, because the glyph icon is showing up. But Font.js never detects that it is loaded.

Any ideas?

Here is the test case.

<!doctype html>
<html lang="us">
<head>
    <meta charset="utf-8">
    <link href="http://code.ionicframework.com/ionicons/1.5.2/css/ionicons.min.css" rel="stylesheet" type="text/css">
</head>
<script src="Font.js"></script>

<script>
    var font = new Font();
    font.onload = function(){
        console.log("loaded");
    };
    font.fontFamily = "Ionicons"
    font.src = font.fontFamily;
</script>
<!-- this does display the correct character -->
<i class="ion-arrow-right-a"></i>=
</body>
</html>
Pomax commented 4 years ago

probably obsolete with the 2019 rewrite =P