From: kamichi Date: Wed, 6 Aug 2014 01:53:01 +0000 (+0900) Subject: Updated. X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2d3e1d1725346662edb74814e8f7919acfe845fd;p=chise%2Fkage.git Updated. --- diff --git a/engine/buhin.js b/engine/buhin.js old mode 100755 new mode 100644 diff --git a/engine/kage.js b/engine/kage.js old mode 100755 new mode 100644 index d2fc215..c58fda5 --- a/engine/kage.js +++ b/engine/kage.js @@ -2,19 +2,56 @@ function Kage(size){ // method function makeGlyph(polygons, buhin){ // void var glyphData = this.kBuhin.search(buhin); - if(glyphData != ""){ - this.drawStrokesArray(polygons, this.adjustKirikuchi(this.adjustUroko2(this.adjustUroko(this.adjustKakato(this.adjustTate(this.adjustMage(this.adjustHane(this.getEachStrokes(glyphData))))))))); - } + this.makeGlyph2(polygons, glyphData); } Kage.prototype.makeGlyph = makeGlyph; function makeGlyph2(polygons, data){ // void - if(data != ""){ - this.drawStrokesArray(polygons, this.adjustKirikuchi(this.adjustUroko2(this.adjustUroko(this.adjustKakato(this.adjustTate(this.adjustMage(this.adjustHane(this.getEachStrokes(data))))))))); - } + if(data != ""){ + var strokesArray = this.adjustKirikuchi(this.adjustUroko2(this.adjustUroko(this.adjustKakato(this.adjustTate(this.adjustMage(this.adjustHane(this.getEachStrokes(data)))))))); + for(var i = 0; i < strokesArray.length; i++){ + dfDrawFont(this, polygons, + strokesArray[i][0], + strokesArray[i][1], + strokesArray[i][2], + strokesArray[i][3], + strokesArray[i][4], + strokesArray[i][5], + strokesArray[i][6], + strokesArray[i][7], + strokesArray[i][8], + strokesArray[i][9], + strokesArray[i][10]); + } + } } Kage.prototype.makeGlyph2 = makeGlyph2; + function makeGlyph3(data){ // void + var result = new Array(); + if(data != ""){ + var strokesArray = this.adjustKirikuchi(this.adjustUroko2(this.adjustUroko(this.adjustKakato(this.adjustTate(this.adjustMage(this.adjustHane(this.getEachStrokes(data)))))))); + for(var i = 0; i < strokesArray.length; i++){ + var polygons = new Polygons(); + dfDrawFont(this, polygons, + strokesArray[i][0], + strokesArray[i][1], + strokesArray[i][2], + strokesArray[i][3], + strokesArray[i][4], + strokesArray[i][5], + strokesArray[i][6], + strokesArray[i][7], + strokesArray[i][8], + strokesArray[i][9], + strokesArray[i][10]); + result.push(polygons); + } + } + return result; + } + Kage.prototype.makeGlyph3 = makeGlyph3; + function getEachStrokes(glyphData){ // strokes array var strokesArray = new Array(); var strokes = glyphData.split("$"); @@ -270,56 +307,6 @@ function Kage(size){ } Kage.prototype.adjustKakato = adjustKakato; - function drawStrokesArray(polygons, strokesArray){ - for(var i = 0; i < strokesArray.length; i++){ - dfDrawFont(this, polygons, - strokesArray[i][0], - strokesArray[i][1], - strokesArray[i][2], - strokesArray[i][3], - strokesArray[i][4], - strokesArray[i][5], - strokesArray[i][6], - strokesArray[i][7], - strokesArray[i][8], - strokesArray[i][9], - strokesArray[i][10]); - } - } - Kage.prototype.drawStrokesArray = drawStrokesArray; - - function drawGlyph(polygons, glyph){ // void - // [glyph] : [stroke]$[stroke]$..... - // [stroke] : [column]:[column]:..... - var strokes = glyph.split("$"); - for(var i = 0; i < strokes.length; i++){ - var columns = strokes[i].split(":"); - if(Math.floor(columns[0]) != 99){ - dfDrawFont(this, polygons, - Math.floor(columns[0]), - Math.floor(columns[1]), Math.floor(columns[2]), - Math.floor(columns[3]), Math.floor(columns[4]), - Math.floor(columns[5]), Math.floor(columns[6]), - Math.floor(columns[7]), Math.floor(columns[8]), - Math.floor(columns[9]), Math.floor(columns[10])); - } else { - var buhin = this.kBuhin.search(columns[7]); - if(buhin != ""){ - this.drawBuhin(polygons, buhin, - Math.floor(columns[3]), - Math.floor(columns[4]), - Math.floor(columns[5]), - Math.floor(columns[6]), - Math.floor(columns[1]), - Math.floor(columns[2]), - Math.floor(columns[9]), - Math.floor(columns[10])); - } - } - } - } - Kage.prototype.drawGlyph = drawGlyph; - function getBox(glyph){ // minX, minY, maxX, maxY var a = new Object(); a.minX = 200; @@ -373,62 +360,6 @@ function Kage(size){ } Kage.prototype.stretch = stretch; - function drawBuhin(polygons, glyph, x1, y1, x2, y2, sx, sy, sx2, sy2){ // void - var strokes = glyph.split("$"); - var box = this.getBox(glyph); - if(sx != 0 || sy != 0){ - if(sx > 100){ - sx -= 200; // Ǥ°ÕÅÀ¥â¡¼¥É - } else { - sx2 = 0; // Ãæ¿´ÅÀ¥â¡¼¥É - sy2 = 0; - } - } - for(var i = 0; i < strokes.length; i++){ - var columns = strokes[i].split(":"); - if(sx != 0 || sy != 0){ - columns[3] = stretch(sx, sx2, columns[3], box.minX, box.maxX); - columns[4] = stretch(sy, sy2, columns[4], box.minY, box.maxY); - columns[5] = stretch(sx, sx2, columns[5], box.minX, box.maxX); - columns[6] = stretch(sy, sy2, columns[6], box.minY, box.maxY); - if(columns[0] != 99){ - columns[7] = stretch(sx, sx2, columns[7], box.minX, box.maxX); - columns[8] = stretch(sy, sy2, columns[8], box.minY, box.maxY); - columns[9] = stretch(sx, sx2, columns[9], box.minX, box.maxX); - columns[10] = stretch(sy, sy2, columns[10], box.minY, box.maxY); - } - } - if(Math.floor(columns[0]) != 99){ - dfDrawFont(this, polygons, - Math.floor(columns[0]), - Math.floor(columns[1]), - Math.floor(columns[2]), - x1 + Math.floor(columns[3]) * (x2 - x1) / 200, - y1 + Math.floor(columns[4]) * (y2 - y1) / 200, - x1 + Math.floor(columns[5]) * (x2 - x1) / 200, - y1 + Math.floor(columns[6]) * (y2 - y1) / 200, - x1 + Math.floor(columns[7]) * (x2 - x1) / 200, - y1 + Math.floor(columns[8]) * (y2 - y1) / 200, - x1 + Math.floor(columns[9]) * (x2 - x1) / 200, - y1 + Math.floor(columns[10]) * (y2 - y1) / 200); - } else { - var buhin = this.kBuhin.search(columns[7]); - if(buhin != ""){ - this.drawBuhin(polygons, buhin, - x1 + Math.floor(columns[3]) * (x2 - x1) / 200, - y1 + Math.floor(columns[4]) * (y2 - y1) / 200, - x1 + Math.floor(columns[5]) * (x2 - x1) / 200, - y1 + Math.floor(columns[6]) * (y2 - y1) / 200, - Math.floor(columns[1]), - Math.floor(columns[2]), - Math.floor(columns[9]), - Math.floor(columns[10])); - } - } - } - } - Kage.prototype.drawBuhin = drawBuhin; - //properties Kage.prototype.kMincho = 0; Kage.prototype.kGothic = 1; diff --git a/engine/kagecd.js b/engine/kagecd.js old mode 100755 new mode 100644 diff --git a/engine/kagedf.js b/engine/kagedf.js old mode 100755 new mode 100644 diff --git a/engine/polygon.js b/engine/polygon.js old mode 100755 new mode 100644 diff --git a/engine/polygons.js b/engine/polygons.js old mode 100755 new mode 100644 diff --git a/engine/sample.html b/engine/sample.html index 7c26c5e..9ff8299 100644 --- a/engine/sample.html +++ b/engine/sample.html @@ -8,7 +8,7 @@ -