-# Makefile\r
-#\r
-\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
-#LIBS= -L/usr/local/lib -lpng -ldb -lglib-2.0\r
-\r
-#for linux\r
-CFLAGS= -I/usr/local/include -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include\r
-LIBS= -L/usr/local/lib -lpng -ldb -lglib-2.0\r
-\r
-#for MacOSX with fink\r
-#CFLAGS= -I/sw/include -I/sw/include/db3 -I/sw/include/glib-2.0 -I/sw/lib/glib-2.0/include/ -I/sw/include/libpng/ -I/usr/include\r
-#LIBS= -L/sw/lib -lpng -lglib-2.0 -L/usr/lib -ldb\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
-kagecgi.o: kagecgi.c\r
-kagedf.o: kagedf.c\r
-kagecd.o: kagecd.c\r
-kageic.o: kageic.c\r
-kagepoly.o: kagepoly.c\r
-kagedb.o: kagedb.c\r
-kageeg.o: kageeg.c\r
-kagechar.o: kagechar.c\r
-kagecomb.o: kagecomb.c\r
-kagetool.o: kagetool.c\r
-kagepng.o: kagepng.c\r
-\r
-clean:\r
- \rm -r -f *.o *~ *.exe *.cgi *.stackdump kagedb\r
-\r
-install: kage.cgi\r
+# Makefile
+#
+
+CC=gcc -Wall
+INSTALL=install
+WGET=wget
+BINDIR=/usr/local/bin
+SHAREDIR=/usr/local/share/kagecgi
+DBURL=http://fonts.jp/kagedb/kagedb
+
+#for cygwin
+CFLAGS=
+LIBS= -lpng -ldb
+
+#for linux
+#CFLAGS= -I/usr/local/include
+#LIBS= -L/usr/local/lib -lpng -ldb
+
+#for MacOSX with fink
+#CFLAGS= -I/sw/include -I/sw/include/db3 -I/sw/include/libpng/
+#LIBS= -L/sw/lib -lpng -ldb
+
+all: kage.cgi
+
+kage.cgi: kagecgi.o kagepng.o kagedf.o kagecd.o kageic.o kagepoly.o kagedb.o kageeg.o kagecomb.o kagechar.o kagetool.o kagestr.o
+ $(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 kagestr.o $(LIBS)
+
+kagecgi.o: kagecgi.c
+kagedf.o: kagedf.c
+kagecd.o: kagecd.c
+kageic.o: kageic.c
+kagepoly.o: kagepoly.c
+kagedb.o: kagedb.c
+kageeg.o: kageeg.c
+kagechar.o: kagechar.c
+kagecomb.o: kagecomb.c
+kagetool.o: kagetool.c
+kagepng.o: kagepng.c
+kagestr.o: kagestr.c
+
+clean:
+ \rm -r -f *.o *~ *.exe *.cgi *.stackdump kagedb
+
+install: kage.cgi
mkdir -p $(BINDIR)
- $(INSTALL) -c -m 755 kage.cgi $(BINDIR)\r
- mkdir -p $(SHAREDIR)\r
+ $(INSTALL) -c -m 755 kage.cgi $(BINDIR)
+ mkdir -p $(SHAREDIR)
$(INSTALL) -c -m 644 error.png $(SHAREDIR)
-\r
-kagedb:\r
- $(WGET) $(DBURL)\r
-\r
-database: kagedb\r
+
+kagedb:
+ $(WGET) $(DBURL)
+
+database: kagedb
$(INSTALL) -c -m 644 kagedb $(SHAREDIR)
-\r
- Berkely DB 3
- libpng
- - glib2.0
CONFIGURATION
Please edit `Makefile' fit with your environment.
-
RUNNING MAKE
============
-//kagecgi.c\r
-//\r
-\r
-#include "kage.h"\r
-#include "kagecgi.h"\r
-#include "sysdep.h"\r
-\r
-int main(int argc, char *argv[]){\r
- GString *tmp1, *tmp2, *test1, *test2, *filename;\r
- FILE *err;\r
- char errbuf[errorFileSize];\r
- char *pos, *cur;\r
- int dummy;\r
- int type;\r
-\r
- dummy = initDB();\r
-\r
- //set default\r
- kShotai = kMincho;\r
-// kShotai = kGothic;\r
- kSize = 200;\r
- kType = 0; //png\r
- kInput = 0; //ids or direct\r
- kResultText = g_string_new("");\r
- kMode = 0;\r
- \r
- //confirm request\r
- type = 0;\r
- //GET request\r
- if(type == 0){\r
- tmp1 = g_string_new((gchar *)getenv("QUERY_STRING"));\r
- if(tmp1->len != 0) type = 2;\r
- }\r
- //argv(detect after GET request)\r
- if(type == 0){
- tmp1 = g_string_new((gchar *)argv[1]);\r
- if(tmp1->len != 0) type = 1;
- }
- //redirect\r
- if(type == 0){\r
- tmp1 = g_string_new((gchar *)getenv("REDIRECT_URL"));\r
- if(tmp1->len != 0) type = 3;\r
- }\r
- //error\r
- if(type == 0){\r
- fprintf(stderr, "Request Error.\n");\r
- return 0;\r
- }\r
- pos = tmp1->str;\r
- \r
- //separate token\r
- if(type == 1 || type == 2){ //argv or GET request\r
- while(1){\r
- cur = strchr(pos, '&');\r
- tmp2 = g_string_new(pos);\r
- if(cur != NULL) g_string_set_size(tmp2, cur - pos);\r
- //got request string\r
- if(strncmp(tmp2->str, "shotai=mincho", 13) == 0) kShotai = kMincho;\r
- else if(strncmp(tmp2->str, "shotai=gothic", 13) == 0) kShotai = kGothic;\r
- else if(strncmp(tmp2->str, "shotai=skeleton", 15) == 0) kShotai = kGothic;\r
- else if(strncmp(tmp2->str, "type=png", 8) == 0) kType = 0;\r
- else if(strncmp(tmp2->str, "type=svg", 8) == 0) kType = 1;\r
- else if(strncmp(tmp2->str, "type=eps", 8) == 0) kType = 2;\r
- else if(strncmp(tmp2->str, "type=raw", 8) == 0) kType = 3;\r
- else if(strncmp(tmp2->str, "input=ids", 9) == 0) kInput = 0;\r
- else if(strncmp(tmp2->str, "input=directwithadjust", 22) == 0) kInput = 2;\r
- else if(strncmp(tmp2->str, "input=direct", 12) == 0) kInput = 1;\r
- else if(strncmp(tmp2->str, "size=24", 7) == 0) kSize = 24;\r
- else if(strncmp(tmp2->str, "size=200", 8) == 0) kSize = 200;\r
- else test1 = g_string_new(tmp2->str);\r
- if(cur == NULL) break;\r
- pos = cur + 1;\r
- }\r
- }\r
- else{ // redirected request\r
- kInput = 0;\r
- while(1){\r
- cur = strchr(pos, '/');\r
- tmp2 = g_string_new(pos);\r
- if(cur != NULL) g_string_set_size(tmp2, cur - pos);\r
- //got request string\r
- if(strncmp(tmp2->str, "mincho", 6) == 0) kShotai = kMincho;\r
- else if(strncmp(tmp2->str, "gothic", 6) == 0) kShotai = kGothic;\r
- else if(strncmp(tmp2->str, "skeleton", 8) == 0) kShotai = kGothic;\r
- else if(strncmp(tmp2->str, "v0.4", 4) == 0);\r
- else test1 = g_string_new(tmp2->str);\r
- if(cur == NULL) break;\r
- pos = cur + 1;\r
- }\r
- if(strncmp(test1->str + test1->len - 4, ".png", 4) == 0) kType = 0;\r
- if(strncmp(test1->str + test1->len - 4, ".svg", 4) == 0) kType = 1;\r
- if(strncmp(test1->str + test1->len - 4, ".eps", 4) == 0) kType = 2;\r
- if(strncmp(test1->str + test1->len - 4, ".raw", 4) == 0) kType = 3;\r
- g_string_set_size(test1, test1->len - 4);\r
- }\r
- \r
- //clear result buffer\r
- test2 = g_string_new("");\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
- g_string_append(kResultText, "%%Title: ");\r
- g_string_append(kResultText, test1->str);\r
- g_string_append(kResultText, "\n");\r
- g_string_append(kResultText, "%%Creator: KAGE System\n");\r
- g_string_append(kResultText, "%%CreationDate: 00:00 1-1-2004\n");\r
- g_string_append(kResultText, "%%EndComments\n");\r
- g_string_append(kResultText, "%%EndProlog\n");\r
- g_string_append(kResultText, "%%Page \"");\r
- g_string_append(kResultText, test1->str);\r
- g_string_append(kResultText, "\" 1\n");\r
- g_string_append(kResultText, "newpath\n");\r
- }\r
- kageCanvas = initPng(canvasWidth, canvasHeight);\r
- if(kInput == 0) generateGlyph(test1, test2);\r
- else{\r
- convert99(test1, test2);\r
- // g_string_append(test2, test1->str);\r
- }\r
-\r
- if(kType == 0){ //png(image)\r
- if(test2->len != 0){\r
- if(kInput != 1){ //0 and 2\r
- test2 = CalcSizes(test2, 1);\r
- }\r
- DrawBox();\r
- drawGlyph(test2, 0);\r
- //output to file\r
- filename = g_string_new(pngFilePath);\r
- if(kShotai == kMincho) g_string_append(filename, "mincho/");\r
- else if(kShotai == kGothic) g_string_append(filename, "gothic/");//skeleton??\r
- g_string_append(filename, test1->str);\r
- g_string_append(filename, ".png");\r
- \r
-//skip for adjustment mode\r
-// fp = fopen(filename->str, "w");\r
-// writePng(pngWidth, pngHeight, kageCanvas, fp);\r
-// fclose(fp);\r
- //output to stdout\r
- if(type != 1) fprintf(stdout, "Content-type: image/png\n\n");\r
- writePng(pngWidth, pngHeight, kageCanvas, stdout);\r
- //done\r
- closePng(pngWidth, pngHeight, kageCanvas);\r
- }\r
- else{\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
- fwrite(errbuf, sizeof(char), errorFileSize, stdout);\r
- fclose(err);\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
- if(type != 1) fprintf(stdout, "Content-type: image/svg-xml\n\n");\r
- fprintf(stdout, "%s", kResultText->str);\r
- }\r
- else{\r
- if(type != 1) 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 = 2;\r
- drawGlyph(test2, 0);\r
- g_string_append(kResultText, "fill\n");\r
- g_string_append(kResultText, "%%EOF\n");\r
- if(type != 1) fprintf(stdout, "Content-type: application/postscript\n\n");\r
- fprintf(stdout, "%s", kResultText->str);\r
- }\r
- else{\r
- if(type != 1) fprintf(stdout, "Content-type: text/plain\n\n");\r
- fprintf(stdout, "An error occurred.");\r
- }\r
- }\r
- else{ //raw(text)\r
-\r
- if(test2->len != 0){\r
- test2 = CalcSizes(test2, 1);\r
- if(type != 1) fprintf(stdout, "Content-type: text/plain\n\n");\r
- fprintf(stdout, "result=%s", test2->str);\r
- }\r
- else{\r
- if(type != 1) fprintf(stdout, "Content-type: text/plain\n\n");\r
- fprintf(stdout, "result=nodata");\r
- }\r
- }\r
- dummy = closeDB();\r
- \r
- return 0;\r
-}\r
-\r
+//kagecgi.c
+//
+
+#include "kage.h"
+#include "kagecgi.h"
+#include "sysdep.h"
+
+int main(int argc, char *argv[]){
+ KGString *tmp1, *tmp2, *test1, *test2, *filename;
+ FILE *err;
+ char errbuf[errorFileSize];
+ char *pos, *cur;
+ int dummy;
+ int type;
+
+ dummy = initDB();
+
+ //set default
+ kShotai = kMincho;
+ //kShotai = kGothic;
+ kSize = 200;
+ kType = 0; //png
+ kInput = 0; //ids or direct
+ kResultText = kg_string_new("");
+ kMode = 0;
+
+ //confirm request
+ type = 0;
+ //GET request
+ if(type == 0){
+ tmp1 = kg_string_new((kgchar *)getenv("QUERY_STRING"));
+ if(tmp1->len != 0) type = 2;
+ }
+ //argv(detect after GET request)
+ if(type == 0){
+ tmp1 = kg_string_new((kgchar *)argv[1]);
+ if(tmp1->len != 0) type = 1;
+ }
+ //redirect
+ if(type == 0){
+ tmp1 = kg_string_new((kgchar *)getenv("REDIRECT_URL"));
+ if(tmp1->len != 0) type = 3;
+ }
+ //error
+ if(type == 0){
+ fprintf(stderr, "Request Error.\n");
+ return 0;
+ }
+ pos = tmp1->str;
+
+ //separate token
+ if(type == 1 || type == 2){ //argv or GET request
+ while(1){
+ cur = strchr(pos, '&');
+ tmp2 = kg_string_new(pos);
+ if(cur != NULL) kg_string_set_size(tmp2, cur - pos);
+ //got request string
+ if(strncmp(tmp2->str, "shotai=mincho", 13) == 0) kShotai = kMincho;
+ else if(strncmp(tmp2->str, "shotai=gothic", 13) == 0) kShotai = kGothic;
+ else if(strncmp(tmp2->str, "shotai=skeleton", 15) == 0) kShotai = kGothic;
+ else if(strncmp(tmp2->str, "type=png", 8) == 0) kType = 0;
+ else if(strncmp(tmp2->str, "type=svg", 8) == 0) kType = 1;
+ else if(strncmp(tmp2->str, "type=eps", 8) == 0) kType = 2;
+ else if(strncmp(tmp2->str, "type=raw", 8) == 0) kType = 3;
+ else if(strncmp(tmp2->str, "input=ids", 9) == 0) kInput = 0;
+ else if(strncmp(tmp2->str, "input=directwithadjust", 22) == 0) kInput = 2;
+ else if(strncmp(tmp2->str, "input=direct", 12) == 0) kInput = 1;
+ else if(strncmp(tmp2->str, "size=24", 7) == 0) kSize = 24;
+ else if(strncmp(tmp2->str, "size=200", 8) == 0) kSize = 200;
+ else test1 = kg_string_new(tmp2->str);
+ if(cur == NULL) break;
+ pos = cur + 1;
+ }
+ }
+ else{ // redirected request
+ kInput = 0;
+ while(1){
+ cur = strchr(pos, '/');
+ tmp2 = kg_string_new(pos);
+ if(cur != NULL) kg_string_set_size(tmp2, cur - pos);
+ //got request string
+ if(strncmp(tmp2->str, "mincho", 6) == 0) kShotai = kMincho;
+ else if(strncmp(tmp2->str, "gothic", 6) == 0) kShotai = kGothic;
+ else if(strncmp(tmp2->str, "skeleton", 8) == 0) kShotai = kGothic;
+ else if(strncmp(tmp2->str, "v0.4", 4) == 0);
+ else test1 = kg_string_new(tmp2->str);
+ if(cur == NULL) break;
+ pos = cur + 1;
+ }
+ if(strncmp(test1->str + test1->len - 4, ".png", 4) == 0) kType = 0;
+ if(strncmp(test1->str + test1->len - 4, ".svg", 4) == 0) kType = 1;
+ if(strncmp(test1->str + test1->len - 4, ".eps", 4) == 0) kType = 2;
+ if(strncmp(test1->str + test1->len - 4, ".raw", 4) == 0) kType = 3;
+ kg_string_set_size(test1, test1->len - 4);
+ }
+
+ //clear result buffer
+ test2 = kg_string_new("");
+ if(kType == 1){ //svg
+ kg_string_append(kResultText, "<?xml version=\"1.0\"?>\n");
+ kg_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");
+ kg_string_append(kResultText, "<svg viewBox=\"0 0 1024 1024\">");
+ }
+ else if(kType == 2){ //eps
+ kg_string_append(kResultText, "%!PS-Adobe-3.0 EPSF-3.0\n");
+ kg_string_append(kResultText, "%%BoundingBox: 0 -208 1024 816\n");
+ kg_string_append(kResultText, "%%Pages: 0\n");
+ kg_string_append(kResultText, "%%Title: ");
+ kg_string_append(kResultText, test1->str);
+ kg_string_append(kResultText, "\n");
+ kg_string_append(kResultText, "%%Creator: KAGE System\n");
+ kg_string_append(kResultText, "%%CreationDate: 00:00 1-1-2004\n");
+ kg_string_append(kResultText, "%%EndComments\n");
+ kg_string_append(kResultText, "%%EndProlog\n");
+ kg_string_append(kResultText, "%%Page \"");
+ kg_string_append(kResultText, test1->str);
+ kg_string_append(kResultText, "\" 1\n");
+ kg_string_append(kResultText, "newpath\n");
+ }
+ kageCanvas = initPng(canvasWidth, canvasHeight);
+ if(kInput == 0) generateGlyph(test1, test2);
+ else{
+ convert99(test1, test2);
+ // kg_string_append(test2, test1->str);
+ }
+
+ if(kType == 0){ //png(image)
+ if(test2->len != 0){
+ if(kInput != 1){ //0 and 2
+ test2 = CalcSizes(test2, 1);
+ }
+ DrawBox();
+ drawGlyph(test2, 0);
+ //output to file
+ filename = kg_string_new(pngFilePath);
+ if(kShotai == kMincho) kg_string_append(filename, "mincho/");
+ else if(kShotai == kGothic) kg_string_append(filename, "gothic/");//skeleton??
+ kg_string_append(filename, test1->str);
+ kg_string_append(filename, ".png");
+
+ //skip for adjustment mode
+ //fp = fopen(filename->str, "w");
+ //writePng(pngWidth, pngHeight, kageCanvas, fp);
+ //fclose(fp);
+ //output to stdout
+ if(type != 1) fprintf(stdout, "Content-type: image/png\n\n");
+ writePng(pngWidth, pngHeight, kageCanvas, stdout);
+ //done
+ closePng(pngWidth, pngHeight, kageCanvas);
+ }
+ else{
+ err = fopen(errorFileName, "r");
+ fread(errbuf, sizeof(char), errorFileSize, err);
+ //printf("An error occurred.\r\n");
+ if(type != 1) fprintf(stdout, "Content-type: image/png\n\n");
+ fwrite(errbuf, sizeof(char), errorFileSize, stdout);
+ fclose(err);
+ }
+ }
+ else if(kType == 1){ //svg(vector graphics)
+ if(test2->len != 0){
+ test2 = CalcSizes(test2, 1);
+ kMode = 1;
+ drawGlyph(test2, 0);
+ kg_string_append(kResultText, "</svg>\n");
+ if(type != 1) fprintf(stdout, "Content-type: image/svg-xml\n\n");
+ fprintf(stdout, "%s", kResultText->str);
+ }
+ else{
+ if(type != 1) fprintf(stdout, "Content-type: text/plain\n\n");
+ fprintf(stdout, "An error occurred.");
+ }
+ }
+ else if(kType == 2){ //eps(vector graphics)
+ if(test2->len != 0){
+ test2 = CalcSizes(test2, 1);
+ kMode = 2;
+ drawGlyph(test2, 0);
+ kg_string_append(kResultText, "fill\n");
+ kg_string_append(kResultText, "%%EOF\n");
+ if(type != 1) fprintf(stdout, "Content-type: application/postscript\n\n");
+ fprintf(stdout, "%s", kResultText->str);
+ }
+ else{
+ if(type != 1) fprintf(stdout, "Content-type: text/plain\n\n");
+ fprintf(stdout, "An error occurred.");
+ }
+ }
+ else{ //raw(text)
+
+ if(test2->len != 0){
+ test2 = CalcSizes(test2, 1);
+ if(type != 1) fprintf(stdout, "Content-type: text/plain\n\n");
+ fprintf(stdout, "result=%s", test2->str);
+ }
+ else{
+ if(type != 1) fprintf(stdout, "Content-type: text/plain\n\n");
+ fprintf(stdout, "result=nodata");
+ }
+ }
+ dummy = closeDB();
+
+ return 0;
+}
+
#define _KAGECGI_H_\r
\r
// define for localhost environment\r
-#define errorFileSize 4009\r
+#define errorFileSize 3992\r
#define errorFileName "/usr/local/share/kagecgi/error.png"\r
#define pngFilePath "/var/www/fontsjp/v0.4/"\r
#define databaseFileName "/usr/local/share/kagecgi/kagedb"\r
int kSize;\r
int kType;\r
int kInput;\r
-GString *kResultText;\r
+KGString *kResultText;\r
int kMode;\r
\r
-void generateGlyph(const GString *in, GString *out);\r
-void searchPartsData(const GString *in, GString *out);\r
-void searchAliasData(const GString *in, GString *out);\r
-void searchCacheData(const GString *in, GString *out);\r
-void doCombine(const GString *in, GString *out);\r
-void drawGlyph(const GString *in, const int mode);\r
-\r
-int isIDS(const GString *in);\r
-void divideInto2(const GString *in, GString *partIDS1, GString *partIDS3);\r
-void divideInto3(const GString *in, GString *partIDS1, GString *partIDS2, GString *partIDS3);\r
-void addStrokeWithTransform(const GString *stroke, const int num, const int *tf, GString *out, int mode);\r
-void convertArray(int *buf, GString *out, int size, int mode);\r
+void generateGlyph(const KGString *in, KGString *out);\r
+void searchPartsData(const KGString *in, KGString *out);\r
+void searchAliasData(const KGString *in, KGString *out);\r
+void searchCacheData(const KGString *in, KGString *out);\r
+void doCombine(const KGString *in, KGString *out);\r
+void drawGlyph(const KGString *in, const int mode);\r
+\r
+int isIDS(const KGString *in);\r
+void divideInto2(const KGString *in, KGString *partIDS1, KGString *partIDS3);\r
+void divideInto3(const KGString *in, KGString *partIDS1, KGString *partIDS2, KGString *partIDS3);\r
+void addStrokeWithTransform(const KGString *stroke, const int num, const int *tf, KGString *out, int mode);\r
+void convertArray(int *buf, KGString *out, int size, int mode);\r
int * convertStroke(const char *in, int *a, int *size);\r
-void convert99(const GString *in, GString *out);\r
-void convert99calc(const char *in, GString *out);\r
+void convert99(const KGString *in, KGString *out);\r
+void convert99calc(const char *in, KGString *out);\r
\r
void DotsWidth(int *dlx, int *drx);\r
void DotsHeight(int *dly, int *dry);\r
-void PartsWidth(const GString *in, int *lx, int *rx);\r
-void PartsHeight(const GString *in, int *ly, int *ry);\r
-GString * CalcSizes(const GString *in, int mode);\r
+void PartsWidth(const KGString *in, int *lx, int *rx);\r
+void PartsHeight(const KGString *in, int *ly, int *ry);\r
+KGString * CalcSizes(const KGString *in, int mode);\r
void DrawBox();\r
-void CalcOptions(const GString *in, int *mitsudo, int *flag, double *yoko, double *tate);\r
-void DoDrawParts(const GString *in, const int lx1, const double rf1, const int ly1, const double rfy1);\r
-void DoDrawMixFont(const GString *in1, const int lx1, const double rf1, const GString *in2, const int lx2, const double rf2, const int ly1, const double rfy1, const int ly2, const double rfy2);\r
+void CalcOptions(const KGString *in, int *mitsudo, int *flag, double *yoko, double *tate);\r
+void DoDrawParts(const KGString *in, const int lx1, const double rf1, const int ly1, const double rfy1);\r
+void DoDrawMixFont(const KGString *in1, const int lx1, const double rf1, const KGString *in2, const int lx2, const double rf2, const int ly1, const double rfy1, const int ly2, const double rfy2);\r
\r
-void combineYoko2(const GString *parts1, const GString *parts3, int *result);\r
-void combineYoko3(const GString *parts1, const GString *parts2, const GString *parts3, int *result);\r
-void combineTate2(const GString *parts1, const GString *parts3, int *result);\r
-void combineTate3(const GString *parts1, const GString *parts2, const GString *parts3, int *result);\r
-void combineHame2(const GString *parts1, const GString *parts3, int *result);\r
+void combineYoko2(const KGString *parts1, const KGString *parts3, int *result);\r
+void combineYoko3(const KGString *parts1, const KGString *parts2, const KGString *parts3, int *result);\r
+void combineTate2(const KGString *parts1, const KGString *parts3, int *result);\r
+void combineTate3(const KGString *parts1, const KGString *parts2, const KGString *parts3, int *result);\r
+void combineHame2(const KGString *parts1, const KGString *parts3, int *result);\r
\r
int initDB();\r
int closeDB();\r
-void searchPartsData(const GString *in, GString *out);\r
-void searchAliasData(const GString *in, GString *out);\r
+void searchPartsData(const KGString *in, KGString *out);\r
+void searchAliasData(const KGString *in, KGString *out);\r
\r
png_bytepp initPng(int width, int height);\r
int closePng(int width, int height, png_bytepp canvas);\r
#include "kagecgi.h"\r
#include "sysdep.h"\r
\r
-int isIDS(const GString *in){\r
- //check IDC "u2ff*"\r
- if(strncmp(in->str, "u2ff", 4) == 0){\r
- //check the last char\r
- if('0' <= (in->str)[4] && (in->str)[4] <= 'a') return TRUE;\r
- }\r
- return FALSE;\r
+int isIDS(const KGString *in){\r
+ //check IDC "u2ff*"\r
+ if(strncmp(in->str, "u2ff", 4) == 0){\r
+ //check the last char\r
+ if('0' <= (in->str)[4] && (in->str)[4] <= 'a') return 1; //true\r
+ }\r
+ return 0; //false\r
}\r
\r
-void divideInto2(const GString *in, GString *partIDS1, GString *partIDS3){\r
- GString *buffer[16];\r
- char tmp[kMaxIDCLength + 1];\r
- int i, counter, pointer, flag;\r
- \r
- g_string_set_size(partIDS1, 0);\r
- \r
- counter = 0;\r
- pointer = 0;\r
- for(i = 0; i < in->len; i++){\r
- if((in->str)[i] == '.'){\r
- strncpy(tmp, (in->str) + pointer, i - pointer);\r
- tmp[i - pointer] = '\0';\r
- buffer[counter] = g_string_new(tmp);\r
- counter++;\r
- pointer = i + 1;\r
- }\r
- }\r
- strncpy(tmp, (in->str) + pointer, i - pointer);\r
- tmp[i - pointer] = '\0';\r
- buffer[counter] = g_string_new(tmp);\r
- counter++;\r
- \r
- //reject over-length of IDS\r
- if(counter > kMaxIDSSequenceLength) return;\r
- \r
- //1st scan\r
- pointer = 1;\r
- flag = 0;\r
- while(flag >= 0 && pointer < counter){\r
- g_string_append(partIDS1, (buffer[pointer])->str);\r
- g_string_append(partIDS1, ".");\r
- if(strncmp((buffer[pointer])->str, "u2ff", 4) == 0){\r
- switch (((buffer[pointer])->str)[4]){\r
- case '0':\r
- case '1':\r
- case '4':\r
- case '5':\r
- case '6':\r
- case '7':\r
- case '8':\r
- case '9':\r
- case 'a':\r
- case 'b':\r
- flag++;\r
- break;\r
- case '2':\r
- case '3':\r
- flag = flag + 2;\r
- break;\r
- }\r
- }\r
- else flag--;\r
- pointer++;\r
- }\r
- g_string_erase(partIDS1, partIDS1->len - 1, 1);\r
- \r
- //2nd scan\r
- flag = 0;\r
- while(flag >= 0 && pointer < counter){\r
- g_string_append(partIDS3, (buffer[pointer])->str);\r
- g_string_append(partIDS3, ".");\r
- if(strncmp((buffer[pointer])->str, "u2ff", 4) == 0){\r
- switch (((buffer[pointer])->str)[4]){\r
- case '0':\r
- case '1':\r
- case '4':\r
- case '5':\r
- case '6':\r
- case '7':\r
- case '8':\r
- case '9':\r
- case 'a':\r
- case 'b':\r
- flag++;\r
- break;\r
- case '2':\r
- case '3':\r
- flag = flag + 2;\r
- break;\r
- }\r
- }\r
- else flag--;\r
- pointer++;\r
- }\r
- g_string_erase(partIDS3, partIDS3->len - 1, 1);\r
+void divideInto2(const KGString *in, KGString *partIDS1, KGString *partIDS3){\r
+ KGString *buffer[16];\r
+ char tmp[kMaxIDCLength + 1];\r
+ int i, counter, pointer, flag;\r
+ \r
+ kg_string_set_size(partIDS1, 0);\r
+ \r
+ counter = 0;\r
+ pointer = 0;\r
+ for(i = 0; i < in->len; i++){\r
+ if((in->str)[i] == '.'){\r
+ strncpy(tmp, (in->str) + pointer, i - pointer);\r
+ tmp[i - pointer] = '\0';\r
+ buffer[counter] = kg_string_new(tmp);\r
+ counter++;\r
+ pointer = i + 1;\r
+ }\r
+ }\r
+ strncpy(tmp, (in->str) + pointer, i - pointer);\r
+ tmp[i - pointer] = '\0';\r
+ buffer[counter] = kg_string_new(tmp);\r
+ counter++;\r
+ \r
+ //reject over-length of IDS\r
+ if(counter > kMaxIDSSequenceLength) return;\r
+ \r
+ //1st scan\r
+ pointer = 1;\r
+ flag = 0;\r
+ while(flag >= 0 && pointer < counter){\r
+ kg_string_append(partIDS1, (buffer[pointer])->str);\r
+ kg_string_append(partIDS1, ".");\r
+ if(strncmp((buffer[pointer])->str, "u2ff", 4) == 0){\r
+ switch (((buffer[pointer])->str)[4]){\r
+ case '0':\r
+ case '1':\r
+ case '4':\r
+ case '5':\r
+ case '6':\r
+ case '7':\r
+ case '8':\r
+ case '9':\r
+ case 'a':\r
+ case 'b':\r
+ flag++;\r
+ break;\r
+ case '2':\r
+ case '3':\r
+ flag = flag + 2;\r
+ break;\r
+ }\r
+ }\r
+ else flag--;\r
+ pointer++;\r
+ }\r
+ kg_string_erase(partIDS1, partIDS1->len - 1, 1);\r
+ \r
+ //2nd scan\r
+ flag = 0;\r
+ while(flag >= 0 && pointer < counter){\r
+ kg_string_append(partIDS3, (buffer[pointer])->str);\r
+ kg_string_append(partIDS3, ".");\r
+ if(strncmp((buffer[pointer])->str, "u2ff", 4) == 0){\r
+ switch (((buffer[pointer])->str)[4]){\r
+ case '0':\r
+ case '1':\r
+ case '4':\r
+ case '5':\r
+ case '6':\r
+ case '7':\r
+ case '8':\r
+ case '9':\r
+ case 'a':\r
+ case 'b':\r
+ flag++;\r
+ break;\r
+ case '2':\r
+ case '3':\r
+ flag = flag + 2;\r
+ break;\r
+ }\r
+ }\r
+ else flag--;\r
+ pointer++;\r
+ }\r
+ kg_string_erase(partIDS3, partIDS3->len - 1, 1);\r
}\r
\r
-void divideInto3(const GString *in, GString *partIDS1, GString *partIDS2, GString *partIDS3){\r
- GString *buffer[16];\r
- char tmp[kMaxIDCLength + 1];\r
- int i, counter, pointer, flag;\r
- \r
- g_string_set_size(partIDS1, 0);\r
- \r
- counter = 0;\r
- pointer = 0;\r
- for(i = 0; i < in->len; i++){\r
- if((in->str)[i] == '.'){\r
- strncpy(tmp, (in->str) + pointer, i - pointer);\r
- tmp[i - pointer] = '\0';\r
- buffer[counter] = g_string_new(tmp);\r
- counter++;\r
- pointer = i + 1;\r
- }\r
- }\r
- strncpy(tmp, (in->str) + pointer, i - pointer);\r
- tmp[i - pointer] = '\0';\r
- buffer[counter] = g_string_new(tmp);\r
- counter++;\r
- \r
- //reject over-length of IDS\r
- if(counter > kMaxIDSSequenceLength) return;\r
- \r
- //1st scan\r
- pointer = 1;\r
- flag = 0;\r
- while(flag >= 0 && pointer < counter){\r
- g_string_append(partIDS1, (buffer[pointer])->str);\r
- g_string_append(partIDS1, ".");\r
- if(strncmp((buffer[pointer])->str, "u2ff", 4) == 0){\r
- switch (((buffer[pointer])->str)[4]){\r
- case '0':\r
- case '1':\r
- case '4':\r
- case '5':\r
- case '6':\r
- case '7':\r
- case '8':\r
- case '9':\r
- case 'a':\r
- case 'b':\r
- flag++;\r
- break;\r
- case '2':\r
- case '3':\r
- flag = flag + 2;\r
- break;\r
- }\r
- }\r
- else flag--;\r
- pointer++;\r
- }\r
- g_string_erase(partIDS1, partIDS1->len - 1, 1);\r
- \r
- //2nd scan\r
- flag = 0;\r
- while(flag >= 0 && pointer < counter){\r
- g_string_append(partIDS2, (buffer[pointer])->str);\r
- g_string_append(partIDS2, ".");\r
- if(strncmp((buffer[pointer])->str, "u2ff", 4) == 0){\r
- switch (((buffer[pointer])->str)[4]){\r
- case '0':\r
- case '1':\r
- case '4':\r
- case '5':\r
- case '6':\r
- case '7':\r
- case '8':\r
- case '9':\r
- case 'a':\r
- case 'b':\r
- flag++;\r
- break;\r
- case '2':\r
- case '3':\r
- flag = flag + 2;\r
- break;\r
- }\r
- }\r
- else flag--;\r
- pointer++;\r
- }\r
- g_string_erase(partIDS2, partIDS2->len - 1, 1);\r
- \r
- //3rd scan\r
- flag = 0;\r
- while(flag >= 0 && pointer < counter){\r
- g_string_append(partIDS3, (buffer[pointer])->str);\r
- g_string_append(partIDS3, ".");\r
- if(strncmp((buffer[pointer])->str, "u2ff", 4) == 0){\r
- switch (((buffer[pointer])->str)[4]){\r
- case '0':\r
- case '1':\r
- case '4':\r
- case '5':\r
- case '6':\r
- case '7':\r
- case '8':\r
- case '9':\r
- case 'a':\r
- case 'b':\r
- flag++;\r
- break;\r
- case '2':\r
- case '3':\r
- flag = flag + 2;\r
- break;\r
- }\r
- }\r
- else flag--;\r
- pointer++;\r
- }\r
- g_string_erase(partIDS3, partIDS3->len - 1, 1);\r
+void divideInto3(const KGString *in, KGString *partIDS1, KGString *partIDS2, KGString *partIDS3){\r
+ KGString *buffer[16];\r
+ char tmp[kMaxIDCLength + 1];\r
+ int i, counter, pointer, flag;\r
+ \r
+ kg_string_set_size(partIDS1, 0);\r
+ \r
+ counter = 0;\r
+ pointer = 0;\r
+ for(i = 0; i < in->len; i++){\r
+ if((in->str)[i] == '.'){\r
+ strncpy(tmp, (in->str) + pointer, i - pointer);\r
+ tmp[i - pointer] = '\0';\r
+ buffer[counter] = kg_string_new(tmp);\r
+ counter++;\r
+ pointer = i + 1;\r
+ }\r
+ }\r
+ strncpy(tmp, (in->str) + pointer, i - pointer);\r
+ tmp[i - pointer] = '\0';\r
+ buffer[counter] = kg_string_new(tmp);\r
+ counter++;\r
+ \r
+ //reject over-length of IDS\r
+ if(counter > kMaxIDSSequenceLength) return;\r
+ \r
+ //1st scan\r
+ pointer = 1;\r
+ flag = 0;\r
+ while(flag >= 0 && pointer < counter){\r
+ kg_string_append(partIDS1, (buffer[pointer])->str);\r
+ kg_string_append(partIDS1, ".");\r
+ if(strncmp((buffer[pointer])->str, "u2ff", 4) == 0){\r
+ switch (((buffer[pointer])->str)[4]){\r
+ case '0':\r
+ case '1':\r
+ case '4':\r
+ case '5':\r
+ case '6':\r
+ case '7':\r
+ case '8':\r
+ case '9':\r
+ case 'a':\r
+ case 'b':\r
+ flag++;\r
+ break;\r
+ case '2':\r
+ case '3':\r
+ flag = flag + 2;\r
+ break;\r
+ }\r
+ }\r
+ else flag--;\r
+ pointer++;\r
+ }\r
+ kg_string_erase(partIDS1, partIDS1->len - 1, 1);\r
+ \r
+ //2nd scan\r
+ flag = 0;\r
+ while(flag >= 0 && pointer < counter){\r
+ kg_string_append(partIDS2, (buffer[pointer])->str);\r
+ kg_string_append(partIDS2, ".");\r
+ if(strncmp((buffer[pointer])->str, "u2ff", 4) == 0){\r
+ switch (((buffer[pointer])->str)[4]){\r
+ case '0':\r
+ case '1':\r
+ case '4':\r
+ case '5':\r
+ case '6':\r
+ case '7':\r
+ case '8':\r
+ case '9':\r
+ case 'a':\r
+ case 'b':\r
+ flag++;\r
+ break;\r
+ case '2':\r
+ case '3':\r
+ flag = flag + 2;\r
+ break;\r
+ }\r
+ }\r
+ else flag--;\r
+ pointer++;\r
+ }\r
+ kg_string_erase(partIDS2, partIDS2->len - 1, 1);\r
+ \r
+ //3rd scan\r
+ flag = 0;\r
+ while(flag >= 0 && pointer < counter){\r
+ kg_string_append(partIDS3, (buffer[pointer])->str);\r
+ kg_string_append(partIDS3, ".");\r
+ if(strncmp((buffer[pointer])->str, "u2ff", 4) == 0){\r
+ switch (((buffer[pointer])->str)[4]){\r
+ case '0':\r
+ case '1':\r
+ case '4':\r
+ case '5':\r
+ case '6':\r
+ case '7':\r
+ case '8':\r
+ case '9':\r
+ case 'a':\r
+ case 'b':\r
+ flag++;\r
+ break;\r
+ case '2':\r
+ case '3':\r
+ flag = flag + 2;\r
+ break;\r
+ }\r
+ }\r
+ else flag--;\r
+ pointer++;\r
+ }\r
+ kg_string_erase(partIDS3, partIDS3->len - 1, 1);\r
}\r
\r
-void addStrokeWithTransform(const GString *stroke, const int num, const int *tf, GString *out, int mode){\r
- int *buf, i, size;\r
- GString *tmp;\r
- \r
- tmp = g_string_new("");\r
- buf = convertStroke(stroke->str, buf, &size);\r
- \r
- for(i = 0; i < size; i++){\r
- if(buf[i * 11 + 0] != 0 && buf[i * 11 + 0] != 99){\r
- buf[i * 11 + 3] =\r
- tf[(num - 1) * 4 + 0] + buf[i * 11 + 3] * (tf[(num - 1) * 4 + 2] - tf[(num - 1) * 4 + 0]) / pngWidth;\r
- buf[i * 11 + 5] =\r
- tf[(num - 1) * 4 + 0] + buf[i * 11 + 5] * (tf[(num - 1) * 4 + 2] - tf[(num - 1) * 4 + 0]) / pngWidth;\r
- buf[i * 11 + 7] =\r
- tf[(num - 1) * 4 + 0] + buf[i * 11 + 7] * (tf[(num - 1) * 4 + 2] - tf[(num - 1) * 4 + 0]) / pngWidth;\r
- buf[i * 11 + 9] =\r
- tf[(num - 1) * 4 + 0] + buf[i * 11 + 9] * (tf[(num - 1) * 4 + 2] - tf[(num - 1) * 4 + 0]) / pngWidth;\r
- buf[i * 11 + 4] =\r
- tf[(num - 1) * 4 + 1] + buf[i * 11 + 4] * (tf[(num - 1) * 4 + 3] - tf[(num - 1) * 4 + 1]) / pngHeight;\r
- buf[i * 11 + 6] =\r
- tf[(num - 1) * 4 + 1] + buf[i * 11 + 6] * (tf[(num - 1) * 4 + 3] - tf[(num - 1) * 4 + 1]) / pngHeight;\r
- buf[i * 11 + 8] =\r
- tf[(num - 1) * 4 + 1] + buf[i * 11 + 8] * (tf[(num - 1) * 4 + 3] - tf[(num - 1) * 4 + 1]) / pngHeight;\r
- buf[i * 11 + 10] =\r
- tf[(num - 1) * 4 + 1] + buf[i * 11 + 10] * (tf[(num - 1) * 4 + 3] - tf[(num - 1) * 4 + 1]) / pngHeight;\r
- }\r
- }\r
- convertArray(buf, tmp, size, mode);\r
- if(out->len != 0) g_string_append(out, "$");\r
- g_string_append(out, tmp->str);\r
- \r
- free((void *)buf);\r
+void addStrokeWithTransform(const KGString *stroke, const int num, const int *tf, KGString *out, int mode){\r
+ int *buf, i, size;\r
+ KGString *tmp;\r
+ \r
+ tmp = kg_string_new("");\r
+ buf = convertStroke(stroke->str, buf, &size);\r
+ \r
+ for(i = 0; i < size; i++){\r
+ if(buf[i * 11 + 0] != 0 && buf[i * 11 + 0] != 99){\r
+ buf[i * 11 + 3] =\r
+ tf[(num - 1) * 4 + 0] + buf[i * 11 + 3] * (tf[(num - 1) * 4 + 2] - tf[(num - 1) * 4 + 0]) / pngWidth;\r
+ buf[i * 11 + 5] =\r
+ tf[(num - 1) * 4 + 0] + buf[i * 11 + 5] * (tf[(num - 1) * 4 + 2] - tf[(num - 1) * 4 + 0]) / pngWidth;\r
+ buf[i * 11 + 7] =\r
+ tf[(num - 1) * 4 + 0] + buf[i * 11 + 7] * (tf[(num - 1) * 4 + 2] - tf[(num - 1) * 4 + 0]) / pngWidth;\r
+ buf[i * 11 + 9] =\r
+ tf[(num - 1) * 4 + 0] + buf[i * 11 + 9] * (tf[(num - 1) * 4 + 2] - tf[(num - 1) * 4 + 0]) / pngWidth;\r
+ buf[i * 11 + 4] =\r
+ tf[(num - 1) * 4 + 1] + buf[i * 11 + 4] * (tf[(num - 1) * 4 + 3] - tf[(num - 1) * 4 + 1]) / pngHeight;\r
+ buf[i * 11 + 6] =\r
+ tf[(num - 1) * 4 + 1] + buf[i * 11 + 6] * (tf[(num - 1) * 4 + 3] - tf[(num - 1) * 4 + 1]) / pngHeight;\r
+ buf[i * 11 + 8] =\r
+ tf[(num - 1) * 4 + 1] + buf[i * 11 + 8] * (tf[(num - 1) * 4 + 3] - tf[(num - 1) * 4 + 1]) / pngHeight;\r
+ buf[i * 11 + 10] =\r
+ tf[(num - 1) * 4 + 1] + buf[i * 11 + 10] * (tf[(num - 1) * 4 + 3] - tf[(num - 1) * 4 + 1]) / pngHeight;\r
+ }\r
+ }\r
+ convertArray(buf, tmp, size, mode);\r
+ if(out->len != 0) kg_string_append(out, "$");\r
+ kg_string_append(out, tmp->str);\r
+ \r
+ free((void *)buf);\r
}\r
\r
-void convertArray(int *buf, GString *out, int size, int mode){\r
- int i;\r
- char tmp[kMaxStrokeDataLength];\r
- \r
- for(i = 0; i < size; i++){\r
- if(!(mode == 1 && (buf[i * 11 + 0] == 0 || buf[i * 11 + 0] == 99))){\r
- sprintf(tmp, "%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d$",\r
- buf[i * 11 + 0],\r
- buf[i * 11 + 1],\r
- buf[i * 11 + 2],\r
- buf[i * 11 + 3],\r
- buf[i * 11 + 4],\r
- buf[i * 11 + 5],\r
- buf[i * 11 + 6],\r
- buf[i * 11 + 7],\r
- buf[i * 11 + 8],\r
- buf[i * 11 + 9],\r
- buf[i * 11 + 10]);\r
- g_string_append(out, tmp);\r
- }\r
- }\r
- g_string_erase(out, (out->len - 1), 1);\r
+void convertArray(int *buf, KGString *out, int size, int mode){\r
+ int i;\r
+ char tmp[kMaxStrokeDataLength];\r
+ \r
+ for(i = 0; i < size; i++){\r
+ if(!(mode == 1 && (buf[i * 11 + 0] == 0 || buf[i * 11 + 0] == 99))){\r
+ sprintf(tmp, "%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d$",\r
+ buf[i * 11 + 0],\r
+ buf[i * 11 + 1],\r
+ buf[i * 11 + 2],\r
+ buf[i * 11 + 3],\r
+ buf[i * 11 + 4],\r
+ buf[i * 11 + 5],\r
+ buf[i * 11 + 6],\r
+ buf[i * 11 + 7],\r
+ buf[i * 11 + 8],\r
+ buf[i * 11 + 9],\r
+ buf[i * 11 + 10]);\r
+ kg_string_append(out, tmp);\r
+ }\r
+ }\r
+ out = kg_string_erase(out, (out->len - 1), 1);\r
}\r
\r
int * convertStroke(const char *in, int *a, int *size){\r
- int i, counter, pointer;\r
- int a0,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10;\r
- char tmp[kMaxStrokeDataLength + 1];\r
- \r
- a = (int *)malloc(0);\r
- counter = 0;\r
- pointer = 0;\r
- for(i = 0; i < strlen(in); i++){\r
- if(in[i] == '$'){\r
- strncpy(tmp, &in[pointer], i - pointer);\r
- tmp[i - pointer] = '\0';\r
- a = (int *)realloc(a, sizeof(int) * 11 * (counter + 1));\r
- sscanf(tmp, "%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d",\r
- &a0,&a1,&a2,&a3,&a4,&a5,&a6,&a7,&a8,&a9,&a10);\r
- a[counter * 11 + 0] = a0;\r
- a[counter * 11 + 1] = a1;\r
- a[counter * 11 + 2] = a2;\r
- a[counter * 11 + 3] = a3;\r
- a[counter * 11 + 4] = a4;\r
- a[counter * 11 + 5] = a5;\r
- a[counter * 11 + 6] = a6;\r
- a[counter * 11 + 7] = a7;\r
- a[counter * 11 + 8] = a8;\r
- a[counter * 11 + 9] = a9;\r
- a[counter * 11 + 10] = a10;\r
- counter++;\r
- pointer = i + 1;\r
- }\r
- }\r
- strncpy(tmp, &in[pointer], i - pointer);\r
- tmp[i - pointer] = '\0';\r
- a = (int *)realloc(a, sizeof(int) * 11 * (counter + 1));\r
- sscanf(tmp, "%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d",\r
- &a0,&a1,&a2,&a3,&a4,&a5,&a6,&a7,&a8,&a9,&a10);\r
- a[counter * 11 + 0] = a0;\r
- a[counter * 11 + 1] = a1;\r
- a[counter * 11 + 2] = a2;\r
- a[counter * 11 + 3] = a3;\r
- a[counter * 11 + 4] = a4;\r
- a[counter * 11 + 5] = a5;\r
- a[counter * 11 + 6] = a6;\r
- a[counter * 11 + 7] = a7;\r
- a[counter * 11 + 8] = a8;\r
- a[counter * 11 + 9] = a9;\r
- a[counter * 11 + 10] = a10;\r
- counter++;\r
- *(size) = counter;\r
- return a;\r
+ int i, counter, pointer;\r
+ int a0,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10;\r
+ char tmp[kMaxStrokeDataLength + 1];\r
+ \r
+ a = (int *)malloc(0);\r
+ counter = 0;\r
+ pointer = 0;\r
+ for(i = 0; i < strlen(in); i++){\r
+ if(in[i] == '$'){\r
+ strncpy(tmp, &in[pointer], i - pointer);\r
+ tmp[i - pointer] = '\0';\r
+ a = (int *)realloc(a, sizeof(int) * 11 * (counter + 1));\r
+ sscanf(tmp, "%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d",\r
+ &a0,&a1,&a2,&a3,&a4,&a5,&a6,&a7,&a8,&a9,&a10);\r
+ a[counter * 11 + 0] = a0;\r
+ a[counter * 11 + 1] = a1;\r
+ a[counter * 11 + 2] = a2;\r
+ a[counter * 11 + 3] = a3;\r
+ a[counter * 11 + 4] = a4;\r
+ a[counter * 11 + 5] = a5;\r
+ a[counter * 11 + 6] = a6;\r
+ a[counter * 11 + 7] = a7;\r
+ a[counter * 11 + 8] = a8;\r
+ a[counter * 11 + 9] = a9;\r
+ a[counter * 11 + 10] = a10;\r
+ counter++;\r
+ pointer = i + 1;\r
+ }\r
+ }\r
+ strncpy(tmp, &in[pointer], i - pointer);\r
+ tmp[i - pointer] = '\0';\r
+ a = (int *)realloc(a, sizeof(int) * 11 * (counter + 1));\r
+ sscanf(tmp, "%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d",\r
+ &a0,&a1,&a2,&a3,&a4,&a5,&a6,&a7,&a8,&a9,&a10);\r
+ a[counter * 11 + 0] = a0;\r
+ a[counter * 11 + 1] = a1;\r
+ a[counter * 11 + 2] = a2;\r
+ a[counter * 11 + 3] = a3;\r
+ a[counter * 11 + 4] = a4;\r
+ a[counter * 11 + 5] = a5;\r
+ a[counter * 11 + 6] = a6;\r
+ a[counter * 11 + 7] = a7;\r
+ a[counter * 11 + 8] = a8;\r
+ a[counter * 11 + 9] = a9;\r
+ a[counter * 11 + 10] = a10;\r
+ counter++;\r
+ *(size) = counter;\r
+ return a;\r
}\r
\r
-void convert99(const GString *in, GString *out){\r
- int i, pointer;\r
- char tmp[kMaxStrokeDataLength + 1];\r
- GString *buf;\r
- \r
- g_string_set_size(out, 0);\r
- buf = g_string_new("");\r
- pointer = 0;\r
- for(i = 0; i < in->len; i++){\r
- if((in->str)[i] == '$'){\r
- strncpy(tmp, in->str + pointer, i - pointer);\r
- tmp[i - pointer] = '\0';\r
- if(strncmp(tmp, "99:", 3) == 0){\r
- convert99calc(tmp, buf);\r
- if(buf->len == 0){\r
- g_string_set_size(out, 0);\r
- return;\r
- }\r
- g_string_append(out, buf->str);\r
- }\r
- else g_string_append(out, tmp);\r
- g_string_append(out, "$");\r
- \r
- pointer = i + 1;\r
- }\r
- }\r
- strncpy(tmp, in->str + pointer, i - pointer);\r
- tmp[i - pointer] = '\0';\r
- if(strncmp(tmp, "99:", 3) == 0){\r
- convert99calc(tmp, buf);\r
- if(buf->len == 0){\r
- g_string_set_size(out, 0);\r
- return;\r
- }\r
- g_string_append(out, buf->str);\r
+void convert99(const KGString *in, KGString *out){\r
+ int i, pointer;\r
+ char tmp[kMaxStrokeDataLength + 1];\r
+ KGString *buf;\r
+ \r
+ kg_string_set_size(out, 0);\r
+ buf = kg_string_new("");\r
+ pointer = 0;\r
+ for(i = 0; i < in->len; i++){\r
+ if((in->str)[i] == '$'){\r
+ strncpy(tmp, in->str + pointer, i - pointer);\r
+ tmp[i - pointer] = '\0';\r
+ if(strncmp(tmp, "99:", 3) == 0){\r
+ convert99calc(tmp, buf);\r
+ if(buf->len == 0){\r
+ kg_string_set_size(out, 0);\r
+ return;\r
}\r
- else g_string_append(out, tmp);\r
+ kg_string_append(out, buf->str);\r
+ }\r
+ else kg_string_append(out, tmp);\r
+ kg_string_append(out, "$");\r
+ \r
+ pointer = i + 1;\r
+ }\r
+ }\r
+ strncpy(tmp, in->str + pointer, i - pointer);\r
+ tmp[i - pointer] = '\0';\r
+ if(strncmp(tmp, "99:", 3) == 0){\r
+ convert99calc(tmp, buf);\r
+ if(buf->len == 0){\r
+ kg_string_set_size(out, 0);\r
+ return;\r
+ }\r
+ kg_string_append(out, buf->str);\r
+ }\r
+ else kg_string_append(out, tmp);\r
}\r
\r
-void convert99calc(const char *in, GString *out){\r
- GString *buf1, *buf2;\r
- int a1,x1,y1,x2,y2,option,option2;\r
- char pname[kMaxStrokeDataLength];\r
- int tf[12];\r
- \r
- g_string_set_size(out, 0);\r
- buf2 = g_string_new("");\r
- \r
- //get parts data\r
- sscanf(in, "%d:%d:%d:%d:%d:%d:%d:%s",\r
- &a1,&option,&option2,&x1,&y1,&x2,&y2,pname);\r
- //end = strchr(pname, ':');\r
- //*end = '\0';\r
- buf1 = g_string_new(pname);\r
- generateGlyph(buf1, buf2);\r
- if(buf2->len == 0) return;\r
- \r
- //convert\r
- tf[0] = x1;\r
- tf[1] = y1;\r
- tf[2] = x2;\r
- tf[3] = y2;\r
- addStrokeWithTransform(buf2, 1, tf, out, 1);\r
+void convert99calc(const char *in, KGString *out){\r
+ KGString *buf1, *buf2;\r
+ int a1,x1,y1,x2,y2,option,option2;\r
+ char pname[kMaxStrokeDataLength];\r
+ int tf[12];\r
+ \r
+ kg_string_set_size(out, 0);\r
+ buf2 = kg_string_new("");\r
+ \r
+ //get parts data\r
+ sscanf(in, "%d:%d:%d:%d:%d:%d:%d:%s",\r
+ &a1,&option,&option2,&x1,&y1,&x2,&y2,pname);\r
+ //end = strchr(pname, ':');\r
+ //*end = '\0';\r
+ buf1 = kg_string_new(pname);\r
+ generateGlyph(buf1, buf2);\r
+ if(buf2->len == 0) return;\r
+ \r
+ //convert\r
+ tf[0] = x1;\r
+ tf[1] = y1;\r
+ tf[2] = x2;\r
+ tf[3] = y2;\r
+ addStrokeWithTransform(buf2, 1, tf, out, 1);\r
}\r
#include "kagecgi.h"\r
#include "sysdep.h"\r
\r
-void combineYoko2(const GString *parts1, const GString *parts3, int *result){\r
+void combineYoko2(const KGString *parts1, const KGString *parts3, int *result){\r
int f, g, h, i, j, k, l;\r
int flg_boxL, flg_boxR;\r
int Xside, YsideLa, YsideLb, YsideRa, YsideRb, YheightL, YnanameL, YsmallL;\r
kShotai = tempShotai;\r
}\r
\r
-void combineYoko3(const GString *parts1, const GString *parts2, const GString *parts3, int *result){\r
+void combineYoko3(const KGString *parts1, const KGString *parts2, const KGString *parts3, int *result){\r
//not yet\r
}\r
\r
-void combineTate2(const GString *parts1, const GString *parts3, int *result){\r
+void combineTate2(const KGString *parts1, const KGString *parts3, int *result){\r
int f, g, h, i, j, k, l;\r
int flg_boxL, flg_boxR;\r
int pxL, pxR, pyL, pyR;\r
kShotai = tempShotai;\r
}\r
\r
-void combineTate3(const GString *parts1, const GString *parts2, const GString *parts3, int *result){\r
+void combineTate3(const KGString *parts1, const KGString *parts2, const KGString *parts3, int *result){\r
//not yet\r
}\r
\r
-void combineHame2(const GString *parts1, const GString *parts3, int *result){\r
+void combineHame2(const KGString *parts1, const KGString *parts3, int *result){\r
int i;\r
int *buf, strokes;\r
\r
-//kagedb.c\r
-//\r
-\r
-#include "kage.h"\r
-#include "kagecgi.h"\r
-#include "sysdep.h"\r
-\r
-int initDB(){\r
+//kagedb.c
+//
+
+#include "kage.h"
+#include "kagecgi.h"
+#include "sysdep.h"
+
+int initDB(){
db_create(&kDatabase, NULL, 0);
- kDatabase->open(kDatabase, databaseFileName, NULL, DB_HASH, DB_RDONLY, 0644);\r
- return 0;\r
-}\r
-\r
-int closeDB(){\r
- kDatabase->close(kDatabase, 0);\r
- return 0;\r
-}\r
-\r
-void searchPartsData(const GString *in, GString *out){\r
- DBT dbkey, dbdata;\r
- char *start, *end, *buf;\r
- GString *temp, *temp2;\r
- \r
- //cut off the end '-0000' if 'in' end with it\r
- temp = g_string_new(in->str);\r
-// if(strncmp(temp->str + temp->len - 5, "-0000", 5) == 0) g_string_set_size(temp, temp->len - 5);\r
- if((temp->str)[0] == 'u'){\r
- if(strncmp(temp->str + temp->len - 4, "-j00", 4) == 0) g_string_set_size(temp, temp->len - 4);\r
- else if(strncmp(temp->str + temp->len - 4, "-g00", 4) == 0) g_string_set_size(temp, temp->len - 2);\r
- else if(strncmp(temp->str + temp->len - 4, "-t00", 4) == 0) g_string_set_size(temp, temp->len - 2);\r
- else if(strncmp(temp->str + temp->len - 4, "-k00", 4) == 0) g_string_set_size(temp, temp->len - 2);\r
- else if(strncmp(temp->str + temp->len - 4, "-v00", 4) == 0) g_string_set_size(temp, temp->len - 2);\r
- else if(strncmp(temp->str + temp->len - 4, "-u00", 4) == 0) g_string_set_size(temp, temp->len - 2);\r
- }\r
- \r
- memset(&dbkey,0,sizeof(DBT));\r
- memset(&dbdata,0,sizeof(DBT));\r
- dbkey.data = temp->str;\r
- dbkey.size = temp->len;\r
- g_string_set_size(out, 0);\r
- temp2 = g_string_new("");\r
- kDatabase->get(kDatabase, NULL, &dbkey, &dbdata, 0);\r
- if(dbdata.size != 0){\r
+ kDatabase->open(kDatabase, databaseFileName, NULL, DB_HASH, DB_RDONLY, 0644);
+ return 0;
+}
+
+int closeDB(){
+ kDatabase->close(kDatabase, 0);
+ return 0;
+}
+
+void searchPartsData(const KGString *in, KGString *out){
+ DBT dbkey, dbdata;
+ char *start, *end, *buf;
+ KGString *temp, *temp2;
+
+ //cut off the end '-0000' if 'in' end with it
+ temp = kg_string_new(in->str);
+// if(strncmp(temp->str + temp->len - 5, "-0000", 5) == 0) kg_string_set_size(temp, temp->len - 5);
+ if((temp->str)[0] == 'u'){
+ if(strncmp(temp->str + temp->len - 4, "-j00", 4) == 0) kg_string_set_size(temp, temp->len - 4);
+ else if(strncmp(temp->str + temp->len - 4, "-g00", 4) == 0) kg_string_set_size(temp, temp->len - 2);
+ else if(strncmp(temp->str + temp->len - 4, "-t00", 4) == 0) kg_string_set_size(temp, temp->len - 2);
+ else if(strncmp(temp->str + temp->len - 4, "-k00", 4) == 0) kg_string_set_size(temp, temp->len - 2);
+ else if(strncmp(temp->str + temp->len - 4, "-v00", 4) == 0) kg_string_set_size(temp, temp->len - 2);
+ else if(strncmp(temp->str + temp->len - 4, "-u00", 4) == 0) kg_string_set_size(temp, temp->len - 2);
+ }
+
+ memset(&dbkey,0,sizeof(DBT));
+ memset(&dbdata,0,sizeof(DBT));
+ dbkey.data = temp->str;
+ dbkey.size = temp->len;
+ kg_string_set_size(out, 0);
+ temp2 = kg_string_new("");
+ kDatabase->get(kDatabase, NULL, &dbkey, &dbdata, 0);
+ if(dbdata.size != 0){
buf = (char *)malloc(dbdata.size + 1);
strncpy(buf, dbdata.data, dbdata.size + 1);
- //first:search selected shotai\r
- if(kShotai == kMincho) start = strstr(buf, ",mincho,");\r
- else start = strstr(buf, ",gothic,");\r
- if(start != NULL){\r
- start = strchr((start+8), ',');\r
- if(start != NULL){\r
- start = strchr((start+1), ',');\r
- if(start != NULL){\r
- end = strchr((start+1), ',');\r
- if(end != NULL){\r
- g_string_append_len(temp2, (start+1), end - start - 2 + 1);\r
- convert99(temp2, out);\r
- return;\r
- }\r
- }\r
- }\r
- }\r
- //second:search another shotai\r
- if(kShotai == kMincho) start = strstr(buf, ",gothic,");\r
- else start = strstr(buf, ",mincho,");\r
- if(start != NULL){\r
- start = strchr((start+8), ',');\r
- if(start != NULL){\r
- start = strchr((start+1), ',');\r
- if(start != NULL){\r
- end = strchr((start+1), ',');\r
- if(end != NULL){\r
- g_string_append_len(temp2, (start+1), end - start - 2 + 1);\r
- convert99(temp2, out);\r
- return;\r
- }\r
- }\r
- }\r
- }\r
+ //first:search selected shotai
+ if(kShotai == kMincho) start = strstr(buf, ",mincho,");
+ else start = strstr(buf, ",gothic,");
+ if(start != NULL){
+ start = strchr((start+8), ',');
+ if(start != NULL){
+ start = strchr((start+1), ',');
+ if(start != NULL){
+ end = strchr((start+1), ',');
+ if(end != NULL){
+ kg_string_append_len(temp2, (start+1), end - start - 2 + 1);
+ convert99(temp2, out);
+ return;
+ }
+ }
+ }
+ }
+ //second:search another shotai
+ if(kShotai == kMincho) start = strstr(buf, ",gothic,");
+ else start = strstr(buf, ",mincho,");
+ if(start != NULL){
+ start = strchr((start+8), ',');
+ if(start != NULL){
+ start = strchr((start+1), ',');
+ if(start != NULL){
+ end = strchr((start+1), ',');
+ if(end != NULL){
+ kg_string_append_len(temp2, (start+1), end - start - 2 + 1);
+ convert99(temp2, out);
+ return;
+ }
+ }
+ }
+ }
free(buf);
- }\r
-}\r
-\r
-void searchAliasData(const GString *in, GString *out){\r
- DBT dbkey, dbdata;\r
- char *start, *end, *buf;\r
- GString *temp;\r
- \r
- //cut off the end '-0000' if 'in' end with it\r
- temp = g_string_new(in->str);\r
-// if(strncmp(temp->str + temp->len - 5, "-0000", 5) == 0) g_string_set_size(temp, temp->len - 5);\r
- if((temp->str)[0] == 'u'){\r
- if(strncmp(temp->str + temp->len - 4, "-j00", 4) == 0) g_string_set_size(temp, temp->len - 4);\r
- else if(strncmp(temp->str + temp->len - 4, "-g00", 4) == 0) g_string_set_size(temp, temp->len - 2);\r
- else if(strncmp(temp->str + temp->len - 4, "-t00", 4) == 0) g_string_set_size(temp, temp->len - 2);\r
- else if(strncmp(temp->str + temp->len - 4, "-k00", 4) == 0) g_string_set_size(temp, temp->len - 2);\r
- else if(strncmp(temp->str + temp->len - 4, "-v00", 4) == 0) g_string_set_size(temp, temp->len - 2);\r
- else if(strncmp(temp->str + temp->len - 4, "-u00", 4) == 0) g_string_set_size(temp, temp->len - 2);\r
- }\r
- \r
- memset(&dbkey,0,sizeof(DBT));\r
- memset(&dbdata,0,sizeof(DBT));\r
- dbkey.data = temp->str;\r
- dbkey.size = temp->len;\r
- g_string_set_size(out, 0);\r
- kDatabase->get(kDatabase, NULL, &dbkey, &dbdata, 0);\r
- if(dbdata.size != 0){\r
+ }
+}
+
+void searchAliasData(const KGString *in, KGString *out){
+ DBT dbkey, dbdata;
+ char *start, *end, *buf;
+ KGString *temp;
+
+ //cut off the end '-0000' if 'in' end with it
+ temp = kg_string_new(in->str);
+// if(strncmp(temp->str + temp->len - 5, "-0000", 5) == 0) kg_string_set_size(temp, temp->len - 5);
+ if((temp->str)[0] == 'u'){
+ if(strncmp(temp->str + temp->len - 4, "-j00", 4) == 0) kg_string_set_size(temp, temp->len - 4);
+ else if(strncmp(temp->str + temp->len - 4, "-g00", 4) == 0) kg_string_set_size(temp, temp->len - 2);
+ else if(strncmp(temp->str + temp->len - 4, "-t00", 4) == 0) kg_string_set_size(temp, temp->len - 2);
+ else if(strncmp(temp->str + temp->len - 4, "-k00", 4) == 0) kg_string_set_size(temp, temp->len - 2);
+ else if(strncmp(temp->str + temp->len - 4, "-v00", 4) == 0) kg_string_set_size(temp, temp->len - 2);
+ else if(strncmp(temp->str + temp->len - 4, "-u00", 4) == 0) kg_string_set_size(temp, temp->len - 2);
+ }
+
+ memset(&dbkey,0,sizeof(DBT));
+ memset(&dbdata,0,sizeof(DBT));
+ dbkey.data = temp->str;
+ dbkey.size = temp->len;
+ kg_string_set_size(out, 0);
+ kDatabase->get(kDatabase, NULL, &dbkey, &dbdata, 0);
+ if(dbdata.size != 0){
buf = (char *)malloc(dbdata.size + 1);
strncpy(buf, dbdata.data, dbdata.size + 1);
- start = strstr(buf, ",linkto,");\r
- if(start != NULL){\r
- start = strchr((start+8), ',');\r
- if(start != NULL){\r
- start = strchr((start+1), ',');\r
- if(start != NULL){\r
- end = strchr((start+1), ',');\r
- if(end != NULL){\r
- g_string_append_len(out, (start+1), end - start - 2 + 1);\r
- }\r
- }\r
- }\r
- }\r
+ start = strstr(buf, ",linkto,");
+ if(start != NULL){
+ start = strchr((start+8), ',');
+ if(start != NULL){
+ start = strchr((start+1), ',');
+ if(start != NULL){
+ end = strchr((start+1), ',');
+ if(end != NULL){
+ kg_string_append_len(out, (start+1), end - start - 2 + 1);
+ }
+ }
+ }
+ }
free(buf);
- }\r
-}\r
-\r
+ }
+}
+
#include "kagecgi.h"\r
#include "sysdep.h"\r
\r
-void generateGlyphByIDS(const GString *in, GString *out, int flag){\r
- GString *tmp1, *tmp2;\r
+void generateGlyphByIDS(const KGString *in, KGString *out, int flag){\r
+ KGString *tmp1, *tmp2;\r
\r
//pass this method if 'in' is not UCS parts\r
if((in->str)[0] != 'u'){\r
return;\r
}\r
\r
- tmp1 = g_string_new(in->str);\r
- tmp2 = g_string_new(in->str);\r
+ tmp1 = kg_string_new(in->str);\r
+ tmp2 = kg_string_new(in->str);\r
\r
//append place flag\r
if(1 <= flag && flag <= 7){\r
- if(tmp1->len != 7) g_string_append(tmp1, "-");\r
- if(flag == 1) g_string_append(tmp1, "01");\r
- else if(flag == 2) g_string_append(tmp1, "02");\r
- else if(flag == 3) g_string_append(tmp1, "03");\r
- else if(flag == 4) g_string_append(tmp1, "04");\r
- else if(flag == 5) g_string_append(tmp1, "05");\r
- else if(flag == 6) g_string_append(tmp1, "06");\r
+ if(tmp1->len != 7) kg_string_append(tmp1, "-");\r
+ if(flag == 1) kg_string_append(tmp1, "01");\r
+ else if(flag == 2) kg_string_append(tmp1, "02");\r
+ else if(flag == 3) kg_string_append(tmp1, "03");\r
+ else if(flag == 4) kg_string_append(tmp1, "04");\r
+ else if(flag == 5) kg_string_append(tmp1, "05");\r
+ else if(flag == 6) kg_string_append(tmp1, "06");\r
}\r
\r
generateGlyph(tmp1, out);\r
return;\r
}\r
\r
-void generateGlyph(const GString *in, GString *out){\r
- GString *tmp;\r
- tmp = g_string_new("");\r
- g_string_set_size(out, 0);\r
+void generateGlyph(const KGString *in, KGString *out){\r
+ KGString *tmp;\r
+ tmp = kg_string_new("");\r
+ kg_string_set_size(out, 0);\r
\r
//search from parts\r
searchPartsData(in, tmp);\r
if(tmp->len != 0){\r
tmp = CalcSizes(tmp, 1);\r
- g_string_assign(out, tmp->str);\r
+ out = kg_string_assign(out, tmp->str);\r
return;\r
}\r
\r
}\r
}\r
\r
-void doCombine(const GString *in, GString *out){\r
- GString *partIDS1, *partIDS2, *partIDS3;\r
- GString *partStroke1, *partStroke2, *partStroke3;\r
+void doCombine(const KGString *in, KGString *out){\r
+ KGString *partIDS1, *partIDS2, *partIDS3;\r
+ KGString *partStroke1, *partStroke2, *partStroke3;\r
int result[12];\r
\r
- partIDS1 = g_string_new("");\r
- partIDS2 = g_string_new("");\r
- partIDS3 = g_string_new("");\r
- partStroke1 = g_string_new("");\r
- partStroke2 = g_string_new("");\r
- partStroke3 = g_string_new("");\r
+ partIDS1 = kg_string_new("");\r
+ partIDS2 = kg_string_new("");\r
+ partIDS3 = kg_string_new("");\r
+ partStroke1 = kg_string_new("");\r
+ partStroke2 = kg_string_new("");\r
+ partStroke3 = kg_string_new("");\r
\r
- g_string_set_size(out, 0);\r
+ kg_string_set_size(out, 0);\r
\r
//check first IDC\r
if(strncmp(in->str, "u2ff", 4) != 0) return;\r
}\r
}\r
\r
-void drawGlyph(const GString *in, const int mode){\r
+void drawGlyph(const KGString *in, const int mode){\r
int i, j;\r
int *buf;\r
buf = convertStroke(in->str, buf, &j);\r
}\r
else if(kMode == 1){ //output for svg\r
sprintf(buf, "<path d=\"M ");\r
- g_string_append(kResultText, buf);\r
+ kg_string_append(kResultText, buf);\r
for(i = 0; i < number; i++){\r
sprintf(buf, "%.0f,%.0f ", poly[i].X * 5, poly[i].Y * 5);\r
- g_string_append(kResultText, buf);\r
+ kg_string_append(kResultText, buf);\r
}\r
sprintf(buf, "Z\"/>");\r
- g_string_append(kResultText, buf);\r
+ kg_string_append(kResultText, buf);\r
}\r
else if(kMode == 2){ //output for eps\r
sprintf(buf, "%.0f %.0f moveto\n", poly[0].X * 5, 1000 - (poly[0].Y * 5) - 200);\r
- g_string_append(kResultText, buf);\r
+ kg_string_append(kResultText, buf);\r
for(i = 1; i < number; i++){\r
sprintf(buf, " %.0f %.0f lineto\n", poly[i].X * 5, 1000 - (poly[i].Y * 5) - 200);\r
- g_string_append(kResultText, buf);\r
+ kg_string_append(kResultText, buf);\r
}\r
sprintf(buf, " %.0f %.0f lineto\n", poly[0].X * 5, 1000 - (poly[0].Y * 5) - 200);\r
- g_string_append(kResultText, buf);\r
- g_string_append(kResultText, "closepath\n");\r
+ kg_string_append(kResultText, buf);\r
+ kg_string_append(kResultText, "closepath\n");\r
}\r
\r
}\r
}\r
}\r
\r
-void PartsWidth(const GString *in, int *lx, int *rx){\r
+void PartsWidth(const KGString *in, int *lx, int *rx){\r
int i;\r
int *buf, strokes;\r
\r
free(buf);\r
}\r
\r
-void PartsHeight(const GString *in, int *ly, int *ry){\r
+void PartsHeight(const KGString *in, int *ly, int *ry){\r
int i;\r
int *buf, strokes;\r
\r
free(buf);\r
}\r
\r
-GString * CalcSizes(const GString *in, int mode){\r
+KGString * CalcSizes(const KGString *in, int mode){\r
int i, j, k, basewidth, one_lineX, one_lineY;\r
int dlx1, drx1, dly1, dry1;\r
int px1, py1;\r
\r
int *buf, strokes;\r
int tf[12];\r
- GString *out;\r
+ KGString *out;\r
\r
- out = g_string_new("");\r
+ out = kg_string_new("");\r
basewidth = pngWidth * 0.9;\r
\r
if(mode == 0){\r
tf[2] = px1 + pr1 * 200;\r
tf[3] = py1 + pry1 * 200;\r
addStrokeWithTransform(in, 1, tf, out, 0);\r
- return g_string_new(out->str);\r
+ return kg_string_new(out->str);\r
}\r
\r
void DrawBox(){\r
}\r
}\r
\r
-void CalcOptions(const GString *in, int *mitsudo, int *flag, double *yoko, double *tate){\r
+void CalcOptions(const KGString *in, int *mitsudo, int *flag, double *yoko, double *tate){\r
int i, j, k, l, flg;\r
int dlx1, drx1, dly1, dry1;\r
int kari, mode;\r
free(buf);\r
}\r
\r
-void DoDrawParts(const GString *in, const int lx1, const double rf1, const int ly1, const double rfy1){\r
+void DoDrawParts(const KGString *in, const int lx1, const double rf1, const int ly1, const double rfy1){\r
int i;\r
int *buf, strokes;\r
\r
free(buf);\r
}\r
\r
-void DoDrawMixFont(const GString *in1,\r
+void DoDrawMixFont(const KGString *in1,\r
const int lx1,\r
const double rf1,\r
- const GString *in2,\r
+ const KGString *in2,\r
const int lx2,\r
const double rf2,\r
const int ly1,\r
\r
#include <sys/fcntl.h>\r
\r
-#include <glib.h>\r
-\r
#include <png.h>\r
\r
#include <db.h>\r
\r
+#include "kagestr.h"\r