diff --git a/extract.js b/extract.js index 3c49978..17f0cc2 100644 --- a/extract.js +++ b/extract.js @@ -90,4 +90,36 @@ if(argv.ttf) { font['OS/2'].sCapHeight *= upmscale; fs.writeFileSync(argv.ttf, toBuffer(new TTFWriter(options).write(font))); -} \ No newline at end of file +}; + +if(argv.svg) { + function toSVGPath(glyph){ + var buf = ''; + if(glyph.contours) for(var j = 0; j < glyph.contours.length; j++) { + var contour = glyph.contours[j]; + if(contour.length){ + buf += 'M' + contour[0].x + ' ' + contour[0].y; + for(var k = 1; k < contour.length; k++) if(contour[k].onCurve){ + buf += 'L' + contour[k].x + ' ' + contour[k].y; + } else if(contour[k + 1]){ + if(contour[k + 1].onCurve){ + buf += 'Q' + contour[k].x + ' ' + contour[k].y + ' ' + contour[k + 1].x + ' ' + contour[k + 1].y; + k += 1 + } else { + buf += 'Q' + contour[k].x + ' ' + contour[k].y + ' ' + (contour[k].x + contour[k + 1].x) / 2 + ' ' + (contour[k].y + contour[k + 1].y) / 2; + } + } + buf += 'Z\n' + } + } + return buf; + } + var svg = '' + svg += '' + for(var j = 0; j < font.glyf.length; j++){ + var gd = '' + svg += gd; + } + svg += '' + fs.writeFileSync(argv.svg, svg, 'utf-8') +}; \ No newline at end of file diff --git a/glyphs/letters-unified-basic.patel b/glyphs/letters-unified-basic.patel index 7588504..d79c1e3 100644 --- a/glyphs/letters-unified-basic.patel +++ b/glyphs/letters-unified-basic.patel @@ -379,9 +379,9 @@ symbol-block 'Y' symbol-block 'y' define [SmallYShape top bottom] : glyph-construction local xbottom : mix SB RIGHTSB 0.28 - local turnp : top / (top - DESCENDER) + local turnp : top / (top - bottom) local xb : mix SB RIGHTSB 0.51 - local yb : mix 0 top (0.05 * turnp) + local yb : mix [mix bottom top (-DESCENDER / (XH - DESCENDER))] top (0.05 * turnp) include : tagged 'strokeR' : xStrand xbottom bottom RIGHTSB top 0.1 0.6 0.14 include : tagged 'strokeL' : halfXStrand SB top xb yb (0.1 * turnp) 0.4 (0.14 * turnp)