mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-21 18:37:58 +03:00
LibPDF: Return an error if we fail to load a replacement font
This commit is contained in:
parent
96064ec5af
commit
a2b57dd188
Notes:
sideshowbarker
2024-07-17 21:11:12 +09:00
Author: https://github.com/janso3 Commit: https://github.com/SerenityOS/serenity/commit/a2b57dd188 Pull-request: https://github.com/SerenityOS/serenity/pull/17443 Reviewed-by: https://github.com/linusg Reviewed-by: https://github.com/rtobar ✅
@ -38,7 +38,8 @@ PDFErrorOr<void> PDFFont::CommonData::load_from_dict(Document* document, Nonnull
|
|||||||
auto replacement = replacement_for_standard_latin_font(base_font);
|
auto replacement = replacement_for_standard_latin_font(base_font);
|
||||||
float point_size = (font_size * POINTS_PER_INCH) / DEFAULT_DPI;
|
float point_size = (font_size * POINTS_PER_INCH) / DEFAULT_DPI;
|
||||||
font = Gfx::FontDatabase::the().get(replacement.get<0>(), replacement.get<1>(), point_size);
|
font = Gfx::FontDatabase::the().get(replacement.get<0>(), replacement.get<1>(), point_size);
|
||||||
VERIFY(font);
|
if (!font)
|
||||||
|
return Error(Error::Type::Internal, DeprecatedString::formatted("Failed to load {} {} at {}pt", replacement.get<0>(), replacement.get<1>(), point_size));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dict->contains(CommonNames::Encoding)) {
|
if (dict->contains(CommonNames::Encoding)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user