changeset 22839:a5fb0006b2ee

Remove obsolete bitmap font tools.
author diego
date Sat, 31 Mar 2007 14:14:28 +0000
parents c13fe81f024c
children 4d49e4ae19bb
files TOOLS/Makefile TOOLS/README TOOLS/mpfc/Makefile TOOLS/mpfc/mpfc-ce.c TOOLS/mpfc/mpfc-kr.c TOOLS/png2raw.c TOOLS/subfont-c/Makefile TOOLS/subfont-c/README TOOLS/subfont-c/encodings/charmap2enc TOOLS/subfont-c/encodings/osd-mplayer TOOLS/subfont-c/encodings/runme-kr TOOLS/subfont-c/font.desc.tail TOOLS/subfont-c/fontgen TOOLS/subfont-c/osd/README TOOLS/subfont-c/osd/gen.py TOOLS/subfont-c/osd/gen_osd_h.c TOOLS/subfont-c/osd/osd.pfb TOOLS/subfont-c/osd/runme TOOLS/subfont-c/runme TOOLS/subfont-c/subfont.c
diffstat 20 files changed, 0 insertions(+), 2668 deletions(-) [+]
line wrap: on
line diff
--- a/TOOLS/Makefile	Sat Mar 31 14:10:44 2007 +0000
+++ b/TOOLS/Makefile	Sat Mar 31 14:14:28 2007 +0000
@@ -8,7 +8,6 @@
 	avisubdump$(EXESUF) \
 	dump_mp4$(EXESUF) \
 	movinfo$(EXESUF) \
-	png2raw$(EXESUF) \
 	subrip$(EXESUF) \
 #	vivodump$(EXESUF) \
 
@@ -18,9 +17,6 @@
 
 all: $(OBJS)
 
-png2raw$(EXESUF): png2raw.c
-	$(CC) $< -o $@ -lpng
-
 subrip$(EXESUF): subrip.c
 	$(CC) $(CFLAGS) -g -o $@ $< ../vobsub.o ../spudec.o ../mp_msg.o \
           ../unrarlib.o ../libswscale/libswscale.a ../libavutil/libavutil.a \
--- a/TOOLS/README	Sat Mar 31 14:10:44 2007 +0000
+++ b/TOOLS/README	Sat Mar 31 14:14:28 2007 +0000
@@ -391,15 +391,6 @@
 Usage:        movinfo <filename.mov>
 
 
-png2raw
-
-Author:       Arpi
-
-Description:  PNG to RAW image converter, used by .raw font creators.
-
-Usage:        png2raw <file1> [file2...]
-
-
 vivodump
 
 Author:       Arpi
