MacPDF: Don't hardcode my serenity directory

https://www.africau.edu/images/default/sample.pdf is a good
document for testing that the built-in fonts load.
This commit is contained in:
Nico Weber 2023-09-29 21:02:14 -04:00 committed by Andreas Kling
parent 8a7d3cb3f4
commit e4d2aa82e2

View file

@ -16,9 +16,14 @@
- (void)applicationDidFinishLaunching:(NSNotification*)aNotification
{
// FIXME: copy the fonts to the bundle or something
auto source_root = DeprecatedString("/Users/thakis/src/serenity");
Gfx::FontDatabase::set_default_fonts_lookup_path(DeprecatedString::formatted("{}/Base/res/fonts", source_root));
// FIXME: Copy the fonts to the bundle or something
// Get from `Build/lagom/bin/MacPDF.app/Contents/MacOS/MacPDF` to `.`.
NSString* source_root = [[NSBundle mainBundle] executablePath];
for (int i = 0; i < 7; ++i)
source_root = [source_root stringByDeletingLastPathComponent];
auto source_root_string = DeprecatedString([source_root UTF8String]);
Gfx::FontDatabase::set_default_fonts_lookup_path(DeprecatedString::formatted("{}/Base/res/fonts", source_root_string));
}
- (void)applicationWillTerminate:(NSNotification*)aNotification