warn and fail if no freetype fonts found

This commit is contained in:
Vadim Lopatin 2015-01-28 13:53:02 +03:00
parent 4459efb406
commit 016a958a17
2 changed files with 16 additions and 0 deletions

View File

@ -564,6 +564,11 @@ class FreeTypeFontManager : FontManager {
return true; return true;
} }
/// returns number of registered fonts
@property int registeredFontCount() {
return cast(int)_fontFiles.length;
}
} }
private int myabs(int n) { return n >= 0 ? n : -n; } private int myabs(int n) { return n >= 0 ? n : -n; }

View File

@ -1133,6 +1133,17 @@ version (Windows) {
ft.registerFont("/Library/Fonts/Georgia Italic.ttf", FontFamily.SansSerif, "Georgia", true, FontWeight.Normal); ft.registerFont("/Library/Fonts/Georgia Italic.ttf", FontFamily.SansSerif, "Georgia", true, FontWeight.Normal);
ft.registerFont("/Library/Fonts/Georgia Bold Italic.ttf", FontFamily.SansSerif, "Georgia", true, FontWeight.Bold); ft.registerFont("/Library/Fonts/Georgia Bold Italic.ttf", FontFamily.SansSerif, "Georgia", true, FontWeight.Bold);
} }
if (!ft.registeredFontCount) {
Log.e("******************************************************************");
Log.e("No font files found!!!");
Log.e("Currently, only hardcoded font paths implemented.");
Log.e("Probably you can modify sdlapp.d to add some fonts for your system.");
Log.e("TODO: use fontconfig");
Log.e("******************************************************************");
assert(false);
}
FontManager.instance = ft; FontManager.instance = ft;
return sdlmain(args); return sdlmain(args);