Преглед изворни кода

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;