mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 03:47:35 +00:00
LibGfx/OpenType: Load x-height metrics from OS/2 table if available
Before this change we always returned the font's point size as the x-height which was basically never correct. We now get it from the OS/2 table (if one with version >= 2 is available in the file). Otherwise we fall back to using the ascent of the 'x' glyph. Most fonts appear to have a sufficiently modern OS/2 table.
This commit is contained in:
parent
8090adf268
commit
69c33bd4ca
6 changed files with 50 additions and 1 deletions
4
Tests/LibWeb/Layout/expected/css-ex-unit.txt
Normal file
4
Tests/LibWeb/Layout/expected/css-ex-unit.txt
Normal file
|
@ -0,0 +1,4 @@
|
|||
Viewport <#document> at (0,0) content-size 800x600 children: not-inline
|
||||
BlockContainer <html> at (0,0) content-size 800x177.132812 [BFC] children: not-inline
|
||||
BlockContainer <body> at (8,8) content-size 784x161.132812 children: not-inline
|
||||
BlockContainer <div> at (8,8) content-size 107.421875x161.132812 children: not-inline
|
8
Tests/LibWeb/Layout/input/css-ex-unit.html
Normal file
8
Tests/LibWeb/Layout/input/css-ex-unit.html
Normal file
|
@ -0,0 +1,8 @@
|
|||
<!doctype html><style>
|
||||
div {
|
||||
font: 20px SerenitySans;
|
||||
width: 10ex;
|
||||
height: 15ex;
|
||||
background: red;
|
||||
}
|
||||
</style><div>
|
Loading…
Add table
Add a link
Reference in a new issue