From f409f68a9aaa51f0e1b6a157e73c6edb16e3de24 Mon Sep 17 00:00:00 2001 From: MacDue Date: Sat, 1 Apr 2023 21:14:21 +0100 Subject: [PATCH] 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
  • . --- Userland/Libraries/LibWeb/Painting/MarkerPaintable.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Userland/Libraries/LibWeb/Painting/MarkerPaintable.cpp b/Userland/Libraries/LibWeb/Painting/MarkerPaintable.cpp index 4fe591a181..5e347f3454 100644 --- a/Userland/Libraries/LibWeb/Painting/MarkerPaintable.cpp +++ b/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(), layout_box().text(), Gfx::TextAlignment::Center); + // FIXME: This should use proper text layout logic! + // This does not line up with the text in the
  • element which looks very sad :( + context.painter().draw_text(device_enclosing.to_type(), layout_box().text(), layout_box().scaled_font(context), Gfx::TextAlignment::Center); break; case CSS::ListStyleType::None: return;