diff options
Diffstat (limited to 'Userland/Libraries/LibPDF')
-rw-r--r-- | Userland/Libraries/LibPDF/Fonts/PDFFont.h | 1 | ||||
-rw-r--r-- | Userland/Libraries/LibPDF/Fonts/TrueTypeFont.cpp | 12 | ||||
-rw-r--r-- | Userland/Libraries/LibPDF/Fonts/TrueTypeFont.h | 1 | ||||
-rw-r--r-- | Userland/Libraries/LibPDF/Fonts/Type0Font.cpp | 5 | ||||
-rw-r--r-- | Userland/Libraries/LibPDF/Fonts/Type0Font.h | 1 | ||||
-rw-r--r-- | Userland/Libraries/LibPDF/Fonts/Type1Font.cpp | 12 | ||||
-rw-r--r-- | Userland/Libraries/LibPDF/Fonts/Type1Font.h | 1 | ||||
-rw-r--r-- | Userland/Libraries/LibPDF/Renderer.cpp | 11 |
8 files changed, 1 insertions, 43 deletions
diff --git a/Userland/Libraries/LibPDF/Fonts/PDFFont.h b/Userland/Libraries/LibPDF/Fonts/PDFFont.h index 49f0933f77..57d1df9a40 100644 --- a/Userland/Libraries/LibPDF/Fonts/PDFFont.h +++ b/Userland/Libraries/LibPDF/Fonts/PDFFont.h @@ -39,7 +39,6 @@ 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 void draw_glyph(Gfx::Painter& painter, Gfx::FloatPoint point, float width, u32 char_code, Color color) = 0; diff --git a/Userland/Libraries/LibPDF/Fonts/TrueTypeFont.cpp b/Userland/Libraries/LibPDF/Fonts/TrueTypeFont.cpp index 85c5799ca0..527f11bd6c 100644 --- a/Userland/Libraries/LibPDF/Fonts/TrueTypeFont.cpp +++ b/Userland/Libraries/LibPDF/Fonts/TrueTypeFont.cpp @@ -43,18 +43,6 @@ TrueTypeFont::TrueTypeFont(PDFFont::CommonData data) m_is_standard_font = m_data.is_standard_font; } -u32 TrueTypeFont::char_code_to_code_point(u16 char_code) const -{ - if (m_data.to_unicode) - TODO(); - - if (m_data.encoding->should_map_to_bullet(char_code)) - return 8226; // Bullet. - - auto descriptor = m_data.encoding->get_char_code_descriptor(char_code); - return descriptor.code_point; -} - float TrueTypeFont::get_char_width(u16 char_code) const { u16 width; diff --git a/Userland/Libraries/LibPDF/Fonts/TrueTypeFont.h b/Userland/Libraries/LibPDF/Fonts/TrueTypeFont.h index c38b630e4b..bdfeac2545 100644 --- a/Userland/Libraries/LibPDF/Fonts/TrueTypeFont.h +++ b/Userland/Libraries/LibPDF/Fonts/TrueTypeFont.h @@ -21,7 +21,6 @@ public: TrueTypeFont(PDFFont::CommonData); ~TrueTypeFont() override = default; - u32 char_code_to_code_point(u16 char_code) const override; float get_char_width(u16 char_code) const override; void draw_glyph(Gfx::Painter&, Gfx::FloatPoint, float, u32, Color) override; diff --git a/Userland/Libraries/LibPDF/Fonts/Type0Font.cpp b/Userland/Libraries/LibPDF/Fonts/Type0Font.cpp index 402cb702cf..0febd0934e 100644 --- a/Userland/Libraries/LibPDF/Fonts/Type0Font.cpp +++ b/Userland/Libraries/LibPDF/Fonts/Type0Font.cpp @@ -77,11 +77,6 @@ Type0Font::Type0Font(CIDSystemInfo const& system_info, HashMap<u16, u16> const& { } -u32 Type0Font::char_code_to_code_point(u16 char_code) const -{ - return char_code; -} - float Type0Font::get_char_width(u16 char_code) const { u16 width; diff --git a/Userland/Libraries/LibPDF/Fonts/Type0Font.h b/Userland/Libraries/LibPDF/Fonts/Type0Font.h index 0d286de18b..d5745e899e 100644 --- a/Userland/Libraries/LibPDF/Fonts/Type0Font.h +++ b/Userland/Libraries/LibPDF/Fonts/Type0Font.h @@ -24,7 +24,6 @@ public: Type0Font(CIDSystemInfo const&, HashMap<u16, u16> const& widths, u16 missing_width); ~Type0Font() override = default; - u32 char_code_to_code_point(u16 char_code) const override; float get_char_width(u16 char_code) const override; void draw_glyph(Gfx::Painter&, Gfx::FloatPoint, float, u32, Color) override {}; diff --git a/Userland/Libraries/LibPDF/Fonts/Type1Font.cpp b/Userland/Libraries/LibPDF/Fonts/Type1Font.cpp index fd93c815de..334c5ce991 100644 --- a/Userland/Libraries/LibPDF/Fonts/Type1Font.cpp +++ b/Userland/Libraries/LibPDF/Fonts/Type1Font.cpp @@ -63,18 +63,6 @@ Type1Font::Type1Font(Data data) m_is_standard_font = m_data.is_standard_font; } -u32 Type1Font::char_code_to_code_point(u16 char_code) const -{ - if (m_data.to_unicode) - TODO(); - - if (m_data.encoding->should_map_to_bullet(char_code)) - return 8226; // Bullet. - - auto descriptor = m_data.encoding->get_char_code_descriptor(char_code); - return descriptor.code_point; -} - float Type1Font::get_char_width(u16 char_code) const { u16 width; diff --git a/Userland/Libraries/LibPDF/Fonts/Type1Font.h b/Userland/Libraries/LibPDF/Fonts/Type1Font.h index 7a5224bc18..04d7c36ca6 100644 --- a/Userland/Libraries/LibPDF/Fonts/Type1Font.h +++ b/Userland/Libraries/LibPDF/Fonts/Type1Font.h @@ -25,7 +25,6 @@ public: Type1Font(Data); ~Type1Font() override = default; - u32 char_code_to_code_point(u16 char_code) const override; float get_char_width(u16 char_code) const override; void draw_glyph(Gfx::Painter& painter, Gfx::FloatPoint point, float width, u32 char_code, Color color) override; diff --git a/Userland/Libraries/LibPDF/Renderer.cpp b/Userland/Libraries/LibPDF/Renderer.cpp index c5a6d00700..47fd771b4d 100644 --- a/Userland/Libraries/LibPDF/Renderer.cpp +++ b/Userland/Libraries/LibPDF/Renderer.cpp @@ -742,21 +742,12 @@ void Renderer::show_text(DeprecatedString const& string) auto original_position = glyph_position; 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 glyph_width = char_width * font_size; - - if (code_point != 0x20) - text_state().font->draw_glyph(m_painter, glyph_position, glyph_width, char_code, state().paint_color); - + text_state().font->draw_glyph(m_painter, glyph_position, glyph_width, char_code, state().paint_color); auto tx = glyph_width; tx += text_state().character_spacing; - - if (code_point == ' ') - tx += text_state().word_spacing; - tx *= text_state().horizontal_scaling; - glyph_position += { tx, 0.0f }; } |