The svgs will no longer contain NaNs.
This commit is contained in:
parent
fc799f50c9
commit
c2cfbb4061
2 changed files with 16 additions and 1 deletions
16
generator.js
16
generator.js
|
@ -133,11 +133,25 @@ if(argv.ttf) (function(){
|
||||||
|
|
||||||
if(argv.svg) (function(){
|
if(argv.svg) (function(){
|
||||||
console.log(' Writing outline as SVG -> ' + argv.svg);
|
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 mix(a, b, p){ return a + (b - a) * p };
|
||||||
|
|
||||||
function toSVGPath(glyph){
|
function toSVGPath(glyph){
|
||||||
var buf = '';
|
var buf = '';
|
||||||
|
foundNaN = false;
|
||||||
|
glyfname = glyph.name;
|
||||||
if(glyph.contours) for(var j = 0; j < glyph.contours.length; j++) {
|
if(glyph.contours) for(var j = 0; j < glyph.contours.length; j++) {
|
||||||
var contour = glyph.contours[j];
|
var contour = glyph.contours[j];
|
||||||
var lx = 0;
|
var lx = 0;
|
||||||
|
|
|
@ -441,6 +441,7 @@ define [determineMixR w v u sw] : begin
|
||||||
local adjust : clamp 0.975 1 (1 - (iwidth / idepth - 2) * 0.0125)
|
local adjust : clamp 0.975 1 (1 - (iwidth / idepth - 2) * 0.0125)
|
||||||
#console.log iwidth idepth (iwidth / idepth) adjust
|
#console.log iwidth idepth (iwidth / idepth) adjust
|
||||||
r = r * adjust
|
r = r * adjust
|
||||||
|
if (r < 0.5) : set r 0.5
|
||||||
return r
|
return r
|
||||||
|
|
||||||
define nHookSegments 12
|
define nHookSegments 12
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue