mplayer fontconfig annoyance on windows

The mplayer build I use on windows reloads the font cache every time I restart my computer. I found out the cause of this is that I clear the temp dir on restart and it keeps the font cache there.

I wondered: how to make mplayer do not always reload the font cache?

(It takes a lot of time and I'm usually "off guard" when this happens. Being able to live with only 1 or 2 fonts usually, I often perceive it like "adding injury to insult".)

Other builds I've tried before are used to reload the full font cache in each new working directory, as they placed the cache in that local directory. As sources for up-to-date builds of windows binaries varied somehow over the years, it would be good to know, what mplayer tries to actually do.

  1. How to make fontconfig search for the fonts (cache) elsewhere?
  2. How exactly is mplayer searching for fonts? (Does it always rely on fonts.conf?)
  3. Is it possible to disable fontconfig from the command line? What would mplayer do then?
  4. Can I disable updating of the font cache even when fonts do change? (Ie. "only use already known fonts forever")

Note: There used to be a single, built-in, default font in old times for mplayer. What happened to that?

I've found an option <cachedir> in fonts/fonts.conf, relative to mplayer.exe, which I can use to solve 1. (I keep it up to date manually when a new build arrives and I often forgot to do so. And the rest of the questions still remains. Also, where does it search for the fonts/fonts.conf file?)


It seems that Mplayer depends on "%tmp%" value to create the font cache. This means that you may get the mplayer.exe process to see a different value whilst the others in the "real temp folder" aren't affected.

(Please note that it's NOT "%TEMP%" BUT "%TMP%" but it doesn't harm to change both of them for mplayer.exe so you may setup both.)

How to:

  1. Create a temp folder under mplayer. e.g. C:\Mplayer\Temp
  2. Create a new batch file under Mplayer.exe's path. e.g. C:\Mplayer\mplayerlaunch.bat
  3. Fill the new batch file with the following:

    set tmp=C:\Mplayer\Temp

    Mplayer.exe %*

  4. Test the batch script whilst the new temp folder is opened on Windows Explorer. e.g. play a video.

  5. See if the font cache folder is generated there. If so, everything's fine - now you have set up a dedicated temp folder for MPlayer which isn't affected by the temp folder cleanup you scheduled. Just run that batch file every time instead of MPlayer.exe.

p.s I know you already solved this issue by changing the config. However, by this way, you don't have to change the config file whenever you got a new build because you can place this batch file somewhere outside of the actual mplayer folder, which won't be overwritten by installing a new build.