Skip to content

Commit

Permalink
LibGfx+LibWeb: Use harfbuzz for text shaping
Browse files Browse the repository at this point in the history
This replaces glyph positioning system with harfbuzz's shaping
algorithm. Adding support for bidirectional encoded text.
  • Loading branch information
BenJilks authored and kalenikaliaksandr committed Aug 16, 2024
1 parent 0d05ab2 commit 0d63269
Show file tree
Hide file tree
Showing 48 changed files with 363 additions and 331 deletions.
36 changes: 18 additions & 18 deletions Tests/LibWeb/Layout/expected/acid1.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline
BlockContainer <ul> at (135,45) content-size 340x0 children: inline
TextNode <#text>
BlockContainer <li> at (150,60) content-size 50x90 floating [BFC] children: inline
frag 0 from TextNode start: 0, length: 7, rect: [150,60 37.875x10] baseline: 8
frag 0 from TextNode start: 0, length: 7, rect: [150,60 37.890625x10] baseline: 8
"the way"
TextNode <#text>
TextNode <#text>
BlockContainer <li#bar> at (235,55) content-size 139.96875x90 floating [BFC] children: not-inline
BlockContainer <(anonymous)> at (235,55) content-size 139.96875x0 children: inline
TextNode <#text>
BlockContainer <p> at (235,55) content-size 139.96875x10 children: inline
frag 0 from TextNode start: 0, length: 14, rect: [235,55 74.3125x10] baseline: 8
frag 0 from TextNode start: 0, length: 14, rect: [235,55 74.296875x10] baseline: 8
"the world ends"
TextNode <#text>
BlockContainer <(anonymous)> at (235,65) content-size 139.96875x0 children: inline
Expand All @@ -36,14 +36,14 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline
TextNode <#text>
TextNode <#text>
BlockContainer <p> at (235,65) content-size 139.96875x19 children: inline
frag 0 from TextNode start: 1, length: 5, rect: [235,65 27.484375x19] baseline: 12.5
frag 0 from TextNode start: 1, length: 5, rect: [235,65 27.5x19] baseline: 12.5
"bang "
frag 1 from RadioButton start: 0, length: 0, rect: [262,65 12x12] baseline: 12
frag 1 from RadioButton start: 0, length: 0, rect: [263,65 12x12] baseline: 12
TextNode <#text>
RadioButton <input> at (262,65) content-size 12x12 inline-block children: not-inline
RadioButton <input> at (263,65) content-size 12x12 inline-block children: not-inline
TextNode <#text>
BlockContainer <p> at (235,84) content-size 139.96875x19 children: inline
frag 0 from TextNode start: 1, length: 8, rect: [235,84 45.15625x19] baseline: 12.5
frag 0 from TextNode start: 1, length: 8, rect: [235,84 45.171875x19] baseline: 12.5
"whimper "
frag 1 from RadioButton start: 0, length: 0, rect: [280,84 12x12] baseline: 12
TextNode <#text>
Expand All @@ -53,9 +53,9 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline
TextNode <#text>
TextNode <#text>
BlockContainer <li> at (409.96875,60) content-size 50x90 floating [BFC] children: inline
frag 0 from TextNode start: 0, length: 6, rect: [409.96875,60 31.578125x10] baseline: 8
frag 0 from TextNode start: 0, length: 6, rect: [409.96875,60 31.59375x10] baseline: 8
"i grow"
frag 1 from TextNode start: 7, length: 3, rect: [409.96875,70 14.03125x10] baseline: 8
frag 1 from TextNode start: 7, length: 3, rect: [409.96875,70 14.015625x10] baseline: 8
"old"
TextNode <#text>
TextNode <#text>
Expand All @@ -72,7 +72,7 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline
BlockContainer <address> at (280,195) content-size 50x20 children: inline
frag 0 from TextNode start: 0, length: 3, rect: [280,195 17.28125x10] baseline: 8
"bar"
frag 1 from TextNode start: 4, length: 6, rect: [280,205 30.21875x10] baseline: 8
frag 1 from TextNode start: 4, length: 6, rect: [280,205 30.234375x10] baseline: 8
"maids,"
TextNode <#text>
BlockContainer <(anonymous)> at (280,215) content-size 50x0 children: inline
Expand All @@ -81,36 +81,36 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline
BlockContainer <h1> at (365,185) content-size 100x100 floating [BFC] children: inline
frag 0 from TextNode start: 0, length: 11, rect: [365,185 56.421875x10] baseline: 8
"sing to me,"
frag 1 from TextNode start: 12, length: 12, rect: [365,195 65.4375x10] baseline: 8
frag 1 from TextNode start: 12, length: 12, rect: [365,195 65.46875x10] baseline: 8
"erbarme dich"
TextNode <#text>
TextNode <#text>
TextNode <#text>
BlockContainer <(anonymous)> at (20,30) content-size 480x0 children: inline
TextNode <#text>
BlockContainer <p> at (20,335) content-size 480x65 children: inline
frag 0 from TextNode start: 1, length: 90, rect: [20,335 473.625x13] baseline: 9.5
frag 0 from TextNode start: 1, length: 90, rect: [20,335 473.6875x13] baseline: 9.5
"This is a nonsensical document, but syntactically valid HTML 4.0. All 100%-conformant CSS1"
frag 1 from TextNode start: 92, length: 74, rect: [20,348 396.96875x13] baseline: 9.5
"agents should be able to render the document elements above this paragraph"
frag 2 from TextNode start: 167, length: 43, rect: [20,361 207.890625x13] baseline: 9.5
frag 2 from TextNode start: 167, length: 43, rect: [20,361 207.9375x13] baseline: 9.5
"indistinguishably (to the pixel) from this "
frag 3 from TextNode start: 0, length: 31, rect: [331,361 159.671875x13] baseline: 9.5
" (except font rasterization and"
frag 4 from TextNode start: 32, length: 89, rect: [20,374 465.015625x13] baseline: 9.5
frag 4 from TextNode start: 32, length: 89, rect: [20,374 465.09375x13] baseline: 9.5
"form widgets). All discrepancies should be traceable to CSS1 implementation shortcomings."
frag 5 from TextNode start: 122, length: 67, rect: [20,387 345.546875x13] baseline: 9.5
frag 5 from TextNode start: 122, length: 67, rect: [20,387 345.59375x13] baseline: 9.5
"Once you have finished evaluating this test, you can return to the "
frag 6 from TextNode start: 0, length: 1, rect: [425,387 2.71875x13] baseline: 9.5
frag 6 from TextNode start: 0, length: 1, rect: [426,387 2.71875x13] baseline: 9.5
"."
TextNode <#text>
InlineNode <a>
frag 0 from TextNode start: 0, length: 20, rect: [228,361 103.015625x13] baseline: 9.5
frag 0 from TextNode start: 0, length: 20, rect: [228,361 103.03125x13] baseline: 9.5
"reference rendering,"
TextNode <#text>
TextNode <#text>
InlineNode <a>
frag 0 from TextNode start: 0, length: 11, rect: [366,387 59.890625x13] baseline: 9.5
frag 0 from TextNode start: 0, length: 11, rect: [366,387 59.90625x13] baseline: 9.5
"parent page"
TextNode <#text>
TextNode <#text>
Expand Down Expand Up @@ -138,7 +138,7 @@ ViewportPaintable (Viewport<#document>) [0,0 800x600]
InlinePaintable (InlineNode<FORM>)
PaintableWithLines (BlockContainer<P>) [235,65 139.96875x19]
TextPaintable (TextNode<#text>)
RadioButtonPaintable (RadioButton<INPUT>) [262,65 12x12]
RadioButtonPaintable (RadioButton<INPUT>) [263,65 12x12]
PaintableWithLines (BlockContainer<P>) [235,84 139.96875x19]
TextPaintable (TextNode<#text>)
RadioButtonPaintable (RadioButton<INPUT>) [280,84 12x12]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
Viewport <#document> at (0,0) content-size 800x600 children: not-inline
BlockContainer <html> at (0,0) content-size 800x75 [BFC] children: not-inline
BlockContainer <body> at (8,8) content-size 784x59 children: inline
frag 0 from BlockContainer start: 0, length: 0, rect: [13,10 414.640625x55] baseline: 44.484375
BlockContainer <button.button_button___eDCW> at (13,10) content-size 414.640625x55 positioned inline-block [BFC] children: not-inline
BlockContainer <(anonymous)> at (13,10) content-size 414.640625x55 flex-container(column) [FFC] children: not-inline
BlockContainer <(anonymous)> at (13,10) content-size 414.640625x55 flex-item [BFC] children: inline
frag 0 from TextNode start: 0, length: 14, rect: [13,10 414.640625x55] baseline: 42.484375
frag 0 from BlockContainer start: 0, length: 0, rect: [13,10 414.703125x55] baseline: 44.484375
BlockContainer <button.button_button___eDCW> at (13,10) content-size 414.703125x55 positioned inline-block [BFC] children: not-inline
BlockContainer <(anonymous)> at (13,10) content-size 414.703125x55 flex-container(column) [FFC] children: not-inline
BlockContainer <(anonymous)> at (13,10) content-size 414.703125x55 flex-item [BFC] children: inline
frag 0 from TextNode start: 0, length: 14, rect: [13,10 414.703125x55] baseline: 42.484375
"See more games"
TextNode <#text>
BlockContainer <(anonymous)> at (9,9) content-size 422.640625x57 positioned [BFC] children: inline
BlockContainer <(anonymous)> at (9,9) content-size 422.703125x57 positioned [BFC] children: inline
TextNode <#text>

ViewportPaintable (Viewport<#document>) [0,0 800x600]
PaintableWithLines (BlockContainer<HTML>) [0,0 800x75]
PaintableWithLines (BlockContainer<BODY>) [8,8 784x59]
PaintableWithLines (BlockContainer<BUTTON>.button_button___eDCW) [8,8 424.640625x59]
PaintableWithLines (BlockContainer(anonymous)) [13,10 414.640625x55]
PaintableWithLines (BlockContainer(anonymous)) [13,10 414.640625x55]
PaintableWithLines (BlockContainer<BUTTON>.button_button___eDCW) [8,8 424.703125x59]
PaintableWithLines (BlockContainer(anonymous)) [13,10 414.703125x55]
PaintableWithLines (BlockContainer(anonymous)) [13,10 414.703125x55]
TextPaintable (TextNode<#text>)
PaintableWithLines (BlockContainer(anonymous)) [9,9 422.640625x57]
PaintableWithLines (BlockContainer(anonymous)) [9,9 422.703125x57]
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
Viewport <#document> at (0,0) content-size 800x600 children: not-inline
BlockContainer <html> at (0,0) content-size 800x75 [BFC] children: not-inline
BlockContainer <body> at (8,8) content-size 784x59 children: inline
frag 0 from BlockContainer start: 0, length: 0, rect: [13,10 414.640625x55] baseline: 44.484375
BlockContainer <button.button_button___eDCW> at (13,10) content-size 414.640625x55 positioned inline-block [BFC] children: not-inline
BlockContainer <(anonymous)> at (9,9) content-size 422.640625x57 positioned [BFC] children: inline
frag 0 from BlockContainer start: 0, length: 0, rect: [13,10 414.703125x55] baseline: 44.484375
BlockContainer <button.button_button___eDCW> at (13,10) content-size 414.703125x55 positioned inline-block [BFC] children: not-inline
BlockContainer <(anonymous)> at (9,9) content-size 422.703125x57 positioned [BFC] children: inline
TextNode <#text>
BlockContainer <(anonymous)> at (13,10) content-size 414.640625x55 flex-container(column) [FFC] children: not-inline
BlockContainer <(anonymous)> at (13,10) content-size 414.640625x55 flex-item [BFC] children: inline
frag 0 from TextNode start: 0, length: 14, rect: [13,10 414.640625x55] baseline: 42.484375
BlockContainer <(anonymous)> at (13,10) content-size 414.703125x55 flex-container(column) [FFC] children: not-inline
BlockContainer <(anonymous)> at (13,10) content-size 414.703125x55 flex-item [BFC] children: inline
frag 0 from TextNode start: 0, length: 14, rect: [13,10 414.703125x55] baseline: 42.484375
"See more games"
TextNode <#text>

ViewportPaintable (Viewport<#document>) [0,0 800x600]
PaintableWithLines (BlockContainer<HTML>) [0,0 800x75]
PaintableWithLines (BlockContainer<BODY>) [8,8 784x59]
PaintableWithLines (BlockContainer<BUTTON>.button_button___eDCW) [8,8 424.640625x59]
PaintableWithLines (BlockContainer(anonymous)) [9,9 422.640625x57]
PaintableWithLines (BlockContainer(anonymous)) [13,10 414.640625x55]
PaintableWithLines (BlockContainer(anonymous)) [13,10 414.640625x55]
PaintableWithLines (BlockContainer<BUTTON>.button_button___eDCW) [8,8 424.703125x59]
PaintableWithLines (BlockContainer(anonymous)) [9,9 422.703125x57]
PaintableWithLines (BlockContainer(anonymous)) [13,10 414.703125x55]
PaintableWithLines (BlockContainer(anonymous)) [13,10 414.703125x55]
TextPaintable (TextNode<#text>)
Loading

0 comments on commit 0d63269

Please sign in to comment.