-
- /* Check for an existing Fontbuilder thread */
- vlc_mutex_t *lock = var_AcquireMutex( "fontbuilder" );
- p_fontbuilder = vlc_object_find_name( p_filter->p_libvlc,
- "fontlist builder",
- FIND_CHILD );
-
- if( ! p_fontbuilder )
- {
- /* Create the FontBuilder thread as a child of a top-level
- * object, so that it can survive the destruction of the
- * freetype object - the fontlist only needs to be built once,
- * and calling the fontbuild a second time while the first is
- * still in progress can cause thread instabilities.
- */
-
- p_fontbuilder = vlc_object_create( p_filter->p_libvlc,
- sizeof(vlc_object_t) );
- if( p_fontbuilder )
- {
- p_fontbuilder->psz_object_name = strdup( "fontlist builder" );
- vlc_object_attach( p_fontbuilder, p_filter->p_libvlc );
-
- var_Create( p_fontbuilder, "build-done", VLC_VAR_BOOL );
- var_SetBool( p_fontbuilder, "build-done", false );
- var_AddCallback( p_fontbuilder, "build-done", BuildDone, p_sys );
-
- if( vlc_thread_create( p_fontbuilder,
- "fontlist builder",
- FontBuilder,
- VLC_THREAD_PRIORITY_LOW,
- false ) )
- {
- /* Don't destroy the fontconfig object - we won't be able to do
- * italics or bold or change the font face, but we will still
- * be able to do underline and change the font size.
- */
- msg_Warn( p_filter, "fontconfig database builder thread can't "
- "be launched. Font styling support will be limited." );
- }
- }
- else
- {
- vlc_object_release( p_fontbuilder );
- }
- }
- else
- {
- vlc_object_release( p_fontbuilder );
- }
- vlc_mutex_unlock( lock );
-