浏览代码

LibPDF: Account for inverted y axis when rendering text

Matthew Olsson 4 年之前
父节点
当前提交
cafd7c11b4
共有 1 个文件被更改,包括 1 次插入0 次删除
  1. 1 0
      Userland/Libraries/LibPDF/Renderer.cpp

+ 1 - 0
Userland/Libraries/LibPDF/Renderer.cpp

@@ -540,6 +540,7 @@ void Renderer::show_text(const String& string, int shift)
 
 
         auto text_position = text_rendering_matrix.map(Gfx::FloatPoint { 0.0f, 0.0f });
         auto text_position = text_rendering_matrix.map(Gfx::FloatPoint { 0.0f, 0.0f });
         text_position.set_y(static_cast<float>(m_bitmap->height()) - text_position.y());
         text_position.set_y(static_cast<float>(m_bitmap->height()) - text_position.y());
+        text_position.set_y(text_position.y() - static_cast<float>(font->baseline()));
 
 
         // FIXME: For some reason, the space character in LiberationSerif is drawn as an exclamation point
         // FIXME: For some reason, the space character in LiberationSerif is drawn as an exclamation point
         if (code_point != 0x20)
         if (code_point != 0x20)