r5232 - trunk/misc/ttf2conchars

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Tue Dec 16 04:28:13 EST 2008


Author: div0
Date: 2008-12-16 04:28:08 -0500 (Tue, 16 Dec 2008)
New Revision: 5232

Modified:
   trunk/misc/ttf2conchars/foo.sh
   trunk/misc/ttf2conchars/ttf2conchars.c
Log:
new parameter use


Modified: trunk/misc/ttf2conchars/foo.sh
===================================================================
--- trunk/misc/ttf2conchars/foo.sh	2008-12-16 08:45:57 UTC (rev 5231)
+++ trunk/misc/ttf2conchars/foo.sh	2008-12-16 09:28:08 UTC (rev 5232)
@@ -9,6 +9,6 @@
 
 set -ex
 gcc -Wall -Wextra ttf2conchars.c `sdl-config --cflags --libs` -lSDL_ttf -lSDL_image -ggdb3
-./a.out gfx/conchars.tga 0 56 64 gfx/vera-sans.tga /usr/share/fonts/truetype/ttf-bitstream-vera/VeraBd.ttf "" "" 0.05 0.004 0.000000000000001
-./a.out gfx/conchars.tga 0 56 64 gfx/vera-sans-big.tga /usr/share/fonts/truetype/ttf-bitstream-vera/VeraBd.ttf "" "" 0.18 0.05  0.000000000000001
+./a.out gfx/conchars.tga 0 56 64 gfx/vera-sans.tga /usr/share/fonts/truetype/ttf-bitstream-vera/VeraBd.ttf "" "" 1 0.08 0.000000000000001
+./a.out gfx/conchars.tga 0 56 64 gfx/vera-sans-big.tga /usr/share/fonts/truetype/ttf-bitstream-vera/VeraBd.ttf "" "" 1 0.28  0.000000000000001
 display gfx/vera-sans-big.tga

Modified: trunk/misc/ttf2conchars/ttf2conchars.c
===================================================================
--- trunk/misc/ttf2conchars/ttf2conchars.c	2008-12-16 08:45:57 UTC (rev 5231)
+++ trunk/misc/ttf2conchars/ttf2conchars.c	2008-12-16 09:28:08 UTC (rev 5232)
@@ -246,8 +246,8 @@
 {
 	// note: x0, y0 is the origin of the UNFILTERED image; it is "transparently" expanded by a BLURFUNCIMAX.
 	int x, y, d, xa, ya, xb, yb;
+	d = (int) BLURFUNCIMAX(1, B);
 
-	d = (int) BLURFUNCIMAX(A,B);
 	SDL_LockSurface(src);
 	SDL_LockSurface(dest);
 
@@ -572,7 +572,7 @@
 	SDL_Color white = {255, 255, 255, 255};
 	Uint32 transparent;
 	int maxAscent, maxDescent, maxWidth;
-	int i;
+	int i, j;
 	int currentSize;
 	int isfixed;
 
@@ -591,14 +591,40 @@
 	double B = atof(argv[10]);
 	double C = atof(argv[11]);
 	int differentFonts;
+	int d;
 
+	double f = 0, a = 0;
+
+	d = (int) BLURFUNCIMAX(1, B);
+	fprintf(stderr, "Translating parameters:\nA=%f B=%f (using %d pixels)\n", A, B, (int) BLURFUNCIMAX(A, B));
+	if(C == 0)
+	{
+		B = A * B;
+		A = A * 1;
+	}
+	else
+	{
+		for(i=-d; i<=d; ++i)
+			for(j=-d; j<=d; ++j)
+			{
+				f = BLURFUNC(i*i+j*j, 1, B);
+				f = MAX(0, f);
+
+				if(C == 0)
+					a = MAX(a, f);
+				else
+					a = a + f;
+			}
+		B = A/a * B;
+		A = A/a * 1;
+	}
+	fprintf(stderr, "A=%f B=%f (using %d pixels)\n", A, B, (int) BLURFUNCIMAX(A, B));
+
 	char widthfilename[512];
 	snprintf(widthfilename, sizeof(widthfilename), "%.*s.width", (int)strlen(outfilename) - 4, outfilename);
 
 	int border=(int) BLURFUNCIMAX(A, B);
 
-	fprintf(stderr, "Using %d border pixels\n", border);
-
 	if(SDL_Init(0) < 0)
 		errx(1, "SDL_Init failed");
 




More information about the nexuiz-commits mailing list