Skip to content

Instantly share code, notes, and snippets.

@tomasdev
Created January 4, 2012 18:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomasdev/1561358 to your computer and use it in GitHub Desktop.
Save tomasdev/1561358 to your computer and use it in GitHub Desktop.
@@ -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