mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-21 23:20:20 +00:00
LibPDF: Add a CFF_DEBUG toggle
I'd like to put some debug prints behind this soon. No behavior change.
This commit is contained in:
parent
11f7db8f34
commit
3c49d0dad3
Notes:
sideshowbarker
2024-07-16 17:12:03 +09:00
Author: https://github.com/nico Commit: https://github.com/SerenityOS/serenity/commit/3c49d0dad3 Pull-request: https://github.com/SerenityOS/serenity/pull/21451
4 changed files with 12 additions and 2 deletions
|
@ -38,6 +38,10 @@
|
|||
# cmakedefine01 CANVAS_RENDERING_CONTEXT_2D_DEBUG
|
||||
#endif
|
||||
|
||||
#ifndef CFF_DEBUG
|
||||
# cmakedefine01 CFF_DEBUG
|
||||
#endif
|
||||
|
||||
#ifndef CMAKE_DEBUG
|
||||
# cmakedefine01 CMAKE_DEBUG
|
||||
#endif
|
||||
|
|
|
@ -14,6 +14,7 @@ set(BXVGA_DEBUG ON)
|
|||
set(CACHE_DEBUG ON)
|
||||
set(CALLBACK_MACHINE_DEBUG ON)
|
||||
set(CANVAS_RENDERING_CONTEXT_2D_DEBUG ON)
|
||||
set(CFF_DEBUG ON)
|
||||
set(CMAKE_DEBUG ON)
|
||||
set(COMMIT_DEBUG ON)
|
||||
set(COMPOSE_DEBUG ON)
|
||||
|
|
|
@ -243,6 +243,7 @@ write_cmake_config("ak_debug_gen") {
|
|||
"CACHE_DEBUG=",
|
||||
"CALLBACK_MACHINE_DEBUG=",
|
||||
"CANVAS_RENDERING_CONTEXT_2D_DEBUG=",
|
||||
"CFF_DEBUG=",
|
||||
"CMAKE_DEBUG=",
|
||||
"COMPOSE_DEBUG=",
|
||||
"COPY_DEBUG=",
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
// CFF spec: https://adobe-type-tools.github.io/font-tech-notes/pdfs/5176.CFF.pdf
|
||||
|
||||
#include <AK/Debug.h>
|
||||
#include <AK/Endian.h>
|
||||
#include <AK/String.h>
|
||||
#include <LibGfx/Forward.h>
|
||||
|
@ -31,8 +32,9 @@ PDFErrorOr<NonnullRefPtr<CFF>> CFF::create(ReadonlyBytes const& cff_bytes, RefPt
|
|||
// CFF spec, "7 Name INDEX"
|
||||
Vector<String> font_names;
|
||||
TRY(parse_index(reader, [&](ReadonlyBytes const& data) -> PDFErrorOr<void> {
|
||||
auto string = TRY(String::from_utf8(data));
|
||||
return TRY(font_names.try_append(string));
|
||||
auto font_name = TRY(String::from_utf8(data));
|
||||
dbgln_if(CFF_DEBUG, "CFF font name '{}'", font_name);
|
||||
return TRY(font_names.try_append(font_name));
|
||||
}));
|
||||
|
||||
auto cff = adopt_ref(*new CFF());
|
||||
|
@ -130,8 +132,10 @@ PDFErrorOr<NonnullRefPtr<CFF>> CFF::create(ReadonlyBytes const& cff_bytes, RefPt
|
|||
|
||||
// Encoding given or read
|
||||
if (encoding) {
|
||||
dbgln_if(CFF_DEBUG, "CFF using external encoding");
|
||||
cff->set_encoding(move(encoding));
|
||||
} else {
|
||||
dbgln_if(CFF_DEBUG, "CFF using embedded encoding");
|
||||
auto encoding = Encoding::create();
|
||||
for (size_t i = 0; i < glyphs.size(); i++) {
|
||||
if (i == 0) {
|
||||
|
|
Loading…
Reference in a new issue