\r
//clear result buffer\r
test2 = g_string_new("");\r
- if(kType == 2){\r
+ if(kType == 1){ //svg\r
+ g_string_append(kResultText, "<?xml version=\"1.0\"?>\n");\r
+ g_string_append(kResultText, "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.0//EN\" \"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd\">\n");\r
+ g_string_append(kResultText, "<svg viewBox=\"0 0 1024 1024\">");\r
+ }\r
+ else if(kType == 2){ //eps\r
g_string_append(kResultText, "%!PS-Adobe-3.0 EPSF-3.0\n");\r
g_string_append(kResultText, "%%BoundingBox: 0 -208 1024 816\n");\r
g_string_append(kResultText, "%%Pages: 0\n");\r
}\r
}\r
else if(kType == 1){ //svg(vector graphics)\r
+ if(test2->len != 0){\r
+ test2 = CalcSizes(test2, 1);\r
+ kMode = 1;\r
+ drawGlyph(test2, 0);\r
+ g_string_append(kResultText, "</svg>\n");\r
+ fprintf(stdout, "Content-type: image/svg-xml\n\n");\r
+ fprintf(stdout, "%s", kResultText->str);\r
+ }\r
+ else{\r
+ fprintf(stdout, "Content-type: text/plain\n\n");\r
+ fprintf(stdout, "An error occurred.");\r
+ }\r
}\r
else if(kType == 2){ //eps(vector graphics)\r
if(test2->len != 0){\r
test2 = CalcSizes(test2, 1);\r
- kMode = 1;\r
+ kMode = 2;\r
drawGlyph(test2, 0);\r
g_string_append(kResultText, "fill\n");\r
g_string_append(kResultText, "%%EOF\n");\r
if(kMode == 0){ //normal\r
fillPolygon(poly, number, 0, kageCanvas);\r
}\r
- else{ //output for eps\r
+ else if(kMode == 1){ //output for svg\r
+ sprintf(buf, "<path d=\"M ");\r
+ g_string_append(kResultText, buf);\r
+ for(i = 0; i < number; i++){\r
+ sprintf(buf, "%d,%d ", poly[i].X * 5, poly[i].Y * 5);\r
+ g_string_append(kResultText, buf);\r
+ }\r
+ sprintf(buf, "Z\"/>");\r
+ g_string_append(kResultText, buf);\r
+ }\r
+ else if(kMode == 2){ //output for eps\r
sprintf(buf, "%d %d moveto\n", poly[0].X * 5, 1000 - (poly[0].Y * 5) - 200);\r
g_string_append(kResultText, buf);\r
for(i = 1; i < number; i++){\r
g_string_append(kResultText, buf);\r
g_string_append(kResultText, "closepath\n");\r
}\r
+\r
}\r