summaryrefslogtreecommitdiffstats
path: root/libvo/font_load.c
diff options
context:
space:
mode:
authorarpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-12-29 14:59:23 +0000
committerarpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-12-29 14:59:23 +0000
commitc8b0ddfe4e1570b83b815a3c9befced24e4d2875 (patch)
treed0e864e177b24d068bea47f15a911d16a252ddc3 /libvo/font_load.c
parent7e26b6cc29c1f050f55152f0759cd2db276d107e (diff)
downloadmpv-c8b0ddfe4e1570b83b815a3c9befced24e4d2875.tar.bz2
mpv-c8b0ddfe4e1570b83b815a3c9befced24e4d2875.tar.xz
these patches let ,,oldstyle'' and freetype subtitle renderers live
together happily. if an oldstyle subtitle (font.desc) is found, it will be used. otherwise mplayer will choose subfont.ttf, if freetype was detected during ./configure. (also you can use -font /path/to/font.desc and -font /path/to/foobar.ttf too) patch-set by Wojtek Kaniewski <wojtekka@bydg.pdi.net> git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@8636 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libvo/font_load.c')
-rw-r--r--libvo/font_load.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/libvo/font_load.c b/libvo/font_load.c
index 646817e0c1..82d8d6a81b 100644
--- a/libvo/font_load.c
+++ b/libvo/font_load.c
@@ -1,7 +1,5 @@
#include "config.h"
-#ifndef HAVE_FREETYPE
-
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -56,6 +54,7 @@ int i,j;
int chardb=0;
int fontdb=-1;
int version=0;
+int first=1;
desc=malloc(sizeof(font_desc_t));if(!desc) return NULL;
memset(desc,0,sizeof(font_desc_t));
@@ -92,6 +91,21 @@ while(fgets(sor,1020,f)){
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)) {
+ printf("%s doesn't look like a font description, ignoring\n", fname);
+ fclose(f);
+ free(desc);
+ free(dn);
+ return NULL;
+ }
+ first = 0;
+ }
+
p[0]=d;++pdb;
while(1){
int c=*s++;
@@ -303,4 +317,3 @@ read_font_desc("high_arpi.desc",1);
}
#endif
-#endif /* HAVE_FREETYPE */