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

Pavel Koshevoy pkoshevoy at gmail.com
Mon Sep 3 07:13:10 PDT 2012


On 9/3/2012 2:28 AM, Akira TAGOH wrote:
> On Mon, Sep 3, 2012 at 12:05 PM, Pavel Koshevoy <pkoshevoy at gmail.com> wrote:
>> I've seen this issue brought up on the ffmpeg-devel mailing list, and here.
>> I hope there will be a positive resolution.  If relative-to-exe fontconfig
>> search path is not possible perhaps ffmpeg developers will be more amiable
>> to adding a fontconfig configuration parameter to the drawtext filter (so it
>> can pass correct fonts.conf file path to libass, which will in turn
>> initialize fontconfig).
> They could use FcConfigAppFontAddFile() and/or FcConfigAppFontAddDir()
> to load own fonts.conf and rules. I guess it may be somewhat
> acceptable for that project since they statically linked fontconfig?
>

ffmpeg optionally links to fontconfig, whether it's static or dynamic 
depends on what's available.  ffmpeg developers view is that they should 
be linking to system fontconfig (which should be dynamic).  This is a 
problem because ffmpeg is cross-platform project, and there is no system 
fontconfig on OSX or Windows.  So, making a cross-platform 
redistributable application linking to ffmpeg libraries and fontconfig 
is problematic.

ffmpeg vf_drawtext filter already allows one to specify a font to use 
(this doesn't require fontconfig).   I suppose a filter parameter could 
be created to pass an additional fonts directory. vf_ass filter may need 
a similar parameter to tell it which fonts.conf to use.

BTW, I was in a similar situation and ended up creating a temporary 
fonts.conf file to initialize libass.  I can't initialize fontconfig 
directly because libass encapsulates fontconfig.  In case this is 
beneficial to someone else, here is the link to my code -- 
http://apprenticevideo.svn.sourceforge.net/viewvc/apprenticevideo/trunk/apprenticevideo/yaeCanvas.cpp?revision=389&view=markup
The relevant code starts at getFontsConf function.

     Pavel.



More information about the Fontconfig mailing list