mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 06:07:34 +00:00
LibGfx+LibWeb: Calculate and save glyph positions during layout
Previously, we determined the positions of glyphs for each text run at the time of painting, which constituted a significant portion of the painting process according to profiles. However, since we already go through each glyph to figure out the width of each fragment during layout, we can simultaneously gather data about the position of each glyph in the layout phase and utilize this information in the painting phase. I had to update expectations for a couple of reference tests. These updates are due to the fact that we now measure glyph positions during layout using a 1x font, and then linearly scale each glyph's position to device pixels during painting. This approach should be acceptable, considering we measure a fragment's width and height with an unscaled font during layout.
This commit is contained in:
parent
1a35621930
commit
681771d210
17 changed files with 65 additions and 42 deletions
|
@ -20,7 +20,7 @@ public:
|
|||
CSSPixels bottom() const { return m_bottom; }
|
||||
CSSPixels baseline() const { return m_baseline; }
|
||||
|
||||
void add_fragment(Node const& layout_node, int start, int length, CSSPixels leading_size, CSSPixels trailing_size, CSSPixels leading_margin, CSSPixels trailing_margin, CSSPixels content_width, CSSPixels content_height, CSSPixels border_box_top, CSSPixels border_box_bottom);
|
||||
void add_fragment(Node const& layout_node, int start, int length, CSSPixels leading_size, CSSPixels trailing_size, CSSPixels leading_margin, CSSPixels trailing_margin, CSSPixels content_width, CSSPixels content_height, CSSPixels border_box_top, CSSPixels border_box_bottom, Span<Gfx::DrawGlyphOrEmoji const> = {});
|
||||
|
||||
Vector<LineBoxFragment> const& fragments() const { return m_fragments; }
|
||||
Vector<LineBoxFragment>& fragments() { return m_fragments; }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue