Created
January 4, 2012 18:28
-
-
Save tomasdev/1561358 to your computer and use it in GitHub Desktop.
fix cufon from https://github.com/oori/cufon/commit/a1e1d9157e21a11c065ee5dccefb1f844d7cfd51#commitcomment-837796
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
@@ -339,6 +339,12 @@ var Cufon = (function() { | |
return glyphs; | |
})(data.glyphs); | |
+ this.missingGlyphs = ''; | |
+ for (var i in this.glyphs) { | |
+ this.missingGlyphs += i; | |
+ } | |
+ this.missingGlyphsRegexp = new RegExp("[^" + this.missingGlyphs.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&") + "]"); | |
+ | |
this.w = data.w; | |
this.baseSize = parseInt(face['units-per-em'], 10); | |
@@ -618,6 +624,10 @@ var Cufon = (function() { | |
if (/\s$/.test(text)) parts.push(''); | |
} | |
for (var i = 0, l = parts.length; i < l; ++i) { | |
+ if (font.missingGlyphsRegexp.test(parts[i])) { | |
+ fragment.appendChild(document.createTextNode(parts[i])); | |
+ continue; | |
+ } | |
processed = engines[options.engine](font, | |
needsAligning ? CSS.textAlign(parts[i], style, i, l) : parts[i], | |
style, options, node, el, i < l - 1); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment