Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[First Run] Steam hardcodes DejaVuSans.ttf path #5421

Closed
flibitijibibo opened this issue Mar 23, 2018 · 7 comments
Closed

[First Run] Steam hardcodes DejaVuSans.ttf path #5421

flibitijibibo opened this issue Mar 23, 2018 · 7 comments

Comments

@flibitijibibo
Copy link

flibitijibibo commented Mar 23, 2018

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 [First Run] License agreement does not run in Big Picture UI #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
@flibitijibibo
Copy link
Author

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.

@alkazar
Copy link

alkazar commented Jan 25, 2019

@flibitijibibo thanks for bringing this to my attention!

@alkazar
Copy link

alkazar commented Mar 16, 2019

@flibitijibibo

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

ValveSoftware/SteamOS#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.

@flibitijibibo
Copy link
Author

flibitijibibo commented Mar 16, 2019

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...?

@alkazar
Copy link

alkazar commented Apr 20, 2019

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.

@flibitijibibo flibitijibibo changed the title [First Run] Steam bootstrapper package does not contain critical Big Picture/SteamOS assets [First Run] Steam hardcodes DejaVuSans.ttf path Jul 12, 2019
@flibitijibibo
Copy link
Author

flibitijibibo commented Jul 18, 2019

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...

@flibitijibibo
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants