function makeGlyph(polygons, buhin){ // void\r
var glyphData = this.kBuhin.search(buhin);\r
if(glyphData != ""){\r
- this.drawStrokesArray(polygons, this.adjustKirikuchi(this.adjustUroko(this.adjustKakato(this.adjustTate(this.getEachStrokes(glyphData))))));\r
+ this.drawStrokesArray(polygons, this.adjustKirikuchi(this.adjustUroko(this.adjustKakato(this.adjustTate(this.adjustMage(this.getEachStrokes(glyphData)))))));\r
}\r
}\r
Kage.prototype.makeGlyph = makeGlyph;\r
for(var j = 0; j < strokesArray.length; j++){\r
if(i != j && (strokesArray[j][0] == 1 || strokesArray[j][0] == 3 || strokesArray[j][0] == 7) && strokesArray[j][3] == strokesArray[j][5] &&\r
!(strokesArray[i][4] + 1 > strokesArray[j][6] || strokesArray[i][6] - 1 < strokesArray[j][4]) &&\r
- Math.abs(strokesArray[i][3] - strokesArray[j][3]) < this.kMinWidthT * 4){\r
- strokesArray[i][1] += (4 - Math.floor(Math.abs(strokesArray[i][3] - strokesArray[j][3]) / this.kMinWidthT)) * 1000;\r
+ Math.abs(strokesArray[i][3] - strokesArray[j][3]) < this.kMinWidthT * this.kAdjustTateStep){\r
+ strokesArray[i][1] += (this.kAdjustTateStep - Math.floor(Math.abs(strokesArray[i][3] - strokesArray[j][3]) / this.kMinWidthT)) * 1000;\r
if(strokesArray[i][1] > this.kAdjustTateStep * 1000){\r
strokesArray[i][1] = strokesArray[i][1] % 1000 + this.kAdjustTateStep * 1000;\r
}\r
}\r
Kage.prototype.adjustTate = adjustTate;\r
\r
+ function adjustMage(strokesArray){ // strokesArray\r
+ for(var i = 0; i < strokesArray.length; i++){\r
+ if((strokesArray[i][0] == 3) && strokesArray[i][6] == strokesArray[i][8]){\r
+ for(var j = 0; j < strokesArray.length; j++){\r
+ if(i != j && (\r
+ (strokesArray[j][0] == 1 && strokesArray[j][4] == strokesArray[j][6] &&\r
+ !(strokesArray[i][5] + 1 > strokesArray[j][5] || strokesArray[i][7] - 1 < strokesArray[j][3]) &&\r
+ Math.abs(strokesArray[i][6] - strokesArray[j][4]) < this.kMinWidthT * this.kAdjustMageStep) ||\r
+ (strokesArray[j][0] == 3 && strokesArray[j][6] == strokesArray[j][8] &&\r
+ !(strokesArray[i][5] + 1 > strokesArray[j][7] || strokesArray[i][7] - 1 < strokesArray[j][5]) &&\r
+ Math.abs(strokesArray[i][6] - strokesArray[j][6]) < this.kMinWidthT * this.kAdjustMageStep)\r
+ )){\r
+ strokesArray[i][2] += (this.kAdjustMageStep - Math.floor(Math.abs(strokesArray[i][6] - strokesArray[j][6]) / this.kMinWidthT)) * 1000;\r
+ if(strokesArray[i][2] > this.kAdjustMageStep * 1000){\r
+ strokesArray[i][2] = strokesArray[i][2] % 1000 + this.kAdjustMageStep * 1000;\r
+ }\r
+ }\r
+ }\r
+ }\r
+ }\r
+ return strokesArray;\r
+ }\r
+ Kage.prototype.adjustMage = adjustMage;\r
+ \r
function adjustKirikuchi(strokesArray){ // strokesArray\r
for(var i = 0; i < strokesArray.length; i++){\r
if(strokesArray[i][0] == 2 && strokesArray[i][1] == 32 &&\r
this.kAdjustUrokoLine = ([22, 26, 30]); // check for crossing. corresponds to length\r
\r
this.kAdjustTateStep = 4;\r
+ \r
+ this.kAdjustMageStep = 5;\r
}\r
\r
this.kBuhin = new Buhin();\r
var poly, poly2;\r
var hosomi;\r
var kMinWidthT, kMinWidthT2;\r
- var a1, a2, opt1, opt2, opt3;\r
+ var a1, a2, opt1, opt2, opt3, opt4;\r
\r
if(kage.kShotai == kage.kMincho){ // mincho\r
a1 = ta1 % 1000;\r
a2 = ta2 % 100;\r
opt1 = Math.floor((ta1 % 10000) / 1000);\r
- opt2 = Math.floor(ta2 / 100);\r
+ opt2 = Math.floor((ta2 % 1000) / 100);\r
opt3 = Math.floor(ta1 / 10000);\r
+ opt4 = Math.floor(ta2 / 1000);\r
\r
kMinWidthT = kage.kMinWidthT - opt1 / 2;\r
- kMinWidthT2 = kage.kMinWidthT - opt3 / 2;\r
+ kMinWidthT2 = kage.kMinWidthT - opt4 / 2;\r
\r
switch(a1 % 100){\r
case 0:\r
kage2.kRate = 10;\r
\r
var curve = new Array(2); // L and R\r
- get_candidate(kage2, curve, a1, a2, x1, y1, sx1, sy1, x2, y2, opt3);\r
+ get_candidate(kage2, curve, a1, a2, x1, y1, sx1, sy1, x2, y2, opt3, opt4);\r
\r
var dcl12_34 = new Array(2);\r
var dcr12_34 = new Array(2);\r
else if(a2 == 7){\r
deltad = Math.pow(1.0 - t, hosomi);\r
}\r
- else if(opt3 > 0){\r
- deltad = ((kage.kMinWidthT - opt3 / 2) / kage.kMinWidthT) + opt3 / 2 / kage.kMinWidthT * t;\r
+ else if(opt3 > 0 || opt4 > 0){\r
+ deltad = ((kage.kMinWidthT - opt3 / 2) - (opt4 - opt3) / 2 * t) / kage.kMinWidthT;\r
}\r
else{ deltad = 1; }\r
\r
poly = new Polygon();\r
if(kage.kUseCurve){\r
// by curve path\r
- poly.push(x2 - kMinWidthT, y2);\r
- poly.push(x2 - kMinWidthT * 0.9, y2 + kMinWidthT * 0.9, 1);\r
- poly.push(x2, y2 + kMinWidthT);\r
- poly.push(x2 + kMinWidthT * 0.9, y2 + kMinWidthT * 0.9, 1);\r
- poly.push(x2 + kMinWidthT, y2);\r
+ poly.push(x2 - kMinWidthT2, y2);\r
+ poly.push(x2 - kMinWidthT2 * 0.9, y2 + kMinWidthT2 * 0.9, 1);\r
+ poly.push(x2, y2 + kMinWidthT2);\r
+ poly.push(x2 + kMinWidthT2 * 0.9, y2 + kMinWidthT2 * 0.9, 1);\r
+ poly.push(x2 + kMinWidthT2, y2);\r
} else {\r
// by polygon\r
- poly.push(x2 - kMinWidthT, y2);\r
- poly.push(x2 - kMinWidthT * 0.7, y2 + kMinWidthT * 0.7);\r
- poly.push(x2, y2 + kMinWidthT);\r
- poly.push(x2 + kMinWidthT * 0.7, y2 + kMinWidthT * 0.7);\r
- poly.push(x2 + kMinWidthT, y2);\r
+ poly.push(x2 - kMinWidthT2, y2);\r
+ poly.push(x2 - kMinWidthT2 * 0.7, y2 + kMinWidthT2 * 0.7);\r
+ poly.push(x2, y2 + kMinWidthT2);\r
+ poly.push(x2 + kMinWidthT2 * 0.7, y2 + kMinWidthT2 * 0.7);\r
+ poly.push(x2 + kMinWidthT2, y2);\r
}\r
polygons.push(poly);\r
}\r
poly = new Polygon();\r
if(kage.kUseCurve){\r
// by curve path\r
- poly.push(x2, y2 - kMinWidthT);\r
- poly.push(x2 + kMinWidthT * 0.9, y2 - kMinWidthT * 0.9, 1);\r
- poly.push(x2 + kMinWidthT, y2);\r
- poly.push(x2 + kMinWidthT * 0.9, y2 + kMinWidthT * 0.9, 1);\r
- poly.push(x2, y2 + kMinWidthT);\r
+ poly.push(x2, y2 - kMinWidthT2);\r
+ poly.push(x2 + kMinWidthT2 * 0.9, y2 - kMinWidthT2 * 0.9, 1);\r
+ poly.push(x2 + kMinWidthT2, y2);\r
+ poly.push(x2 + kMinWidthT2 * 0.9, y2 + kMinWidthT2 * 0.9, 1);\r
+ poly.push(x2, y2 + kMinWidthT2);\r
} else {\r
// by polygon\r
- poly.push(x2, y2 - kMinWidthT);\r
- poly.push(x2 + kMinWidthT * 0.7, y2 - kMinWidthT * 0.7);\r
- poly.push(x2 + kMinWidthT, y2);\r
- poly.push(x2 + kMinWidthT * 0.7, y2 + kMinWidthT * 0.7);\r
- poly.push(x2, y2 + kMinWidthT);\r
+ poly.push(x2, y2 - kMinWidthT2);\r
+ poly.push(x2 + kMinWidthT2 * 0.7, y2 - kMinWidthT2 * 0.7);\r
+ poly.push(x2 + kMinWidthT2, y2);\r
+ poly.push(x2 + kMinWidthT2 * 0.7, y2 + kMinWidthT2 * 0.7);\r
+ poly.push(x2, y2 + kMinWidthT2);\r
}\r
polygons.push(poly);\r
}\r
else{\r
poly = new Polygon();\r
if(kage.kUseCurve){\r
- poly.push(x2 + Math.sin(rad) * kMinWidthT * v, y2 - Math.cos(rad) * kMinWidthT * v);\r
- poly.push(x2 + Math.cos(rad) * kMinWidthT * 0.9 * v + Math.sin(rad) * kMinWidthT * 0.9 * v,\r
- y2 + Math.sin(rad) * kMinWidthT * 0.9 * v - Math.cos(rad) * kMinWidthT * 0.9 * v, 1);\r
- poly.push(x2 + Math.cos(rad) * kMinWidthT * v, y2 + Math.sin(rad) * kMinWidthT * v);\r
- poly.push(x2 + Math.cos(rad) * kMinWidthT * 0.9 * v - Math.sin(rad) * kMinWidthT * 0.9 * v,\r
- y2 + Math.sin(rad) * kMinWidthT * 0.9 * v + Math.cos(rad) * kMinWidthT * 0.9 * v, 1);\r
- poly.push(x2 - Math.sin(rad) * kMinWidthT * v, y2 + Math.cos(rad) * kMinWidthT * v);\r
+ poly.push(x2 + Math.sin(rad) * kMinWidthT2 * v, y2 - Math.cos(rad) * kMinWidthT2 * v);\r
+ poly.push(x2 + Math.cos(rad) * kMinWidthT2 * 0.9 * v + Math.sin(rad) * kMinWidthT2 * 0.9 * v,\r
+ y2 + Math.sin(rad) * kMinWidthT2 * 0.9 * v - Math.cos(rad) * kMinWidthT2 * 0.9 * v, 1);\r
+ poly.push(x2 + Math.cos(rad) * kMinWidthT2 * v, y2 + Math.sin(rad) * kMinWidthT2 * v);\r
+ poly.push(x2 + Math.cos(rad) * kMinWidthT2 * 0.9 * v - Math.sin(rad) * kMinWidthT2 * 0.9 * v,\r
+ y2 + Math.sin(rad) * kMinWidthT2 * 0.9 * v + Math.cos(rad) * kMinWidthT2 * 0.9 * v, 1);\r
+ poly.push(x2 - Math.sin(rad) * kMinWidthT2 * v, y2 + Math.cos(rad) * kMinWidthT2 * v);\r
} else {\r
- poly.push(x2 + Math.sin(rad) * kMinWidthT * v, y2 - Math.cos(rad) * kMinWidthT * v);\r
- poly.push(x2 + Math.cos(rad) * kMinWidthT * 0.7 * v + Math.sin(rad) * kMinWidthT * 0.7 * v,\r
- y2 + Math.sin(rad) * kMinWidthT * 0.7 * v - Math.cos(rad) * kMinWidthT * 0.7 * v);\r
- poly.push(x2 + Math.cos(rad) * kMinWidthT * v, y2 + Math.sin(rad) * kMinWidthT * v);\r
- poly.push(x2 + Math.cos(rad) * kMinWidthT * 0.7 * v - Math.sin(rad) * kMinWidthT * 0.7 * v,\r
- y2 + Math.sin(rad) * kMinWidthT * 0.7 * v + Math.cos(rad) * kMinWidthT * 0.7 * v);\r
- poly.push(x2 - Math.sin(rad) * kMinWidthT * v, y2 + Math.cos(rad) * kMinWidthT * v);\r
+ poly.push(x2 + Math.sin(rad) * kMinWidthT2 * v, y2 - Math.cos(rad) * kMinWidthT2 * v);\r
+ poly.push(x2 + Math.cos(rad) * kMinWidthT2 * 0.7 * v + Math.sin(rad) * kMinWidthT2 * 0.7 * v,\r
+ y2 + Math.sin(rad) * kMinWidthT2 * 0.7 * v - Math.cos(rad) * kMinWidthT2 * 0.7 * v);\r
+ poly.push(x2 + Math.cos(rad) * kMinWidthT2 * v, y2 + Math.sin(rad) * kMinWidthT2 * v);\r
+ poly.push(x2 + Math.cos(rad) * kMinWidthT2 * 0.7 * v - Math.sin(rad) * kMinWidthT2 * 0.7 * v,\r
+ y2 + Math.sin(rad) * kMinWidthT2 * 0.7 * v + Math.cos(rad) * kMinWidthT2 * 0.7 * v);\r
+ poly.push(x2 - Math.sin(rad) * kMinWidthT2 * v, y2 + Math.cos(rad) * kMinWidthT2 * v);\r
}\r
polygons.push(poly);\r
}\r
poly = new Polygon();\r
if(x1 < x2){\r
poly.push(x2, y2 - kMinWidthT + 1);\r
- poly.push(x2 + 2, y2 - kMinWidthT - kage.kWidth * 5);\r
- poly.push(x2, y2 - kMinWidthT - kage.kWidth * 5);\r
+ poly.push(x2 + 2, y2 - kMinWidthT - kage.kWidth * (4 * (1 - opt1 / kage.kAdjustMageStep) + 1));\r
+ poly.push(x2, y2 - kMinWidthT - kage.kWidth * (4 * (1 - opt1 / kage.kAdjustMageStep) + 1));\r
poly.push(x2 - kMinWidthT, y2 - kMinWidthT + 1);\r
} else {\r
poly.push(x2, y2 - kMinWidthT + 1);\r
- poly.push(x2 - 2, y2 - kMinWidthT - kage.kWidth * 5);\r
- poly.push(x2, y2 - kMinWidthT - kage.kWidth * 5);\r
+ poly.push(x2 - 2, y2 - kMinWidthT - kage.kWidth * (4 * (1 - opt1 / kage.kAdjustMageStep) + 1));\r
+ poly.push(x2, y2 - kMinWidthT - kage.kWidth * (4 * (1 - opt1 / kage.kAdjustMageStep) + 1));\r
poly.push(x2 + kMinWidthT, y2 - kMinWidthT + 1);\r
}\r
poly.reverse(); // for fill-rule\r
}\r
break;\r
case 3:\r
- if(a3 == 5){\r
+ if(a3 % 1000 == 5){\r
if(x1 == x2){\r
if(y1 < y2){ v = 1; } else{ v = -1; }\r
tx1 = x2;\r
ty3 = y3;\r
\r
cdDrawLine(kage, polygons, x1, y1, tx1, ty1, a2, 1);\r
- cdDrawCurve(kage, polygons, tx1, ty1, x2, y2, tx2, ty2, 1 + (a2 - a2 % 1000) * 10, 1);\r
+ cdDrawCurve(kage, polygons, tx1, ty1, x2, y2, tx2, ty2, 1 + (a2 - a2 % 1000) * 10, 1 + (a3 - a3 % 1000));\r
if((x2 < x3 && tx3 - tx2 > 0) || (x2 > x3 && tx2 - tx3 > 0)){ // for closer position\r
- cdDrawLine(kage, polygons, tx2, ty2, tx3, ty3, 6, 5); // bolder by force\r
+ cdDrawLine(kage, polygons, tx2, ty2, tx3, ty3, 6 + (a3 - a3 % 1000), 5); // bolder by force\r
}\r
}\r
else{\r
ty2 = 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, tx2, ty2, 1 + (a2 - a2 % 1000) * 10, 1);\r
- cdDrawLine(kage, polygons, tx2, ty2, x3, y3, 6, a3); // bolder by force\r
+ cdDrawCurve(kage, polygons, tx1, ty1, x2, y2, tx2, ty2, 1 + (a2 - a2 % 1000) * 10, 1 + (a3 - a3 % 1000));\r
+ cdDrawLine(kage, polygons, tx2, ty2, x3, y3, 6 + (a3 - a3 % 1000), a3); // bolder by force\r
}\r
break;\r
case 12:\r