function makeGlyph(polygons, buhin){ // void\r
var glyphData = this.kBuhin.search(buhin);\r
if(glyphData != ""){\r
- this.drawStrokesArray(polygons, this.adjustUroko(this.adjustKakato(this.getEachStrokes(glyphData))));\r
+ this.drawStrokesArray(polygons, this.adjustKirikuchi(this.adjustUroko(this.adjustKakato(this.getEachStrokes(glyphData)))));\r
}\r
}\r
Kage.prototype.makeGlyph = makeGlyph;\r
}\r
Kage.prototype.adjustUroko = adjustUroko;\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
+ strokesArray[i][3] > strokesArray[i][5] &&\r
+ strokesArray[i][4] < strokesArray[i][6]){\r
+ for(var j = 0; j < strokesArray.length; j++){ // no need to skip when i == j\r
+ if(strokesArray[j][0] == 1 &&\r
+ strokesArray[j][3] < strokesArray[i][3] && strokesArray[j][5] > strokesArray[i][3] &&\r
+ strokesArray[j][4] == strokesArray[i][4] && strokesArray[j][4] == strokesArray[j][6]){\r
+ strokesArray[i][1] = 132;\r
+ j = strokesArray.length;\r
+ }\r
+ }\r
+ }\r
+ }\r
+ return strokesArray;\r
+ }\r
+ Kage.prototype.adjustKirikuchi = adjustKirikuchi;\r
+ \r
function adjustKakato(strokesArray){ // strokesArray\r
for(var i = 0; i < strokesArray.length; i++){\r
if(strokesArray[i][0] == 1 &&\r
var hosomi;\r
\r
if(kage.kShotai == kage.kMincho){ // mincho\r
- switch(a1){\r
+ switch(a1 % 100){\r
case 0:\r
case 7:\r
delta = -1 * kage.kMinWidthY * 0.5;\r
case 2: // ... must be 32\r
case 6:\r
case 22:\r
+ case 32: // changed\r
delta = 0;\r
break;\r
case 12:\r
- case 32:\r
+ //case 32:\r
delta = kage.kMinWidthY;\r
break;\r
default:\r
y1 = y1 - delta * Math.sin(rad) * v;\r
}\r
\r
- switch(a2){\r
+ switch(a2 % 100){\r
case 0:\r
case 1:\r
case 7:\r
x3 = x3 + delta * Math.cos(rad) * v;\r
y3 = y3 + delta * Math.sin(rad) * v;\r
}\r
-\r
- hosomi = 0.5;\r
- if(Math.sqrt((x3 - x1) * (x3 - x1) + (y3 - y1) * (y3 - y1)) < 50){\r
- hosomi += 0.4 * (1 - Math.sqrt((x3 - x1) * (x3 - x1) + (y3 - y1) * (y3 - y1)) / 50);\r
- }\r
+ \r
+ hosomi = 0.5;\r
+ if(Math.sqrt((x3 - x1) * (x3 - x1) + (y3 - y1) * (y3 - y1)) < 50){\r
+ hosomi += 0.4 * (1 - Math.sqrt((x3 - x1) * (x3 - x1) + (y3 - y1) * (y3 - y1)) / 50);\r
+ }\r
\r
poly = new Polygon();\r
poly2 = new Polygon();\r
}\r
\r
if(a1 == 7 && a2 == 0){ // L2RD: fatten\r
- deltad = Math.pow(t, hosomi) * kage.kL2RDfatten;\r
+ deltad = Math.pow(t, hosomi) * kage.kL2RDfatten;\r
}\r
else if(a1 == 7){\r
deltad = Math.pow(t, hosomi);\r
poly2.push(x + ia, y + ib);\r
}\r
\r
+ // suiheisen ni setsuzoku\r
+ if(a1 == 132){\r
+ var index = 0;\r
+ while(true){\r
+ if(poly2.array[index].y <= y1 && y1 <= poly2.array[index + 1].y){\r
+ break;\r
+ }\r
+ index++;\r
+ }\r
+ newx1 = poly2.array[index + 1].x + (poly2.array[index].x - poly2.array[index + 1].x) *\r
+ (poly2.array[index + 1].y - y1) / (poly2.array[index + 1].y - poly2.array[index].y);\r
+ newy1 = y1;\r
+ newx2 = poly.array[0].x + (poly.array[0].x - poly.array[1].x) * (poly.array[0].y - y1) /\r
+ (poly.array[1].y - poly.array[0].y);\r
+ newy2 = y1;\r
+ \r
+ for(var i = 0; i < index; i++){\r
+ poly2.shift();\r
+ }\r
+ poly2.set(0, newx1, newy1);\r
+ poly.unshift(newx2, newy2);\r
+ }\r
+ \r
poly2.reverse();\r
poly.concat(poly2);\r
polygons.push(poly);\r
this.array = this.array.concat(poly.array);\r
}\r
Polygon.prototype.concat = concat;\r
-\r
+ \r
+ function shift(){ // void\r
+ this.array.shift();\r
+ }\r
+ Polygon.prototype.shift = shift;\r
+ \r
+ function unshift(x, y){ // void\r
+ var temp = new Object();\r
+ temp.x = Math.floor(x*10)/10;\r
+ temp.y = Math.floor(y*10)/10;\r
+ this.array.unshift(temp);\r
+ }\r
+ Polygon.prototype.unshift = unshift;\r
+ \r
// property\r
this.array = new Array();\r
\r