# HG changeset patch # User ib # Date 1391273870 0 # Node ID 36cbede214286e68d251d19dbaf7cdffd986e1b2 # Parent 61a9df2e25d07d24d308b162d60ac39eeddd8967 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. diff -r 61a9df2e25d0 -r 36cbede21428 sub/font_load.c --- a/sub/font_load.c Sat Feb 01 15:13:00 2014 +0000 +++ b/sub/font_load.c Sat Feb 01 16:57:50 2014 +0000 @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -75,6 +76,7 @@ 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 @@ 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 @@ 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