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

LibPDF: Scale default glyph width by font size and x scale

This fixes rendering of commas in 0000941.pdf page 1. The commas
use the default width, and without this they show up very large,
covering the page.

Also, it's nice that the code now looks like the regular case 4 lines
further up.
This commit is contained in:
Nico Weber 2024-02-12 08:10:08 -05:00 committed by Sam Atkins
parent b9afac0a06
commit 751185cb76

View file

@ -69,7 +69,7 @@ PDFErrorOr<Gfx::FloatPoint> SimpleFont::draw_string(Gfx::Painter& painter, Gfx::
else if (auto width = get_glyph_width(char_code); width.has_value())
glyph_width = width.value();
else
glyph_width = m_missing_width; // FIXME: times m_font_matrix.x_scale() probably?
glyph_width = font_size * m_missing_width * m_font_matrix.x_scale();
Gfx::FloatPoint glyph_render_position = text_rendering_matrix.map(glyph_position);
TRY(draw_glyph(painter, glyph_render_position, glyph_width, char_code, renderer));