1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 06:17:35 +00:00

pdf: Load fonts in debug mode via Core::Resource URIs

This commit is contained in:
Andrew Kaster 2023-10-03 15:41:48 -06:00 committed by Andrew Kaster
parent 09e3921ff8
commit 74707d151b

View file

@ -8,6 +8,8 @@
#include <LibCore/ArgsParser.h> #include <LibCore/ArgsParser.h>
#include <LibCore/File.h> #include <LibCore/File.h>
#include <LibCore/MappedFile.h> #include <LibCore/MappedFile.h>
#include <LibCore/ResourceImplementationFile.h>
#include <LibCore/System.h>
#include <LibGfx/ImageFormats/PNGWriter.h> #include <LibGfx/ImageFormats/PNGWriter.h>
#include <LibPDF/CommonNames.h> #include <LibPDF/CommonNames.h>
#include <LibPDF/Document.h> #include <LibPDF/Document.h>
@ -186,8 +188,8 @@ static PDF::PDFErrorOr<int> pdf_main(Main::Arguments arguments)
#if !defined(AK_OS_SERENITY) #if !defined(AK_OS_SERENITY)
if (debugging_stats || !render_path.is_empty()) { if (debugging_stats || !render_path.is_empty()) {
// Get from Build/lagom/bin/pdf to Base/res/fonts. // Get from Build/lagom/bin/pdf to Base/res/fonts.
auto source_root = LexicalPath(arguments.argv[0]).parent().parent().parent().parent().string(); auto source_root = LexicalPath(MUST(Core::System::current_executable_path()).to_deprecated_string()).parent().parent().parent().parent().string();
Gfx::FontDatabase::set_default_fonts_lookup_path(DeprecatedString::formatted("{}/Base/res/fonts", source_root)); Core::ResourceImplementation::install(make<Core::ResourceImplementationFile>(TRY(String::formatted("{}/Base/res", source_root))));
} }
#endif #endif