mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 06:07:34 +00:00
LibPDF: Load replacements for TrueTypeFonts without an embedded font
This previously only happened for Type 1 fonts.
This commit is contained in:
parent
5deac3a7f5
commit
bdd5f36121
1 changed files with 5 additions and 0 deletions
|
@ -17,6 +17,7 @@ PDFErrorOr<void> TrueTypeFont::initialize(Document* document, NonnullRefPtr<Dict
|
|||
{
|
||||
TRY(SimpleFont::initialize(document, dict, font_size));
|
||||
|
||||
// If there's an embedded font program we use that; otherwise we try to find a replacement font
|
||||
if (dict->contains(CommonNames::FontDescriptor)) {
|
||||
auto descriptor = MUST(dict->get_dict(document, CommonNames::FontDescriptor));
|
||||
if (descriptor->contains(CommonNames::FontFile2)) {
|
||||
|
@ -26,7 +27,11 @@ PDFErrorOr<void> TrueTypeFont::initialize(Document* document, NonnullRefPtr<Dict
|
|||
m_font = adopt_ref(*new Gfx::ScaledFont(*ttf_font, point_size, point_size));
|
||||
}
|
||||
}
|
||||
if (!m_font) {
|
||||
m_font = TRY(replacement_for(base_font_name().to_lowercase(), font_size));
|
||||
}
|
||||
|
||||
VERIFY(m_font);
|
||||
return {};
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue