Repository navigation
Fix FontTemplateDescriptor under FreeType - #19928
Conversation
|
I would like to implement tests for this change, but need some guidance. I asked about this in IRC but got no response:
I see two options (or both):
Advice please! |
|
Go ahead and enable the tests. They were added when we weren't paying attention; there's no reason I know of not to run them in Servo. |
See servo#19928 (comment) Note that some of these tests require you to install the fonts found in tests/wpt/web-platform-tests/css/fonts.
Enable css-fonts WPT tests See #19928 (comment) Note that some of these tests require you to install the fonts found in tests/wpt/web-platform-tests/css/fonts. r? @jdm <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/19930) <!-- Reviewable:end -->
See servo#19928 (comment) Note that some of these tests require you to install the fonts found in tests/wpt/web-platform-tests/css/fonts.
Enable css-fonts WPT tests See #19928 (comment) Note that some of these tests require you to install the fonts found in tests/wpt/web-platform-tests/css/fonts. r? @jdm <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/19930) <!-- Reviewable:end -->
|
I've been looking into how to test this and have hit several roadblocks after enabling the css-fonts tests. The change to how the font weight is detected is captured by css/css-fonts/font-weight-normal-001.xht. (I haven't found an existing test which captures the font stretch fix.) However, it doesn't easily show this bug fix for two reasons:
Therefore I propose to write a unit test to encapsulate this change. |
|
A unit test sounds sensible, in that case. |
9f867ac to
38622c7
Compare
|
OK, I've added a test. I tried to use the existing test fonts in |
| use malloc_size_of::{MallocSizeOf, MallocSizeOfOps}; | ||
| use platform::font::FontHandle; | ||
| use platform::font_context::FontContextHandle; | ||
| pub use platform::font_context::FontContextHandle; |
There was a problem hiding this comment.
I had to do this for the test, which doesn't seem ideal but I struggled to find an alternative. In the existing code, a FontContext instantiates a FontContextHandle, but instantiating a FontContext requires lots of dependencies (some of them external to this crate too).
fd68b22 to
ecf441d
Compare
|
The test I wrote failed on Windows but it's fixed now. |
|
@emilio has reviewed and says he's happy with the code, but he's unsure about whether there are licensing issues caused by the inclusion of the DejaVu fonts for testing: https://mozilla.logbot.info/servo/20180206#c14250864-c14250932 |
|
The license is fine. |
|
@bors-servo r=emilio,jack |
|
📌 Commit ecf441d has been approved by |
Fix FontTemplateDescriptor under FreeType Issue #17321. Under Linux, using "font-family: sans-serif" previously caused Servo to select the "UltraLight" face (of DejaVu Sans). There were two reasons for this: 1. Font weight was only retrieved from the OS/2 table for bold faces. This neglected to retrieve the weight information for "lighter than normal" weight faces. This meant that the UltraLight face appeared as normal weight, and was selected. 2. Retrieval of font stretch information from the OS/2 table was not implemented at all. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/19928) <!-- Reviewable:end -->
|
💔 Test failed - mac-dev-unit |
Add my SSH key In servo/servo#19928 @metajack suggested that I could use one of the builders to work on Mac-specific code and @jdm requested I submit my key in a PR here. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/saltfs/795) <!-- Reviewable:end -->
|
💔 Test failed - mac-dev-unit |
Issue servo#17321. Under Linux, using "font-family: sans-serif" previously caused Servo to select the "UltraLight" face (of DejaVu Sans). There were two reasons for this: 1. Font weight was only retrieved from the OS/2 table for bold faces. This neglected to retrieve the weight information for "lighter than normal" weight faces. This meant that the UltraLight face appeared as normal weight, and was selected. 2. Retrieval of font stretch information from the OS/2 table was not implemented at all.
ae1020f to
446b0e4
Compare
|
@bors-servo r+ |
|
📌 Commit 446b0e4 has been approved by |
Fix FontTemplateDescriptor under FreeType Issue #17321. Under Linux, using "font-family: sans-serif" previously caused Servo to select the "UltraLight" face (of DejaVu Sans). There were two reasons for this: 1. Font weight was only retrieved from the OS/2 table for bold faces. This neglected to retrieve the weight information for "lighter than normal" weight faces. This meant that the UltraLight face appeared as normal weight, and was selected. 2. Retrieval of font stretch information from the OS/2 table was not implemented at all. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/19928) <!-- Reviewable:end -->
|
💔 Test failed - linux-dev |
|
@bors-servo retry
|
Fix FontTemplateDescriptor under FreeType Issue #17321. Under Linux, using "font-family: sans-serif" previously caused Servo to select the "UltraLight" face (of DejaVu Sans). There were two reasons for this: 1. Font weight was only retrieved from the OS/2 table for bold faces. This neglected to retrieve the weight information for "lighter than normal" weight faces. This meant that the UltraLight face appeared as normal weight, and was selected. 2. Retrieval of font stretch information from the OS/2 table was not implemented at all. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/19928) <!-- Reviewable:end -->
|
💔 Test failed - linux-rel-wpt |
|
⚡ Previous build results for android, arm32, arm64, linux-dev, linux-rel-css, mac-dev-unit, mac-rel-css1, mac-rel-wpt4, windows-msvc-dev are reusable. Rebuilding only linux-rel-wpt, mac-rel-css2, mac-rel-wpt1, mac-rel-wpt2, mac-rel-wpt3... |
|
☀️ Test successful - android, arm32, arm64, linux-dev, linux-rel-css, linux-rel-wpt, mac-dev-unit, mac-rel-css1, mac-rel-css2, mac-rel-wpt1, mac-rel-wpt2, mac-rel-wpt3, mac-rel-wpt4, windows-msvc-dev |
Issue #17321. Under Linux, using "font-family: sans-serif" previously
caused Servo to select the "UltraLight" face (of DejaVu Sans). There were
two reasons for this:
Font weight was only retrieved from the OS/2 table for bold faces.
This neglected to retrieve the weight information for "lighter than
normal" weight faces. This meant that the UltraLight face appeared as
normal weight, and was selected.
Retrieval of font stretch information from the OS/2 table was not
implemented at all.
This change is