Added EPS output function.
authorKoichi KAMICHI <kamichi@fonts.jp>
Thu, 29 May 2008 04:37:50 +0000 (04:37 +0000)
committerKoichi KAMICHI <kamichi@fonts.jp>
Thu, 29 May 2008 04:37:50 +0000 (04:37 +0000)
engine/polygons.js

index 6e95331..7467878 100755 (executable)
@@ -54,7 +54,37 @@ function Polygons(){
     return buffer;\r
   }\r
   Polygons.prototype.generateSVG = generateSVG;\r
-  \r
+\r
+    function generateEPS(){ // string\r
+       var buffer = "";\r
+       buffer += "%!PS-Adobe-3.0 EPSF-3.0\n";\r
+       buffer += "%%BoundingBox: 0 -208 1024 816\n";\r
+       buffer += "%%Pages: 0\n";\r
+       buffer += "%%Title: Kanji glyph\n";\r
+       buffer += "%%Creator: GlyphWiki powered by KAGE system\n";\r
+       buffer += "%%CreationDate: " + new Date() + "\n";\r
+       buffer += "%%EndComments\n";\r
+       buffer += "%%EndProlog\n";\r
+       buffer += "%%Page \"Kanji glyph\" 1\n";\r
+       buffer += "newpath\n";\r
+       \r
+       for(var i = 0; i < this.array.length; i++){\r
+           for(var j = 0; j < this.array[i].array.length; j++){\r
+               buffer += (this.array[i].array[j].x * 5) + " " + (1000 - this.array[i].array[j].y * 5 - 200) + " ";\r
+               if(j == 0){\r
+                   buffer += "moveto\n";\r
+               } else {\r
+                   buffer += "lineto\n";\r
+               }\r
+           }\r
+           buffer += "closepath\n";\r
+       }\r
+       buffer += "fill\n";\r
+       buffer += "%%EOF\n";\r
+       return buffer;\r
+    }\r
+    Polygons.prototype.generateEPS = generateEPS;\r
+\r
   // property\r
   this.array = new Array();\r
   \r