Browse Source

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 years ago
parent
commit
f409f68a9a
1 changed files with 3 additions and 1 deletions
  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;