--- a/TOOLS/mpfc/Makefile	Sat Mar 31 14:10:44 2007 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,15 +0,0 @@
-
-TARGET = mpfc-ce mpfc-kr
-
-LIBS=-lgd -lttf -lpng
-
-all: $(TARGET)
-
-mpfc-ce: mpfc-ce.c
-	$(CC) -Wall -O2 -o $@ $< $(LIBS)
-
-mpfc-kr: mpfc-kr.c
-	$(CC) -Wall -O2 -o $@ $< $(LIBS)
-
-clean:
-	-rm -f $(TARGET)
--- a/TOOLS/mpfc/mpfc-ce.c	Sat Mar 31 14:10:44 2007 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,284 +0,0 @@
-/*
-  
-  mplayer font creator for central-europe (latin-1 etc) charset
-
-  This program uses gd & freetype2 library to draw each characters then
-  write the image to stdout.
-
-  Written by Sunjin Yang <lethean@realtime.ssu.ac.kr> May 03, 2001.
-  Modified by Arpad Gereoffy <arpi@thot.banki.hu> Jun 18, 2001.
-
-*/
-
-#include <gd.h>
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-
-#define UPSCALE_FACTOR 2
-
-#define X_ALIGN (8*UPSCALE_FACTOR)
-#define ALIGNED(x) (((x)+(X_ALIGN-1))&(~(X_ALIGN-1)))
-
-#define DEF_FONT_SIZE		16.0
-
-#define DEF_CHAR_GAP		6
-#define CHAR_SKIP(gap)		(gap / 4)
-
-#define AUTHOR			"Sunjin Yang <lethean@realtime.ssu.ac.kr>"
-#define VERSION			"0.1"
-
-struct code_range {
-	int start, end;
-};
-
-/* basic alphabet character range */
-//static struct code_range ascii_range = { 0x21, 0x7E };
-static struct code_range ascii_range = { 0x20, 0x1FF };
-
-#ifdef USE_UNIFIED_KOREAN
-
-/* Unified Hangul Code Encoding */
-static struct code_range first_byte_range[] = {
-	{ 0x81, 0xFE }, { 0, 0 }
-};
-static struct code_range second_byte_range[] = {
-	{ 0x41, 0x5A }, { 0x61, 0x7A }, { 0x81, 0x9F }, { 0xA0, 0xBF },
-	{ 0xC0, 0xDF }, { 0xE0, 0xFE },	{ 0, 0 }
-};
-
-#else
-
-/* KSX 1001:1992 */
-static struct code_range first_byte_range[] = {
-	{ 0xA1, 0xAC }, { 0xB0, 0xFD }, { 0, 0 }
-};
-static struct code_range second_byte_range[] = {
-	{ 0xA1, 0xAF }, { 0xB0, 0xBF }, { 0xC0, 0xCF }, { 0xD0, 0xDF },
-	{ 0xE0, 0xEF }, { 0xF0, 0xFE }, { 0, 0 }
-};
-
-#endif
-
-#define _output(msg...)	fprintf(stdout, ##msg)
-
-/* debugging macros */
-#define _print(msg...)	fprintf(stderr, ##msg)
-#define _info(msg...)	{ _print("mpfc: "); _print(##msg); _print("\n"); }
-#define _abort(msg...)	{ _info(##msg); exit(1); }
-
-static double size;
-static int gap,vgap;
-static char *name, *font, *eng_font, *kor_font;
-static int file_index;
-static char filename[20];
-
-static int base_x, char_count;
-static gdImagePtr char_image[65536];
-
-static gdImagePtr concat_char_images(void)
-{
-	gdImagePtr ret;
-	int width, height, i, x,black, white;
-
-	/* get image's width & height */
-	height = size + (vgap * 2);
-	for (width = 0, i = 0; i < char_count; i++)
-		width += ALIGNED(char_image[i]->sx);
-
-	ret = gdImageCreate(width, height);
-
-	/* background color (first allocated) */
-	black = gdImageColorResolve(ret, 0, 0, 0);
-//	white = gdImageColorResolve(ret, 255, 255, 255);
-	for(x=1;x<=255;x++)
-	    white = gdImageColorResolve(ret, x,x,x);
-
-	width = 0;
-	for (i = 0; i < char_count; i++) {
-		gdImageCopy(ret, char_image[i],	/* dst, src */
-			    width + 0, 0,	/* dstX, dstY */
-			    0, 0,	 	/* srcX, srcY */
-			    char_image[i]->sx, char_image[i]->sy); /* size */
-		width += ALIGNED(char_image[i]->sx);
-		gdImageDestroy(char_image[i]);
-	}
-	char_count = 0;
-
-	return ret;
-}
-
-static gdImagePtr create_char_image(int code)
-{
-	gdImagePtr im;
-	int rect[8], black, white, width, height, x, y;
-	char *err;
-	char s[10];
-	
-#if 1
-	sprintf(s,"&#%d;",code);
-#else
-	if(code>=0x100){
-	  s[0]=code>>8;
-	  s[1]=code&0xFF;
-	  s[2]=0;
-	} else {
-	  s[0]=code;
-	  s[1]=0;
-	}
-#endif
-
-	/* obtain border rectangle so that we can size the image. */
-	err = gdImageStringTTF(NULL, &rect[0], 0, font, size, .0, 0, 0, s);
-	if (err)
-		_abort("%s\n", err);
-
-	/* create an image big enough for a string plus a little whitespace. */
-	width = rect[2] - rect[6] + gap;
-	height = size + (vgap * 2);
-	im = gdImageCreate(width, height);
-
-	/* background color (first allocated) */
-	black = gdImageColorResolve(im, 0, 0, 0);
-	for(x=1;x<=255;x++)
-	    white = gdImageColorResolve(im, x,x,x);
-//	white = gdImageColorResolve(im, 255, 255, 255);
-
-	/* render the string, offset origin to center string.
-	   note that we use top-left coordinate for adjustment
-	   since gd origin is in top-left with y increasing downwards. */
-	x = (gap / 2) - rect[6];
-	y = (vgap) - rect[7] + (size + rect[7]);
-	err = gdImageStringTTF(im, &rect[0], white, font, size, .0, x, y, s);
-	if (err)
-		_abort("%s\n", err);
-
-	//if (*s == '"') _output("'%s' ", s); else _output("\"%s\" ", s);
-	_output("0x%x %d %d\n", code,
-		(base_x + CHAR_SKIP(gap))/UPSCALE_FACTOR -1, 
-		(base_x + width - CHAR_SKIP(gap))/UPSCALE_FACTOR - 0);
-	base_x += ALIGNED(width);
-//	base_x = (base_x+width+7)&(~7); // align to 8-pixel boundary for fast MMX code
-
-	return im;
-}
-
-void make_charset_font(struct code_range *first, struct code_range *second)
-{
-	gdImagePtr im;
-	FILE *fd;
-	int i, j;
-	
-	base_x = 0;
-	char_count = 0;
-
-	_output("[files]\n");
-	//_output("alpha %s%d_a.raw\n", name, file_index);
-	_output("alpha %s%02d_a.raw\n", name, file_index);
-	_output("bitmap %s%02d_b.raw\n\n", name, file_index);
-	_output("[characters]\n");
-
-	for (i = first->start; i <= first->end; i++) {
-		if (!second) {
-			char_image[char_count++] = create_char_image(i);
-		} else
-			for (j = second->start; j <= second->end; j++) {
-				char_image[char_count++]= create_char_image((i<<8)|j);
-			}
-	}
-
-	_output("\n");
-	
-	/* concatenate each character images into one image. */
-	im = concat_char_images();
-	
-	/* get filename and create one with it. */
-	sprintf(filename, "%s%02d_b.png", name, file_index++);
-	fd = fopen(filename, "w+");
-	if (!fd)
-		_abort(strerror(errno));
-
-	/* write image to the PNG file. */
-	gdImagePng(im, fd);
-
-	fclose(fd);
-
-	/* destroy it */
-	gdImageDestroy(im);
-}
-
-int main(int argc, char **argv)
-{
-	int i, j;
-
-	if (argc < 4)
-		_abort("usage:%s name eng-ttf kor-ttf [size gap vgap]",argv[0]);
-
-	/* get program parameter like font names, size... */
-	name = argv[1];
-	eng_font = argv[2];
-	kor_font = argv[3];
-	size = DEF_FONT_SIZE;
-	gap = DEF_CHAR_GAP;
-	vgap = DEF_CHAR_GAP;
-	if (argc > 4) {
-		float __s; sscanf(argv[4], "%f", &__s);
-		size = (double)__s;
-	}
-	if (argc > 5)
-		sscanf(argv[5], "%d", &gap);
-	if (argc > 6)
-		sscanf(argv[6], "%d", &vgap);
-
-	/* write basic font information. */
-	_output("[info]\n");
-	_output("name \"%s version %s - created by %s\"\n",
-		name, VERSION, AUTHOR);
-	_output("descversion 1\n");
-	_output("spacewidth %d\n", (int)(size / 2));
-	_output("charspace -%d\n", CHAR_SKIP(gap) + 1);
-	_output("; height %d\n\n", (int)size + DEF_CHAR_GAP);
-
-	/* write general OSD fonts information. */
-	_output("[files]\n");
-	_output("alpha arpi_osd_a.raw\n");
-	_output("bitmap arpi_osd_b.raw\n\n");
-	_output("[characters]\n");
-	_output("0x01 0 36\n");
-	_output("0x02 35 71\n");
-	_output("0x03 70 106\n");
-	_output("0x04 116 152\n");
-	_output("0x05 164 200\n");
-	_output("0x06 209 245\n");
-	_output("0x07 256 292\n");
-	_output("0x08 305 342\n");
-	_output("0x09 354 400\n");
-	_output("0x0A 407 442\n");
-	_output("0x0B 457 494\n");
-	_output("[files]\n");
-	_output("alpha arpi_progress_a.raw\n");
-	_output("bitmap arpi_progress_b.raw\n\n");
-	_output("[characters]\n");
-	_output("0x10 4 21\n");
-	_output("0x11 30 41\n");
-	_output("0x12 50 66\n");
-	_output("0x13 74 85\n\n");
-
-
-	file_index = 0;
-	
-	/* create basic alphabet character set. */
-	font = eng_font;
-	make_charset_font(&ascii_range, NULL);
-
-#if 0
-	/* create korean character set. */
-	font = kor_font;
-	for (i = 0; first_byte_range[i].start != 0; i++)
-		for (j = 0; second_byte_range[j].start != 0; j++)
-			make_charset_font(&first_byte_range[i], &second_byte_range[j]);
-#endif
-
-	return 0;
-}
-
--- a/TOOLS/mpfc/mpfc-kr.c	Sat Mar 31 14:10:44 2007 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,255 +0,0 @@
-/*
-  
-  mplayer font creator for korean(euc-kr) charset
-
-  This program uses gd & freetype2 library to draw each characters then
-  write the image to stdout.
-
-  Written by Sunjin Yang <lethean@realtime.ssu.ac.kr> May 03, 2001.
-
-*/
-
-#include <gd.h>
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-
-#define DEF_FONT_SIZE		16.0
-
-#define DEF_CHAR_GAP		6
-#define CHAR_SKIP(gap)		(gap / 4)
-
-#define AUTHOR			"Sunjin Yang <lethean@realtime.ssu.ac.kr>"
-#define VERSION			"0.1"
-
-struct code_range {
-	int start, end;
-};
-
-/* basic alphabet character range */
-static struct code_range ascii_range = { 0x21, 0x7E };
-
-#ifdef USE_UNIFIED_KOREAN
-
-/* Unified Hangul Code Encoding */
-static struct code_range first_byte_range[] = {
-	{ 0x81, 0xFE }, { 0, 0 }
-};
-static struct code_range second_byte_range[] = {
-	{ 0x41, 0x5A }, { 0x61, 0x7A }, { 0x81, 0x9F }, { 0xA0, 0xBF },
-	{ 0xC0, 0xDF }, { 0xE0, 0xFE },	{ 0, 0 }
-};
-
-#else
-
-/* KSX 1001:1992 */
-static struct code_range first_byte_range[] = {
-	{ 0xA1, 0xAC }, { 0xB0, 0xFD }, { 0, 0 }
-};
-static struct code_range second_byte_range[] = {
-	{ 0xA1, 0xAF }, { 0xB0, 0xBF }, { 0xC0, 0xCF }, { 0xD0, 0xDF },
-	{ 0xE0, 0xEF }, { 0xF0, 0xFE }, { 0, 0 }
-};
-
-#endif
-
-#define _output(msg...)	fprintf(stdout, ##msg)
-
-/* debugging macros */
-#define _print(msg...)	fprintf(stderr, ##msg)
-#define _info(msg...)	{ _print("mpfc: "); _print(##msg); _print("\n"); }
-#define _abort(msg...)	{ _info(##msg); exit(1); }
-
-static double size;
-static int gap;
-static char *name, *font, *eng_font, *kor_font;
-static int file_index;
-static char filename[20], str[10];
-
-static int base_x, char_count;
-static gdImagePtr char_image[65536];
-
-static gdImagePtr concat_char_images(void)
-{
-	gdImagePtr ret;
-	int width, height, i, black, white;
-
-	/* get image's width & height */
-	height = size + (gap * 2);
-	for (width = 0, i = 0; i < char_count; i++)
-		width += char_image[i]->sx;
-
-	ret = gdImageCreate(width, height);
-
-	/* background color (first allocated) */
-	black = gdImageColorResolve(ret, 0, 0, 0);
-	white = gdImageColorResolve(ret, 255, 255, 255);
-
-	width = 0;
-	for (i = 0; i < char_count; i++) {
-		gdImageCopy(ret, char_image[i],	/* dst, src */
-			    width + 0, 0,	/* dstX, dstY */
-			    0, 0,	 	/* srcX, srcY */
-			    char_image[i]->sx, char_image[i]->sy); /* size */
-		width += char_image[i]->sx;
-		gdImageDestroy(char_image[i]);
-	}
-	char_count = 0;
-
-	return ret;
-}
-
-static gdImagePtr create_char_image(char *s)
-{
-	gdImagePtr im;
-	int rect[8], black, white, width, height, x, y;
-	char *err;
-
-	/* obtain border rectangle so that we can size the image. */
-	err = gdImageStringTTF(NULL, &rect[0], 0, font, size, .0, 0, 0, s);
-	if (err)
-		_abort("%s\n", err);
-
-	/* create an image big enough for a string plus a little whitespace. */
-	width = rect[2] - rect[6] + gap;
-	height = size + (gap * 2);
-	im = gdImageCreate(width, height);
-
-	/* background color (first allocated) */
-	black = gdImageColorResolve(im, 0, 0, 0);
-	white = gdImageColorResolve(im, 255, 255, 255);
-
-	/* render the string, offset origin to center string.
-	   note that we use top-left coordinate for adjustment
-	   since gd origin is in top-left with y increasing downwards. */
-	x = (gap / 2) - rect[6];
-	y = (gap / 2) - rect[7] + (size + rect[7]);
-	err = gdImageStringTTF(im, &rect[0], white, font, size, .0, x, y, s);
-	if (err)
-		_abort("%s\n", err);
-
-	if (*s == '"') _output("'%s' ", s); else _output("\"%s\" ", s);
-	_output("%d %d\n", 
-		base_x + CHAR_SKIP(gap), base_x + width - CHAR_SKIP(gap) - 1);
-	base_x += width;
-		
-	return im;
-}
-
-void make_charset_font(struct code_range *first, struct code_range *second)
-{
-	gdImagePtr im;
-	FILE *fd;
-	int i, j;
-	
-	base_x = 0;
-	char_count = 0;
-
-	_output("[files]\n");
-	//_output("alpha %s%d_a.raw\n", name, file_index);
-	_output("alpha %s%02d_b.raw\n", name, file_index);
-	_output("bitmap %s%02d_b.raw\n\n", name, file_index);
-	_output("[characters]\n");
-
-	for (i = first->start; i <= first->end; i++) {
-		str[0] = (char)i;
-		if (!second) {
-			str[1] = '\0';
-			char_image[char_count++] = create_char_image(str);
-		} else
-			for (j = second->start; j <= second->end; j++) {
-				str[1] = (char)j; str[2] = '\0';
-				char_image[char_count++]= create_char_image(str);
-			}
-	}
-
-	_output("\n");
-	
-	/* concatenate each character images into one image. */
-	im = concat_char_images();
-	
-	/* get filename and create one with it. */
-	sprintf(filename, "%s%02d_b.png", name, file_index++);
-	fd = fopen(filename, "w+");
-	if (!fd)
-		_abort(strerror(errno));
-
-	/* write image to the PNG file. */
-	gdImagePng(im, fd);
-
-	fclose(fd);
-
-	/* destroy it */
-	gdImageDestroy(im);
-}
-
-int main(int argc, char **argv)
-{
-	int i, j;
-
-	if (argc < 4)
-		_abort("usage:%s name eng-ttf kor-ttf [size gap]",argv[0]);
-
-	/* get program parameter like font names, size... */
-	name = argv[1];
-	eng_font = argv[2];
-	kor_font = argv[3];
-	size = DEF_FONT_SIZE;
-	gap = DEF_CHAR_GAP;
-	if (argc > 4) {
-		float __s; sscanf(argv[4], "%f", &__s);
-		size = (double)__s;
-	}
-	if (argc > 5)
-		sscanf(argv[5], "%d", &gap);
-
-	/* write basic font information. */
-	_output("[info]\n");
-	_output("name \"%s version %s - created by %s\"\n",
-		name, VERSION, AUTHOR);
-	_output("descversion 1\n");
-	_output("spacewidth %d\n", (int)(size / 2));
-	_output("charspace -%d\n", CHAR_SKIP(gap) + 1);
-	_output("height %d\n\n", (int)size + DEF_CHAR_GAP);
-
-	/* write general OSD fonts information. */
-	_output("[files]\n");
-	_output("alpha arpi_osd_a.raw\n");
-	_output("bitmap arpi_osd_b.raw\n\n");
-	_output("[characters]\n");
-	_output("0x01 0 36\n");
-	_output("0x02 35 71\n");
-	_output("0x03 70 106\n");
-	_output("0x04 116 152\n");
-	_output("0x05 164 200\n");
-	_output("0x06 209 245\n");
-	_output("0x07 256 292\n");
-	_output("0x08 305 342\n");
-	_output("0x09 354 400\n");
-	_output("0x0A 407 442\n");
-	_output("0x0B 457 494\n");
-	_output("[files]\n");
-	_output("alpha arpi_progress_a.raw\n");
-	_output("bitmap arpi_progress_b.raw\n\n");
-	_output("[characters]\n");
-	_output("0x10 4 21\n");
-	_output("0x11 30 41\n");
-	_output("0x12 50 66\n");
-	_output("0x13 74 85\n\n");
-
-
-	file_index = 0;
-	
-	/* create basic alphabet character set. */
-	font = eng_font;
-	make_charset_font(&ascii_range, NULL);
-
-	/* create korean character set. */
-	font = kor_font;
-	for (i = 0; first_byte_range[i].start != 0; i++)
-		for (j = 0; second_byte_range[j].start != 0; j++)
-			make_charset_font(&first_byte_range[i], &second_byte_range[j]);
-
-	return 0;
-}
-
--- a/TOOLS/png2raw.c	Sat Mar 31 14:10:44 2007 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,183 +0,0 @@
-#define DEBUG
-
-#include <stdlib.h>
-
-//#include "png.h"
-#include <png.h>
-
-typedef struct _txSample
-{
- unsigned int  Width;
- unsigned int  Height;
- unsigned int  BPP;
- unsigned long ImageSize;
- char *        Image;
-} txSample;
-
-typedef struct
-{
- unsigned int    Width;
- unsigned int    Height;
- unsigned int    Depth;
- unsigned int    Alpha;
-
- unsigned int    Components;
- unsigned char * Data;
- unsigned char * Palette;
-} pngRawInfo;
-
-int pngLoadRawF( FILE *fp,pngRawInfo *pinfo )
-{
- unsigned char   header[8];
- png_structp     png;
- png_infop       info;
- png_infop       endinfo;
- png_bytep       data;
- png_bytep     * row_p;
- png_uint_32     width,height;
- int             depth,color;
- png_uint_32     i;
-
- if ( pinfo == NULL ) return 1;
-
- fread( header,1,8,fp );
- if ( !png_check_sig( header,8 ) ) return 1;
-
- png=png_create_read_struct( PNG_LIBPNG_VER_STRING,NULL,NULL,NULL );
- info=png_create_info_struct( png );
- endinfo=png_create_info_struct( png );
-
- png_init_io( png,fp );
- png_set_sig_bytes( png,8 );
- png_read_info( png,info );
- png_get_IHDR( png,info,&width,&height,&depth,&color,NULL,NULL,NULL );
-
- pinfo->Width=width;
- pinfo->Height=height;
- pinfo->Depth=depth;
-
- data=( png_bytep ) malloc( png_get_rowbytes( png,info )*height );
- row_p=( png_bytep * ) malloc( sizeof( png_bytep )*height );
- for ( i=0; i < height; i++ ) row_p[i]=&data[png_get_rowbytes( png,info )*i];
-
- png_read_image( png,row_p );
- free( row_p );
-
- if ( color == PNG_COLOR_TYPE_PALETTE )
-  {
-   int cols;
-   png_get_PLTE( png,info,( png_colorp * ) &pinfo->Palette,&cols );
-  }
-  else pinfo->Palette=NULL;
-
- if ( color&PNG_COLOR_MASK_ALPHA )
-  {
-   if ( color&PNG_COLOR_MASK_PALETTE || color == PNG_COLOR_TYPE_GRAY_ALPHA ) pinfo->Components=2;
-     else pinfo->Components=4;
-   pinfo->Alpha=8;
-  }
-  else
-   {
-    if ( color&PNG_COLOR_MASK_PALETTE || color == PNG_COLOR_TYPE_GRAY ) pinfo->Components=1;
-      else pinfo->Components=3;
-    pinfo->Alpha=0;
-   }
- pinfo->Data=data;
-
- png_read_end( png,endinfo );
- png_destroy_read_struct( &png,&info,&endinfo );
-
- return 0;
-}
-
-int pngLoadRaw( const char *filename,pngRawInfo *pinfo )
-{
- int result;
- FILE *fp=fopen( filename,"rb" );
-
- if ( fp == NULL ) return 0;
- result=pngLoadRawF( fp,pinfo );
- if ( fclose( fp ) != 0 )
-  {
-   if ( result )
-    {
-     free( pinfo->Data );
-     free( pinfo->Palette );
-    }
-   return 1;
-  }
- return 0;
-}
-
-int pngRead( unsigned char * fname,txSample * bf )
-{
- pngRawInfo raw;
-
- if ( pngLoadRaw( fname,&raw ) )
-  {
-   #ifdef DEBUG
-    fprintf( stderr,"[png] file read error ( %s ).\n",fname );
-   #endif
-   return 1;
-  }
- bf->Width=raw.Width;
- bf->Height=raw.Height;
- bf->BPP=( raw.Depth * raw.Components ) + raw.Alpha;
- bf->ImageSize=bf->Width * bf->Height * ( bf->BPP / 8 );
- if ( ( bf->Image=malloc( bf->ImageSize ) ) == NULL )
-  {
-   #ifdef DEBUG
-    fprintf( stderr,"[png]  Not enough memory for image buffer.\n" );
-   #endif
-   return 2;
-  }
- memcpy( bf->Image,raw.Data,bf->ImageSize );
- free( raw.Data );
- #ifdef DEBUG
-  fprintf( stderr,"[png] filename: %s.\n",fname );
-  fprintf( stderr,"[png]  size: %dx%d bits: %d\n",bf->Width,bf->Height,bf->BPP );
-  fprintf( stderr,"[png]  imagesize: %lu\n",bf->ImageSize );
-  fprintf( stderr,"Palette: %s\n",raw.Palette?"yes":"no");
- #endif
- return 0;
-}
-
-static char fname[256];
-
-static unsigned char rawhead[32]={'m','h','w','a','n','h',0,4,
-                                   0,0,0,0,1,0,0,0,
-                                   0,0,0,0,0,0,0,0,
-                                   0,0,0,0,0,0,0,0};
-static unsigned char rawpal[3*256];
-
-int main(int argc,char* argv[]){
-  txSample ize;
-  FILE *f;
-  int i;
-  for(i=0;i<256;i++) rawpal[i*3]=rawpal[i*3+1]=rawpal[i*3+2]=i;
-
-if(argc<2) {printf("Usage: png2raw file1 [file2...]\n");exit(1);}
-while(argc>1){
-  ++argv;--argc;
-  printf("Converting %s...\n",argv[0]);
-  if(pngRead(argv[0],&ize)) continue;
-  if(ize.BPP!=8){ printf("Invalid BPP: %d\n",ize.BPP);continue;}
-  snprintf(fname,256,"%s.raw",argv[0]);
-  f=fopen(fname,"wb");
-  rawhead[8]=ize.Width>>8;
-  rawhead[9]=ize.Width&255;
-  rawhead[10]=ize.Height>>8;
-  rawhead[11]=ize.Height&255;
-  fwrite(rawhead,32,1,f);
-  fwrite(rawpal,3*256,1,f);
-  fwrite(ize.Image,ize.ImageSize,1,f);
-  fclose(f);
-  
-}
-
-
-
-}
-
-
-
--- a/TOOLS/subfont-c/Makefile	Sat Mar 31 14:10:44 2007 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-
-MPROOT=../..
-
-include $(MPROOT)/config.mak
-
-LDLIBS=-lm $(MPROOT)/osdep/timer-lx.o $(shell freetype-config --libs)
-CFLAGS=$(OPTFLAGS) $(shell freetype-config --cflags) -I$(MPROOT)
-
-#CFLAGS+=-O0			# for RedHat's gcc-2.96-95
-#CFLAGS+=-DOLD_FREETYPE2	# for FreeType 2.0.1
-#CFLAGS+=-g
-#CFLAGS+=-DDEBUG
-#CFLAGS+=-DNEW_DESC
-
-
-subfont:	subfont.o
-
-subfont.o:	subfont.c
-	$(CC) $(CFLAGS) -c $< -o $@
-
-subfont.S:	subfont.c
-	$(CC) $(CFLAGS) -S $< -o $@
-
-clean:
-	rm -f subfont subfont.o subfont.S core
--- a/TOOLS/subfont-c/README	Sat Mar 31 14:10:44 2007 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,112 +0,0 @@
-Usage:
-~~~~~~
-1. Make sure you have FreeType 2 installed.
-2. Get a TrueType or Type 1 font.
-3. Run ./configure from mplayer's root directory.
-4. Modify `runme' script for your encoding and font path.
-5. Type: ./runme
-6. Copy *.raw and font.desc files to ~/.mplayer/font/
-7. Run subfont alone to see more options.
-
-
-About:
-~~~~~~
-`subfont' program renders antialiased OSD and subtitle fonts for mplayer.
-
-What you get are bitmap and alpha *.raw files and a font.desc.
-What you need is TrueType, Type 1 or any other font supported by FreeType.
-
-Alpha channel is created using outline and Gaussian blur filters.
-
-ANY encoding is now supported! That is, all 8-bit encodings known by libc
-and user-supplied encodings (also multibyte) through custom encoding files.
-
-I prepared also Type 1 font `osd.pfb' for OSD characters based on bitmaps
-created by chass.
-
-
-Encodings:
-~~~~~~~~~~
-You can get any encoding and any charset.
-1. If you want 8-bit charset, which is known to libc, encoded either in 8-bit
-   or Unicode (like ISO-8859-*, KOI8-*):
-   
-   Find correct encoding name using `iconv --list' (on RedHat) and use it.
-   For latin2 subtitles I would write:
-   ./subfont iso-8859-2 24 verdana.ttf
-   and for UTF-8 subtitles with latin2 charset:
-   ./subfont --unicode iso-8859-2 24 verdana.ttf
-
-2. If you want encoding not known to libc or non 8-bit (like EUC-KR):
-
-   Create file describing your charset:
-
-   For each character you want to render write the line consisting of:
-       hexadecimal Unicode character code
-       followed by whitespace
-       followed by hexadecimal number representing your encoding
-       followed by new line character
-   or (for UTF-8 subtitles):
-       hexadecimal Unicode character code
-       followed by new line character.
-
-   Example:
-       To render a single letter `aogonek' (Unicode 0x0105) and encode
-       it using iso-8859-2 encoding (0xB1), your custom encoding file will consist
-       of a sigle line:
-       0105 B1
-
-       or to get unicode font.desc, write only:
-       0105
-
-   Subfont was tested with Korean fonts from truetype-fonts-ko-2.0-1k.noarch.rpm
-   I found on http://rpmfind.net/ and euc-kr encoding.  Custom encoding file
-   for euc-kr was generated from charmap I found in /usr/share/i18n/charmaps/EUC-KR.gz
-   (glibc package).  Simple script for this you will find in encodings directory.
-   This should work with -unicode switch for mplayer (though this is not Unicode).
-   It took about 10 seconds to render over 8000 characters on P3 @ 600MHz.
-
-
-New font.desc format (proposal):
-~~~~~~~~~~~~~~~~~~~~~==========~
-Subfont will generate new font.desc format when compiled with NEW_DESC macro defined
-(uncomment appropriate line in Makefile).
-
-These changes are to make bitmaps smaller and processing faster.
-
-Changes to [info] section:
- There is no `spacewidth'. It will not be useful.
- `height` is the distance from one baseline to the next.
- `ascender' is the distance from the baseline to the highest grid coordinate used to place the outline point.
- `descender' is the distance from the baseline to the lowest grid coordinate used to place the outline point.
-Note: upwards direction is positive.
-Read more: freetype-2.*/docs/glyphs/glyphs-3.html
-
-Changes to [characters] section:
- Bitmap start and bitmap end are replaced with:
-  bitmap start,
-  bitmap width,
-  bitmap height,
-  left bearing -- the horizontal distance from the current pen position to the bitmaps's left edge,
-  top bearing -- the vertical distance from the baseline to the bitmaps's top edge,
-  advance -- the horizontal distance the pen position must be incremented by after each glyph is rendered.
-
-To anderstand this you must think in verctorial coordinates.
-Necessarily read freetype-2.*/docs/glyphs/glyphs-7.html about vectorial coordinates!
-
-
-Notes:
-~~~~~~
-  + Starting x position of each character and the bitmap width is aligned
-to multiple of 8 (required by mplayer).
-
-  + My development platform is RedHat 7.1.  FreeType versions tested are
-2.0.1 through 2.0.4.
-
-  + FreeType library has a bug that makes subfont display some warning message
-about Unicode charmap for osd.pfb.
-
-
-Author:
-~~~~~~~
-Artur Zaprzala <zybi@fanthom.irc.pl>
--- a/TOOLS/subfont-c/encodings/charmap2enc	Sat Mar 31 14:10:44 2007 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
-#!/usr/bin/awk -f
-# only for mostly 2-byte encodings like euc-kr
-
-$2~"^/x..$" {
-	c = substr($2, 3, 2)
-	if (c<"80")
-	    print substr($1, 3, 4) "\t" c
-}
-$2~"^/x../x..$" {
-	print substr($1, 3, 4) "\t" substr($2, 3, 2) substr($2, 7, 2)
-}
--- a/TOOLS/subfont-c/encodings/osd-mplayer	Sat Mar 31 14:10:44 2007 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,15 +0,0 @@
-E001	01
-E002	02
-E003	03
-E004	04
-E005	05
-E006	06
-E007	07
-E008	08
-E009	09
-E00A	0A
-E00B	0B
-E010	10
-E011	11
-E012	12
-E013	13
--- a/TOOLS/subfont-c/encodings/runme-kr	Sat Mar 31 14:10:44 2007 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-gunzip -c /usr/share/i18n/charmaps/EUC-KR.gz | ./charmap2enc > euc-kr
--- a/TOOLS/subfont-c/font.desc.tail	Sat Mar 31 14:10:44 2007 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,170 +0,0 @@
-
-;
-; MPlayer subtitle font description file - HighreS ONE
-; font created by a'rpi & chass
-; .desc created by chass & atmosfear
-; -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-;
-;
-; This file contains the data for MPlayer to build up the font
-; table from the bitmap files. These fonts are used for the OSD
-; (On Screen Display) and for the subtitles.
-;
-;
-; A few words for the novice user about the fonts:
-; -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-;
-; MPlayer uses antialiased bitmap fonts, which look far better
-; then the TTF rendering used by other players. A letter consists
-; of two main parts: the Bitmap and the Alpha chanel. The bitmap
-; is what you see on the screen, and the Aplha chanel makes the 
-; Font fade smoothly ito the background. And in this font we use
-; the alpha to get a smooth black outline of the letters, which 
-; makes them visible even on white areas of the movie.
-;
-; MPlayer needs at least two separate 8bit/pixel format bitmap
-; files and a .desc file to be able to use the font. One of the
-; files is the bitmap the other is the alpha. The .desc (like this
-; one) gives MPlayer the information needed to convert a bitmap
-; to characters. But the .desc allows to use more bitmap and alpha
-; files: this feature is useful when one wants to add local language
-; support for the subtitles.
-;
-; -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-;
-; ABOUT THE .DESC
-;
-; [1],File layout: the file consists of several sections,
-; the sections are marked like [XXX] where XXX is the section
-; name. The three main sections:
-;
-;  [info]: gives general information about the font, like the
-;          version of the .desc, the author's name and general 
-;          rendering options like kerning.
-;
-;  [files] & [characters] : they go togeather, they describe
-;                           the place of characters in the bitmap.
-;                           Up to 16 is allowed per .desc
-;
-; [2],The variables:
-;
-; [info]
-;    name        string            name of the font, and misc information
-;    desc        int               Version of this file
-;    spacewidth  int               num of pixels for #32
-;    charspace   int               the distance between chars
-;    height      int               the distance between rows
-; [files]
-;    alpha       string            name of alpha map file
-;    bitmap      string            name of bitmap file
-; [character]
-;                string int int    the positon of a character
-;
-;
-; MPlayer can build up it's font table from up to 16*2 files (16 bitmap
-; and 16 alpha channels).
-;                           
-
-
-;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-;informations about the font
-
-;[info]
-
-;the author and other stuff
-;name "HighreS ONE - created by A'rpi and cHaSS - pre-alpha version"
-
-;version number of the file (if greater than version MPlayer can
-;handle, then ignores the unknown variables)
-
-;descversion 1
-
-;the length of #32 in pixels
-
-;spacewidth 13
-
-;the distance between chars. the alpha renderer can handle
-;negative numbers too
-
-;charspace -3
-
-;height 26
-;height 35
-
-;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-;file section
-
-;[files]
-
-;the name of the alpha file used for the next [characters]
-;section 
-
-;alpha arpi_a.raw
-;alpha nfont_a.raw
-
-;the name of the bitmap file used for the next [characters]
-;section 
-
-;bitmap arpi_b.raw
-;bitmap nfont_b.raw
-
-
-
-;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-;the description of the characters: 
-;each row specifies one character: first, the char (between " or ')
-;then the x-coordinate of the beginning and the end.
-
-
-;[characters]
-
-;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-[files]
-alpha arpi_osd_a.raw
-bitmap arpi_osd_b.raw
-
-[characters]
-;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-;Symbols for the OSD
-; range form 01 to 1F
-
-;play
-0x01 0 36
-;pause
-0x02 35 71
-;stop
-0x03 70 106
-;rewind
-0x04 116 152
-;fast forward
-0x05 164 200
-;clock symbol for the OSD
-0x06 209 245
-;contrast
-0x07 256 292
-;stauration
-0x08 305 342
-;volume
-0x09 354 400
-;brightness
-0x0A 407 442
-;Hue
-0x0B 457 494
-
-;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-;OSD progress bar characters
-;
-[files]
-
-alpha arpi_progress_a.raw
-bitmap arpi_progress_b.raw
-
-[characters]
-; [ character
-0x10 4 21
-; | character
-0x11 30 41
-; ] character
-0x12 50 66
-; . char
-0x13 74 85
--- a/TOOLS/subfont-c/fontgen	Sat Mar 31 14:10:44 2007 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-#!/bin/bash
-
-# Font Generator script by alex@naxine.org
-
-if [ -z $1 ]; then
-    echo "fontgen: too few parameters"
-    echo "fontgen: Usage: $0 <input font filename> <output dir>"
-    exit
-fi
-
-if [ ! -r $1 ]; then
-    echo "fontgen: input font file not readable"
-    exit
-fi
-
-subfont_exec=subfont
-#unicode="--unicode"
-#font=arial.ttf
-#font=mints-mild.pcf
-#font=/home/alex/artwiz-mints-mild-latin2.hex
-font=$1
-if [ ! -z $2 ]; then
-    outdir="--outdir $2"
-    mkdir $2
-fi
-#font=verdana.ttf
-encoding=iso-8859-2
-fontsize=12
-symbolssize=10
-blur=2
-outline=1.5
-
-if [ ! -x $subfont_exec ]; then
-    echo "fontgen: 'subfont' not found or not executable!"
-    echo "fontgen: trying to compile"
-    
-    make || exit
-    
-    if [ ! -x $subfont_exec ]; then
-	echo "failed"
-	exit
-    fi
-    
-    exit
-fi
-
-# subfont <encoding> <size> <input>
-echo "fontgen: creating font..."
-./$subfont_exec $outdir $unicode --blur $blur --outline $outline "$encoding" $fontsize "$font" || exit
-echo "fontgen: creating osd symbols..."
-./$subfont_exec $outdir --append --blur $blur --outline $outline encodings/osd-mplayer $symbolssize osd/osd.pfb || exit
-
-exit
--- a/TOOLS/subfont-c/osd/README	Sat Mar 31 14:10:44 2007 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-Requires t1utils and python.
-
-Based on font created by chass.
--- a/TOOLS/subfont-c/osd/gen.py	Sat Mar 31 14:10:44 2007 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,440 +0,0 @@
-#!/usr/bin/python
-
-from math import *
-import sys
-import string
-
-k = (sqrt(2.)-1.)*4./3.
-
-chars = []
-encoding = []
-count = 1
-first = 1
-
-def append(s):
-    chars.append(s)
-
-def rint(x):
-    return int(round(x))
-"""
-    if x>=0:
-	return int(x+0.5)
-    else:
-	return int(x-0.5)
-"""
-
-class vec:
-    def __init__(self, x, y=0):
-        if type(x) is type(()):
-	    self.x, self.y = x
-	else:
-	    self.x = x
-	    self.y = y
-    def set(self, x, y):
-        self.__init__(x, y)
-    def move(self, x, y):
-        self.x = self.x + x
-        self.y = self.y + y
-    def __add__(self, v):
-        return vec(self.x+v.x, self.y+v.y)
-    def __sub__(self, v):
-        return vec(self.x-v.x, self.y-v.y)
-    def int(self):
-        return vec(rint(self.x), rint(self.y))
-    def t(self):
-        return (self.x, self.y)
-
-class pvec(vec):
-    def __init__(self, l, a):
-        self.x = l * cos(a)
-        self.y = l * sin(a)
-
-
-pen = vec(0,0)
-
-def moveto(x, y=0):
-    global first
-    dx = rint(x-pen.x)
-    dy = rint(y-pen.y)
-    if dx!=0:
-        if dy!=0:
-	    append("\t%i %i rmoveto" % (dx, dy))
-	else:
-	    append("\t%i hmoveto" % (dx))
-    elif dy!=0:
-	    append("\t%i vmoveto" % (dy))
-    elif first:
-	    append("\t0 hmoveto")
-	    first = 0
-    pen.x = pen.x+dx
-    pen.y = pen.y+dx
-
-def rlineto(v):
-    if v.x!=0:
-        if v.y!=0:
-	    append("\t%i %i rlineto" % (v.x, v.y))
-	else:
-	    append("\t%i hlineto" % (v.x))
-    elif v.y!=0:
-	    append("\t%i vlineto" % (v.y))
-
-def closepath():
-    append("\tclosepath")
-
-history = []
-def movebase(x, y=0):
-    history.append((x,y))
-    pen.move(-x, -y)
-
-def moveback():
-    x, y = history.pop()
-    pen.move(x, y)
-
-def ellipse(rx, ry = None, half=0):
-    # rx>0 => counter-clockwise (filled)
-    # rx<0 => clockwise
-
-    if ry==None: ry = abs(rx)
-
-    dx1 = rint(k*rx)
-    dx2 = rx-dx1
-
-    dy1 = rint(k*ry)
-    dy2 = ry-dy1
-
-    rx = abs(rx)
-    moveto(0, -ry)
-    append("\t%i 0 %i %i 0 %i rrcurveto" % (+dx1, +dx2, +dy2, +dy1))
-    append("\t0 %i %i %i %i 0 rrcurveto" % (+dy1, -dx2, +dy2, -dx1))
-    if not half:
-	append("\t%i 0 %i %i 0 %i rrcurveto" % (-dx1, -dx2, -dy2, -dy1))
-	append("\t0 %i %i %i %i 0 rrcurveto" % (-dy1, +dx2, -dy2, +dx1))
-    closepath()
-    if half:
-	pen.set(0, ry)
-    else:
-	pen.set(0, -ry)
-
-circle = ellipse
-
-def rect(w, h):
-    moveto(0, 0)
-    if w>0:
-	append("\t%i hlineto" % (w))
-	append("\t%i vlineto" % (h))
-	append("\t%i hlineto" % (-w))
-	pen.set(0, h)
-    else:
-	append("\t%i vlineto" % (h))
-	append("\t%i hlineto" % (-w))
-	append("\t%i vlineto" % (-h))
-	pen.set(-w, 0)
-    closepath()
-
-def poly(p):
-    moveto(0, 0)
-    prev = vec(0, 0)
-    for q in p:
-        rlineto(vec(q)-prev)
-	prev = vec(q)
-    closepath()
-    pen.set(prev.x, prev.y)
-
-def line(w, l, a):
-    vw = pvec(w*.5, a-pi*.5)
-    vl = pvec(l, a)
-    p = vw
-    moveto(p.x, p.y)
-    p0 = p
-    #print '%%wla %i %i %.3f: %.3f %.3f' % (w, l, a, p0.x, p0.y)
-    p = p+vl
-    rlineto((p-p0).int())
-    p0 = p
-    #print '%%wla %i %i %.3f: %.3f %.3f' % (w, l, a, p0.x, p0.y)
-    p = p-vw-vw
-    rlineto((p-p0).int())
-    p0 = p
-    #print '%%wla %i %i %.3f: %.3f %.3f' % (w, l, a, p0.x, p0.y)
-    p = p-vl
-    #print '%%wla %i %i %.3f: %.3f %.3f' % (w, l, a, p.x, p.y)
-    rlineto((p-p0).int())
-    closepath()
-    pen.set(p.x, p.y)
-
-
-def begin(name, code, hsb, w):
-    global first, count, history
-    history = []
-    pen.set(0, 0)
-    append("""\
-/uni%04X { %% %s
-	%i %i hsbw""" % (code+0xE000, name, hsb, w))
-    i = len(encoding)
-    while i<code:
-	encoding.append('dup %i /.notdef put' % (i,))
-	i = i+1
-    encoding.append('dup %i /uni%04X put' % (code, code+0xE000))
-    count = count + 1
-    first = 1
-
-
-def end():
-    append("""\
-	endchar
-} ND""")
-
-
-
-########################################
-
-r = 400
-s = 375
-hsb = 200	# horizontal side bearing
-hsb2 = 30
-over = 10	# overshoot
-width = 2*r+2*over+2*hsb2
-
-########################################
-begin('play', 0x01, hsb, width)
-poly((  (s,r),
-	(0, 2*r),))
-end()
-
-
-########################################
-w=150
-begin('pause', 0x02, hsb, width)
-rect(w, 2*r)
-movebase(2*w)
-rect(w, 2*r)
-end()
-
-
-########################################
-begin('stop', 0x03, hsb, width)
-rect(665, 720)
-end()
-
-
-########################################
-begin('rewind', 0x04, hsb/2, width)
-movebase(2*s+15)
-poly((  (0, 2*r),
-	(-s, r),))
-movebase(-s-15)
-poly((  (0, 2*r),
-	(-s, r),))
-end()
-
-
-########################################
-begin('fast forward', 0x05, hsb/2, width)
-poly((  (s,r),
-	(0, 2*r),))
-movebase(s+15)
-poly((  (s,r),
-	(0, 2*r),))
-end()
-
-
-########################################
-begin('clock', 0x06, hsb2, width)
-movebase(r, r)
-circle(r+over)
-wc = 65
-r0 = r-3*wc
-n = 4
-movebase(-wc/2, -wc/2)
-rect(-wc, wc)
-moveback()
-for i in range(n):
-    a = i*2*pi/n
-    v = pvec(r0, a)
-    movebase(v.x, v.y)
-    line(-wc, r-r0, a)
-    moveback()
-hh = 11
-mm = 8
-line(-50, r*.5, pi/2-2*pi*(hh+mm/60.)/12)
-line(-40, r*.9, pi/2-2*pi*mm/60.)
-end()
-
-
-########################################
-begin('contrast', 0x07, hsb2, width)
-movebase(r, r)
-circle(r+over)
-circle(-(r+over-80), half=1)
-end()
-
-
-########################################
-begin('saturation', 0x08, hsb2, width)
-movebase(r, r)
-circle(r+over)
-circle(-(r+over-80))
-
-v = pvec(160, pi/2)
-movebase(v.x, v.y)
-circle(80)
-moveback()
-
-v = pvec(160, pi/2+pi*2/3)
-movebase(v.x, v.y)
-circle(80)
-moveback()
-
-v = pvec(160, pi/2-pi*2/3)
-movebase(v.x, v.y)
-circle(80)
-end()
-
-
-########################################
-begin('volume', 0x09, 0, 1000)
-poly((  (1000, 0),
-	(1000, 500),))
-end()
-
-
-########################################
-begin('brightness', 0x0A, hsb2, width)
-movebase(r, r)
-circle(150)
-circle(-100)
-
-rb = 375
-wb = 50
-l = 140
-n = 8
-for i in range(n):
-    a = i*2*pi/n
-    v = pvec(l, a)
-    movebase(v.x, v.y)
-    line(wb, rb-l, a)
-    moveback()
-end()
-
-
-########################################
-begin('hue', 0x0B, hsb2, width)
-movebase(r, r)
-circle(r+over)
-ellipse(-(322), 166)
-movebase(0, 280)
-circle(-(60))
-end()
-
-
-########################################
-begin('progress [', 0x10, (334-182)/2, 334)
-poly((  (182, 0),
-	(182, 90),
-	(145, 90),
-	(145, 550),
-	(182, 550),
-	(182, 640),
-	(0, 640),
-))
-end()
-
-
-########################################
-begin('progress |', 0x11, (334-166)/2, 334)
-rect(166, 640)
-end()
-
-
-########################################
-begin('progress ]', 0x12, (334-182)/2, 334)
-poly((  (182, 0),
-	(182, 640),
-	(0, 640),
-	(0, 550),
-	(37, 550),
-	(37, 90),
-	(0, 90),
-))
-end()
-
-
-########################################
-begin('progress .', 0x13, (334-130)/2, 334)
-movebase(0, (640-130)/2)
-rect(130, 130)
-end()
-
-
-
-########################################
-print """\
-%!PS-AdobeFont-1.0: OSD 1.00
-%%CreationDate: Sun Jul 22 12:38:28 2001
-%
-%%EndComments
-12 dict begin
-/FontInfo 9 dict dup begin
-/version (Version 1.00) readonly def
-/Notice (This is generated file.) readonly def
-/FullName (OSD) readonly def
-/FamilyName (OSD) readonly def
-/Weight (Regular) readonly def
-/ItalicAngle 0.000000 def
-/isFixedPitch false def
-/UnderlinePosition -133 def
-/UnderlineThickness 49 def
-end readonly def
-/FontName /OSD def
-/PaintType 0 def
-/StrokeWidth 0 def
-/FontMatrix [0.001 0 0 0.001 0 0] def
-/FontBBox {0 -10 1000 810} readonly def
-/Encoding 256 array"""
-
-print string.join(encoding, '\n')
-i = len(encoding)
-while i<256:
-    print 'dup %i /.notdef put' % i
-    i = i+1
-
-
-print """\
-readonly def
-currentdict end
-currentfile eexec
-dup /Private 15 dict dup begin
-/RD{string currentfile exch readstring pop}executeonly def
-/ND{noaccess def}executeonly def
-/NP{noaccess put}executeonly def
-/ForceBold false def
-/BlueValues [ -10 0 800 810 640 650 720 730 ] def
-/StdHW [ 65 ] def
-/StdVW [ 65 ] def
-/StemSnapH [ 65 800 ] def
-/StemSnapV [ 65 150 ] def
-/MinFeature {16 16} def
-/password 5839 def
-/Subrs 1 array
-dup 0 {
-	return
-	} NP
- ND
-2 index
-/CharStrings %i dict dup begin""" % count
-
-print """\
-/.notdef {
-	0 400 hsbw
-	endchar
-} ND"""
-
-print string.join(chars, '\n')
-
-
-print """\
-end
-end
-readonly put
-noaccess put
-dup/FontName get exch definefont pop
-mark currentfile closefile"""
--- a/TOOLS/subfont-c/osd/gen_osd_h.c	Sat Mar 31 14:10:44 2007 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,15 +0,0 @@
-#include <stdio.h>
-
-int main()
-{
-    int c;
-    int cnt;
-    printf("unsigned char osd_font_pfb[] = {");
-    for (cnt = 0;;cnt++) {
-	if (cnt % 16 == 0) printf("\n");
-	c = getchar();
-	if (c < 0) break;
-	printf("0x%02x,", c);
-    }
-    printf("};\n");
-}
Binary file TOOLS/subfont-c/osd/osd.pfb has changed
--- a/TOOLS/subfont-c/osd/runme	Sat Mar 31 14:10:44 2007 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,4 +0,0 @@
-#
-./gen.py > osd.t1a &&
-t1asm --pfb osd.t1a osd.pfb &&
-ftview 80 osd.pfb > /dev/null 2>&1 &
--- a/TOOLS/subfont-c/runme	Sat Mar 31 14:10:44 2007 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-#!/bin/bash
-
-#unicode="--unicode"
-#font=arial.ttf
-#font=mints-mild.pcf
-#font=/home/alex/artwiz-mints-mild-latin2.hex
-font=$1
-#font=verdana.ttf
-encoding=iso-8859-2
-fontsize=$2
-symbolssize=$3
-blur=2
-outline=1.5
-
-make || exit
-
-./subfont $unicode --blur $blur --outline $outline "$encoding" $fontsize "$font" || exit
-./subfont --append --blur $blur --outline $outline encodings/osd-mplayer $symbolssize osd/osd.pfb || exit
-
-#cp font.desc *.raw ~/.mplayer/font/
-
-exit
-
-# display *.raw files
-SIZE=`awk '/bitmap size:/ {print $NF; exit}' font.desc`+800
-display -size $SIZE gray:$encoding-a.raw &
-display -size $SIZE gray:$encoding-b.raw &
-#convert -size $SIZE gray:$encoding-a.raw $encoding-a.png
-#convert -size $SIZE gray:$encoding-b.raw $encoding-b.png
--- a/TOOLS/subfont-c/subfont.c	Sat Mar 31 14:10:44 2007 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1040 +0,0 @@
-/*
- * Renders antialiased fonts for mplayer using freetype library.
- * Should work with TrueType, Type1 and any other font supported by libfreetype.
- * Can generate font.desc for any encoding.
- *
- *
- * Artur Zaprzala <zybi@fanthom.irc.pl>
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <iconv.h>
-#include <math.h>
-#include <string.h>
-#include <libgen.h>
-
-
-#ifndef OLD_FREETYPE2
-#include <ft2build.h>	
-#include FT_FREETYPE_H
-#include FT_GLYPH_H
-#else			/* freetype 2.0.1 */
-#include <freetype/freetype.h>
-#include <freetype/ftglyph.h>
-#endif
-
-
-#include "libavutil/common.h"
-#include "mpbswap.h"
-#include "osdep/timer.h"
-
-#ifndef DEBUG
-#define DEBUG	0
-#endif
-
-
-//// default values
-char		*encoding = "iso-8859-1";	/* target encoding */
-char		*charmap = "ucs-4";		/* font charmap encoding, I hope ucs-4 is always big endian */
-						/* gcc 2.1.3 doesn't support ucs-4le, but supports ucs-4 (==ucs-4be) */
-float		ppem = 22;			/* font size in pixels */
-
-double		radius = 2;			/* blur radius */
-double		thickness = 1.5;		/* outline thickness */
-
-char*		font_desc = "font.desc";
-//char*		font_desc = "/dev/stdout";
-
-char		*outdir = ".";
-
-//// constants
-int const	colors = 256;
-int const	maxcolor = 255;
-unsigned const	base = 256;
-unsigned const	first_char = 33;
-#define max_charset_size	60000
-//int const	max_charset_size = 256;
-unsigned	charset_size = 0;
-
-////
-char		*command;
-char		*encoding_name;
-char		*font_path;
-//char		*font_metrics;
-int		append_mode = 0;
-int		unicode_desc = 0;
-
-unsigned char	*bbuffer, *abuffer;
-int		width, height;
-int		padding;
-static FT_ULong	charset[max_charset_size];		/* characters we want to render; Unicode */
-static FT_ULong	charcodes[max_charset_size];	/* character codes in 'encoding' */
-iconv_t cd;					// iconv conversion descriptor
-
-
-
-#define eprintf(...)		fprintf(stderr, ##__VA_ARGS__)
-#define ERROR(msg, ...)		eprintf("%s: error: " msg "\n", command, ##__VA_ARGS__),exit(1)
-#define WARNING(msg, ...)	eprintf("%s: warning: " msg "\n", command, ##__VA_ARGS__)
-
-#define f266ToInt(x)		(((x)+32)>>6)	// round fractional fixed point number to integer
-						// coordinates are in 26.6 pixels (i.e. 1/64th of pixels)
-#define f266CeilToInt(x)	(((x)+63)>>6)	// ceiling
-#define f266FloorToInt(x)	((x)>>6)	// floor
-#define f1616ToInt(x)		(((x)+0x8000)>>16)	// 16.16
-#define floatTof266(x)		((int)((x)*(1<<6)+0.5))
-
-#define ALIGN(x)		(((x)+7)&~7)	// 8 byte align
-
-
-
-void paste_bitmap(FT_Bitmap *bitmap, int x, int y) {
-    int drow = x+y*width;
-    int srow = 0;
-    int sp, dp, w, h;
-    if (bitmap->pixel_mode==ft_pixel_mode_mono)
-	for (h = bitmap->rows; h>0; --h, drow+=width, srow+=bitmap->pitch)
-	    for (w = bitmap->width, sp=dp=0; w>0; --w, ++dp, ++sp)
-		    bbuffer[drow+dp] = (bitmap->buffer[srow+sp/8] & (0x80>>(sp%8))) ? 255:0;
-    else
-	for (h = bitmap->rows; h>0; --h, drow+=width, srow+=bitmap->pitch)
-	    for (w = bitmap->width, sp=dp=0; w>0; --w, ++dp, ++sp)
-		    bbuffer[drow+dp] = bitmap->buffer[srow+sp];
-}
-
-
-void write_header(FILE *f) {
-    static unsigned char   header[800] = "mhwanh";
-    int i;
-    header[7] = 4;
-    if (width < 0x10000) { // are two bytes enough for the width?
-    header[8] = width>>8;	header[9] = (unsigned char)width;
-    } else {               // store width using 4 bytes at the end of the header
-	    header[8] = header[9] = 0;
-	    header[28] = (width >> 030) & 0xFF;
-	    header[29] = (width >> 020) & 0xFF;
-	    header[30] = (width >> 010) & 0xFF;
-	    header[31] = (width       ) & 0xFF;
-    }
-    header[10] = height>>8;	header[11] = (unsigned char)height;
-    header[12] = colors>>8;	header[13] = (unsigned char)colors;
-    for (i = 32; i<800; ++i) header[i] = (i-32)/3;
-    fwrite(header, 1, 800, f);
-}
-
-
-void write_bitmap(void *buffer, char type) {
-    FILE *f;
-    int const max_name = 128;
-    char name[max_name];
-
-    snprintf(name, max_name, "%s/%s-%c.raw", outdir, encoding_name, type);
-    f = fopen(name, "wb");
-    if (f==NULL) ERROR("fopen failed.");
-    write_header(f);
-    fwrite(buffer, 1, width*height, f);
-    fclose(f);
-}
-
-
-void render() {
-    FT_Library	library;
-    FT_Face	face;
-    FT_Error	error;
-    FT_Glyph	*glyphs;
-    FT_BitmapGlyph glyph;
-    FILE	*f;
-    int	const	load_flags = FT_LOAD_DEFAULT | FT_LOAD_NO_HINTING;
-    int		pen_x = 0, pen_xa;
-    int		ymin = INT_MAX, ymax = INT_MIN;
-    int		i, uni_charmap = 1;
-    int		baseline, space_advance = 20;
-    int		glyphs_count = 0;
-
-
-    /* initialize freetype */
-    error = FT_Init_FreeType(&library);
-    if (error) ERROR("Init_FreeType failed.");
-    error = FT_New_Face(library, font_path, 0, &face);
-    if (error) ERROR("New_Face failed. Maybe the font path `%s' is wrong.", font_path);
-
-    /*
-    if (font_metrics) {
-	error = FT_Attach_File(face, font_metrics);
-	if (error) WARNING("FT_Attach_File failed.");
-    }
-    */
-
-
-#if 0
-    /************************************************************/
-    eprintf("Font encodings:\n");
-    for (i = 0; i<face->num_charmaps; ++i)
-	eprintf("'%.4s'\n", (char*)&face->charmaps[i]->encoding);
-
-    //error = FT_Select_Charmap(face, ft_encoding_unicode);
-    //error = FT_Select_Charmap(face, ft_encoding_adobe_standard);
-    //error = FT_Select_Charmap(face, ft_encoding_adobe_custom);
-    //error = FT_Set_Charmap(face, face->charmaps[1]);
-    //if (error) WARNING("FT_Select_Charmap failed.");
-#endif
-
-
-#if 0
-    /************************************************************/
-    if (FT_HAS_GLYPH_NAMES(face)) {
-	int const max_gname = 128;
-	char gname[max_gname];
-	for (i = 0; i<face->num_glyphs; ++i) {
-	    FT_Get_Glyph_Name(face, i, gname, max_gname);
-	    eprintf("%02x `%s'\n", i, gname);
-	}
-
-    }
-#endif
-
-
-    if (face->charmap==NULL || face->charmap->encoding!=ft_encoding_unicode) {
-	WARNING("Unicode charmap not available for this font. Very bad!");
-	uni_charmap = 0;
-	error = FT_Set_Charmap(face, face->charmaps[0]);
-	if (error) WARNING("No charmaps! Strange.");
-    }
-
-
-
-    /* set size */
-    if (FT_IS_SCALABLE(face)) {
-	error = FT_Set_Char_Size(face, floatTof266(ppem), 0, 0, 0);
-	if (error) WARNING("FT_Set_Char_Size failed.");
-    } else {
-	int j = 0;
-	int jppem = face->available_sizes[0].height;
-	/* find closest size */
-	for (i = 0; i<face->num_fixed_sizes; ++i) {
-	    if (fabs(face->available_sizes[i].height - ppem) < abs(face->available_sizes[i].height - jppem)) {
-		j = i;
-		jppem = face->available_sizes[i].height;
-	    }
-	}
-	WARNING("Selected font is not scalable. Using ppem=%i.", face->available_sizes[j].height);
-	error = FT_Set_Pixel_Sizes(face, face->available_sizes[j].width, face->available_sizes[j].height);
-	if (error) WARNING("FT_Set_Pixel_Sizes failed.");
-    }
-
-
-    if (FT_IS_FIXED_WIDTH(face))
-	WARNING("Selected font is fixed-width.");
-
-
-    /* compute space advance */
-    error = FT_Load_Char(face, ' ', load_flags);
-    if (error) WARNING("spacewidth set to default.");
-    else space_advance = f266ToInt(face->glyph->advance.x);
-
-
-    /* create font.desc */
-{
-    int const max_name = 128;
-    char name[max_name];
-
-    snprintf(name, max_name, "%s/%s", outdir, font_desc);
-    f = fopen(name, append_mode ? "a":"w");
-}
-    if (f==NULL) ERROR("fopen failed.");
-
-
-    /* print font.desc header */
-    if (append_mode) {
-	fprintf(f, "\n\n# ");
-    } else {
-	fprintf(f,  "# This file was generated with subfont for MPlayer.\n"
-		    "# Subfont by Artur Zaprzala <zybi@fanthom.irc.pl>.\n\n");
-	fprintf(f, "[info]\n");
-    }
-
-    fprintf(f, "name 'Subtitle font for %s %s, \"%s%s%s\" face, size: %.1f pixels, blur: %.1f, outline: %.1f'\n",
-	    encoding_name,
-	    unicode_desc ? "charset, Unicode encoding":"encoding",
-	    face->family_name ? face->family_name : font_path,
-	    face->style_name ? " ":"", face->style_name ? face->style_name:"",
-	    ppem, radius, thickness);
-
-    if (!append_mode) {
-#ifdef NEW_DESC
-	fprintf(f, "descversion 2\n");
-#else
-	fprintf(f, "descversion 1\n");
-#endif
-	fprintf(f, "spacewidth %i\n",	2*padding + space_advance);
-#ifndef NEW_DESC
-	fprintf(f, "charspace %i\n",	-2*padding);
-#endif
-	fprintf(f, "height %li\n",	f266ToInt(face->size->metrics.height));
-#ifdef NEW_DESC
-	fprintf(f, "ascender %i\n",	f266CeilToInt(face->size->metrics.ascender));
-	fprintf(f, "descender %i\n",	f266FloorToInt(face->size->metrics.descender));
-#endif
-    }
-    fprintf(f, "\n[files]\n");
-    fprintf(f, "alpha %s-a.raw\n",	encoding_name);
-    fprintf(f, "bitmap %s-b.raw\n",	encoding_name);
-    fprintf(f, "\n[characters]\n");
-
-
-    // render glyphs, compute bitmap size and [characters] section
-    glyphs = (FT_Glyph*)malloc(charset_size*sizeof(FT_Glyph*));
-    for (i= 0; i<charset_size; ++i) {
-	FT_GlyphSlot	slot;
-	FT_ULong	character, code;
-	FT_UInt		glyph_index;
-	FT_BBox		bbox;
-
-	character = charset[i];
-	code = charcodes[i];
-
-	// get glyph index
-	if (character==0)
-	    glyph_index = 0;
-	else {
-	    glyph_index = FT_Get_Char_Index(face, uni_charmap ? character:code);
-	    if (glyph_index==0) {
-		WARNING("Glyph for char 0x%02lx|U+%04lX|%c not found.", code, character,
-			 code<' '||code>255 ? '.':(char)code);
-		continue;
-	    }
-	}
-
-	// load glyph
-	error = FT_Load_Glyph(face, glyph_index, load_flags);
-	if (error) {
-	    WARNING("FT_Load_Glyph 0x%02x (char 0x%02lx|U+%04lX) failed.", glyph_index, code, character);
-	    continue;
-	}
-	slot = face->glyph;
-
-	// render glyph
-	if (slot->format != ft_glyph_format_bitmap) {
-	    error = FT_Render_Glyph(slot, ft_render_mode_normal);
-	    if (error) {
-		WARNING("FT_Render_Glyph 0x%04x (char 0x%02lx|U+%04lX) failed.", glyph_index, code, character);
-		continue;
-	    }
-	}
-
-	// extract glyph image
-	error = FT_Get_Glyph(slot, (FT_Glyph*)&glyph);
-	if (error) {
-	    WARNING("FT_Get_Glyph 0x%04x (char 0x%02lx|U+%04lX) failed.", glyph_index, code, character);
-	    continue;
-	}
-	glyphs[glyphs_count++] = (FT_Glyph)glyph;
-
-#ifdef NEW_DESC
-	// max height
-	if (glyph->bitmap.rows > height) height = glyph->bitmap.rows;
-
-	// advance pen
-	pen_xa = pen_x + glyph->bitmap.width + 2*padding;
-
-	// font.desc
-	fprintf(f, "0x%04x %i %i %i %i %i %i;\tU+%04X|%c\n", unicode_desc ? character:code,
-		pen_x,						// bitmap start
-		glyph->bitmap.width + 2*padding,		// bitmap width
-		glyph->bitmap.rows + 2*padding,			// bitmap height
-		glyph->left - padding,				// left bearing
-		glyph->top + padding,				// top bearing
-		f266ToInt(slot->advance.x),			// advance
-		character, code<' '||code>255 ? '.':code);
-#else
-	// max height
-	if (glyph->top > ymax) {
-	    ymax = glyph->top;
-	    //eprintf("%3i: ymax %i (%c)\n", code, ymax, code);
-	}
-	if (glyph->top - glyph->bitmap.rows < ymin) {
-	    ymin = glyph->top - glyph->bitmap.rows;
-	    //eprintf("%3i: ymin %i (%c)\n", code, ymin, code);
-	}
-
-	/* advance pen */
-	pen_xa = pen_x + f266ToInt(slot->advance.x) + 2*padding;
-
-	/* font.desc */
-	fprintf(f, "0x%04lx %i %i;\tU+%04lX|%c\n", unicode_desc ? character:code,
-		pen_x,						// bitmap start
-		pen_xa-1,					// bitmap end
-		character, code<' '||code>255 ? '.':(char)code);
-#endif
-	pen_x = ALIGN(pen_xa);
-    }
-
-
-    width = pen_x;
-    pen_x = 0;
-#ifdef NEW_DESC
-    if (height<=0) ERROR("Something went wrong. Use the source!");
-    height += 2*padding;
-#else
-    if (ymax<=ymin) ERROR("Something went wrong. Use the source!");
-    height = ymax - ymin + 2*padding;
-    baseline = ymax + padding;
-#endif
-
-    // end of font.desc
-    if (DEBUG) eprintf("bitmap size: %ix%i\n", width, height);
-    fprintf(f, "# bitmap size: %ix%i\n", width, height);
-    fclose(f);
-
-    bbuffer = (unsigned char*)malloc(width*height);
-    if (bbuffer==NULL) ERROR("malloc failed.");
-    memset(bbuffer, 0, width*height);
-
-
-    /* paste glyphs */
-    for (i= 0; i<glyphs_count; ++i) {
-	glyph = (FT_BitmapGlyph)glyphs[i];
-#ifdef NEW_DESC
-	paste_bitmap(&glyph->bitmap,
-	    pen_x + padding,
-	    padding);
-
-	/* advance pen */
-	pen_x += glyph->bitmap.width + 2*padding;
-#else
-	paste_bitmap(&glyph->bitmap,
-	    pen_x + padding + glyph->left,
-	    baseline - glyph->top);
-
-	/* advance pen */
-	pen_x += f1616ToInt(glyph->root.advance.x) + 2*padding;
-#endif
-	pen_x = ALIGN(pen_x);
-
-	FT_Done_Glyph((FT_Glyph)glyph);
-    }
-    free(glyphs);
-
-
-    error = FT_Done_FreeType(library);
-    if (error) ERROR("FT_Done_FreeType failed.");
-}
-
-
-/* decode from 'encoding' to unicode */
-FT_ULong decode_char(char c) {
-    FT_ULong o;
-    char *inbuf = &c;
-    char *outbuf = (char*)&o;
-    int inbytesleft = 1;
-    int outbytesleft = sizeof(FT_ULong);
-
-    size_t count = iconv(cd, &inbuf, &inbytesleft, &outbuf, &outbytesleft);
-
-    /* convert unicode BigEndian -> MachineEndian */
-    o = be2me_32(o);
-
-    // if (count==-1) o = 0; // not OK, at least my iconv() returns E2BIG for all
-    if (outbytesleft!=0) o = 0;
-
-    /* we don't want control characters */
-    if (o>=0x7f && o<0xa0) o = 0;
-    return o;
-}
-
-
-void prepare_charset() {
-    FILE *f;
-    FT_ULong i;
-
-    f = fopen(encoding, "r");		// try to read custom encoding
-    if (f==NULL) {
-	int count = 0;
-	// check if ucs-4 is available
-	cd = iconv_open(charmap, charmap);
-	if (cd==(iconv_t)-1) ERROR("iconv doesn't know %s encoding. Use the source!", charmap);
-	iconv_close(cd);
-
-	cd = iconv_open(charmap, encoding);
-	if (cd==(iconv_t)-1) ERROR("Unsupported encoding `%s', use iconv --list to list character sets known on your system.", encoding);
-
-	charset_size = 256 - first_char;
-	for (i = 0; i<charset_size; ++i) {
-	    charcodes[count] = i+first_char;
-	    charset[count] = decode_char(i+first_char);
-	    //eprintf("%04X U%04X\n", charcodes[count], charset[count]);
-	    if (charset[count]!=0) ++count;
-	}
-	charcodes[count] = charset[count] = 0; ++count;
-	charset_size = count;
-
-	iconv_close(cd);
-    } else {
-	unsigned int character, code;
-	int count;
-
-	eprintf("Reading custom encoding from file '%s'.\n", encoding);
-
-       	while ((count = fscanf(f, "%x%*[ \t]%x", &character, &code)) != EOF) {
-	    if (charset_size==max_charset_size) {
-		WARNING("There is no place for  more than %i characters. Use the source!", max_charset_size);
-		break;
-	    }
-	    if (count==0) ERROR("Unable to parse custom encoding file.");
-	    if (character<32) continue;	// skip control characters
-	    charset[charset_size] = character;
-	    charcodes[charset_size] = count==2 ? code : character;
-	    ++charset_size;
-	}
-	fclose(f);
-//	encoding = basename(encoding);
-    }
-    if (charset_size==0) ERROR("No characters to render!");
-}
-
-
-// general outline
-void outline(
-	unsigned char *s,
-	unsigned char *t,
-	int width,
-	int height,
-	unsigned char *m,
-	int r,
-	int mwidth,
-	int msize) {
-
-    int x, y;
-#if 1
-    for (y = 0; y<height; y++) {
-	for (x = 0; x<width; x++) {
-	    const int src= s[x];
-	    if(src==0) continue;
-#if 0 
-	    if(src==255 && x>0 && y>0 && x+1<width && y+1<height
-	       && s[x-1]==255 && s[x+1]==255 && s[x-width]==255 && s[x+width]==255){
-		t[x + y*width]=255;
-            }else
-#endif
-	    {
-		const int x1=(x<r) ? r-x : 0;
-		const int y1=(y<r) ? r-y : 0;
-		const int x2=(x+r>=width ) ? r+width -x : 2*r+1;
-		const int y2=(y+r>=height) ? r+height-y : 2*r+1;
-		register unsigned char *dstp= t + (y1+y-r)* width + x-r;
-		//register int *mp  = m +  y1     *mwidth;
-		register unsigned char *mp= m + msize*src + y1*mwidth;
-		int my;
-
-		for(my= y1; my<y2; my++){
-//		    unsigned char *dstp= t + (my+y-r)* width + x-r;
-//		    int *mp  = m +  my     *mwidth;
-		    register int mx;
-		    for(mx= x1; mx<x2; mx++){
-//			const int tmp= (src*mp[mx] + 128)>>8;
-//			if(dstp[mx] < tmp) dstp[mx]= tmp;
-			if(dstp[mx] < mp[mx]) dstp[mx]= mp[mx];
-		    }
-		    dstp+=width;
-		    mp+=mwidth;
-		}
-            }
-	}
-	s+= width;
-    }
-#else
-    for (y = 0; y<height; ++y) {
-	for (x = 0; x<width; ++x, ++s, ++t) {
-	  //if(s[0]>=192) printf("%d\n",s[0]);
-	  if(s[0]!=255){
-	    unsigned max = 0;
-	    unsigned *mrow = m + r;
-	    unsigned char *srow = s -r*width;
-	    int x1=(x<r)?-x:-r;
-	    int x2=(x+r>=width)?(width-x-1):r;
-	    int my;
-
-	    for (my = -r; my<=r; ++my, srow+= width, mrow+= mwidth) {
-		int mx;
-		if (y+my < 0) continue;
-		if (y+my >= height) break;
-
-		for (mx = x1; mx<=x2; ++mx) {
-		    unsigned v = srow[mx] * mrow[mx];
-		    if (v>max) max = v;
-		}
-	    }
-//	    if(!max) *t = 0; else
-	    *t = (max + base/2) / base;
-	  } else 
-	    *t = 255;
-	}
-    }
-#endif
-}
-
-
-// 1 pixel outline
-void outline1(
-	unsigned char *s,
-	unsigned char *t,
-	int width,
-	int height) {
-
-    int x, y, mx, my;
-
-    for (x = 0; x<width; ++x, ++s, ++t) *t = *s;
-    for (y = 1; y<height-1; ++y) {
-	*t++ = *s++;
-	for (x = 1; x<width-1; ++x, ++s, ++t) {
-	    unsigned v = (
-		    s[-1-width]+
-		    s[-1+width]+
-		    s[+1-width]+
-		    s[+1+width]
-		)/2 + (
-		    s[-1]+
-		    s[+1]+
-		    s[-width]+
-		    s[+width]+
-		    s[0]
-		);
-	    *t = v>maxcolor ? maxcolor : v;
-	}
-	*t++ = *s++;
-    }
-    for (x = 0; x<width; ++x, ++s, ++t) *t = *s;
-}
-
-
-// gaussian blur
-void blur(
-	unsigned char *buffer,
-	unsigned short *tmp2,
-	int width,
-	int height,
-	int *m,
-	int *m2,
-	int r,
-	int mwidth,
-	unsigned volume) {
-
-    int x, y;
-
-#if 1
-    unsigned char  *s = buffer;
-    unsigned short *t = tmp2+1;
-    for(y=0; y<height; y++){
-	memset(t-1, 0, (width+1)*sizeof(short));
-//	for(x=0; x<width+1; x++)
-//	    t[x]= 128;
-
-	for(x=0; x<r; x++){
-	    const int src= s[x];
-	    if(src){
-		register unsigned short *dstp= t + x-r;
-		int mx;
-		unsigned *m3= m2 + src*mwidth;
-		for(mx=r-x; mx<mwidth; mx++){
-		    dstp[mx]+= m3[mx];
-		}
-	    }
-	}
-	for(; x<width-r; x++){
-	    const int src= s[x];
-	    if(src){
-		register unsigned short *dstp= t + x-r;
-		int mx;
-		unsigned *m3= m2 + src*mwidth;
-		for(mx=0; mx<mwidth; mx++){
-		    dstp[mx]+= m3[mx];
-		}
-	    }
-	}
-	for(; x<width; x++){
-	    const int src= s[x];
-	    if(src){
-		register unsigned short *dstp= t + x-r;
-		int mx;
-		const int x2= r+width -x;
-		const int off= src*mwidth;
-		unsigned *m3= m2 + src*mwidth;
-		for(mx=0; mx<x2; mx++){
-		    dstp[mx]+= m3[mx];
-		}
-	    }
-	}
-	s+= width;
-	t+= width + 1;
-    }
-
-    t = tmp2;
-    for(x=0; x<width; x++){
-	for(y=0; y<r; y++){
-	    unsigned short *srcp= t + y*(width+1) + 1;
-	    int src= *srcp;
-	    if(src){
-		register unsigned short *dstp= srcp - 1 + width+1;
-		const int src2= (src + 128)>>8;
-		unsigned *m3= m2 + src2*mwidth;
-
-		int mx;
-		*srcp= 128;
-		for(mx=r-1; mx<mwidth; mx++){
-		    *dstp += m3[mx];
-		    dstp+= width+1;
-		}
-	    }
-	}
-	for(; y<height-r; y++){
-	    unsigned short *srcp= t + y*(width+1) + 1;
-	    int src= *srcp;
-	    if(src){
-		register unsigned short *dstp= srcp - 1 - r*(width+1);
-		const int src2= (src + 128)>>8;
-		unsigned *m3= m2 + src2*mwidth;
-
-		int mx;
-		*srcp= 128;
-		for(mx=0; mx<mwidth; mx++){
-		    *dstp += m3[mx];
-		    dstp+= width+1;
-		}
-	    }
-	}
-	for(; y<height; y++){
-	    unsigned short *srcp= t + y*(width+1) + 1;
-	    int src= *srcp;
-	    if(src){
-		const int y2=r+height-y;
-		register unsigned short *dstp= srcp - 1 - r*(width+1);
-		const int src2= (src + 128)>>8;
-		unsigned *m3= m2 + src2*mwidth;
-
-		int mx;
-		*srcp= 128;
-		for(mx=0; mx<y2; mx++){
-		    *dstp += m3[mx];
-		    dstp+= width+1;
-		}
-	    }
-	}
-	t++;
-    }
- 
-    t = tmp2;
-    s = buffer;
-    for(y=0; y<height; y++){
-	for(x=0; x<width; x++){
-	    s[x]= t[x]>>8;
-	}
-	s+= width;
-	t+= width + 1;
-    }
-#else
-    unsigned char *tmp = (unsigned char*)tmp2;
-    unsigned char *s = buffer - r;
-    unsigned char *t = tmp;
-    
-    int *m_end=m+256*mwidth;
-
-    for (y = 0; y<height; ++y) {
-	for (x = 0; x<width; ++x, ++s, ++t) {
-	    unsigned sum = 65536/2;
-	    int x1 = (x<r) ? r-x:0;
-	    int x2 = (x+r>=width) ? (r+width-x):mwidth;
-	    unsigned* mp = m + 256*x1;
-	    int mx;
-
-	    for (mx = x1; mx<x2; ++mx, mp+=256)	sum+= mp[s[mx]];
-	    *t = sum>>16;
-	}
-    }
-
-    tmp -= r*width;
-    for (x = 0; x<width; ++x, ++tmp, ++buffer) {
-	int y1max=(r<height)?r:height;
-	int y2min=height-r;
-	if(y2min<y1max) y2min=y1max;
-	s = tmp;
-	t = buffer;
-#if 0
-	for (y = 0; y<height; ++y, s+= width, t+= width) {
-	    unsigned sum = 65536/2;
-	    int y1 = (y<r) ? r-y:0;
-	    int y2 = (y+r>=height) ? (r+height-y):mwidth;
-	    register unsigned *mp = m + 256*y1;
-	    register unsigned char *smy = s + y1*width;
-	    int my;
-	    for (my = y1; my<y2; ++my, smy+= width, mp+=256)
-		sum+= mp[*smy];
-	    *t = sum>>16;
-	}
-#else
-	// pass 1:  0..r
-	for (y = 0; y<y1max; ++y, s+= width, t+= width) {
-	    unsigned sum = 65536/2;
-	    int y1 = r-y;
-	    int my = y1;
-	    int y2 = (y+r>=height) ? (r+height-y):mwidth;
-	    unsigned char *smy = s + y1*width;
-	    unsigned* mp = m + 256*y1;
-	    for (; my<y2; ++my, smy+= width, mp+=256) sum+=mp[*smy];
-	    *t = sum>>16;
-	}
-	// pass 2:  r..(height-r)
-	for (; y<y2min; ++y, s+= width, t+= width) {
-	    unsigned sum = 65536/2;
-	    unsigned char *smy = s;
-	    unsigned* mp = m;
-//	    int my=0;
-//	    for (; my<mwidth; ++my, smy+=width, mp+=256) sum+=mp[*smy];
-	    for (; mp<m_end; smy+=width, mp+=256) sum+=mp[*smy];
-	    *t = sum>>16;
-	}
-	// pass 3:  (height-r)..height
-	for (; y<height; ++y, s+= width, t+= width) {
-	    unsigned sum = 65536/2;
-	    int y2 = r+height-y;
-	    unsigned char *smy = s;
-	    unsigned* mp = m;
-	    int my=0;
-	    for (; my<y2; ++my, smy+= width, mp+=256) sum+=mp[*smy];
-	    *t = sum>>16;
-	}
-#endif
-    }
-#endif
-}
-
-
-// Gaussian matrix
-// Maybe for future use.
-unsigned gmatrix(unsigned *m, int r, int w, double const A) {
-    unsigned volume = 0;		// volume under Gaussian area is exactly -pi*base/A
-    int mx, my;
-
-    for (my = 0; my<w; ++my) {
-	for (mx = 0; mx<w; ++mx) {
-	    m[mx+my*w] = (unsigned)(exp(A * ((mx-r)*(mx-r)+(my-r)*(my-r))) * base + .5);
-	    volume+= m[mx+my*w];
-	    if (DEBUG) eprintf("%3i ", m[mx+my*w]);
-	}
-	if (DEBUG) eprintf("\n");
-    }
-    if (DEBUG) {
-	eprintf("A= %f\n", A);
-	eprintf("volume: %i; exact: %.0f; volume/exact: %.6f\n\n", volume, -M_PI*base/A, volume/(-M_PI*base/A));
-    }
-    return volume;
-}
-
-
-void alpha() {
-    unsigned int ttime;
-    int const g_r = ceil(radius);
-    int const o_r = ceil(thickness);
-    int const g_w = 2*g_r+1;		// matrix size
-    int const o_w = 2*o_r+1;		// matrix size
-    int const o_size = o_w * o_w;
-    double const A = log(1.0/base)/(radius*radius*2);
-    double volume_factor=0.0;
-    double volume_diff;
-
-    int mx, my, i;
-    unsigned volume = 0;		// volume under Gaussian area is exactly -pi*base/A
-
-    unsigned *g = (unsigned*)malloc(g_w * sizeof(unsigned));
-    unsigned *gt = (unsigned*)malloc(256 * g_w * sizeof(unsigned));
-    unsigned *gt2 = (unsigned*)malloc(256 * g_w * sizeof(unsigned));
-    unsigned *om = (unsigned*)malloc(o_w*o_w * sizeof(unsigned));
-    unsigned char *omt = malloc(o_size*256);
-    unsigned char *omtp = omt;
-    unsigned short *tmp = malloc((width+1)*height*sizeof(short));
-
-    if (g==NULL || gt==NULL || gt2==NULL || om==NULL || omt==NULL) ERROR("malloc failed.");
-
-    // gaussian curve with volume = 256
-    for (volume_diff=10000000; volume_diff>0.0000001; volume_diff*=0.5){
-	volume_factor+= volume_diff;
-	volume=0;
-	for (i = 0; i<g_w; ++i) {
-	    g[i] = (unsigned)(exp(A * (i-g_r)*(i-g_r)) * volume_factor + .5);
-	    volume+= g[i];
-	}
-	if(volume>256) volume_factor-= volume_diff;
-    }
-    volume=0;
-    for (i = 0; i<g_w; ++i) {
-	g[i] = (unsigned)(exp(A * (i-g_r)*(i-g_r)) * volume_factor + .5);
-	volume+= g[i];
-	if (DEBUG) eprintf("%3i ", g[i]);
-    }
-    
-    //volume *= volume;
-    if (DEBUG) eprintf("\n");
-
-    // gauss table:
-    for(mx=0;mx<g_w;mx++){
-	for(i=0;i<256;i++){
-	    gt[256*mx+i] = (i*g[mx]*65536+(volume/2))/volume;
-	    gt2[mx+i*g_w] = i*g[mx];
-	}
-    }
-
-    /* outline matrix */
-    for (my = 0; my<o_w; ++my) {
-	for (mx = 0; mx<o_w; ++mx) {
-	    // antialiased circle would be perfect here, but this one is good enough
-	    double d = thickness + 1 - sqrt((mx-o_r)*(mx-o_r)+(my-o_r)*(my-o_r));
-	    om[mx+my*o_w] = d>=1 ? base : d<=0 ? 0 : (d*base + .5);
-	    if (DEBUG) eprintf("%3i ", om[mx+my*o_w]);
-	}
-	if (DEBUG) eprintf("\n");
-    }
-    if (DEBUG) eprintf("\n");
-
-    // outline table:
-    for(i=0;i<256;i++){
-	for(mx=0;mx<o_size;mx++) *(omtp++) = (i*om[mx] + (base/2))/base;
-    }
-
-    ttime=GetTimer();
-    if(thickness==1.0)
-      outline1(bbuffer, abuffer, width, height);	// FAST solid 1 pixel outline
-    else
-      outline(bbuffer, abuffer, width, height, omt, o_r, o_w, o_size);	// solid outline
-    //outline(bbuffer, abuffer, width, height, gm, g_r, g_w);	// Gaussian outline
-    ttime=GetTimer()-ttime;
-    printf("outline: %7d us\n",ttime);
-
-    ttime=GetTimer();
-//    blur(abuffer, bbuffer, width, height, g, g_r, g_w, volume);
-    blur(abuffer, tmp, width, height, gt, gt2, g_r, g_w, volume);
-    ttime=GetTimer()-ttime;
-    printf("gauss:   %7d us\n",ttime);
-
-    free(g);
-    free(om);
-}
-
-
-void usage() {
-    printf("Usage: %s [--outdir dir] [--append] [--unicode] [--blur b] [--outline o] encoding ppem font\n", command);
-    printf("\n"
-	    "  Program creates 3 files: font.desc, <encoding>-a.raw, <encoding>-b.raw.\n"
-	    "\n"
-	    "  --outdir         output directory to place files.\n"
-	    "  --append         append results to existing font.desc, suppress info header.\n"
-	    "  --unicode        use Unicode in font.desc. This will work with -utf8 option of mplayer.\n"
-	    "  --blur b         specify blur radius, float.\n"
-	    "  --outline o      specify outline thickness, float.\n"
-	    "  encoding         must be an 8 bit encoding, like iso-8859-2, or path to custom encoding file (see README).\n"
-	    "                   To list encodings available on your system use iconv --list.\n"
-	    "  ppem             Font size in pixels (default 24), float.\n"
-	    "  font             Font file path. Any format supported by the freetype library (*.ttf, *.pfb, ...).\n"
-	    );
-    exit(1);
-}
-
-
-void parse_args(int argc, char **argv) {
-    int i, a = 0;
-    double d;
-
-    command = strrchr(argv[a], '/');
-    if (command==NULL) command = argv[a];
-    else ++command;
-    ++a; --argc;
-
-    if (argc>=1 && strcmp(argv[a], "--outdir")==0) {
-	++a; --argc;
-	if (argc==0) usage();
-
-	outdir = strdup(argv[a]);
-	++a; --argc;
-    }
-
-    if (argc>=1 && strcmp(argv[a], "--append")==0) {
-	append_mode = 1;
-	++a; --argc;
-    }
-
-    if (argc>=1 && strcmp(argv[a], "--unicode")==0) {
-	unicode_desc = 1;
-	++a; --argc;
-    }
-
-    if (argc>=1 && strcmp(argv[a], "--blur")==0) {
-	++a; --argc;
-	if (argc==0) usage();
-
-	d = atof(argv[a]);
-	if (d>=0 && d<20) radius = d;
-	else WARNING("using default blur radius.");
-	++a; --argc;
-    }
-
-    if (argc>=1 && strcmp(argv[a], "--outline")==0) {
-	++a; --argc;
-	if (argc==0) usage();
-
-	d = atof(argv[a]);
-	if (d>=0 && d<20) thickness = d;
-	else WARNING("using default outline thickness.");
-	++a; --argc;
-    }
-
-    if (argc<3) usage();
-
-    // encoding
-    if (argv[a][0]!=0)
-	encoding = argv[a];
-    encoding_name = strrchr(encoding, '/');
-    if (!encoding_name) encoding_name=encoding;
-    else ++encoding_name;
-    ++a; --argc;
-
-    // ppem
-    d = atof(argv[a]);
-    if (d>2.) ppem = d;
-    ++a; --argc;
-
-    // font
-    font_path = argv[a];
-    ++a; --argc;
-}
-
-
-int main(int argc, char **argv) {
-    unsigned int ttime;
-    parse_args(argc, argv);
-
-    padding = ceil(radius) + ceil(thickness);
-
-    ttime=GetTimer();
-    prepare_charset();
-    ttime=GetTimer()-ttime;
-    printf("charset: %7d us\n",ttime);
-
-    ttime=GetTimer();
-    render();
-    ttime=GetTimer()-ttime;
-    printf("render:  %7d us\n",ttime);
-
-    write_bitmap(bbuffer, 'b');
-
-    abuffer = (unsigned char*)malloc(width*height);
-    if (abuffer==NULL) ERROR("malloc failed.");
-    memset(abuffer, 0, width*height);
-    alpha();
-    write_bitmap(abuffer, 'a');
-
-    free(bbuffer);
-    free(abuffer);
-
-//    fflush(stderr);
-    return 0;
-}