[Android] FontCache: build the fontconfig cache at startup

Duncan McNamara git at videolan.org
Thu Oct 1 12:16:57 UTC 2026


vlc-android | branch: master | Duncan McNamara <dcn.mcnamara at gmail.com> | Fri Sep 18 13:27:51 2026 +0000| [4271718bb8077dc3b6d00d53bed23b2a81f98a56] | committer: Duncan McNamara

FontCache: build the fontconfig cache at startup

Since libvlcjni3 builds fontconfig for Android (libvlcjni bb7d40c), the
freetype text renderer scans every system font when it is first loaded,
which blocks the video output creation for several seconds on the first
run.

Build that cache in the background when the app starts instead, so that
the scan runs during the onboarding rather than during a playback.

The result is stored in the settings along with a fingerprint of the
system fonts, so that the cache is rebuilt after a system update, and
abandoned after a few failed attempts on devices where it can't be
stored.

libvlcjni4 has fontconfig disabled so we have to use VersionDependent
to keep both builds working.

> https://code.videolan.org/videolan/vlc-android/commit/4271718bb8077dc3b6d00d53bed23b2a81f98a56
---

 .../org/videolan/mobile/app/AppSetupDelegate.kt    |  24 ++++
 .../src/main/java/org/videolan/tools/Settings.kt   |   3 +
 .../src/org/videolan/vlc/util/FontCache.kt         | 133 +++++++++++++++++++++
 .../vlc3/src/org/videolan/vlc/VersionDependant.kt  |   7 ++
 .../vlc4/src/org/videolan/vlc/VersionDependant.kt  |  11 ++
 5 files changed, 178 insertions(+)

Diff:   https://code.videolan.org/videolan/vlc-android/commit/4271718bb8077dc3b6d00d53bed23b2a81f98a56


More information about the Android mailing list