1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 14:27:35 +00:00

LibPDF+MacPDF: Clip text, and add a debug option for disabling it

This commit is contained in:
Nico Weber 2024-01-19 20:01:23 -08:00 committed by Andreas Kling
parent 90fdf738a1
commit a0462f495c
7 changed files with 30 additions and 0 deletions

View file

@ -1011,6 +1011,10 @@ PDFErrorOr<void> Renderer::show_text(ByteString const& string)
if (!text_state().font)
return Error::rendering_unsupported_error("Can't draw text because an invalid font was in use");
OwnPtr<ClipRAII> clip_raii;
if (m_rendering_preferences.clip_text)
clip_raii = make<ClipRAII>(*this);
auto start_position = Gfx::FloatPoint { 0.0f, 0.0f };
auto end_position = TRY(text_state().font->draw_string(m_painter, start_position, string, *this));