protonscr

[First Run] Steam hardcodes DejaVuSans.ttf path

steamclosed Distro Family: FedoraDistro-provided steam package
ValveSoftware/steam-for-linux#5421 · opened 2018-03-23 by flibitijibibo · updated 2019-07-28 · 7 comments · github
Fflibitijibibo 2018-03-23 github

Your system information

  • Steam client version (build number or date): Mar 19 2018 11:59:58
  • Distribution (e.g. Ubuntu): Fedora 27 x86_64
  • Opted into Steam client beta?: No
  • Have you checked for system updates?: Yes

Please describe your issue in as much detail as possible:

Continuing on #5413 slightly, it is impossible to start a fresh installation of Steam Big Picture (or SteamOS) because bootstraplinux_ubuntu12_32.tar.xz does not contain the assets necessary to render the Big Picture updater/installer graphics.

From steam_stdout.txt, after following the repro steps:

Assert( Assertion Failed: UpdateUI CreateGlFont regular failed ):../steamexe/updateui_gl.cpp:293

...

ILocalize::AddFile() failed to load file "public/steambootstrapper_english.txt".
[2018-03-23 14:05:33] Startup - updater built Nov 23 2016 01:05:42
../steamexe/updateui_gl.cpp (293) : Assertion Failed: UpdateUI CreateGlFont regular failed
../steamexe/main.cpp (525) : Assertion Failed: failed to initialize update status ui, or create initial window

Steps for reproducing this issue:

  1. rm -rf ~/.steam* ~/.local/share/Steam for steam user (careful!)
  2. Strip out zenity code in the bootstrap steam.sh script for #5413, always copy the license file (this assumes you have already agreed to the license terms before!)
  3. Start SteamOS session
  4. Crashes on start due to missing files
Fflibitijibibo 2019-01-23 github

CC'ing @alkazar - this isn't steamcompmgr-related but in case there's interest in streamlining the process of making an Arch-based SteamOS session, this may be relevant.

Aalkazar 2019-01-25 github

@flibitijibibo thanks for bringing this to my attention!

Aalkazar 2019-03-16 github

@flibitijibibo

It seems someone has found a solution to this, see the ticket below. Specifically, the response by @fledermaus

https://github.com/ValveSoftware/SteamOS/issues/383

steam looks for a file at roughly this location
(the exact location varies depending on whether
you are on SteamOS or Ubuntu or Debian or whatever):

/home/steam/.local/share/Steam/tenfoot/resource/fonts/tenfoot.uifont

On my broken box, this file was absent.
It is present on my other non-steamos box with steam installed.

If it fails to find that, it then attempts to open:

/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf

When I symlinked the DejaVuSans.ttf file as installed in my distro to that location, it worked!

Looking in such a specific location for a font is not great, but it makes sense since the -steamos option was only meant to run under SteamOS where that font always exists under that location. We shouldn't really expect Valve to make sure it works on other distros.

Fflibitijibibo 2019-03-16 github

Looks like mine is at /usr/share/fonts/dejavu/DejaVuSans.ttf. Looking around, it seems the best way to get the proper path is with a shell command:

fc-match --format=%{file} DejaVuSans.ttf

This can be pulled into a C program, if you don't mind using popen...

#include <stdio.h>
#include <limits.h>

#define FONTSEARCH "/usr/bin/fc-match --format=%{file} DejaVuSans.ttf"

int main(int argc, char **argv)
{
	char fontPath[PATH_MAX];
	FILE *sout = popen(FONTSEARCH, "r");
	if (sout == NULL)
	{
		return -1;
	}
	if (fgets(fontPath, sizeof(fontPath), sout) != NULL)
	{
		printf("FOUND IT: %s\n", fontPath);
	}
	pclose(sout);
	return 0;
}

Fontconfig as a minimum system requirement isn't asking too much, right...?

Aalkazar 2019-04-20 github

Also related is that once you fix the font issue above, the initial update screen is missing the steam logo background. You end up seeing a not so pretty but functional white screen.

This is because ~/.local/share/Steam/tenfoot/resource/image/bootstrapper.jpg is not present.

Fflibitijibibo 2019-07-18 github

I wrote a proper function that dynamically loads libfontconfig and finds the location of DejaVuSans.ttf:

https://gist.github.com/flibitijibibo/93efa0332f251de6f413b83f2c84bd47

This should be less obnoxious than using popen and doesn't add any required dependencies. This was tested on the following configurations:

  • libfontconfig not installed
  • libfontconfig installed, but no DejaVu font collection
  • libfontconfig installed, DejaVu font collection installed

All that has to be done is replacing the const char* with a temporary char[PATH_MAX] and a call to findDejaVuSans(path, sizeof(path)). The only mandatory include introduced is fontconfig.h; you can either do the dlopen work with libdl directly or with SDL_loadso, whichever is more convenient. You could arguably get rid of the dependency on the header too, but if you're reading this then you probably have Fontconfig, so the header file shouldn't be too far away...

Fflibitijibibo 2019-07-28 github

The symlink workaround is now in negativo17's steamos-base-files package. A proper fix would still be good for anyone building SteamOS distributions elsewhere, but for this report it looks like we're set.

Upstream links