3 function makeGlyph(polygons, buhin){ // void
4 var glyphData = this.kBuhin.search(buhin);
6 this.drawStrokesArray(polygons, this.adjustKakato(this.getEachStrokes(glyphData)));
9 Kage.prototype.makeGlyph = makeGlyph;
11 function getEachStrokes(glyphData){ // strokes array
12 var strokesArray = new Array();
13 var strokes = glyphData.split("$");
14 for(var i = 0; i < strokes.length; i++){
15 var columns = strokes[i].split(":");
16 if(Math.floor(columns[0]) != 99){
18 Math.floor(columns[0]),
19 Math.floor(columns[1]),
20 Math.floor(columns[2]),
21 Math.floor(columns[3]),
22 Math.floor(columns[4]),
23 Math.floor(columns[5]),
24 Math.floor(columns[6]),
25 Math.floor(columns[7]),
26 Math.floor(columns[8]),
27 Math.floor(columns[9]),
28 Math.floor(columns[10])
31 var buhin = this.kBuhin.search(columns[7]);
33 strokesArray = strokesArray.concat(this.getEachStrokesOfBuhin(buhin,
34 Math.floor(columns[3]),
35 Math.floor(columns[4]),
36 Math.floor(columns[5]),
37 Math.floor(columns[6]))
44 Kage.prototype.getEachStrokes = getEachStrokes;
46 function getEachStrokesOfBuhin(buhin, x1, y1, x2, y2){
47 var temp = this.getEachStrokes(buhin);
48 var result = new Array();
49 for(var i = 0; i < temp.length; i++){
50 result.push([temp[i][0],
53 x1 + temp[i][3] * (x2 - x1) / 200,
54 y1 + temp[i][4] * (y2 - y1) / 200,
55 x1 + temp[i][5] * (x2 - x1) / 200,
56 y1 + temp[i][6] * (y2 - y1) / 200,
57 x1 + temp[i][7] * (x2 - x1) / 200,
58 y1 + temp[i][8] * (y2 - y1) / 200,
59 x1 + temp[i][9] * (x2 - x1) / 200,
60 y1 + temp[i][10] * (y2 - y1) / 200]);
64 Kage.prototype.getEachStrokesOfBuhin = getEachStrokesOfBuhin;
66 function adjustKakato(strokesArray){ // strokesArray
67 for(var i = 0; i < strokesArray.length; i++){
68 if(strokesArray[i][0] == 1 &&
69 (strokesArray[i][2] == 13 || strokesArray[i][2] == 23)){
70 for(var k = 0; k < this.kAdjustKakatoStep; k++){
72 for(var j = 0; j < strokesArray.length && !crossing; j++){
73 if(i == j){ continue; }
74 switch(strokesArray[j][0]){
81 if(!crossing && isCross(strokesArray[j][7],
85 strokesArray[i][5] - this.kAdjustKakatoRangeX / 2,
86 strokesArray[i][6] + this.kAdjustKakatoRangeY[k],
87 strokesArray[i][5] + this.kAdjustKakatoRangeX / 2,
88 strokesArray[i][6] + this.kAdjustKakatoRangeY[k])){
91 if(!crossing && isCross(strokesArray[j][7],
95 strokesArray[i][5] - this.kAdjustKakatoRangeX / 2,
96 strokesArray[i][6] + this.kAdjustKakatoRangeY[k],
97 strokesArray[i][5] - this.kAdjustKakatoRangeX / 2,
98 strokesArray[i][6] + this.kAdjustKakatoRangeY[k + 1])){
101 if(!crossing && isCross(strokesArray[j][7],
105 strokesArray[i][5] + this.kAdjustKakatoRangeX / 2,
106 strokesArray[i][6] + this.kAdjustKakatoRangeY[k],
107 strokesArray[i][5] + this.kAdjustKakatoRangeX / 2,
108 strokesArray[i][6] + this.kAdjustKakatoRangeY[k + 1])){
111 if(!crossing && isCross(strokesArray[j][7],
115 strokesArray[i][5] - this.kAdjustKakatoRangeX / 2,
116 strokesArray[i][6] + this.kAdjustKakatoRangeY[k + 1],
117 strokesArray[i][5] + this.kAdjustKakatoRangeX / 2,
118 strokesArray[i][6] + this.kAdjustKakatoRangeY[k + 1])){
124 if(!crossing && isCross(strokesArray[j][5],
128 strokesArray[i][5] - this.kAdjustKakatoRangeX / 2,
129 strokesArray[i][6] + this.kAdjustKakatoRangeY[k],
130 strokesArray[i][5] + this.kAdjustKakatoRangeX / 2,
131 strokesArray[i][6] + this.kAdjustKakatoRangeY[k])){
134 if(!crossing && isCross(strokesArray[j][5],
138 strokesArray[i][5] - this.kAdjustKakatoRangeX / 2,
139 strokesArray[i][6] + this.kAdjustKakatoRangeY[k],
140 strokesArray[i][5] - this.kAdjustKakatoRangeX / 2,
141 strokesArray[i][6] + this.kAdjustKakatoRangeY[k + 1])){
144 if(!crossing && isCross(strokesArray[j][5],
148 strokesArray[i][5] + this.kAdjustKakatoRangeX / 2,
149 strokesArray[i][6] + this.kAdjustKakatoRangeY[k],
150 strokesArray[i][5] + this.kAdjustKakatoRangeX / 2,
151 strokesArray[i][6] + this.kAdjustKakatoRangeY[k + 1])){
154 if(!crossing && isCross(strokesArray[j][5],
158 strokesArray[i][5] - this.kAdjustKakatoRangeX / 2,
159 strokesArray[i][6] + this.kAdjustKakatoRangeY[k + 1],
160 strokesArray[i][5] + this.kAdjustKakatoRangeX / 2,
161 strokesArray[i][6] + this.kAdjustKakatoRangeY[k + 1])){
165 if(!crossing && isCross(strokesArray[j][3],
169 strokesArray[i][5] - this.kAdjustKakatoRangeX / 2,
170 strokesArray[i][6] + this.kAdjustKakatoRangeY[k],
171 strokesArray[i][5] + this.kAdjustKakatoRangeX / 2,
172 strokesArray[i][6] + this.kAdjustKakatoRangeY[k])){
175 if(!crossing && isCross(strokesArray[j][3],
179 strokesArray[i][5] - this.kAdjustKakatoRangeX / 2,
180 strokesArray[i][6] + this.kAdjustKakatoRangeY[k],
181 strokesArray[i][5] - this.kAdjustKakatoRangeX / 2,
182 strokesArray[i][6] + this.kAdjustKakatoRangeY[k + 1])){
185 if(!crossing && isCross(strokesArray[j][3],
189 strokesArray[i][5] + this.kAdjustKakatoRangeX / 2,
190 strokesArray[i][6] + this.kAdjustKakatoRangeY[k],
191 strokesArray[i][5] + this.kAdjustKakatoRangeX / 2,
192 strokesArray[i][6] + this.kAdjustKakatoRangeY[k + 1])){
195 if(!crossing && isCross(strokesArray[j][3],
199 strokesArray[i][5] - this.kAdjustKakatoRangeX / 2,
200 strokesArray[i][6] + this.kAdjustKakatoRangeY[k + 1],
201 strokesArray[i][5] + this.kAdjustKakatoRangeX / 2,
202 strokesArray[i][6] + this.kAdjustKakatoRangeY[k + 1])){
208 strokesArray[i][2] += (3 - k) * 100;
216 Kage.prototype.adjustKakato = adjustKakato;
218 function drawStrokesArray(polygons, strokesArray){
219 for(var i = 0; i < strokesArray.length; i++){
220 dfDrawFont(this, polygons,
231 strokesArray[i][10]);
234 Kage.prototype.drawStrokesArray = drawStrokesArray;
236 function drawGlyph(polygons, glyph){ // void
237 // [glyph] : [stroke]$[stroke]$.....
238 // [stroke] : [column]:[column]:.....
239 var strokes = glyph.split("$");
240 for(var i = 0; i < strokes.length; i++){
241 var columns = strokes[i].split(":");
242 if(Math.floor(columns[0]) != 99){
243 dfDrawFont(this, polygons,
244 Math.floor(columns[0]),
245 Math.floor(columns[1]), Math.floor(columns[2]),
246 Math.floor(columns[3]), Math.floor(columns[4]),
247 Math.floor(columns[5]), Math.floor(columns[6]),
248 Math.floor(columns[7]), Math.floor(columns[8]),
249 Math.floor(columns[9]), Math.floor(columns[10]));
251 var buhin = this.kBuhin.search(columns[7]);
253 this.drawBuhin(polygons, buhin,
254 Math.floor(columns[3]),
255 Math.floor(columns[4]),
256 Math.floor(columns[5]),
257 Math.floor(columns[6]));
262 Kage.prototype.drawGlyph = drawGlyph;
264 function drawBuhin(polygons, glyph, x1, y1, x2, y2){ // void
265 var strokes = glyph.split("$");
266 for(var i = 0; i < strokes.length; i++){
267 var columns = strokes[i].split(":");
268 if(Math.floor(columns[0]) != 99){
269 dfDrawFont(this, polygons,
270 Math.floor(columns[0]),
271 Math.floor(columns[1]),
272 Math.floor(columns[2]),
273 x1 + Math.floor(columns[3]) * (x2 - x1) / 200,
274 y1 + Math.floor(columns[4]) * (y2 - y1) / 200,
275 x1 + Math.floor(columns[5]) * (x2 - x1) / 200,
276 y1 + Math.floor(columns[6]) * (y2 - y1) / 200,
277 x1 + Math.floor(columns[7]) * (x2 - x1) / 200,
278 y1 + Math.floor(columns[8]) * (y2 - y1) / 200,
279 x1 + Math.floor(columns[9]) * (x2 - x1) / 200,
280 y1 + Math.floor(columns[10]) * (y2 - y1) / 200);
282 var buhin = this.kBuhin.search(columns[7]);
284 this.drawBuhin(polygons, buhin,
285 x1 + Math.floor(columns[3]) * (x2 - x1) / 200,
286 y1 + Math.floor(columns[4]) * (y2 - y1) / 200,
287 x1 + Math.floor(columns[5]) * (x2 - x1) / 200,
288 y1 + Math.floor(columns[6]) * (y2 - y1) / 200);
293 Kage.prototype.drawBuhin = drawBuhin;
296 Kage.prototype.kMincho = 0;
297 Kage.prototype.kGothic = 1;
298 this.kShotai = this.kMincho;
304 this.kAdjustKakatoL = ([14, 9, 5, 2]); // 調整済みカカト用
305 this.kAdjustKakatoR = ([8, 6, 4, 2]); // 調整済みカカト用
306 this.kAdjustKakatoRangeX = 20; // 影響判定矩形の大きさ
307 this.kAdjustKakatoRangeY = ([1, 19, 24, 30]); // 影響判定矩形の大きさ
308 this.kAdjustKakatoStep = 3; // 影響判定矩形の段階
310 this.kL2RDfatten = 1.1;
311 this.kBuhin = new Buhin();