#define FLAG_SURROUND_TOP 4
#define FLAG_SURROUND_BOTTOM 8
+#define DRAW_GLYPH_MODE_NORMAL 0
+#define DRAW_GLYPH_MODE_WITHOUT_DECORATION 1
+
typedef struct _kPoint{
double X;
double Y;
// kg_string_append(test2, test1->str);
}
+ if(test2->len != 0) test2 = finalAdjustment(test2);
+
if(kType == 0){ //png(image)
if(test2->len != 0){
if(kInput != 1){ //0 and 2
test2 = CalcSizes(test2, 1);
}
DrawBox();
- drawGlyph(test2, 0);
+ drawGlyph(test2, DRAW_GLYPH_MODE_NORMAL);
//output to file
filename = kg_string_new(pngFilePath);
if(kShotai == kMincho) kg_string_append(filename, "mincho/");
if(test2->len != 0){
test2 = CalcSizes(test2, 1);
kMode = 1;
- drawGlyph(test2, 0);
+ drawGlyph(test2, DRAW_GLYPH_MODE_NORMAL);
kg_string_append(kResultText, "</g></svg>\n");
if(type != 1) fprintf(stdout, "Content-type: image/svg-xml\n\n");
fprintf(stdout, "%s", kResultText->str);
if(test2->len != 0){
test2 = CalcSizes(test2, 1);
kMode = 2;
- drawGlyph(test2, 0);
+ drawGlyph(test2, DRAW_GLYPH_MODE_NORMAL);
kg_string_append(kResultText, "fill\n");
kg_string_append(kResultText, "%%EOF\n");
if(type != 1) fprintf(stdout, "Content-type: application/postscript\n\n");
void searchCacheData(const KGString *in, KGString *out);
void doCombine(const KGString *in, KGString *out);
void drawGlyph(const KGString *in, const int mode);
+KGString* finalAdjustment(const KGString *in);
int isIDS(const KGString *in);
void divideInto2(const KGString *in, KGString *partIDS1, KGString *partIDS3);
int *buf;
buf = convertStroke(in->str, buf, &j);
for(i = 0; i < j; i++){
- if(mode == 0){ //normal
+ if(mode == DRAW_GLYPH_MODE_NORMAL){ //normal
dfDrawFont(buf[i * 11 + 0],
buf[i * 11 + 1],
buf[i * 11 + 2],
buf[i * 11 + 9],
buf[i * 11 + 10]);
}
- else if(mode == 1){ //without decoration
+ else if(mode == DRAW_GLYPH_MODE_WITHOUT_DECORATION){ //without decoration
dfDrawFont(buf[i * 11 + 0],
0,
0,
free(buf);
}
+KGString* finalAdjustment(const KGString *in){
+ int i, j, k, l, m, n;
+ int *buf;
+ KGString *temp;
+
+ n = kShotai;
+ kShotai = kGothic;
+ temp = kg_string_new("");
+
+ DrawBox();
+ drawGlyph(in, DRAW_GLYPH_MODE_WITHOUT_DECORATION);
+
+ buf = convertStroke(in->str, buf, &j);
+ for(i = 0; i < j; i++){
+ m = 0;
+ if(buf[i * 11 + 2] == 13){
+ for(k = buf[i * 11 + 5] - kMinWidthT; k < buf[i * 11 + 5] + kMinWidthT; k++){
+ for(l = buf[i * 11 + 6] + kWidth * kKakato * 0.5; l < buf[i * 11 + 6] + kWidth * kKakato + pngHeight * 0.1; l++){
+ if(0 <= l && l < canvasHeight && 0 <= k && k < canvasHeight && kageCanvas[l][k] != kWhite) m++;
+ }
+ }
+ if(m != 0) buf[i * 11 + 2] = 23;
+ }
+ }
+ convertArray(buf, temp, j, 0);
+ free(buf);
+ kShotai = n;
+ return kg_string_new(temp->str);
+}
+
DrawBox();
tempShotai = kShotai;
kShotai = kGothic;
- drawGlyph(in, 1);
+ drawGlyph(in, DRAW_GLYPH_MODE_WITHOUT_DECORATION);
kShotai = tempShotai;
DotsWidth(lx, rx);
/*
DrawBox();
tempShotai = kShotai;
kShotai = kGothic;
- drawGlyph(in, 1);
+ drawGlyph(in, DRAW_GLYPH_MODE_WITHOUT_DECORATION);
kShotai = tempShotai;
DotsHeight(ly, ry);
/*
DrawBox();
tempShotai = kShotai;
kShotai = kGothic;
- drawGlyph(in, 1);
+ drawGlyph(in, DRAW_GLYPH_MODE_WITHOUT_DECORATION);
kShotai = tempShotai;
DotsWidth(&dlx1, &drx1);
DotsHeight(&dly1, &dry1);