diff options
author | diego <diego@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2007-03-31 14:14:28 +0000 |
---|---|---|
committer | diego <diego@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2007-03-31 14:14:28 +0000 |
commit | 1b0616162950f6442b89e20c3f592bd7fe4a383f (patch) | |
tree | e4da9fa629e30fe88572bb26f272d02bdff0ca9f /TOOLS | |
parent | c5bdfbc886a67a121ff7f1f6b27f33d07b0703cd (diff) | |
download | mpv-1b0616162950f6442b89e20c3f592bd7fe4a383f.tar.bz2 mpv-1b0616162950f6442b89e20c3f592bd7fe4a383f.tar.xz |
Remove obsolete bitmap font tools.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@22857 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'TOOLS')
-rw-r--r-- | TOOLS/Makefile | 4 | ||||
-rw-r--r-- | TOOLS/README | 9 | ||||
-rw-r--r-- | TOOLS/mpfc/Makefile | 15 | ||||
-rw-r--r-- | TOOLS/mpfc/mpfc-ce.c | 284 | ||||
-rw-r--r-- | TOOLS/mpfc/mpfc-kr.c | 255 | ||||
-rw-r--r-- | TOOLS/png2raw.c | 183 | ||||
-rw-r--r-- | TOOLS/subfont-c/Makefile | 25 | ||||
-rw-r--r-- | TOOLS/subfont-c/README | 112 | ||||
-rwxr-xr-x | TOOLS/subfont-c/encodings/charmap2enc | 11 | ||||
-rw-r--r-- | TOOLS/subfont-c/encodings/osd-mplayer | 15 | ||||
-rwxr-xr-x | TOOLS/subfont-c/encodings/runme-kr | 1 | ||||
-rw-r--r-- | TOOLS/subfont-c/font.desc.tail | 170 | ||||
-rwxr-xr-x | TOOLS/subfont-c/fontgen | 53 | ||||
-rw-r--r-- | TOOLS/subfont-c/osd/README | 3 | ||||
-rwxr-xr-x | TOOLS/subfont-c/osd/gen.py | 440 | ||||
-rw-r--r-- | TOOLS/subfont-c/osd/gen_osd_h.c | 15 | ||||
-rw-r--r-- | TOOLS/subfont-c/osd/osd.pfb | bin | 8322 -> 0 bytes | |||
-rwxr-xr-x | TOOLS/subfont-c/osd/runme | 4 | ||||
-rwxr-xr-x | TOOLS/subfont-c/runme | 29 | ||||
-rw-r--r-- | TOOLS/subfont-c/subfont.c | 1040 |
20 files changed, 0 insertions, 2668 deletions
diff --git a/TOOLS/Makefile b/TOOLS/Makefile index 50d2db6c5a..3a06fd906b 100644 --- a/TOOLS/Makefile +++ b/TOOLS/Makefile @@ -8,7 +8,6 @@ OBJS = alaw-gen$(EXESUF) \ avisubdump$(EXESUF) \ dump_mp4$(EXESUF) \ movinfo$(EXESUF) \ - png2raw$(EXESUF) \ subrip$(EXESUF) \ # vivodump$(EXESUF) \ @@ -18,9 +17,6 @@ endif 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 \ diff --git a/TOOLS/README b/TOOLS/README index 5824495165..599944f52e 100644 --- a/TOOLS/README +++ b/TOOLS/README @@ -391,15 +391,6 @@ Description: Show QuickTime MOV file structure. 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 diff --git a/TOOLS/mpfc/Makefile b/TOOLS/mpfc/Makefile deleted file mode 100644 index 51cd597603..0000000000 --- a/TOOLS/mpfc/Makefile +++ /dev/null @@ -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) diff --git a/TOOLS/mpfc/mpfc-ce.c b/TOOLS/mpfc/mpfc-ce.c deleted file mode 100644 index 6cd4748435..0000000000 --- a/TOOLS/mpfc/mpfc-ce.c +++ /dev/null @@ -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; -} - diff --git a/TOOLS/mpfc/mpfc-kr.c b/TOOLS/mpfc/mpfc-kr.c deleted file mode 100644 index 668c935370..0000000000 --- a/TOOLS/mpfc/mpfc-kr.c +++ /dev/null @@ -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; -} - diff --git a/TOOLS/png2raw.c b/TOOLS/png2raw.c deleted file mode 100644 index 935811775c..0000000000 --- a/TOOLS/png2raw.c +++ /dev/null @@ -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); - -} - - - -} - - - diff --git a/TOOLS/subfont-c/Makefile b/TOOLS/subfont-c/Makefile deleted file mode 100644 index dbdef85449..0000000000 --- a/TOOLS/subfont-c/Makefile +++ /dev/null @@ -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 diff --git a/TOOLS/subfont-c/README b/TOOLS/subfont-c/README deleted file mode 100644 index b1e65e0464..0000000000 --- a/TOOLS/subfont-c/README +++ /dev/null @@ -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> diff --git a/TOOLS/subfont-c/encodings/charmap2enc b/TOOLS/subfont-c/encodings/charmap2enc deleted file mode 100755 index e32d7a463b..0000000000 --- a/TOOLS/subfont-c/encodings/charmap2enc +++ /dev/null @@ -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) -} diff --git a/TOOLS/subfont-c/encodings/osd-mplayer b/TOOLS/subfont-c/encodings/osd-mplayer deleted file mode 100644 index 26ab043016..0000000000 --- a/TOOLS/subfont-c/encodings/osd-mplayer +++ /dev/null @@ -1,15 +0,0 @@ -E001 01 -E002 02 -E003 03 -E004 04 -E005 05 |