dist/crocodoc.viewer.js
function isSubpixelRenderingSupported() {
        // Test if subpixel rendering is supported
        // @NOTE: jQuery.support.leadingWhitespace is apparently false if browser is IE6-8
        if (!$.support.leadingWhitespace) {
            return false;
        } else {
            //span #1 - desired font-size: 12.5px
            var span = $(util.template(TEST_SPAN_TEMPLATE, { size: 12.5 }))
                .appendTo(document.documentElement).get(0);
            var fontsize1 = $(span).css('font-size');
            var width1 = $(span).width();
            $(span).remove();

            //span #2 - desired font-size: 12.6px
            span = $(util.template(TEST_SPAN_TEMPLATE, { size: 12.6 }))
                .appendTo(document.documentElement).get(0);
            var fontsize2 = $(span).css('font-size');
            var width2 = $(span).width();
            $(span).remove();

            // is not mobile device?
            // @NOTE(plai): Mobile WebKit supports subpixel rendering even though the browser fails the following tests.
            // @NOTE(plai): When modifying these tests, make sure that these tests will work even when the browser zoom is changed.
            // @TODO(plai): Find a better way of testing for mobile Safari.
            if (!('ontouchstart' in window)) {

                //font sizes are the same? (Chrome and Safari will fail this)
                if (fontsize1 === fontsize2) {
                    return false;
                }

                //widths are the same? (Firefox on Windows without GPU will fail this)
                if (width1 === width2) {
                    return false;
                }
            }
        }

        return true;
    }
function isSubpixelRenderingSupported() {
        // Test if subpixel rendering is supported
        // @NOTE: jQuery.support.leadingWhitespace is apparently false if browser is IE6-8
        if (!$.support.leadingWhitespace) {
            return false;
        } else {
            //span #1 - desired font-size: 12.5px
            var span = $(util.template(TEST_SPAN_TEMPLATE, { size: 12.5 }))
                .appendTo(document.documentElement).get(0);
            var fontsize1 = $(span).css('font-size');
            var width1 = $(span).width();
            $(span).remove();

            //span #2 - desired font-size: 12.6px
            span = $(util.template(TEST_SPAN_TEMPLATE, { size: 12.6 }))
                .appendTo(document.documentElement).get(0);
            var fontsize2 = $(span).css('font-size');
            var width2 = $(span).width();
            $(span).remove();

            // is not mobile device?
            // @NOTE(plai): Mobile WebKit supports subpixel rendering even though the browser fails the following tests.
            // @NOTE(plai): When modifying these tests, make sure that these tests will work even when the browser zoom is changed.
            // @TODO(plai): Find a better way of testing for mobile Safari.
            if (!('ontouchstart' in window)) {

                //font sizes are the same? (Chrome and Safari will fail this)
                if (fontsize1 === fontsize2) {
                    return false;
                }

                //widths are the same? (Firefox on Windows without GPU will fail this)
                if (width1 === width2) {
                    return false;
                }
            }
        }

        return true;
    }
function isSubpixelRenderingSupported ( ) { // Test if subpixel rendering is supported // @NOTE: jQuery.support.leadingWhitespace is apparently false if browser is IE6-8 if ( ! $ . support . leadingWhitespace ) { return false ; } else { //span #1 - desired font-size: 12.5px var span = $ ( util . template ( TEST_SPAN_TEMPLATE , { size : 12.5 } ) ) . appendTo ( document . documentElement ) . get ( 0 ) ; var fontsize1 = $ ( span ) . css ( 'font-size' ) ; var width1 = $ ( span ) . width ( ) ; $ ( span ) . remove ( ) ; //span #2 - desired font-size: 12.6px span = $ ( util . template ( TEST_SPAN_TEMPLATE , { size : 12.6 } ) ) . appendTo ( document . documentElement ) . get ( 0 ) ; var fontsize2 = $ ( span ) . css ( 'font-size' ) ; var width2 = $ ( span ) . width ( ) ; $ ( span ) . remove ( ) ; // is not mobile device? // @NOTE(plai): Mobile WebKit supports subpixel rendering even though the browser fails the following tests. // @NOTE(plai): When modifying these tests, make sure that these tests will work even when the browser zoom is changed. // @TODO(plai): Find a better way of testing for mobile Safari. if ( ! ( 'ontouchstart' in window ) ) { //font sizes are the same? (Chrome and Safari will fail this) if ( fontsize1 === fontsize2 ) { return false ; } //widths are the same? (Firefox on Windows without GPU will fail this) if ( width1 === width2 ) { return false ; } } } return true ; }
Return true if subpixel rendering is supported
@returns {Boolean}
@private
Return true if subpixel rendering is supported