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

LibPDF: Make SimpleFont font matrix configurable

Type 3 fonts can set it to a custom value.
This commit is contained in:
Nico Weber 2023-11-15 07:46:04 -05:00 committed by Sam Atkins
parent 4cd1a2d319
commit 9632d8ee49
2 changed files with 9 additions and 2 deletions

View file

@ -52,11 +52,11 @@ PDFErrorOr<Gfx::FloatPoint> SimpleFont::draw_string(Gfx::Painter& painter, Gfx::
// and use the default width for the given font otherwise.
float glyph_width;
if (auto width = m_widths.get(char_code); width.has_value())
glyph_width = font_size * width.value() / 1000.0f;
glyph_width = font_size * width.value() * m_font_matrix.x_scale();
else if (auto width = get_glyph_width(char_code); width.has_value())
glyph_width = width.value();
else
glyph_width = m_missing_width;
glyph_width = m_missing_width; // FIXME: times m_font_matrix.x_scale() probably?
TRY(draw_glyph(painter, glyph_position, glyph_width, char_code, paint_color));