[MPlayer-cvslog] r36775 - trunk/sub/font_load.c

ib subversion at mplayerhq.hu
Sat Feb 1 17:57:50 CET 2014


Author: ib
Date: Sat Feb  1 17:57:50 2014
New Revision: 36775

Log:
Fix bug with unicode font loading for font.desc files.

Unicode glyphs might not get loaded even if they are requested and
available.

Fix it by checking the font encoding rather than the subtitle encoding
when loading the font.

Modified:
   trunk/sub/font_load.c

Modified: trunk/sub/font_load.c
==============================================================================
--- trunk/sub/font_load.c	Sat Feb  1 16:13:00 2014	(r36774)
+++ trunk/sub/font_load.c	Sat Feb  1 17:57:50 2014	(r36775)
@@ -21,6 +21,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <strings.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <unistd.h>
@@ -75,6 +76,7 @@ int i,j;
 int chardb=0;
 int fontdb=-1;
 int first=1;
+int unicode;
 
 font_desc_t *desc=calloc(1, sizeof(*desc));
 if(!desc) goto fail_out;
@@ -103,6 +105,8 @@ for(i=0;i<65536;i++) desc->start[i]=desc
 
 section[0]=0;
 
+unicode = !subtitle_font_encoding || strcasecmp(subtitle_font_encoding, "unicode") == 0;
+
 while(fgets(sor,1020,f)){
   unsigned char* p[8];
   int pdb=0;
@@ -255,7 +259,7 @@ while(fgets(sor,1020,f)){
           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];
+          if(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);


More information about the MPlayer-cvslog mailing list