jquery - open javascript library to do the same thing as symbolset -
i planning on creating own symbol font use on website , had intended on using ligatures , ot support spotty @ best, , non-existant older browsers, ie (i know, big surprise). started taking close @ how symbolset works. it's pretty clever , while easy me change couple array variables , done it, javascript proprietary , can't use without permission. i'd love able create own symbol fonts la symbolset i'd need open javascript file let me this. there open jquery plug-ins or javascript libraries this?
i have found http://labs.adamdscott.com/ligatures/ligaturejs.html. walks dom, , replaces known letter combinations ligatures. i've modified script use native ligature support when available:
// ligature.js v1.0 // http://code.google.com/p/ligature-js/ // modifications sabof var ligature = (function() { var testdiv = document.createelement('div'), nativeligaturesupport = testdiv.style.textrendering !== undefined; if (nativeligaturesupport) { return function (node, extended) { if (!node) { ligature(document.body, extended); } else { node.style.textrendering = 'optimizelegibility'; } } } return function(node, extended) { if (!node) { ligature(document.body, extended); } else { if (node.nodetype == 3 && node.parentnode.nodename != 'script') { node.nodevalue = node.nodevalue .replace(/ffl/g, 'ffl') .replace(/ffi/g, 'ffi') .replace(/fl/g, 'fl') .replace(/fi/g, 'fi') .replace(/ff/g, 'ff') .replace(/ij/g, 'ij') .replace(/ij/g, 'IJ'); if (extended) { node.nodevalue = node.nodevalue .replace(/ae/g, 'æ') .replace(/a[ee]/g, 'Æ') .replace(/oe/g, 'œ') .replace(/o[ee]/g, 'Œ') .replace(/ue/g, 'ᵫ') .replace(/st/g, 'st'); } } if (node.childnodes) { (var i=0; < node.childnodes.length; i++) { ligature(node.childnodes.item(i), extended); } } } }; }());
Comments
Post a Comment