[Fontconfig] about FcFini

Vincent Torri vtorri at univ-evry.fr
Tue Mar 31 03:42:59 PDT 2009


hey,

>> if i have understood correctly the code, it is possible to call several
>> time FcInit, but FcFini can be called only once. That's a problem when
>> several libraries use fontconfig (like poppler + qt)
>
> Hi,
>
> My understanding is that:
>
>  * Calling FcInit() is optional.  All fontconfig entry points check and 
> initialize the library if needed.
>
>  * FcFini() is designed to only be called by debugging code from 
> applications, not for normal use by other libraries.
>
>> Would it be possible to use a ref count for the initialisation /
>> finalization of fontconfig ?
>
> It would be feasible if FcInit() was mandatory.  But when it's optional, I'm 
> not sure how to define the semantics.  What will the implicit initialization 
> do?  Increase the ref count or not?

do something like that:

static int _fontconfig_init_count = 0;

int FcIni()
{
   if (!_fontconfig_init_count)
   {
     /* do what is needed during the first call of initialization */
   }

   return ++_fontconfig_init_count;
}

int FcFini()
{
   --_fontconfig_init_count;

   if (!_fontconfig_init_count)
   {
     /* do what is needed during finalization */
   }

   return _fontconfig_init_count;
}


regards

Vincent Torri


More information about the Fontconfig mailing list