Last active
August 29, 2015 14:02
-
-
Save brettz9/1f061bb2ce06368db3e5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://www.quirksmode.org/js/detect.html | |
var BrowserDetect = { | |
init: function () { | |
this.browser = this.searchString(this.dataBrowser) || "An unknown browser"; | |
this.version = this.searchVersion(navigator.userAgent) | |
|| this.searchVersion(navigator.appVersion) | |
|| "an unknown version"; | |
this.OS = this.searchString(this.dataOS) || "an unknown OS"; | |
}, | |
searchString: function (data) { | |
for (var i=0;i<data.length;i++) { | |
var dataString = data[i].string; | |
var dataProp = data[i].prop; | |
this.versionSearchString = data[i].versionSearch || data[i].identity; | |
if (dataString) { | |
if (dataString.indexOf(data[i].subString) != -1) | |
return data[i].identity; | |
} | |
else if (dataProp) | |
return data[i].identity; | |
} | |
}, | |
searchVersion: function (dataString) { | |
var index = dataString.indexOf(this.versionSearchString); | |
if (index == -1) return; | |
return parseFloat(dataString.substring(index+this.versionSearchString.length+1)); | |
}, | |
dataBrowser: [ | |
{ | |
string: navigator.userAgent, | |
subString: "Chrome", | |
identity: "Chrome" | |
}, | |
{ string: navigator.userAgent, | |
subString: "OmniWeb", | |
versionSearch: "OmniWeb/", | |
identity: "OmniWeb" | |
}, | |
{ | |
string: navigator.vendor, | |
subString: "Apple", | |
identity: "Safari", | |
versionSearch: "Version" | |
}, | |
{ | |
prop: window.opera, | |
identity: "Opera", | |
versionSearch: "Version" | |
}, | |
{ | |
string: navigator.vendor, | |
subString: "iCab", | |
identity: "iCab" | |
}, | |
{ | |
string: navigator.vendor, | |
subString: "KDE", | |
identity: "Konqueror" | |
}, | |
{ | |
string: navigator.userAgent, | |
subString: "Firefox", | |
identity: "Firefox" | |
}, | |
{ | |
string: navigator.vendor, | |
subString: "Camino", | |
identity: "Camino" | |
}, | |
{ // for newer Netscapes (6+) | |
string: navigator.userAgent, | |
subString: "Netscape", | |
identity: "Netscape" | |
}, | |
{ | |
string: navigator.userAgent, | |
subString: "MSIE", | |
identity: "Explorer", | |
versionSearch: "MSIE" | |
}, | |
{ | |
string: navigator.userAgent, | |
subString: "Gecko", | |
identity: "Mozilla", | |
versionSearch: "rv" | |
}, | |
{ // for older Netscapes (4-) | |
string: navigator.userAgent, | |
subString: "Mozilla", | |
identity: "Netscape", | |
versionSearch: "Mozilla" | |
} | |
], | |
dataOS : [ | |
{ | |
string: navigator.platform, | |
subString: "Win", | |
identity: "Windows" | |
}, | |
{ | |
string: navigator.platform, | |
subString: "Mac", | |
identity: "Mac" | |
}, | |
{ | |
string: navigator.userAgent, | |
subString: "iPhone", | |
identity: "iPhone/iPod" | |
}, | |
{ | |
string: navigator.platform, | |
subString: "Linux", | |
identity: "Linux" | |
} | |
] | |
}; | |
BrowserDetect.init(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html><head><meta charset="utf-8" /> | |
<script src="BrowserDetect.js"></script> | |
<script src="character-in-font.js"></script></head><body> | |
<canvas width="27" height="27" id="testCanvas"></canvas> | |
<script> | |
function write (html) { | |
document.write(html); | |
} | |
function cell (data) { | |
write('<td>' + data + '</td>'); | |
} | |
function row (cell1, cell2) { | |
write('<tr>'); | |
cell(cell1); | |
cell(cell2); | |
write('</tr>'); | |
} | |
var fontInfo = { | |
Arial: [ | |
['a', true], | |
['\uFAFA', false], | |
['\uF2FC', false] | |
] | |
}; | |
/*! http://mths.be/fromcodepoint v0.1.0 by @mathias */ | |
if (!String.fromCodePoint) { | |
(function() { | |
var defineProperty = (function() { | |
// IE 8 only supports `Object.defineProperty` on DOM elements | |
try { | |
var object = {}; | |
var $defineProperty = Object.defineProperty; | |
var result = $defineProperty(object, object, object) && $defineProperty; | |
} catch(error) {} | |
return result; | |
}()); | |
var stringFromCharCode = String.fromCharCode; | |
var floor = Math.floor; | |
var fromCodePoint = function() { | |
var MAX_SIZE = 0x4000; | |
var codeUnits = []; | |
var highSurrogate; | |
var lowSurrogate; | |
var index = -1; | |
var length = arguments.length; | |
if (!length) { | |
return ''; | |
} | |
var result = ''; | |
while (++index < length) { | |
var codePoint = Number(arguments[index]); | |
if ( | |
!isFinite(codePoint) || // `NaN`, `+Infinity`, or `-Infinity` | |
codePoint < 0 || // not a valid Unicode code point | |
codePoint > 0x10FFFF || // not a valid Unicode code point | |
floor(codePoint) != codePoint // not an integer | |
) { | |
throw RangeError('Invalid code point: ' + codePoint); | |
} | |
if (codePoint <= 0xFFFF) { // BMP code point | |
codeUnits.push(codePoint); | |
} else { // Astral code point; split in surrogate halves | |
// http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae | |
codePoint -= 0x10000; | |
highSurrogate = (codePoint >> 10) + 0xD800; | |
lowSurrogate = (codePoint % 0x400) + 0xDC00; | |
codeUnits.push(highSurrogate, lowSurrogate); | |
} | |
if (index + 1 == length || codeUnits.length > MAX_SIZE) { | |
result += stringFromCharCode.apply(null, codeUnits); | |
codeUnits.length = 0; | |
} | |
} | |
return result; | |
}; | |
if (defineProperty) { | |
defineProperty(String, 'fromCodePoint', { | |
'value': fromCodePoint, | |
'configurable': true, | |
'writable': true | |
}); | |
} else { | |
String.fromCodePoint = fromCodePoint; | |
} | |
}()); | |
} | |
/* | |
var c = document.getElementById('testCanvas'); | |
var ctx = c.getContext('2d'); | |
var imgData = ctx.createImageData(27, 27); | |
imgData.data.set(new Uint8ClampedArray([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,184,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,60,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])); | |
ctx.putImageData(imgData, 0, 0); | |
throw ''; | |
*/ | |
var s = ''; | |
var unit = 10000; | |
//var start = unit*0; | |
//end = start + 10000; | |
var start = 0x0D3A; | |
var end = 0x0D3A; | |
for (var i = start; i <= end; i++) { | |
var chr = String.fromCodePoint(i); | |
var result = characterInFont(chr, 'Arial'); | |
if (!result) { | |
write('<b style="color:red">false</b>'); | |
throw ''; | |
} | |
s += (chr + '::' + result + '<br>'); | |
} | |
write('ok'); | |
write(s); | |
/* | |
Object.keys(fontInfo).forEach(function (font) { | |
write('<table border="1" style="font-family:' + font + '"><caption>'+ font +'</caption><th>Character</th><th>Detected correctly?</th></th>'); | |
fontInfo[font].forEach(function (chrInfo) { | |
var chr = chrInfo[0], expected = chrInfo[1]; | |
row(chr, expected === characterInFont(chr, font)); | |
}); | |
write('</table>'); | |
}); | |
*/ | |
</script> | |
</body></html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*globals BrowserDetect, exports, document*/ | |
/*jslint vars:true*/ | |
// Not sure whether it can be relied upon going forward (browsers might change what is shown for unsupported characters), nor am I sure that this is optimized (as I don't have a good understanding of the ideal boundaries to measure here), but the following approach (of drawing text in canvas and inspecting the result as an image) may, if reviewed, provide a more reliable and accurate check than could checking the width. All of the code in the beginning is just browser detection which we must use since feature detection is not possible. | |
(function () {'use strict'; | |
/** | |
* Checks whether a given character is supported in the specified font. If the | |
* font argument is not provided, it will default to sans-serif, the default | |
* of the canvas element | |
* @param {String} chr Character to check for support | |
* @param {String} [font=sans-serif] Font | |
* @returns {Boolean} Whether or not the character is visually distinct from characters that are not supported | |
*/ | |
function characterInFont (chr, font) { | |
var data, | |
size = 27, // we need at least 27 for U+0BCC in Firefox | |
x = 0, | |
y = size, | |
canvas = document.createElement('canvas'), | |
ctx = canvas.getContext('2d'); | |
// Necessary? | |
canvas.width = size; | |
canvas.height = size; | |
/* | |
if (font) { // Default of canvas is 10px sans-serif | |
font = size + 'px ' + font; // Fix size so we can test consistently | |
/** | |
// Is there use to confining by this height? | |
var d = document.createElement("span"); | |
d.font = font; | |
d.textContent = chr; | |
document.body.appendChild(d); | |
var emHeight = d.offsetHeight; | |
document.body.removeChild(d); | |
alert(emHeight); // 19 after page load on Firefox and Chrome regardless of canvas height | |
//* | |
} | |
ctx.font = font; | |
*/ | |
ctx.fillText(chr, x, y); | |
// ctx.scale(2, 2); | |
var measuredWidth = ctx.measureText(chr).width; | |
alert(measuredWidth); | |
if (!measuredWidth) { | |
return true; // Not viewable, so we'll assume it is available | |
} | |
if (measuredWidth > size) { | |
throw '' + chr.charCodeAt().toString(16) + '::' + measuredWidth; | |
} | |
try { | |
data = ctx.getImageData(0, 0, measuredWidth, canvas.height).data; // canvas.width | |
} | |
catch(e) { | |
throw '' + chr.charCodeAt().toString(16) + '::' + measuredWidth; | |
} | |
data = [].slice.call(data); | |
function compareDataToBox (data, box, filter) { | |
if (filter) { // We can stop making this conditional if we confirm the exact arrays will continue to work, or otherwise remove and rely on safer full arrays | |
data = data.filter(function (item) { | |
return item !== 0; | |
}); | |
} | |
return data.toString() !== box; | |
} | |
var missingCharBox; | |
switch (BrowserDetect.browser) { | |
case 'Firefox': // Draws nothing | |
// missingCharBox = ''; // Empty string correct for older Firefox | |
missingCharBox = ''; // Todo: varies with zoom due to https://bugzilla.mozilla.org/show_bug.cgi?id=442133 | |
break; | |
case 'Opera': | |
missingCharBox = '0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,197,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,73,0,0,0,0,0,0,0,0,0,0,0,36,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,36,0,0,0,0,0,0,0,0,0,0,0,36,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,36,0,0,0,0,0,0,0,0,0,0,0,36,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,36,0,0,0,0,0,0,0,0,0,0,0,36,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,36,0,0,0,0,0,0,0,0,0,0,0,197,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,73,0,0,0,0'; | |
//missingCharBox = '197,255,255,255,255,73,36,36,36,36,36,36,36,36,197,255,255,255,255,73'; | |
break; | |
case 'Chrome': | |
missingCharBox = '0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,151,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,67,0,0,0,0,0,0,0,2,0,0,0,26,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,26,0,0,0,0,0,0,0,2,0,0,0,26,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,26,0,0,0,0,0,0,0,2,0,0,0,26,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,26,0,0,0,0,0,0,0,2,0,0,0,26,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,26,0,0,0,0,0,0,0,2,0,0,0,151,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,67,0,0,0,0'; | |
// missingCharBox = '2,151,255,255,255,255,67,2,26,2,26,2,26,2,26,2,26,2,26,2,26,2,26,2,151,255,255,255,255,67'; | |
break; | |
case 'Safari': | |
missingCharBox = '0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,17,0,0,0,23,0,0,0,23,0,0,0,23,0,0,0,23,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,52,0,0,0,21,0,0,0,21,0,0,0,21,0,0,0,21,0,0,0,41,0,0,0,0,0,0,0,0,0,0,0,39,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,39,0,0,0,0,0,0,0,0,0,0,0,39,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,39,0,0,0,0,0,0,0,0,0,0,0,39,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,39,0,0,0,0,0,0,0,0,0,0,0,39,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,39,0,0,0,0,0,0,0,0,0,0,0,63,0,0,0,40,0,0,0,40,0,0,0,40,0,0,0,40,0,0,0,43,0,0,0,0'; | |
// missingCharBox = '17,23,23,23,23,5,52,21,21,21,21,41,39,39,39,39,39,39,39,39,63,40,40,40,40,43'; | |
break; | |
case 'Mozilla': // IE! | |
// missingCharBox = '60,255,255,255,255,255,255,255,150,60,184,88,150,60,184,88,150,60,184,88,150,60,184,88,150,60,184,88,150,60,184,88,150'; | |
missingCharBox = '0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,60,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,150,0,0,0,0,0,0,0,60,0,0,0,184,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,88,0,0,0,150,0,0,0,0,0,0,0,60,0,0,0,184,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,88,0,0,0,150,0,0,0,0,0,0,0,60,0,0,0,184,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,88,0,0,0,150,0,0,0,0,0,0,0,60,0,0,0,184,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,88,0,0,0,150,0,0,0,0,0,0,0,60,0,0,0,184,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,88,0,0,0,150,0,0,0,0,0,0,0,60,0,0,0,184,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,88,0,0,0,150,0,0,0,0'; | |
break; | |
default: | |
throw 'characterInFont() not tested successfully for this browser'; | |
} | |
return compareDataToBox(data, missingCharBox); | |
} | |
// EXPORTS | |
((typeof exports !== 'undefined') ? exports : window).characterInFont = characterInFont; | |
}()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment