瀏覽代碼

LibWeb: Use scaled font when painting list item markers

This now uses the current font (rather than the painter's default)
and scales it correctly. This is not perfect though as just naviely
doing .draw_text() here does not follow the proper text layout logic
so this is misaligned (by a pixel or two) with the text in the <li>.
MacDue 2 年之前
父節點
當前提交
f409f68a9a
共有 1 個文件被更改,包括 3 次插入1 次删除
  1. 3 1
      Userland/Libraries/LibWeb/Painting/MarkerPaintable.cpp

+ 3 - 1
Userland/Libraries/LibWeb/Painting/MarkerPaintable.cpp

@@ -79,7 +79,9 @@ void MarkerPaintable::paint(PaintContext& context, PaintPhase phase) const
     case CSS::ListStyleType::UpperRoman:
         if (layout_box().text().is_null())
             break;
-        context.painter().draw_text(device_enclosing.to_type<int>(), layout_box().text(), Gfx::TextAlignment::Center);
+        // FIXME: This should use proper text layout logic!
+        // This does not line up with the text in the <li> element which looks very sad :(
+        context.painter().draw_text(device_enclosing.to_type<int>(), layout_box().text(), layout_box().scaled_font(context), Gfx::TextAlignment::Center);
         break;
     case CSS::ListStyleType::None:
         return;