+# Makefile\r
#\r
-#\r
-# CC=gcc -g\r
-CC= gcc -Wall\r
-\r
-VERSION=0.0.1\r
\r
-#for cygwin with glib gdk gtk\r
-#CFLAGS= -I/usr/local/include -I/usr/local/include/glib-2.0 -I/usr/local/include/glib-2.0/glib -I/usr/local/include/glib-2.0/gobject -I/usr/local/include/gtk-2.0 -I/usr/local/include/gtk-2.0/gtk -I/usr/local/include/gtk-2.0/gdk -I/usr/local/include/gtk-2.0/gdk-pixbuf -I/usr/local/lib/glib-2.0/include -I/usr/local/lib/gtk-2.0/include -I/usr/local/include/pango-1.0 -I/usr/local/include/atk-1.0\r
-#LIBS= -lpng -ldb -L/usr/local/lib -lglib-2.0 -lgtk-win32-2.0 -lgdk-win32-2.0 -lgthread-2.0 -lpangowin32-1.0 -lgobject-2.0 -lgmodule-2.0 -lpangoft2-1.0 -lpango-1.0 -latk-1.0 -lgdk_pixbuf-2.0\r
+CC=gcc -Wall\r
+INSTALL=install\r
+WGET=wget\r
+BINDIR=/usr/local/bin\r
+SHAREDIR=/usr/local/share/kagecgi\r
+DBURL=http://fonts.jp/kagedb/kagedb\r
\r
#for cygwin with glib\r
#CFLAGS= -I/usr/local/include -I/usr/local/include/glib-2.0 -I/usr/local/include/glib-2.0/glib -I/usr/local/lib/glib-2.0/include\r
#CFLAGS= -I/sw/include -I/sw/include/glib-2.0 -I/sw/lib/glib-2.0/include/ -I/sw/include/libpng/ -I/usr/include -I/usr/X11R6/include/\r
#LIBS= -L/sw/lib -lpng -lglib-2.0 -L/usr/lib -ldbm -L/usr/X11R6/lib -lX11\r
\r
+all: kage.cgi\r
+\r
kage.cgi: kagecgi.o kagepng.o kagedf.o kagecd.o kageic.o kagepoly.o kagedb.o kageeg.o kagecomb.o kagechar.o kagetool.o\r
$(CC) $(CFLAGS) -o kage.cgi kagecgi.o kagepng.o kagedf.o kagecd.o kageic.o kagepoly.o kagedb.o kageeg.o kagecomb.o kagechar.o kagetool.o $(LIBS)\r
\r
kagepng.o: kagepng.c\r
\r
clean:\r
- \rm -r -f *.o *~ *.exe *.cgi *.stackdump\r
+ \rm -r -f *.o *~ *.exe *.cgi *.stackdump kagedb\r
+\r
+install: kage.cgi\r
+ mkdir -p $(BINDIR)
+ $(INSTALL) -c -m 755 kage.cgi $(BINDIR)\r
+ mkdir -p $(SHAREDIR)\r
+ $(INSTALL) -c -m 644 error.png $(SHAREDIR)
+\r
+kagedb:\r
+ $(WGET) $(DBURL)\r
+\r
+database: kagedb\r
+ $(INSTALL) -c -m 644 kagedb $(SHAREDIR)
\r
-KAGE/cgi is a Kanji-glyph generating engine call from httpd server.
+KAGE/cgi is a Kanji-glyph generating engine.
+
+It can use by command prompt and for executable cgi for httpd server.
PREREQUISITES
1) Engine program
-After running `make', `kage.cgi' will appear at current directory.
-
-Please copy the file to proper directory.
+ # make install
-(Configure httpd for enable excuting .cgi files)
+ (by default, it will be installed as /usr/local/bin/kage.cgi)
-2) Parts database
+ Also, if you need to use as cgi, copy/make symbolic link to proper directory.
+ (ex. % cp /usr/local/bin/kage.cgi /var/www/cgi-bin/)
+
+2) Parts database (wget is required)
-Get database file. (URL `http://fonts.jp/kagedb/wiki')
+ # make database
-Copy to proper directory describing at `kagecgi.h'(databeseFileName).
+ (by default, it will be installed as /usr/local/share/kagecgi/kagedb)
TEST
====
-Call engine from a web browser like as `http://hoge.hoge/kage.cgi?u4e00'.
+1) Run from command prompt
+
+ - % kage.cgi u2ff0.u6c35.u6c38 > result.png
+ - % kage.cgi u4e08-k > result.png
+ - % kage.cgi 'u7389&shotai=gothic' > result.png
+ - % kage.cgi 'u4e5f&type=eps' > result.eps
+
+2) Run as cgi program
+
+Call engine by a web browser like as `http://hoge.hoge/cgi-bin/kage.cgi?u4e00'.
Glyph will be appear (`ICHI (one)' : u4e00 in ISO/IEC 10646-1).
- kage.cgi?u7389&shotai=gothic (generate as Gothic glyph [Default: Mincho])
- kage.cgi?u4e5f&type=eps (generate as .eps file [Default: .png file])
-OR run by command prompt mode:
- - % ./kage.cgi u2ff0.u6c35.u6c38 > result.png
- - % ./kage.cgi u4e08-k > result.png
- - % ./kage.cgi 'u7389&shotai=gothic' > result.png
- - % ./kage.cgi 'u4e5f&type=eps' > result.eps
-
GETTING MORE INFORMATION
========================
closePng(pngWidth, pngHeight, kageCanvas);\r
}\r
else{\r
- err = fopen("error.png", "r");\r
+ err = fopen(errorFileName, "r");\r
fread(errbuf, sizeof(char), errorFileSize, err);\r
// printf("An error occurred.\r\n");\r
if(type != 1) fprintf(stdout, "Content-type: image/png\n\n");\r
\r
// define for localhost environment\r
#define errorFileSize 4009\r
-#define errorFileName "error.png"\r
+#define errorFileName "/usr/local/share/kagecgi/error.png"\r
#define pngFilePath "/var/www/fontsjp/v0.4/"\r
-#define databaseFileName "../../kagedb/wiki"\r
+#define databaseFileName "/usr/local/share/kagecgi/kagedb"\r
\r
#define kBaseline 188\r
#define pngWidth 200\r