diff --git a/generator.js b/generator.js index 696149d..53244c8 100644 --- a/generator.js +++ b/generator.js @@ -133,11 +133,25 @@ if(argv.ttf) (function(){ if(argv.svg) (function(){ console.log(' Writing outline as SVG -> ' + argv.svg); - function cov(x){ return Math.round(x * 10000) / 10000 }; + + var foundNaN = false; + var glyfname = ''; + function cov(x) { + if(!isFinite(x)){ + if(!foundNaN) { + console.log("*** NaN value found in " + argv.svg + '(' + glyfname + ')' + " ***") + foundNaN = true + } + return 0 + } + return Math.round(x * 10000) / 10000 + }; function mix(a, b, p){ return a + (b - a) * p }; function toSVGPath(glyph){ var buf = ''; + foundNaN = false; + glyfname = glyph.name; if(glyph.contours) for(var j = 0; j < glyph.contours.length; j++) { var contour = glyph.contours[j]; var lx = 0; diff --git a/glyphs/common-shapes.ptl b/glyphs/common-shapes.ptl index 0d3b045..23703e3 100644 --- a/glyphs/common-shapes.ptl +++ b/glyphs/common-shapes.ptl @@ -441,6 +441,7 @@ define [determineMixR w v u sw] : begin local adjust : clamp 0.975 1 (1 - (iwidth / idepth - 2) * 0.0125) #console.log iwidth idepth (iwidth / idepth) adjust r = r * adjust + if (r < 0.5) : set r 0.5 return r define nHookSegments 12