From 0d63269cb7042dc99e72b320f233d97a4fc284d1 Mon Sep 17 00:00:00 2001 From: BenJilks Date: Tue, 13 Aug 2024 17:05:43 +0100 Subject: [PATCH] LibGfx+LibWeb: Use harfbuzz for text shaping This replaces glyph positioning system with harfbuzz's shaping algorithm. Adding support for bidirectional encoded text. --- Tests/LibWeb/Layout/expected/acid1.txt | 36 ++-- .../button-with-after-pseudo.txt | 20 +-- .../button-with-before-pseudo.txt | 20 +-- ...d-right-with-justified-text-in-between.txt | 156 +++++++++--------- ...at-left-and-right-with-text-in-between.txt | 36 ++-- .../float-should-avoid-inline-block.txt | 8 +- ...line-block-contained-by-abspos-element.txt | 12 +- ...max-width-for-box-with-inline-children.txt | 4 +- ...min-width-for-box-with-inline-children.txt | 2 +- ...-box-for-definite-sizes-without-layout.txt | 12 +- .../Layout/expected/css-dir-selector.txt | 12 +- .../Layout/expected/css-font-size-calc.txt | 2 +- .../Layout/expected/css-import-rule.txt | 2 +- ...css-line-height-percentage-inheritance.txt | 2 +- .../expected/css-namespace-rule-matches.txt | 2 +- .../expected/css-namespace-rule-no-match.txt | 2 +- .../css-namespace-tag-name-selector.txt | 2 +- ...g-auto-width-with-max-width-constraint.txt | 8 +- .../Layout/expected/flex/calc-flex-basis.txt | 8 +- ...etComputedStyle-on-unconnected-element.txt | 2 +- .../Layout/expected/grid/grid-span-4.txt | 4 +- ...-of-absolute-position-box-with-padding.txt | 2 +- Tests/LibWeb/Layout/expected/inline-size.txt | 6 +- .../expected/input-as-button-align-center.txt | 8 +- .../input-as-button-shrink-to-fit.txt | 20 +-- .../Layout/expected/input-placeholder.txt | 20 +-- ...text-node-invalidation-on-value-change.txt | 2 +- ...seudo-element-with-custom-properties-2.txt | 6 +- .../svg-text-with-percentage-values.txt | 8 +- .../Layout/expected/svg-text-with-viewbox.txt | 8 +- .../table/vertical-align-baseline.txt | 44 ++--- .../Layout/expected/textarea-content.txt | 6 +- .../images/css-background-clip-text.png | Bin 274655 -> 274671 bytes .../Screenshot/images/object-fit-position.png | Bin 690108 -> 690122 bytes .../images/svg-text-effects-ref.png | Bin 18402 -> 18358 bytes Userland/Libraries/LibGfx/CMakeLists.txt | 3 +- Userland/Libraries/LibGfx/Font/Font.cpp | 17 ++ Userland/Libraries/LibGfx/Font/Font.h | 8 +- Userland/Libraries/LibGfx/Font/Typeface.cpp | 20 ++- Userland/Libraries/LibGfx/Font/Typeface.h | 5 + Userland/Libraries/LibGfx/Path.cpp | 10 +- Userland/Libraries/LibGfx/TextLayout.cpp | 99 +++++++---- Userland/Libraries/LibGfx/TextLayout.h | 45 +---- .../LibWeb/Layout/InlineFormattingContext.cpp | 2 +- .../LibWeb/Layout/InlineLevelIterator.cpp | 1 - .../LibWeb/Painting/DisplayListPlayerSkia.cpp | 4 +- .../LibWeb/Painting/DisplayListRecorder.cpp | 1 - vcpkg.json | 1 + 48 files changed, 365 insertions(+), 333 deletions(-) diff --git a/Tests/LibWeb/Layout/expected/acid1.txt b/Tests/LibWeb/Layout/expected/acid1.txt index 1b100773a39..7379b1b2706 100644 --- a/Tests/LibWeb/Layout/expected/acid1.txt +++ b/Tests/LibWeb/Layout/expected/acid1.txt @@ -18,7 +18,7 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline BlockContainer