}\r
\r
void PartsWidth(const KGString *in, int *lx, int *rx){\r
+ int tempShotai;\r
+ DrawBox();\r
+ tempShotai = kShotai;\r
+ kShotai = kGothic;\r
+ drawGlyph(in, 1);\r
+ kShotai = tempShotai;\r
+ DotsWidth(lx, rx);\r
+ /*\r
int i;\r
int *buf, strokes;\r
+ double t, x;\r
\r
*lx = 1000; *rx = 0;\r
buf = convertStroke(in->str, buf, &strokes);\r
\r
for(i = 0; i < strokes; i++){\r
- if(buf[i * 11 + 0] % 10 == 0) continue;\r
+ switch(buf[i * 11 + 0] % 10){\r
\r
- if(*lx > buf[i * 11 + 3]) *lx = buf[i * 11 + 3];\r
- if(*rx < buf[i * 11 + 3]) *rx = buf[i * 11 + 3];\r
- if(*lx > buf[i * 11 + 5]) *lx = buf[i * 11 + 5];\r
- if(*rx < buf[i * 11 + 5]) *rx = buf[i * 11 + 5];\r
- \r
- if(buf[i * 11 + 0] % 10 == 2 || buf[i * 11 + 0] % 10 == 3 || buf[i * 11 + 0] % 10 == 8){\r
+ case 0:\r
+ case 9:\r
+ break;\r
+ case 1:\r
+ if(*lx > buf[i * 11 + 3]) *lx = buf[i * 11 + 3];\r
+ if(*rx < buf[i * 11 + 3]) *rx = buf[i * 11 + 3];\r
+ if(*lx > buf[i * 11 + 5]) *lx = buf[i * 11 + 5];\r
+ if(*rx < buf[i * 11 + 5]) *rx = buf[i * 11 + 5];\r
+ break;\r
+ case 2:\r
+ for(t = 0; t <= 1; t = t + 0.05){\r
+ x = (1.0 - t) * (1.0 - t) * buf[i * 11 + 3] + 2.0 * t * (1.0 - t) * buf[i * 11 + 5] + t * t * buf[i * 11 + 7];\r
+ if(*lx > x) *lx = x;\r
+ if(*rx < x) *rx = x;\r
+ }\r
+ break;\r
+ case 3:\r
+ if(*lx > buf[i * 11 + 3]) *lx = buf[i * 11 + 3];\r
+ if(*rx < buf[i * 11 + 3]) *rx = buf[i * 11 + 3];\r
+ if(*lx > buf[i * 11 + 5]) *lx = buf[i * 11 + 5];\r
+ if(*rx < buf[i * 11 + 5]) *rx = buf[i * 11 + 5];\r
if(*lx > buf[i * 11 + 7]) *lx = buf[i * 11 + 7];\r
if(*rx < buf[i * 11 + 7]) *rx = buf[i * 11 + 7];\r
+ break;\r
+ case 6:\r
+ for(t = 0; t < 1; t = t + 0.05){\r
+ x = (1.0 - t) * (1.0 - t) * (1.0 - t) * buf[i * 11 + 3] + 3.0 * t * (1.0 - t) * (1.0 - t) * buf[i * 11 + 5] + 3 * t * t * (1.0 - t) * buf[i * 11 + 7] + t * t * t * buf[i * 11 + 9];\r
+ if(*lx > x) *lx = x;\r
+ if(*rx < x) *rx = x;\r
+ }\r
+ break;\r
+ case 7:\r
+ if(*lx > buf[i * 11 + 3]) *lx = buf[i * 11 + 3];\r
+ if(*rx < buf[i * 11 + 3]) *rx = buf[i * 11 + 3];\r
+ for(t = 0; t < 1; t = t + 0.05){\r
+ x = (1.0 - t) * (1.0 - t) * buf[i * 11 + 5] + 2.0 * t * (1.0 - t) * buf[i * 11 + 7] + t * t * buf[i * 11 + 9];\r
+ if(*lx > x) *lx = x;\r
+ if(*rx < x) *rx = x;\r
+ }\r
}\r
- if(buf[i * 11 + 0] % 10 == 4 || buf[i * 11 + 0] % 10 == 6 || buf[i * 11 + 0] % 10 == 7){\r
- if(*lx > buf[i * 11 + 9]) *lx = buf[i * 11 + 9];\r
- if(*rx < buf[i * 11 + 9]) *rx = buf[i * 11 + 9];\r
- }\r
}\r
free(buf);\r
+ */\r
}\r
\r
void PartsHeight(const KGString *in, int *ly, int *ry){\r
+ int tempShotai;\r
+ DrawBox();\r
+ tempShotai = kShotai;\r
+ kShotai = kGothic;\r
+ drawGlyph(in, 1);\r
+ kShotai = tempShotai;\r
+ DotsHeight(ly, ry);\r
+ /*\r
+ int i;\r
+ int *buf, strokes;\r
+ double t, y;\r
+ \r
+ *ly = 1000; *ry = 0;\r
+ buf = convertStroke(in->str, buf, &strokes);\r
+ \r
+ for(i = 0; i < strokes; i++){\r
+ switch(buf[i * 11 + 0] % 10){\r
+ \r
+ case 0:\r
+ case 9:\r
+ break;\r
+ case 1:\r
+ if(*ly > buf[i * 11 + 4]) *ly = buf[i * 11 + 4];\r
+ if(*ry < buf[i * 11 + 4]) *ry = buf[i * 11 + 4];\r
+ if(*ly > buf[i * 11 + 6]) *ly = buf[i * 11 + 6];\r
+ if(*ry < buf[i * 11 + 6]) *ry = buf[i * 11 + 6];\r
+ break;\r
+ case 2:\r
+ for(t = 0; t <= 1; t = t + 0.05){\r
+ y = (1.0 - t) * (1.0 - t) * buf[i * 11 + 4] + 2.0 * t * (1.0 - t) * buf[i * 11 + 6] + t * t * buf[i * 11 + 8];\r
+ if(*ly > y) *ly = y;\r
+ if(*ry < y) *ry = y;\r
+ }\r
+ break;\r
+ case 3:\r
+ if(*ly > buf[i * 11 + 4]) *ly = buf[i * 11 + 4];\r
+ if(*ry < buf[i * 11 + 4]) *ry = buf[i * 11 + 4];\r
+ if(*ly > buf[i * 11 + 6]) *ly = buf[i * 11 + 6];\r
+ if(*ry < buf[i * 11 + 6]) *ry = buf[i * 11 + 6];\r
+ if(*ly > buf[i * 11 + 8]) *ly = buf[i * 11 + 8];\r
+ if(*ry < buf[i * 11 + 8]) *ry = buf[i * 11 + 8];\r
+ break;\r
+ case 6:\r
+ for(t = 0; t < 1; t = t + 0.05){\r
+ y = (1.0 - t) * (1.0 - t) * (1.0 - t) * buf[i * 11 + 4] + 3.0 * t * (1.0 - t) * (1.0 - t) * buf[i * 11 + 6] + 3 * t * t * (1.0 - t) * buf[i * 11 + 8] + t * t * t * buf[i * 11 + 10];\r
+ if(*ly > y) *ly = y;\r
+ if(*ry < y) *ry = y;\r
+ }\r
+ break;\r
+ case 7:\r
+ if(*ly > buf[i * 11 + 4]) *ly = buf[i * 11 + 4];\r
+ if(*ry < buf[i * 11 + 4]) *ry = buf[i * 11 + 4];\r
+ for(t = 0; t < 1; t = t + 0.05){\r
+ y = (1.0 - t) * (1.0 - t) * buf[i * 11 + 6] + 2.0 * t * (1.0 - t) * buf[i * 11 + 8] + t * t * buf[i * 11 + 10];\r
+ if(*ly > y) *ly = y;\r
+ if(*ry < y) *ry = y;\r
+ }\r
+ }\r
+ }\r
+ free(buf);\r
+ */\r
+ /*\r
int i;\r
int *buf, strokes;\r
\r
}\r
}\r
free(buf);\r
+ */\r
}\r
\r
KGString * CalcSizes(const KGString *in, int mode){\r