X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=engine%2Fkage.js;h=bc97a5af73fe2460f7af409f4f215289c1614b40;hb=89391b0cb321beedeefb3b879599089fb1188bd7;hp=0d3f93387a2cdd40480881fe05683cb55a10a1c3;hpb=1e15373ea418009cbf80ab07f4267caee8fee448;p=chise%2Fkage.git diff --git a/engine/kage.js b/engine/kage.js index 0d3f933..bc97a5a 100755 --- a/engine/kage.js +++ b/engine/kage.js @@ -3,7 +3,7 @@ function Kage(){ function makeGlyph(polygons, buhin){ // void var glyphData = this.kBuhin.search(buhin); if(glyphData != ""){ - this.drawStrokesArray(polygons, this.adjustUroko(this.adjustKakato(this.getEachStrokes(glyphData)))); + this.drawStrokesArray(polygons, this.adjustKirikuchi(this.adjustUroko(this.adjustKakato(this.getEachStrokes(glyphData))))); } } Kage.prototype.makeGlyph = makeGlyph; @@ -65,10 +65,10 @@ function Kage(){ function adjustUroko(strokesArray){ // strokesArray for(var i = 0; i < strokesArray.length; i++){ - if(strokesArray[i][0] == 1 && strokesArray[i][2] == 0){ // c‚̓EƒƒR‚È‚¢‚Ì‚Å–³Ž‹B‚Å‚àŒvŽZ—Ê‚ª–³‘Ê + if(strokesArray[i][0] == 1 && strokesArray[i][2] == 0){ // no operation for TATE for(var k = 0; k < this.kAdjustUrokoLengthStep; k++){ var tx, ty, tlen; - if(strokesArray[i][4] == strokesArray[i][6]){ // ‰¡ + if(strokesArray[i][4] == strokesArray[i][6]){ // YOKO tx = strokesArray[i][5] - this.kAdjustUrokoLine[k]; ty = strokesArray[i][6] - 0.5; tlen = strokesArray[i][5] - strokesArray[i][3]; @@ -92,6 +92,25 @@ function Kage(){ } Kage.prototype.adjustUroko = adjustUroko; + function adjustKirikuchi(strokesArray){ // strokesArray + for(var i = 0; i < strokesArray.length; i++){ + if(strokesArray[i][0] == 2 && strokesArray[i][1] == 32 && + strokesArray[i][3] > strokesArray[i][5] && + strokesArray[i][4] < strokesArray[i][6]){ + for(var j = 0; j < strokesArray.length; j++){ // no need to skip when i == j + if(strokesArray[j][0] == 1 && + strokesArray[j][3] < strokesArray[i][3] && strokesArray[j][5] > strokesArray[i][3] && + strokesArray[j][4] == strokesArray[i][4] && strokesArray[j][4] == strokesArray[j][6]){ + strokesArray[i][1] = 132; + j = strokesArray.length; + } + } + } + } + return strokesArray; + } + Kage.prototype.adjustKirikuchi = adjustKirikuchi; + function adjustKakato(strokesArray){ // strokesArray for(var i = 0; i < strokesArray.length; i++){ if(strokesArray[i][0] == 1 && @@ -204,17 +223,17 @@ function Kage(){ this.kL2RDfatten = 1.1; this.kMage = 10; - this.kAdjustKakatoL = ([14, 9, 5, 2]); // ’²®Ï‚݃JƒJƒg—p 000,100,200,300 - this.kAdjustKakatoR = ([8, 6, 4, 2]); // ’²®Ï‚݃JƒJƒg—p 000,100,200,300 - this.kAdjustKakatoRangeX = 20; // ‰e‹¿”»’è‹éŒ`‚Ì‘å‚«‚³ - this.kAdjustKakatoRangeY = ([1, 19, 24, 30]); // ‰e‹¿”»’è‹éŒ`‚Ì‘å‚«‚³‹«ŠEi3—̈æj - this.kAdjustKakatoStep = 3; // ‰e‹¿”»’è‹éŒ`‚Ì’iŠK + this.kAdjustKakatoL = ([14, 9, 5, 2]); // for KAKATO adjustment 000,100,200,300 + this.kAdjustKakatoR = ([8, 6, 4, 2]); // for KAKATO adjustment 000,100,200,300 + this.kAdjustKakatoRangeX = 20; // check area width + this.kAdjustKakatoRangeY = ([1, 19, 24, 30]); // 3 steps of checking + this.kAdjustKakatoStep = 3; // number of steps - this.kAdjustUrokoX = ([24, 20, 16, 12]); // ’²®Ï‚݃TƒCƒY 000,100,200,300 - this.kAdjustUrokoY = ([12, 11, 9, 8]); // ’²®Ï‚݃TƒCƒY 000,100,200,300 - this.kAdjustUrokoLength = ([22, 36, 50]); // ‰e‹¿”»’è’·‚³‚Ì’iŠK - this.kAdjustUrokoLengthStep = 3; // ‰e‹¿”»’è’·‚³‚Ì’iŠK - this.kAdjustUrokoLine = ([22, 26, 30]); // Œð·‚̉e‹¿”»’èBLength‚ƑΉž + this.kAdjustUrokoX = ([24, 20, 16, 12]); // for UROKO adjustment 000,100,200,300 + this.kAdjustUrokoY = ([12, 11, 9, 8]); // for UROKO adjustment 000,100,200,300 + this.kAdjustUrokoLength = ([22, 36, 50]); // length for checking + this.kAdjustUrokoLengthStep = 3; // number of steps + this.kAdjustUrokoLine = ([22, 26, 30]); // check for crossing. corresponds to length this.kBuhin = new Buhin();