LibGfx+LibWeb: Add Path::glyph_run() and use in canvas

Canvas text painting needs to support per-glyph font fallbacks, which
means we can't hand over responsibility for text shaping to Skia and
instead need to extract glyph paths from our own shaped GlyphRun.
This commit is contained in:
Aliaksandr Kalenik 2025-04-19 18:40:17 +02:00 committed by Andreas Kling
parent 2c64c6d773
commit 1e7922fac8
Notes: github-actions[bot] 2025-04-21 07:52:25 +00:00
6 changed files with 22 additions and 2 deletions

View file

@ -235,8 +235,8 @@ Gfx::Path CanvasRenderingContext2D::text_path(StringView text, float x, float y,
auto const& font = font_cascade_list()->first();
Gfx::Path path;
path.move_to({ x, y });
path.text(Utf8View { text }, font);
auto glyph_run = Gfx::shape_text({ x, y }, 0, Utf8View(text), font, Gfx::GlyphRun::TextType::Ltr, {});
path.glyph_run(*glyph_run);
auto text_width = path.bounding_box().width();
Gfx::AffineTransform transform = {};