UNPKG

modernizr

Version:

Modernizr is a JavaScript library that detects HTML5 and CSS3 features in the user’s browser.

34 lines (33 loc) 950 B
/*! { "name": "CSS Subpixel Fonts", "property": "subpixelfont", "tags": ["css"], "builderAliases": ["css_subpixelfont"], "authors": [ "@derSchepp", "@gerritvanaaken", "@rodneyrehm", "@yatil", "@ryanseddon" ], "notes": [{ "name": "Origin Test", "href": "https://github.com/gerritvanaaken/subpixeldetect" }] } !*/ define(['Modernizr', 'testStyles'], function(Modernizr, testStyles) { /* * (to infer if GDI or DirectWrite is used on Windows) */ testStyles( '#modernizr{position: absolute; top: -10em; visibility:hidden; font: normal 10px arial;}#subpixel{float: left; font-size: 33.3333%;}', function(elem) { var subpixel = elem.firstChild; subpixel.innerHTML = 'This is a text written in Arial'; Modernizr.addTest('subpixelfont', window.getComputedStyle ? window.getComputedStyle(subpixel, null).getPropertyValue('width') !== '44px' : false); }, 1, ['subpixel']); });