function makeGlyph(polygons, buhin){ // void\r
var glyphData = this.kBuhin.search(buhin);\r
if(glyphData != ""){\r
- this.drawStrokesArray(polygons, this.adjustKirikuchi(this.adjustUroko2(this.adjustUroko(this.adjustKakato(this.adjustTate(this.adjustMage(this.getEachStrokes(glyphData))))))));\r
+ this.drawStrokesArray(polygons, this.adjustKirikuchi(this.adjustUroko2(this.adjustUroko(this.adjustKakato(this.adjustTate(this.adjustMage(this.adjustHane(this.getEachStrokes(glyphData)))))))));\r
}\r
}\r
Kage.prototype.makeGlyph = makeGlyph;\r
}\r
Kage.prototype.getEachStrokesOfBuhin = getEachStrokesOfBuhin;\r
\r
+ function adjustHane(sa){ // strokesArray\r
+ for(var i = 0; i < sa.length; i++){\r
+ if((sa[i][0] == 1 || sa[i][0] == 2) && sa[i][2] == 4){\r
+ var lpx; // lastPointX\r
+ var lpy; // lastPointY\r
+ if(sa[i][0] == 1){\r
+ lpx = sa[i][5];\r
+ lpy = sa[i][6];\r
+ } else {\r
+ lpx = sa[i][7];\r
+ lpy = sa[i][8];\r
+ }\r
+ var mn = Infinity; // mostNear\r
+ if(lpx + 18 < 100){\r
+ mn = lpx + 18;\r
+ }\r
+ for(var j = 0; j < sa.length; j++){\r
+ if(i != j && sa[j][0] == 1 && sa[j][3] == sa[j][5] && sa[j][4] <= lpy && sa[j][6] >= lpy){\r
+ if(lpx - sa[j][3] < 900){\r
+ mn = Math.min(mn, lpx - sa[j][3]);\r
+ }\r
+ }\r
+ }\r
+ if(mn != Infinity){\r
+ sa[i][2] += Math.min(400, 400 - Math.floor(mn / 20) * 100); // 0-8 -> 0-400\r
+ }\r
+ }\r
+ }\r
+ return sa;\r
+ }\r
+ Kage.prototype.adjustHane = adjustHane;\r
+\r
function adjustUroko(strokesArray){ // strokesArray\r
for(var i = 0; i < strokesArray.length; i++){\r
if(strokesArray[i][0] == 1 && strokesArray[i][2] == 0){ // no operation for TATE\r
poly = new Polygon();\r
poly.push(x2, y2);\r
poly.push(x2, y2 - kMinWidthT);\r
- poly.push(x2 - kage.kWidth * 4 * Math.pow(kMinWidthT / kage.kMinWidthT, 3), y2 - kMinWidthT);\r
- poly.push(x2 - kage.kWidth * 4 * Math.pow(kMinWidthT / kage.kMinWidthT, 3), y2 - kMinWidthT * 0.5);\r
+ poly.push(x2 - kage.kWidth * 4 * Math.min(1 - opt2 / 10, Math.pow(kMinWidthT / kage.kMinWidthT, 3)), y2 - kMinWidthT);\r
+ poly.push(x2 - kage.kWidth * 4 * Math.min(1 - opt2 / 10, Math.pow(kMinWidthT / kage.kMinWidthT, 3)), y2 - kMinWidthT * 0.5);\r
//poly.reverse();\r
polygons.push(poly);\r
}\r
case 0:\r
break;\r
case 1:\r
- if(a3 == 4){\r
+ if(a3 % 100 == 4){\r
if(x1 == x2){\r
if(y1 < y2){ v = 1; } else{ v = -1; }\r
tx1 = x2;\r
ty1 = y2 - kage.kMage * Math.sin(rad) * v;\r
}\r
cdDrawLine(kage, polygons, x1, y1, tx1, ty1, a2, 1);\r
- cdDrawCurve(kage, polygons, tx1, ty1, x2, y2, x2 - kage.kMage * (((kage.kAdjustTateStep + 4) - Math.floor(a2 / 1000)) / (kage.kAdjustTateStep + 4)), y2, 1 + (a2 - a2 % 1000), 14);\r
+ cdDrawCurve(kage, polygons, tx1, ty1, x2, y2, x2 - kage.kMage * (((kage.kAdjustTateStep + 4) - Math.floor(a2 / 1000)) / (kage.kAdjustTateStep + 4)), y2, 1 + (a2 - a2 % 1000), a3 + 10);\r
}\r
else{\r
cdDrawLine(kage, polygons, x1, y1, x2, y2, a2, a3);\r
break;\r
case 2:\r
//case 12: // ... no need\r
- if(a3 == 4){\r
+ if(a3 % 100 == 4){\r
if(x2 == x3){\r
tx1 = x3;\r
ty1 = y3 - kage.kMage;\r
ty1 = y3 - kage.kMage * Math.sin(rad) * v;\r
}\r
cdDrawCurve(kage, polygons, x1, y1, x2, y2, tx1, ty1, a2, 1);\r
- cdDrawCurve(kage, polygons, tx1, ty1, x3, y3, x3 - kage.kMage, y3, 1, 14);\r
+ cdDrawCurve(kage, polygons, tx1, ty1, x3, y3, x3 - kage.kMage, y3, 1, a3 + 10);\r
}\r
else if(a3 == 5){\r
cdDrawCurve(kage, polygons, x1, y1, x2, y2, x3, y3, a2, 15);\r