[Fontconfig] how to read config file from current dir (relative to a binary using the lib)

Raimund Steger rs at mytum.de
Tue Aug 28 16:47:22 PDT 2012


Helmut Tessarek wrote:
> On 28.08.12 4:53 , Raimund Steger wrote:
>> Is this against current ffmpeg git head?
>> Can you send me the patch you're trying?
>
> Yes, it is ffmpeg git head.
>
> I've tried to add it in the main function and also in the avfilter code that
> initializes fontconfig. (see patches.tar)

OK, I tried your ffmpeg.c.patch, with a configuration in the directory 
./fontconfig;


(1) with vf_ass -- seems OK:

sun2:video_encoding)truss \
-topen -ulibc,libfontconfig:setenv,Fc\* \
ffmpeg -i in.avi -vf ass=$HOME/tmp/test.ass out.avi
[...]
/1 at 1:   -> libc:setenv()
/1 at 1:   <- libc:setenv() = 0
[...]
ffmpeg version N-43970-g6c06b56 Copyright (c) 2000-2012 the FFmpeg 
developers
   built on Aug 28 2012 23:39:01 with gcc 4.5.2 (GCC)
[...]
/1 at 1:   -> libfontconfig:FcConfigCreate()
/1 at 1:   <- libfontconfig:FcConfigCreate() = 0x80a0da8
/1 at 1:   -> libfontconfig:FcConfigParseAndLoad()
/1:     open("/home/rs/tmp/video_encoding/fontconfig/fonts.conf", 
O_RDONLY) = 5
/1: 
open("/home/rs/tmp/video_encoding/fontconfig/conf.d/20-fix-globaladvance
[...]


(2) with vf_drawtext -- seems OK as well:

sun2:video_encoding)truss \
-topen -ulibc,libfontconfig:setenv,Fc\* \
ffmpeg -i in.avi -vf \
drawtext='text=foo:r=25:x=(w-tw)/2:y=h-(2*lh):fontcolor=white' \
out.avi
[...]
/1 at 1:   -> libc:setenv()
/1 at 1:   <- libc:setenv() = 0
[...]
/1 at 1:   -> libfontconfig:FcInitLoadConfigAndFonts()
/1:     open("/home/rs/tmp/video_encoding/fontconfig/fonts.conf", 
O_RDONLY) = 5
/1: 
open("/home/rs/tmp/video_encoding/fontconfig/conf.d/20-fix-globaladvance.conf", 
O_RDONLY) = 7
[...]


I also checked (2) with some bogus config file in ./fontconfig that 
mapped all requests to a single very recognizable font to be sure, and 
it worked.

So I think your patch is OK. I have to say that I didn't link 
statically, but I'd be surprised if that made a difference.

I trust you have checked that ffmpeg enabled fontconfig for vf_drawtext 
with "egrep 'FONTCONFIG|FREETYPE' config.mak"?

Raimund


-- 
Worringer Str 31, Duesseldorf 40211 Germany   home: <rs at mytum.de>
+49-179-2981632 icq 16845346                  work: <rs at interface-ag.de>


More information about the Fontconfig mailing list