1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 08:37:35 +00:00

LibPDF: Introduce loading of common font data in PDFFont base class

This font data is shared between Type 1 and TrueType fonts, which is
why we can now load it in the base class that they both use.
This commit is contained in:
Julian Offenhäuser 2022-11-22 19:41:04 +01:00 committed by Andreas Kling
parent dd82a026f8
commit e748a94f80
2 changed files with 68 additions and 0 deletions

View file

@ -6,8 +6,10 @@
#pragma once
#include <AK/HashMap.h>
#include <LibGfx/Forward.h>
#include <LibPDF/Document.h>
#include <LibPDF/Encoding.h>
namespace PDF {
@ -19,6 +21,17 @@ public:
TrueType
};
// This is used both by Type 1 and TrueType fonts.
struct CommonData {
RefPtr<StreamObject> to_unicode;
RefPtr<Encoding> encoding;
HashMap<u16, u16> widths;
u16 missing_width;
bool is_standard_font;
PDFErrorOr<void> load_from_dict(Document*, NonnullRefPtr<DictObject>);
};
static PDFErrorOr<NonnullRefPtr<PDFFont>> create(Document*, NonnullRefPtr<DictObject>);
virtual ~PDFFont() = default;