mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 06:27:45 +00:00
LibPDF: Don't crash when a font hasn't been loaded yet
This could happen because there was a problem while loading the first font in the document.
This commit is contained in:
parent
79b4293687
commit
bf61f94413
1 changed files with 3 additions and 0 deletions
|
@ -726,6 +726,9 @@ PDFErrorOr<void> Renderer::set_graphics_state_from_dict(NonnullRefPtr<DictObject
|
||||||
|
|
||||||
PDFErrorOr<void> Renderer::show_text(DeprecatedString const& string)
|
PDFErrorOr<void> Renderer::show_text(DeprecatedString const& string)
|
||||||
{
|
{
|
||||||
|
if (!text_state().font)
|
||||||
|
return Error::rendering_unsupported_error("Can't draw text because an invalid font was in use");
|
||||||
|
|
||||||
auto& text_rendering_matrix = calculate_text_rendering_matrix();
|
auto& text_rendering_matrix = calculate_text_rendering_matrix();
|
||||||
|
|
||||||
auto font_size = text_rendering_matrix.x_scale() * text_state().font_size;
|
auto font_size = text_rendering_matrix.x_scale() * text_state().font_size;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue