diff options
author | Matthew Olsson <matthewcolsson@gmail.com> | 2022-03-25 08:14:19 -0700 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-03-31 18:10:45 +0200 |
commit | 058cf5f7f7e482a9baba4e8414f275504bc248d4 (patch) | |
tree | 2389bfedc32540104a104ed3e80250d15d60083b /Userland/Libraries/LibPDF | |
parent | 5f9d35909d96c14256e4fd2354066e75d1e4bf94 (diff) | |
download | serenity-058cf5f7f7e482a9baba4e8414f275504bc248d4.zip |
LibPDF: Accept font size in PDFFont::get_char_width
This will be required for TTF fonts
Diffstat (limited to 'Userland/Libraries/LibPDF')
-rw-r--r-- | Userland/Libraries/LibPDF/Fonts/PDFFont.h | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibPDF/Fonts/Type1Font.cpp | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibPDF/Fonts/Type1Font.h | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibPDF/Renderer.cpp | 2 |
4 files changed, 4 insertions, 4 deletions
diff --git a/Userland/Libraries/LibPDF/Fonts/PDFFont.h b/Userland/Libraries/LibPDF/Fonts/PDFFont.h index 6f3f0ce671..0b28012c57 100644 --- a/Userland/Libraries/LibPDF/Fonts/PDFFont.h +++ b/Userland/Libraries/LibPDF/Fonts/PDFFont.h @@ -17,7 +17,7 @@ public: virtual ~PDFFont() = default; virtual u32 char_code_to_code_point(u16 char_code) const = 0; - virtual float get_char_width(u16 char_code) const = 0; + virtual float get_char_width(u16 char_code, float font_size) const = 0; }; } diff --git a/Userland/Libraries/LibPDF/Fonts/Type1Font.cpp b/Userland/Libraries/LibPDF/Fonts/Type1Font.cpp index 315e808579..e5e144ed34 100644 --- a/Userland/Libraries/LibPDF/Fonts/Type1Font.cpp +++ b/Userland/Libraries/LibPDF/Fonts/Type1Font.cpp @@ -88,7 +88,7 @@ u32 Type1Font::char_code_to_code_point(u16 char_code) const return descriptor.code_point; } -float Type1Font::get_char_width(u16 char_code) const +float Type1Font::get_char_width(u16 char_code, float) const { u16 width; if (auto char_code_width = m_widths.get(char_code); char_code_width.has_value()) { diff --git a/Userland/Libraries/LibPDF/Fonts/Type1Font.h b/Userland/Libraries/LibPDF/Fonts/Type1Font.h index 361d2229cf..6bd3e98caa 100644 --- a/Userland/Libraries/LibPDF/Fonts/Type1Font.h +++ b/Userland/Libraries/LibPDF/Fonts/Type1Font.h @@ -19,7 +19,7 @@ public: ~Type1Font() override = default; u32 char_code_to_code_point(u16 char_code) const override; - float get_char_width(u16 char_code) const override; + float get_char_width(u16 char_code, float font_size) const override; private: RefPtr<StreamObject> m_to_unicode; diff --git a/Userland/Libraries/LibPDF/Renderer.cpp b/Userland/Libraries/LibPDF/Renderer.cpp index 7e95d21a0a..20264ab475 100644 --- a/Userland/Libraries/LibPDF/Renderer.cpp +++ b/Userland/Libraries/LibPDF/Renderer.cpp @@ -654,7 +654,7 @@ void Renderer::show_text(String const& string, float shift) for (auto char_code : string.bytes()) { auto code_point = text_state().font->char_code_to_code_point(char_code); - auto char_width = text_state().font->get_char_width(char_code); + auto char_width = text_state().font->get_char_width(char_code, font_size); if (code_point != 0x20) m_painter.draw_glyph(glyph_position.to_type<int>(), code_point, *font, state().paint_color); |