summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--DOCS/man/de/mplayer.12
-rw-r--r--DOCS/man/en/mplayer.14
-rw-r--r--DOCS/xml/en/install.xml21
-rw-r--r--Makefile4
-rwxr-xr-xconfigure43
-rw-r--r--libvo/font_load_ft.c33
-rw-r--r--mencoder.c11
-rw-r--r--mplayer.c19
8 files changed, 130 insertions, 7 deletions
diff --git a/DOCS/man/de/mplayer.1 b/DOCS/man/de/mplayer.1
index b108393eee..009bd8ab58 100644
--- a/DOCS/man/de/mplayer.1
+++ b/DOCS/man/de/mplayer.1
@@ -919,6 +919,8 @@ alte Schriftunterstützung nicht mehr benutzt werden.
\-font ~/\:.mplayer/\:arial\-14/\:font.desc
.br
\-font ~/\:.mplayer/\:arialuni.ttf
+.br
+\-font 'Bitstream Vera Sans'
.RE
.PD 1
.
diff --git a/DOCS/man/en/mplayer.1 b/DOCS/man/en/mplayer.1
index d0bef28b6a..541c105a70 100644
--- a/DOCS/man/en/mplayer.1
+++ b/DOCS/man/en/mplayer.1
@@ -1164,6 +1164,8 @@ fonts: ~/\:.mplayer/\:font/\:font.desc, default for FreeType fonts:
With FreeType, this option determines path to the text font file.
.br
The \-subfont-* options are available only with FreeType support compiled in.
+.br
+With Fontconfig, this option determines the fontconfig font name.
.I EXAMPLE:
.PD 0
@@ -1171,6 +1173,8 @@ The \-subfont-* options are available only with FreeType support compiled in.
\-font ~/\:.mplayer/\:arial-14/\:font.desc
.br
\-font ~/\:.mplayer/\:arialuni.ttf
+.br
+\-font 'Bitstream Vera Sans'
.RE
.PD 1
.
diff --git a/DOCS/xml/en/install.xml b/DOCS/xml/en/install.xml
index 9cf5ff3eca..d57176e395 100644
--- a/DOCS/xml/en/install.xml
+++ b/DOCS/xml/en/install.xml
@@ -781,6 +781,27 @@ library. Version 2.0.9 or greater is mandatory! Then you have two methods:
RAW plugin too, see URL below)
<!-- FIXME: where's that URL? -->
</para></listitem>
+<listitem><para>
+ using a TrueType (TTF) font, by the means of the <systemitem class="library">
+ freetype</systemitem> library. Version 2.0.9 or greater is mandatory! Then
+ you have two methods:
+ <itemizedlist>
+ <listitem><para>
+ use the <option>-font /path/to/arial.ttf</option> option to specify a
+ TrueType font file on every occasion
+ </para></listitem>
+ <listitem><para>
+ create a symlink:<screen>ln -s /path/to/arial.ttf ~/.mplayer/subfont.ttf</screen>
+ </para></listitem>
+ </itemizedlist>
+ <para>
+ if compiled with <systemitem class="library">fontconfig</systemitem>
+ support, the above methods won't work, instead the <option>-font</option>
+ expects a fontconfig font name and defaults to the sans-serif font. To get
+ a list of fonts known to fontconfig, use <command>fc-list</command>.
+ Example: <option>-font 'Bitstream Vera Sans'</option>
+ </para>
+ </para></listitem>
</itemizedlist>
<para>
diff --git a/Makefile b/Makefile
index cc1bc90bcc..9df3434fc0 100644
--- a/Makefile
+++ b/Makefile
@@ -36,9 +36,9 @@ OBJS_MPLAYER = $(SRCS_MPLAYER:.c=.o)
VO_LIBS = $(AA_LIB) $(X_LIB) $(SDL_LIB) $(GGI_LIB) $(MP1E_LIB) $(MLIB_LIB) $(SVGA_LIB) $(DIRECTFB_LIB)
AO_LIBS = $(ARTS_LIB) $(ESD_LIB) $(NAS_LIB) $(SGIAUDIO_LIB)
CODEC_LIBS = $(AV_LIB) $(FAME_LIB) $(MAD_LIB) $(VORBIS_LIB) $(THEORA_LIB) $(FAAD_LIB) $(LIBLZO_LIB) $(DECORE_LIB) $(XVID_LIB) $(PNG_LIB) $(Z_LIB) $(JPEG_LIB) $(ALSA_LIB) $(XMMS_LIB) $(MATROSKA_LIB)
-COMMON_LIBS = libmpcodecs/libmpcodecs.a mp3lib/libMP3.a liba52/liba52.a libmpeg2/libmpeg2.a $(W32_LIB) $(DS_LIB) libaf/libaf.a libmpdemux/libmpdemux.a input/libinput.a postproc/libswscale.a osdep/libosdep.a $(CSS_LIB) $(CODEC_LIBS) $(FREETYPE_LIB) $(TERMCAP_LIB) $(CDPARANOIA_LIB) $(MPLAYER_NETWORK_LIB) $(WIN32_LIB) $(GIF_LIB) $(MACOSX_FRAMEWORKS) $(SMBSUPPORT_LIB) $(FRIBIDI_LIB) $(FLAC_LIB)
+COMMON_LIBS = libmpcodecs/libmpcodecs.a mp3lib/libMP3.a liba52/liba52.a libmpeg2/libmpeg2.a $(W32_LIB) $(DS_LIB) libaf/libaf.a libmpdemux/libmpdemux.a input/libinput.a postproc/libswscale.a osdep/libosdep.a $(CSS_LIB) $(CODEC_LIBS) $(FREETYPE_LIB) $(TERMCAP_LIB) $(CDPARANOIA_LIB) $(MPLAYER_NETWORK_LIB) $(WIN32_LIB) $(GIF_LIB) $(MACOSX_FRAMEWORKS) $(SMBSUPPORT_LIB) $(FRIBIDI_LIB) $(FLAC_LIB) $(FONTCONFIG_LIB)
-CFLAGS = $(OPTFLAGS) -Ilibmpdemux -Iloader -Ilibvo $(FREETYPE_INC) $(EXTRA_INC) $(CDPARANOIA_INC) $(SDL_INC) $(X11_INC) $(FRIBIDI_INC) $(DVB_INC) $(XVID_INC) # -Wall
+CFLAGS = $(OPTFLAGS) -Ilibmpdemux -Iloader -Ilibvo $(FREETYPE_INC) $(EXTRA_INC) $(CDPARANOIA_INC) $(SDL_INC) $(X11_INC) $(FRIBIDI_INC) $(DVB_INC) $(XVID_INC) $(FONTCONFIG_INC) # -Wall
PARTS = libmpdemux libmpcodecs mp3lib liba52 libmpeg2 libavcodec libao2 drivers osdep postproc input libvo libaf
ifeq ($(INTERNAL_FAAD),yes)
diff --git a/configure b/configure
index c04e0140e0..afb125e6e8 100755
--- a/configure
+++ b/configure
@@ -175,6 +175,7 @@ Optional features:
--disable-css Disable old-style libcss DVD support [autodetect]
--disable-cdparanoia Disable cdparanoia support [autodetect]
--disable-freetype Disable freetype2 font rendering support [autodetect]
+ --disable-fontconfig Disable fontconfig font lookup support [autodetect]
--disable-unrarlib Disable Unique RAR File Library [enabled]
--enable-menu Enable OSD menu support (NOT DVD MENU) [disabled]
--disable-sortsub Disable subtitles sorting [enabled]
@@ -1185,6 +1186,7 @@ _libdv=auto
_cdparanoia=auto
_big_endian=auto
_freetype=auto
+_fontconfig=auto
_shared_pp=no
_menu=no
_qtx=auto
@@ -1400,6 +1402,8 @@ for ac_option do
--disable-big-endian) _big_endian=no ;;
--enable-freetype) _freetype=yes ;;
--disable-freetype) _freetype=no ;;
+ --enable-fontconfig) _fontconfig=yes ;;
+ --disable-fontconfig) _fontconfig=no ;;
--enable-unrarlib) _unrarlib=yes ;;
--disable-unrarlib) _unrarlib=no ;;
--enable-ftp) _ftp=yes ;;
@@ -4274,6 +4278,40 @@ else
fi
echores "$_freetype"
+if test "$_freetype" = no ; then
+ _fontconfig=no
+fi
+echocheck "fontconfig"
+if test "$_fontconfig" = auto ; then
+ if ( pkg-config fontconfig --modversion) > /dev/null 2>&1 ; then
+ cat > $TMPC << EOF
+#include <stdio.h>
+#include <fontconfig/fontconfig.h>
+int main()
+{
+ int err = FcInit();
+ if(err == FcFalse){
+ printf("Couldn't initialize fontconfig lib\n");
+ exit(err);
+ }
+ return 0;
+
+}
+EOF
+ _fontconfig=no
+ cc_check `pkg-config fontconfig --cflags --libs` && ( $TMPO >> "$TMPLOG" ) && _fontconfig=yes
+ else
+ _fontconfig=no
+ fi
+fi
+if test "$_fontconfig" = yes ; then
+ _def_fontconfig='#define HAVE_FONTCONFIG'
+ _inc_fontconfig=`pkg-config fontconfig --cflags`
+ _ld_fontconfig=`pkg-config fontconfig --libs`
+else
+ _def_fontconfig='#undef HAVE_FONTCONFIG'
+fi
+echores "$_fontconfig"
echocheck "fribidi with charsets"
if test "$_fribidi" = yes ; then
@@ -5887,6 +5925,8 @@ CDPARANOIA_INC = $_inc_cdparanoia
CDPARANOIA_LIB = $_ld_cdparanoia
FREETYPE_INC = $_inc_freetype
FREETYPE_LIB = $_ld_freetype
+FONTCONFIG_INC = $_inc_fontconfig
+FONTCONFIG_LIB = $_ld_fontconfig
FRIBIDI_INC = $_inc_fribidi
FRIBIDI_LIB = $_ld_fribidi
LIBLZO_LIB= $_ld_liblzo
@@ -6341,6 +6381,9 @@ $_def_gif_tvt_hack
/* enable FreeType support */
$_def_freetype
+/* enable Fontconfig support */
+$_def_fontconfig
+
/* enable FriBiDi usage */
$_def_fribidi
diff --git a/libvo/font_load_ft.c b/libvo/font_load_ft.c
index 141baeddfc..3279d98361 100644
--- a/libvo/font_load_ft.c
+++ b/libvo/font_load_ft.c
@@ -24,6 +24,10 @@
#include FT_FREETYPE_H
#include FT_GLYPH_H
+#ifdef HAVE_FONTCONFIG
+#include <fontconfig/fontconfig.h>
+#endif
+
#include "../bswap.h"
#include "font_load.h"
#include "mp_msg.h"
@@ -1113,6 +1117,11 @@ int done_freetype()
void load_font_ft(int width, int height)
{
+#ifdef HAVE_FONTCONFIG
+ FcPattern *fc_pattern;
+ FcChar8 *s;
+ FcBool scalable;
+#endif
vo_image_width = width;
vo_image_height = height;
@@ -1122,6 +1131,30 @@ void load_font_ft(int width, int height)
if (vo_font) free_font_desc(vo_font);
#ifdef USE_OSD
+#ifdef HAVE_FONTCONFIG
+ if (font_fontconfig)
+ {
+ if (!font_name)
+ font_name = "sans-serif";
+ FcInit();
+ fc_pattern = FcNameParse(font_name);
+ FcConfigSubstitute(0, fc_pattern, FcMatchPattern);
+ FcDefaultSubstitute(fc_pattern);
+ fc_pattern = FcFontMatch(0, fc_pattern, 0);
+ FcPatternGetBool(fc_pattern, FC_SCALABLE, 0, &scalable);
+ if (scalable != FcTrue) {
+ fc_pattern = FcNameParse("sans-serif");
+ FcConfigSubstitute(0, fc_pattern, FcMatchPattern);
+ FcDefaultSubstitute(fc_pattern);
+ fc_pattern = FcFontMatch(0, fc_pattern, 0);
+ }
+ // s doesn't need to be freed according to fontconfig docs
+ FcPatternGetString(fc_pattern, FC_FILE, 0, &s);
+ vo_font=read_font_desc_ft(s, width, height);
+ free(fc_pattern);
+ }
+ else
+#endif
vo_font=read_font_desc_ft(font_name, width, height);
#endif
}
diff --git a/mencoder.c b/mencoder.c
index 5b5035aab3..82f8e3b227 100644
--- a/mencoder.c
+++ b/mencoder.c
@@ -175,6 +175,9 @@ static int play_n_frames_mf=-1;
// sub:
char *font_name=NULL;
+#ifdef HAVE_FONTCONFIG
+int font_fontconfig=0;
+#endif
float font_factor=0.75;
char **sub_name=NULL;
float sub_delay=0;
@@ -443,7 +446,11 @@ if(!parse_codec_cfg(get_path("codecs.conf"))){
#ifdef USE_OSD
#ifdef HAVE_FREETYPE
init_freetype();
-#else
+#endif
+#ifdef HAVE_FONTCONFIG
+ if(!font_fontconfig)
+ {
+#endif
if(font_name){
vo_font=read_font_desc(font_name,font_factor,verbose>1);
if(!vo_font) mp_msg(MSGT_CPLAYER,MSGL_ERR,MSGTR_CantLoadFont,font_name);
@@ -453,6 +460,8 @@ if(!parse_codec_cfg(get_path("codecs.conf"))){
if(!vo_font)
vo_font=read_font_desc(MPLAYER_DATADIR "/font/font.desc",font_factor,verbose>1);
}
+#ifdef HAVE_FONTCONFIG
+ }
#endif
#endif
diff --git a/mplayer.c b/mplayer.c
index dea449203b..8badd1812c 100644
--- a/mplayer.c
+++ b/mplayer.c
@@ -288,6 +288,9 @@ extern int vo_flags;
// sub:
char *font_name=NULL;
+#ifdef HAVE_FONTCONFIG
+int font_fontconfig=0;
+#endif
float font_factor=0.75;
char **sub_name=NULL;
float sub_delay=0;
@@ -1058,8 +1061,15 @@ if(!parse_codec_cfg(get_path("codecs.conf"))){
//------ load global data first ------
-#ifdef USE_OSD
// check font
+#ifdef USE_OSD
+#ifdef HAVE_FREETYPE
+ init_freetype();
+#endif
+#ifdef HAVE_FONTCONFIG
+ if(!font_fontconfig)
+ {
+#endif
if(font_name){
vo_font=read_font_desc(font_name,font_factor,verbose>1);
if(!vo_font) mp_msg(MSGT_CPLAYER,MSGL_ERR,MSGTR_CantLoadFont,font_name);
@@ -1069,9 +1079,8 @@ if(!parse_codec_cfg(get_path("codecs.conf"))){
if(!vo_font)
vo_font=read_font_desc(MPLAYER_DATADIR "/font/font.desc",font_factor,verbose>1);
}
-#ifdef HAVE_FREETYPE
- if (!vo_font)
- init_freetype();
+#ifdef HAVE_FONTCONFIG
+ }
#endif
#endif
vo_init_osd();
@@ -1373,7 +1382,9 @@ if(stream->type==STREAMTYPE_DVD){
#endif
// CACHE2: initial prefill: 20% later: 5% (should be set by -cacheopts)
+#ifdef HAS_DVBIN_SUPPORT
goto_enable_cache:
+#endif
if(stream_cache_size>0){
current_module="enable_cache";
if(!stream_enable_cache(stream,stream_cache_size*1024,stream_cache_size*1024/5,stream_cache_size*1024/20))