linux error popup for missing fonts

This commit is contained in:
insofaras 2016-09-04 22:24:48 +01:00
parent a01957a3fc
commit f339eef8f5
2 changed files with 11 additions and 0 deletions

View File

@ -284,6 +284,7 @@ internal int LinuxHandleToFD(Plat_Handle);
internal void LinuxStringDup(String*, void*, size_t);
internal void LinuxToggleFullscreen(Display*, Window);
internal void LinuxFatalErrorMsg(const char* msg);
internal Sys_Acquire_Lock_Sig(system_acquire_lock);
internal Sys_Release_Lock_Sig(system_release_lock);

View File

@ -69,6 +69,16 @@ linux_font_load(Partition *part, Render_Font *rf, char *name, i32 pt_size, i32 t
#endif
if (filename != 0){
struct stat st;
if(stat(filename, &st) == -1 || S_ISDIR(st.st_mode)){
char buff[1024];
// NOTE(inso): if/when you can load fonts from anywhere, the message should be changed.
snprintf(buff, sizeof(buff), "Unable to load font '%s'. Make sure this file is in the same directory as the '4ed' executable.", filename);
LinuxFatalErrorMsg(buff);
exit(1);
}
result = font_load_freetype(part, rf, filename, pt_size, tab_width, use_hinting);
}