Browse Source

LibWeb: Scale font per-glyph in paint_text_shadow()

With the support for unicode-ranges implemented, it's no longer
accurate to assume that all glyphs within a fragment share the same
font.
Aliaksandr Kalenik 1 year ago
parent
commit
f9a7535fb8
1 changed files with 1 additions and 2 deletions
  1. 1 2
      Userland/Libraries/LibWeb/Painting/ShadowPainting.cpp

+ 1 - 2
Userland/Libraries/LibWeb/Painting/ShadowPainting.cpp

@@ -587,14 +587,13 @@ void paint_text_shadow(PaintContext& context, PaintableFragment const& fragment,
     auto fragment_width = context.enclosing_device_pixels(fragment.width()).value();
     auto fragment_width = context.enclosing_device_pixels(fragment.width()).value();
     auto fragment_height = context.enclosing_device_pixels(fragment.height()).value();
     auto fragment_height = context.enclosing_device_pixels(fragment.height()).value();
     auto draw_rect = context.enclosing_device_rect(fragment.absolute_rect()).to_type<int>();
     auto draw_rect = context.enclosing_device_rect(fragment.absolute_rect()).to_type<int>();
-    auto const& scaled_font = fragment.layout_node().scaled_font(context);
     auto fragment_baseline = context.rounded_device_pixels(fragment.baseline()).value();
     auto fragment_baseline = context.rounded_device_pixels(fragment.baseline()).value();
 
 
     Vector<Gfx::DrawGlyphOrEmoji> scaled_glyph_run;
     Vector<Gfx::DrawGlyphOrEmoji> scaled_glyph_run;
     scaled_glyph_run.ensure_capacity(fragment.glyph_run().size());
     scaled_glyph_run.ensure_capacity(fragment.glyph_run().size());
     for (auto glyph : fragment.glyph_run()) {
     for (auto glyph : fragment.glyph_run()) {
         glyph.visit([&](auto& glyph) {
         glyph.visit([&](auto& glyph) {
-            glyph.font = scaled_font;
+            glyph.font = *glyph.font->with_size(glyph.font->point_size() * static_cast<float>(context.device_pixels_per_css_pixel()));
             glyph.position = glyph.position.scaled(context.device_pixels_per_css_pixel());
             glyph.position = glyph.position.scaled(context.device_pixels_per_css_pixel());
         });
         });
         scaled_glyph_run.append(move(glyph));
         scaled_glyph_run.append(move(glyph));