Skip to content

Instantly share code, notes, and snippets.

@joshje
Created June 21, 2012 11:02
Show Gist options
  • Save joshje/2965134 to your computer and use it in GitHub Desktop.
Save joshje/2965134 to your computer and use it in GitHub Desktop.

Revisions

  1. joshje revised this gist Jun 21, 2012. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions supportsFFS.html
    Original file line number Diff line number Diff line change
    @@ -28,6 +28,7 @@
    var controlWidth = span.offsetWidth;
    span.className += ' test';
    var testWidth = span.offsetWidth;
    document.getElementsByTagName('html')[0].removeChild(span);
    return (controlWidth != testWidth)? true : false;
    }
    document.write(supportsFFS()? 'I support font-feature-settings :-)' : 'I don‘t support font-feature settings :-(');
  2. joshje created this gist Jun 21, 2012.
    38 changes: 38 additions & 0 deletions supportsFFS.html
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,38 @@
    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="utf-8">
    <title>Opentype Test</title>
    <style>
    span.opentype-test {
    font-family: Corbel;
    font-size: 100px;
    position: absolute;
    visibility: hidden;
    }
    span.opentype-test.test {
    -moz-font-feature-settings: 'tnum=1';
    -webkit-font-feature-settings: 'tnum' 1;
    -moz-font-feature-settings: 'tnum' 1;
    -ms-font-feature-settings: 'tnum' 1;
    -o-font-feature-settings: 'tnum' 1;
    font-feature-settings: 'tnum' 1;
    }
    </style>
    <script>
    supportsFFS = function() {
    var span = document.createElement('span');
    span.appendChild(document.createTextNode('1'));
    span.className = 'opentype-test';
    document.getElementsByTagName('html')[0].appendChild(span);
    var controlWidth = span.offsetWidth;
    span.className += ' test';
    var testWidth = span.offsetWidth;
    return (controlWidth != testWidth)? true : false;
    }
    document.write(supportsFFS()? 'I support font-feature-settings :-)' : 'I don&lsquo;t support font-feature settings :-(');
    </script>
    </head>
    <body>
    </body>
    </html>