summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile4
-rw-r--r--README4
-rw-r--r--cfg-mplayer.h20
-rwxr-xr-xconfigure102
-rw-r--r--sub/ass_mp.c26
-rw-r--r--sub/font_load.c351
-rw-r--r--sub/font_load.h108
-rw-r--r--sub/font_load_ft.c1169
-rw-r--r--sub/osd_dummy.c43
-rw-r--r--sub/osd_ft.c969
-rw-r--r--sub/osd_libass.c1
-rw-r--r--sub/sub.h1
-rw-r--r--sub/subreader.c83
-rw-r--r--sub/subreader.h4
14 files changed, 58 insertions, 2827 deletions
diff --git a/Makefile b/Makefile
index 2417e1caf0..0858181217 100644
--- a/Makefile
+++ b/Makefile
@@ -26,7 +26,6 @@ include config.mak
SRCS_AUDIO_INPUT-$(ALSA) += stream/ai_alsa1x.c
SRCS_AUDIO_INPUT-$(OSS) += stream/ai_oss.c
SRCS_COMMON-$(AUDIO_INPUT) += $(SRCS_AUDIO_INPUT-yes)
-SRCS_COMMON-$(BITMAP_FONT) += sub/font_load.c
SRCS_COMMON-$(CDDA) += stream/stream_cdda.c \
stream/cdinfo.c
SRCS_COMMON-$(CDDB) += stream/stream_cddb.c
@@ -63,7 +62,6 @@ SRCS_COMMON-$(FASTMEMCPY) += libvo/aclib.c
SRCS_COMMON-$(FFMPEG_INTERNALS) += libmpcodecs/vf_mcdeint.c \
libmpcodecs/vf_spp.c \
-SRCS_COMMON-$(FREETYPE) += sub/font_load_ft.c
SRCS_COMMON-$(FTP) += stream/stream_ftp.c
SRCS_COMMON-$(GIF) += libmpdemux/demux_gif.c
SRCS_COMMON-$(HAVE_POSIX_SELECT) += libmpcodecs/vf_bmovl.c
@@ -214,7 +212,7 @@ SRCS_COMMON-$(XANIM_CODECS) += libmpcodecs/vd_xanim.c
SRCS_COMMON-$(XMMS_PLUGINS) += libmpdemux/demux_xmms.c
SRCS_COMMON-$(XVID4) += libmpcodecs/vd_xvid4.c
-SRCS_COMMON-$(OLD_OSD) += sub/osd_ft.c
+SRCS_COMMON-$(DUMMY_OSD) += sub/osd_dummy.c
SRCS_COMMON-$(LIBASS_OSD) += sub/osd_libass.c
SRCS_COMMON = asxparser.c \
diff --git a/README b/README
index c12bf527ae..8085525950 100644
--- a/README
+++ b/README
@@ -15,8 +15,8 @@ Libraries specific to particular video output methods
general:
- libasound (ALSA audio output)
- various general X development libraries
- - libfreetype
- - libfontconfig
+ - libfreetype (for libass)
+ - libfontconfig (for libass)
- libass
- FFmpeg libraries (libavutil libavcodec libavformat libswscale libpostproc)
diff --git a/cfg-mplayer.h b/cfg-mplayer.h
index ae27169c5f..b014e64893 100644
--- a/cfg-mplayer.h
+++ b/cfg-mplayer.h
@@ -636,19 +636,6 @@ const m_option_t common_opts[] = {
OPT_STRINGLIST("sub", sub_name, 0),
OPT_PATHLIST("sub-paths", sub_paths, 0),
-#ifdef CONFIG_FRIBIDI
- {"fribidi-charset", &fribidi_charset, CONF_TYPE_STRING, 0, 0, 0, NULL},
- {"flip-hebrew", &flip_hebrew, CONF_TYPE_FLAG, 0, 0, 1, NULL},
- {"noflip-hebrew", &flip_hebrew, CONF_TYPE_FLAG, 0, 1, 0, NULL},
- {"flip-hebrew-commas", &fribidi_flip_commas, CONF_TYPE_FLAG, 0, 1, 0, NULL},
- {"noflip-hebrew-commas", &fribidi_flip_commas, CONF_TYPE_FLAG, 0, 0, 1, NULL},
-#else
- {"fribidi-charset", "MPlayer was compiled without FriBiDi support.\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
- {"flip-hebrew", "MPlayer was compiled without FriBiDi support.\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
- {"noflip-hebrew", "MPlayer was compiled without FriBiDi support.\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
- {"flip-hebrew-commas", "MPlayer was compiled without FriBiDi support.\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
- {"noflip-hebrew-commas", "MPlayer was compiled without FriBiDi support.\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
-#endif /* CONFIG_FRIBIDI */
#ifdef CONFIG_ICONV
{"subcp", &sub_cp, CONF_TYPE_STRING, 0, 0, 0, NULL},
#endif
@@ -701,13 +688,6 @@ const m_option_t common_opts[] = {
OPT_STRING("ass-styles", ass_styles_file, 0),
OPT_INTRANGE("ass-hinting", ass_hinting, 0, 0, 7),
OPT_START_CONDITIONAL(1, ""),
-#ifdef CONFIG_FONTCONFIG
- {"fontconfig", &font_fontconfig, CONF_TYPE_FLAG, 0, -1, 1, NULL},
- {"nofontconfig", &font_fontconfig, CONF_TYPE_FLAG, 0, 1, -1, NULL},
-#else
- {"fontconfig", "MPlayer was compiled without fontconfig support.\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
- {"nofontconfig", "MPlayer was compiled without fontconfig support.\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
-#endif /* CONFIG_FONTCONFIG */
{NULL, NULL, 0, 0, 0, 0, NULL}
};
diff --git a/configure b/configure
index eade144dba..85a6d48a4c 100755
--- a/configure
+++ b/configure
@@ -344,12 +344,8 @@ Optional features:
--disable-dvdread-internal disable internal libdvdread [autodetect]
--disable-libdvdcss-internal disable internal libdvdcss [autodetect]
--disable-cddb disable cddb [autodetect]
- --disable-bitmap-font disable bitmap font support [enable]
- --disable-freetype disable FreeType 2 font rendering [autodetect]
- --disable-fontconfig disable fontconfig font lookup [autodetect]
--disable-unrarexec disable using of UnRAR executable [enabled]
--disable-sortsub disable subtitle sorting [enabled]
- --enable-fribidi enable the FriBiDi libs [autodetect]
--disable-enca disable ENCA charset oracle library [autodetect]
--enable-macosx-finder enable Mac OS X Finder invocation parameter
parsing [disabled]
@@ -636,9 +632,6 @@ _libdv=auto
_cdda=auto
_cddb=auto
_big_endian=auto
-_bitmap_font=yes
-_freetype=auto
-_fontconfig=auto
_qtx=auto
_coreaudio=auto
_corevideo=auto
@@ -648,7 +641,6 @@ quicktime=auto
_macosx_finder=no
_macosx_bundle=auto
_sortsub=yes
-_fribidi=auto
_enca=auto
_inet6=auto
_gethostbyname2=auto
@@ -975,12 +967,6 @@ for ac_option do
--disable-cddb) _cddb=no ;;
--enable-big-endian) _big_endian=yes ;;
--disable-big-endian) _big_endian=no ;;
- --enable-bitmap-font) _bitmap_font=yes ;;
- --disable-bitmap-font) _bitmap_font=no ;;
- --enable-freetype) _freetype=yes ;;
- --disable-freetype) _freetype=no ;;
- --enable-fontconfig) _fontconfig=yes ;;
- --disable-fontconfig) _fontconfig=no ;;
--enable-unrarexec) _unrar_exec=yes ;;
--disable-unrarexec) _unrar_exec=no ;;
--enable-ftp) _ftp=yes ;;
@@ -1000,9 +986,6 @@ for ac_option do
--enable-libpostproc) libpostproc=yes ;;
--disable-libpostproc) libpostproc=no ;;
- --enable-fribidi) _fribidi=yes ;;
- --disable-fribidi) _fribidi=no ;;
-
--enable-enca) _enca=yes ;;
--disable-enca) _enca=no ;;
@@ -4562,89 +4545,17 @@ echores "$_ass"
echocheck "libass OSD support"
-_old_osd=yes
+_dummy_osd=yes
if test "$_libass_osd" = auto ; then
_libass_osd=no
if test "$_ass" = yes ; then
_libass_osd=yes
- _old_osd=no
- _bitmap_font=no
- # disable unneeded dependencies
- _freetype=no
- _fontconfig=no
- # this should always be forced, because libass does bidi itself
- _fribidi=no
+ _dummy_osd=no
fi
fi
echores "$_libass_osd"
-echocheck "bitmap font support"
-if test "$_bitmap_font" = yes ; then
- def_bitmap_font="#define CONFIG_BITMAP_FONT 1"
-else
- def_bitmap_font="#undef CONFIG_BITMAP_FONT"
-fi
-echores "$_bitmap_font"
-
-
-echocheck "freetype >= 2.0.9"
-
-# freetype depends on iconv
-if test "$_iconv" = no ; then
- _freetype=no
- res_comment="iconv support needed"
-fi
-
-if test "$_freetype" = auto ; then
- if pkg_config_add freetype2 ; then
- _freetype=yes
- else
- die "Unable to find development files for libfreetype. Aborting. If you really mean to compile without FreeType support use --disable-freetype."
- fi
-fi
-if test "$_freetype" = yes ; then
- def_freetype='#define CONFIG_FREETYPE 1'
-else
- def_freetype='#undef CONFIG_FREETYPE'
-fi
-echores "$_freetype"
-
-if test "$_freetype" = no ; then
- _fontconfig=no
- res_comment="FreeType support needed"
-fi
-echocheck "fontconfig"
-if test "$_fontconfig" = auto ; then
- if pkg_config_add 'fontconfig >= 2.4.2' ; then
- _fontconfig=yes
- else
- die "Unable to find development files for libfontconfig. Aborting. If you really mean to compile without fontconfig support use --disable-fontconfig."
- fi
-fi
-if test "$_fontconfig" = yes ; then
- def_fontconfig='#define CONFIG_FONTCONFIG 1'
-else
- def_fontconfig='#undef CONFIG_FONTCONFIG'
-fi
-echores "$_fontconfig"
-
-
-echocheck "fribidi with charsets"
-if test "$_fribidi" = auto ; then
- _fribidi=no
- if pkg_config_add fribidi ; then
- _fribidi=yes
- fi
-fi
-if test "$_fribidi" = yes ; then
- def_fribidi='#define CONFIG_FRIBIDI 1'
-else
- def_fribidi='#undef CONFIG_FRIBIDI'
-fi
-echores "$_fribidi"
-
-
echocheck "ENCA"
if test "$_enca" = auto ; then
_enca=no
@@ -5713,7 +5624,6 @@ ALSA = $_alsa
APPLE_IR = $_apple_ir
APPLE_REMOTE = $_apple_remote
AUDIO_INPUT = $_audio_input
-BITMAP_FONT = $_bitmap_font
CACA = $_caca
CDDA = $_cdda
CDDB = $_cddb
@@ -5732,7 +5642,6 @@ DVDREAD_INTERNAL = $_dvdread_internal
DXR3 = $_dxr3
FAAD = $_faad
FASTMEMCPY = $_fastmemcpy
-FREETYPE = $_freetype
FTP = $_ftp
GIF = $_gif
GL = $_gl
@@ -5748,7 +5657,7 @@ LADSPA = $_ladspa
LIBA52 = $_liba52
LIBASS = $_ass
LIBASS_OSD = $_libass_osd
-OLD_OSD = $_old_osd
+DUMMY_OSD = $_dummy_osd
LIBBLURAY = $_bluray
LIBBS2B = $_libbs2b
LIBDCA = $_libdca
@@ -6072,12 +5981,7 @@ $def_tv_v4l2
/* font stuff */
$def_ass
-$def_bitmap_font
$def_enca
-$def_fontconfig
-$def_freetype
-$def_fribidi
-
/* networking */
$def_closesocket
diff --git a/sub/ass_mp.c b/sub/ass_mp.c
index 3dd743776d..1510e43ab5 100644
--- a/sub/ass_mp.c
+++ b/sub/ass_mp.c
@@ -60,10 +60,8 @@ ASS_Track *mp_ass_default_track(ASS_Library *library, struct MPOpts *opts)
track->default_style = sid;
ASS_Style *style = track->styles + sid;
style->Name = strdup("Default");
- style->FontName = (font_fontconfig >= 0
- && sub_font_name) ? strdup(sub_font_name)
- : (font_fontconfig >= 0
- && font_name) ? strdup(font_name) : strdup("Sans");
+ style->FontName = sub_font_name ? strdup(sub_font_name)
+ : font_name ? strdup(font_name) : strdup("Sans");
style->treat_fontname_as_pattern = 1;
double fs = track->PlayResY * text_font_scale_factor / 100.;
@@ -250,25 +248,19 @@ void mp_ass_configure_fonts(ASS_Renderer *priv)
{
char *dir, *path, *family;
dir = get_path("fonts");
- if (font_fontconfig < 0 && sub_font_name)
- path = strdup(sub_font_name);
- else if (font_fontconfig < 0 && font_name)
- path = strdup(font_name);
- else {
- path = get_path("subfont.ttf");
- if (!mp_path_exists(path)) {
- free(path);
- path = NULL;
- }
+ path = get_path("subfont.ttf");
+ if (!mp_path_exists(path)) {
+ free(path);
+ path = NULL;
}
- if (font_fontconfig >= 0 && sub_font_name)
+ if (sub_font_name)
family = strdup(sub_font_name);
- else if (font_fontconfig >= 0 && font_name)
+ else if (font_name)
family = strdup(font_name);
else
family = 0;
- ass_set_fonts(priv, path, family, font_fontconfig + 1, NULL, 1);
+ ass_set_fonts(priv, path, family, 1, NULL, 1);
free(dir);
free(path);
diff --git a/sub/font_load.c b/sub/font_load.c
deleted file mode 100644
index d8f9eafe34..0000000000
--- a/sub/font_load.c
+++ /dev/null
@@ -1,351 +0,0 @@
-/*
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include "config.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "osdep/io.h"
-
-#include "font_load.h"
-#include "mp_msg.h"
-#include "libavutil/attributes.h"
-
-raw_file* load_raw(char *name,int verbose){
- int bpp;
- raw_file* raw=malloc(sizeof(raw_file));
- unsigned char head[32];
- FILE *f=fopen(name,"rb");
- if(!f) goto err_out; // can't open
- if(fread(head,32,1,f)<1) goto err_out; // too small
- if(memcmp(head,"mhwanh",6)) goto err_out; // not raw file
- raw->w=head[8]*256+head[9];
- raw->h=head[10]*256+head[11];
- raw->c=head[12]*256+head[13];
- if(raw->w == 0) // 2 bytes were not enough for the width... read 4 bytes from the end of the header
- raw->w = ((head[28]*0x100 + head[29])*0x100 + head[30])*0x100 + head[31];
- if(raw->c>256) goto err_out; // too many colors!?
- mp_msg(MSGT_OSD, MSGL_DBG2, "RAW: %s %d x %d, %d colors\n",name,raw->w,raw->h,raw->c);
- if(raw->c){
- raw->pal=malloc(raw->c*3);
- fread(raw->pal,3,raw->c,f);
- bpp=1;
- } else {
- raw->pal=NULL;
- bpp=3;
- }
- raw->bmp=malloc(raw->h*raw->w*bpp);
- fread(raw->bmp,raw->h*raw->w*bpp,1,f);
- fclose(f);
- return raw;
-
-err_out:
- if (f)
- fclose(f);
- free(raw);
- return NULL;
-}
-
-extern int sub_unicode;
-
-font_desc_t* read_font_desc(const char* fname,float factor,int verbose){
-unsigned char sor[1024];
-unsigned char sor2[1024];
-font_desc_t *desc;
-FILE *f = NULL;
-char *dn;
-char section[64];
-int i,j;
-int chardb=0;
-int fontdb=-1;
-int version av_unused;
-int first=1;
-
-desc=malloc(sizeof(font_desc_t));if(!desc) goto fail_out;
-memset(desc,0,sizeof(font_desc_t));
-
-f=fopen(fname,"rt");if(!f){ mp_msg(MSGT_OSD, MSGL_V, "font: can't open file: %s\n",fname); goto fail_out;}
-
-i = strlen (fname) - 9;
-if ((dn = malloc(i+1))){
- strncpy (dn, fname, i);
- dn[i]='\0';
-}
-
-desc->fpath = dn; // search in the same dir as fonts.desc
-
-
-
-// set up some defaults, and erase table
-desc->charspace=2;
-desc->spacewidth=12;
-desc->height=0;
-for(i=0;i<65536;i++) desc->start[i]=desc->width[i]=desc->font[i]=-1;
-
-section[0]=0;
-
-while(fgets(sor,1020,f)){
- unsigned char* p[8];
- int pdb=0;
- unsigned char *s=sor;
- unsigned char *d=sor2;
- int ec=' ';
- int id=0;
- sor[1020]=0;
-
- /* skip files that look like: TTF (0x00, 0x01), PFM (0x00, 0x01), PFB
- * (0x80, 0x01), PCF (0x01, 0x66), fon ("MZ"), gzipped (0x1f, 0x8b) */
-
- if (first) {
- if (!sor[0] || sor[1] == 1 || (sor[0] == 'M' && sor[1] == 'Z') || (sor[0] == 0x1f && sor[1] == 0x8b) || (sor[0] == 1 && sor[1] == 0x66)) {
- mp_msg(MSGT_OSD, MSGL_ERR, "%s doesn't look like a bitmap font description, ignoring.\n", fname);
- goto fail_out;
- }
- first = 0;
- }
-
- p[0]=d;++pdb;
- while(1){
- int c=*s++;
- if(c==0 || c==13 || c==10) break;
- if(!id){
- if(c==39 || c==34){ id=c;continue;} // idezojel
- if(c==';' || c=='#') break;
- if(c==9) c=' ';
- if(c==' '){
- if(ec==' ') continue;
- *d=0; ++d;
- p[pdb]=d;++pdb;
- if(pdb>=8) break;
- continue;
- }
- } else {
- if(id==c){ id=0;continue;} // idezojel
-
- }
- *d=c;d++;
- ec=c;
- }
- if(d==sor2) continue; // skip empty lines
- *d=0;
-
-// printf("params=%d sor=%s\n",pdb,sor);
-// for(i=0;i<pdb;i++) printf(" param %d = '%s'\n",i,p[i]);
-
- if(pdb==1 && p[0][0]=='['){
- int len=strlen(p[0]);
- if(len && len<63 && p[0][len-1]==']'){
- strcpy(section,p[0]);
- mp_msg(MSGT_OSD, MSGL_DBG2, "font: Reading section: %s\n",section);
- if(strcmp(section,"[files]")==0){
- ++fontdb;
- if(fontdb>=16){ mp_msg(MSGT_OSD, MSGL_ERR, "font: Too many bitmaps defined.\n");goto fail_out;}
- }
- continue;
- }
- }
-
- if(strcmp(section,"[fpath]")==0){
- if(pdb==1){
- free (desc->fpath); // release previously allocated memory
- desc->fpath=strdup(p[0]);
- continue;
- }
- } else
-
-#ifdef __AMIGAOS4__
-#define FONT_PATH_SEP ""
-#else
-//! path seperator for font paths, may not be more than one character
-#define FONT_PATH_SEP "/"
-#endif
-
- if(strcmp(section,"[files]")==0){
- char *default_dir=MPLAYER_DATADIR FONT_PATH_SEP "font";
- if(pdb==2 && strcmp(p[0],"alpha")==0){
- char *cp;
- if (!(cp=malloc(strlen(desc->fpath)+strlen(p[1])+2))) goto fail_out;
-
- snprintf(cp,strlen(desc->fpath)+strlen(p[1])+2,"%s" FONT_PATH_SEP "%s",
- desc->fpath,p[1]);
- if(!((desc->pic_a[fontdb]=load_raw(cp,verbose)))){
- free(cp);
- if (!(cp=malloc(strlen(default_dir)+strlen(p[1])+2)))
- goto fail_out;
- snprintf(cp,strlen(default_dir)+strlen(p[1])+2,"%s" FONT_PATH_SEP "%s",
- default_dir,p[1]);
- if (!((desc->pic_a[fontdb]=load_raw(cp,verbose)))){
- mp_msg(MSGT_OSD, MSGL_ERR, "Can't load font bitmap: %s\n",p[1]);
- free(cp);
- goto fail_out;
- }
- }
- free(cp);
- continue;
- }
- if(pdb==2 && strcmp(p[0],"bitmap")==0){
- char *cp;
- if (!(cp=malloc(strlen(desc->fpath)+strlen(p[1])+2))) goto fail_out;
-
- snprintf(cp,strlen(desc->fpath)+strlen(p[1])+2,"%s" FONT_PATH_SEP "%s",
- desc->fpath,p[1]);
- if(!((desc->pic_b[fontdb]=load_raw(cp,verbose)))){
- free(cp);
- if (!(cp=malloc(strlen(default_dir)+strlen(p[1])+2)))
- goto fail_out;
- snprintf(cp,strlen(default_dir)+strlen(p[1])+2,"%s" FONT_PATH_SEP "%s",
- default_dir,p[1]);
- if (!((desc->pic_b[fontdb]=load_raw(cp,verbose)))){
- mp_msg(MSGT_OSD, MSGL_ERR, "Can't load font bitmap: %s\n",p[1]);
- free(cp);
- goto fail_out;
- }
- }
- free(cp);
- continue;
- }
- } else
-
- if(strcmp(section,"[info]")==0){
- if(pdb==2 && strcmp(p[0],"name")==0){
- desc->name=strdup(p[1]);
- continue;
- }
- if(pdb==2 && strcmp(p[0],"descversion")==0){
- version=atoi(p[1]);
- continue;
- }
- if(pdb==2 && strcmp(p[0],"spacewidth")==0){
- desc->spacewidth=atoi(p[1]);
- continue;
- }
- if(pdb==2 && strcmp(p[0],"charspace")==0){
- desc->charspace=atoi(p[1]);
- continue;
- }
- if(pdb==2 && strcmp(p[0],"height")==0){
- desc->height=atoi(p[1]);
- continue;
- }
- } else
-
- if(strcmp(section,"[characters]")==0){
- if(pdb==3){
- int chr=p[0][0];
- int start=atoi(p[1]);
- int end=atoi(p[2]);
- if(sub_unicode && (chr>=0x80)) chr=(chr<<8)+p[0][1];
- else if(strlen(p[0])!=1) chr=strtol(p[0],NULL,0);
- if(end<start) {
- mp_msg(MSGT_OSD, MSGL_WARN, "error in font desc: end<start for char '%c'\n",chr);
- } else {
- desc->start[chr]=start;
- desc->width[chr]=end-start+1;
- desc->font[chr]=fontdb;
-// printf("char %d '%c' start=%d width=%d\n",chr,chr,desc->start[chr],desc->width[chr]);
- ++chardb;
- }
- continue;
- }
- }
- mp_msg(MSGT_OSD, MSGL_ERR, "Syntax error in font desc: %s",sor);
- goto fail_out;
-
-}
-fclose(f);
-f = NULL;
-
- if (first == 1) {
- mp_msg(MSGT_OSD, MSGL_ERR, "%s is empty or a directory, ignoring.\n", fname);
- goto fail_out;
- }
-
-//printf("font: pos of U = %d\n",desc->start[218]);
-
-for(i=0;i<=fontdb;i++){
- if(!desc->pic_a[i] || !desc->pic_b[i]){
- mp_msg(MSGT_OSD, MSGL_ERR, "font: Missing bitmap(s) for sub-font #%d\n",i);
- goto fail_out;
- }
- //if(factor!=1.0f)
- {
- // re-sample alpha
- int f=factor*256.0f;
- int size=desc->pic_a[i]->w*desc->pic_a[i]->h;
- int j;
- mp_msg(MSGT_OSD, MSGL_DBG2, "font: resampling alpha by factor %5.3f (%d) ",factor,f);fflush(stdout);
- for(j=0;j<size;j++){
- int x=desc->pic_a[i]->bmp[j]; // alpha
- int y=desc->pic_b[i]->bmp[j]; // bitmap
-
-#ifdef FAST_OSD
- x=(x<(255-f))?0:1;
-#else
-
- x=255-((x*f)>>8); // scale
- //if(x<0) x=0; else if(x>255) x=255;
- //x^=255; // invert
-
- if(x+y>255) x=255-y; // to avoid overflows
-
- //x=0;
- //x=((x*f*(255-y))>>16);
- //x=((x*f*(255-y))>>16)+y;
- //x=(x*f)>>8;if(x<y) x=y;
-
- if(x<1) x=1; else
- if(x>=252) x=0;
-#endif
-
- desc->pic_a[i]->bmp[j]=x;
-// desc->pic_b[i]->bmp[j]=0; // hack
- }
- mp_msg(MSGT_OSD, MSGL_DBG2, "DONE!\n");
- }
- if(!desc->height) desc->height=desc->pic_a[i]->h;
-}
-
-j='_';if(desc->font[j]<0) j='?';
-for(i=0;i<65536;i++)
- if(desc->font[i]<0){
- desc->start[i]=desc->start[j];
- desc->width[i]=desc->width[j];
- desc->font[i]=desc->font[j];
- }
-desc->font[' ']=-1;
-desc->width[' ']=desc->spacewidth;
-
-mp_msg(MSGT_OSD, MSGL_V, "Bitmap font %s loaded successfully! (%d chars)\n",fname,chardb);
-
-return desc;
-
-fail_out:
- if (f)
- fclose(f);
- free(desc->fpath);
- free(desc->name);
- free(desc);
- return NULL;
-}
-
-#ifndef CONFIG_FREETYPE
-void render_one_glyph(font_desc_t *desc, int c) {}
-int kerning(font_desc_t *desc, int prevc, int c) { return 0; }
-#endif
diff --git a/sub/font_load.h b/sub/font_load.h
deleted file mode 100644
index 933f84804f..0000000000
--- a/sub/font_load.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifndef MPLAYER_FONT_LOAD_H
-#define MPLAYER_FONT_LOAD_H
-
-#include "config.h"
-
-#ifdef CONFIG_FREETYPE
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#endif
-
-typedef struct {
- unsigned char *bmp;
- unsigned char *pal;
- int w,h,c;
-#ifdef CONFIG_FREETYPE
- int charwidth,charheight,pen,baseline,padding;
- int current_count, current_alloc;
-#endif
-} raw_file;
-
-typedef struct font_desc {
-#ifdef CONFIG_FREETYPE
- int dynamic;
-#endif
- char *name;
- char *fpath;
- int spacewidth;
- int charspace;
- int height;
-// char *fname_a;
-// char *fname_b;
- raw_file* pic_a[16];
- raw_file* pic_b[16];
- short font[65536];
- int start[65536]; // short is not enough for unicode fonts
- short width[65536];
- int freetype;
-
-#ifdef CONFIG_FREETYPE
- int face_cnt;
-
- FT_Face faces[16];
- FT_UInt glyph_index[65536];
-
- int max_width, max_height;
-
- struct
- {
- int g_r;
- int o_r;
- int g_w;
- int o_w;
- int o_size;
- unsigned volume;
-
- unsigned *g;
- unsigned *gt2;
- unsigned *om;
- unsigned char *omt;
- unsigned short *tmp;
- } tables;
-#endif
-
-} font_desc_t;
-
-extern font_desc_t* vo_font;
-
-extern int vo_image_width;
-extern int vo_image_height;
-
-extern int force_load_font;
-
-int init_freetype(void);
-int done_freetype(void);
-
-font_desc_t* read_font_desc_ft(const char* fname,int face_index,int movie_width, int movie_height, float font_scale_factor);
-void free_font_desc(font_desc_t *desc);
-
-void render_one_glyph(font_desc_t *desc, int c);
-int kerning(font_desc_t *desc, int prevc, int c);
-
-void load_font_ft(int width, int height, font_desc_t **desc, const char *name, float font_scale_factor);
-
-void blur(unsigned char *buffer, unsigned short *tmp2, int width, int height,
- int stride, int *m2, int r, int mwidth);
-
-raw_file* load_raw(char *name,int verbose);
-font_desc_t* read_font_desc(const char* fname,float factor,int verbose);
-
-#endif /* MPLAYER_FONT_LOAD_H */
diff --git a/sub/font_load_ft.c b/sub/font_load_ft.c
deleted file mode 100644
index 9eb0ab50e8..0000000000
--- a/sub/font_load_ft.c
+++ /dev/null
@@ -1,1169 +0,0 @@
-/*
- * Renders antialiased fonts for mplayer using freetype library.
- * Should work with TrueType, Type1 and any other font supported by libfreetype.
- *
- * Artur Zaprzala <zybi@fanthom.irc.pl>
- *
- * ported inside MPlayer by Jindrich Makovicka <makovick@gmail.com>
- *
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include "config.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <string.h>
-
-#ifdef CONFIG_ICONV
-#include <iconv.h>
-#endif
-
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_GLYPH_H
-
-#ifdef CONFIG_FONTCONFIG
-#include <fontconfig/fontconfig.h>
-#endif
-
-#include "libavutil/common.h"
-#include "mpbswap.h"
-#include "font_load.h"
-#include "mp_msg.h"
-#include "mplayer.h"
-#include "path.h"
-#include "sub/sub.h"
-
-#include "osd_font.h"
-
-#if (FREETYPE_MAJOR > 2) || (FREETYPE_MAJOR == 2 && FREETYPE_MINOR >= 1)
-#define HAVE_FREETYPE21
-#endif
-
-int vo_image_width = 0;
-int vo_image_height = 0;
-int force_load_font;
-
-int using_freetype = 0;
-#ifdef CONFIG_FONTCONFIG
-int font_fontconfig = 1;
-#else
-int font_fontconfig = -1;
-#endif
-
-//// constants
-static unsigned int const colors = 256;
-static unsigned int const maxcolor = 255;
-static unsigned const base = 256;
-static unsigned const first_char = 33;
-#define MAX_CHARSET_SIZE 60000
-
-static FT_Library library;
-
-#define OSD_CHARSET_SIZE 15
-
-static const FT_ULong osd_charset[OSD_CHARSET_SIZE] =
-{
- 0xe001, 0xe002, 0xe003, 0xe004, 0xe005, 0xe006, 0xe007, 0xe008,
- 0xe009, 0xe00a, 0xe00b, 0xe010, 0xe011, 0xe012, 0xe013
-};
-
-static const FT_ULong osd_charcodes[OSD_CHARSET_SIZE] =
-{
- 0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,
- 0x09,0x0a,0x0b,0x10,0x11,0x12,0x13
-};
-
-#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
-
-#define WARNING(msg, args...) mp_msg(MSGT_OSD, MSGL_WARN, msg "\n", ## args)
-
-#define DEBUG 0
-
-//static double ttime;
-
-
-static void paste_bitmap(unsigned char *bbuffer, FT_Bitmap *bitmap, int x, int y, int width, int height, int bwidth) {
- 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 && height > 0; --h, height--, drow+=width, srow+=bitmap->pitch)
- for (w = bwidth, 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 && height > 0; --h, height--, drow+=width, srow+=bitmap->pitch)
- for (w = bwidth, sp=dp=0; w>0; --w, ++dp, ++sp)
- bbuffer[drow+dp] = bitmap->buffer[srow+sp];
-}
-
-
-static int check_font(font_desc_t *desc, float ppem, int padding, int pic_idx,
- int charset_size, const FT_ULong *charset,
- const FT_ULong *charcodes, int unicode)
-{
- FT_Error error;
- FT_Face face = desc->faces[pic_idx];
- int const load_flags = FT_LOAD_DEFAULT;
- int ymin = INT_MAX, ymax = INT_MIN;
- int space_advance = 20;
- int width, height;
- unsigned char *bbuffer;
- int i, uni_charmap = 1;
-
- error = FT_Select_Charmap(face, ft_encoding_unicode);
-// fprintf(stderr, "select unicode charmap: %d\n", error);
-
- 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, 0, floatTof266(ppem), 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);
-
- if (!desc->spacewidth) desc->spacewidth = 2*padding + space_advance;
- if (!desc->charspace) desc->charspace = -2*padding;
- if (!desc->height) desc->height = f266ToInt(face->size->metrics.height);
-
-
- for (i= 0; i<charset_size; ++i) {
- FT_ULong character, code;
- FT_UInt glyph_index;
-
- character = charset[i];
- code = charcodes[i];
- desc->font[unicode?character:code] = pic_idx;
- // 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);
- desc->font[unicode?character:code] = -1;
- continue;
- }
- }
- desc->glyph_index[unicode?character:code] = glyph_index;
- }
-// fprintf(stderr, "font height: %f\n", (double)(face->bbox.yMax-face->bbox.yMin)/(double)face->units_per_EM*ppem);
-// fprintf(stderr,