mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
LibPDF: Replace TODO()s in Type0Font code with Errors
...which causes us to not render these fonts instead of crashing. Reduces number of crashes on 300 random PDFs from the web (the first 300 from 0000.zip from https://pdfa.org/new-large-scale-pdf-corpus-now-publicly-available/) from 64 (21%) to 42 (14%).
This commit is contained in:
parent
33443f7991
commit
095a2a17ed
Notes:
sideshowbarker
2024-07-16 20:08:14 +09:00
Author: https://github.com/nico Commit: https://github.com/SerenityOS/serenity/commit/095a2a17ed Pull-request: https://github.com/SerenityOS/serenity/pull/21514
1 changed files with 3 additions and 3 deletions
|
@ -49,9 +49,9 @@ PDFErrorOr<NonnullOwnPtr<CIDFontType2>> CIDFontType2::create(Document* document,
|
|||
if (descendant->contains(CommonNames::CIDToGIDMap)) {
|
||||
auto value = TRY(descendant->get_object(document, CommonNames::CIDToGIDMap));
|
||||
if (value->is<StreamObject>()) {
|
||||
TODO();
|
||||
return Error::rendering_unsupported_error("Type0 font subtype 2: support for stream cid maps not yet implemented");
|
||||
} else if (value->cast<NameObject>()->name() != "Identity") {
|
||||
TODO();
|
||||
return Error::rendering_unsupported_error("Type0 font: support for non-Identity named cid maps not yet implemented");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -98,7 +98,7 @@ PDFErrorOr<void> Type0Font::initialize(Document* document, NonnullRefPtr<DictObj
|
|||
// FIXME: Support arbitrary CMaps
|
||||
auto cmap_value = TRY(dict->get_object(document, CommonNames::Encoding));
|
||||
if (!cmap_value->is<NameObject>() || cmap_value->cast<NameObject>()->name() != CommonNames::IdentityH)
|
||||
TODO();
|
||||
return Error::rendering_unsupported_error("Type0 font: support for general Encodings not yet implemented");
|
||||
|
||||
auto descendant_font_value = TRY(dict->get_array(document, CommonNames::DescendantFonts));
|
||||
auto descendant_font = TRY(descendant_font_value->get_dict_at(document, 0));
|
||||
|
|
Loading…
Reference in a new issue