Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upFix FontTemplateDescriptor under FreeType #19928
Conversation
highfive
commented
Feb 1, 2018
|
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. |
|
OK, I've added a test. I tried to use the existing test fonts in |
| @@ -9,7 +9,7 @@ use font_cache_thread::FontCacheThread; | |||
| use font_template::FontTemplateDescriptor; | |||
| use malloc_size_of::{MallocSizeOf, MallocSizeOfOps}; | |||
| use platform::font::FontHandle; | |||
| use platform::font_context::FontContextHandle; | |||
| pub use platform::font_context::FontContextHandle; | |||
This comment has been minimized.
This comment has been minimized.
jonleighton
Feb 4, 2018
Author
Contributor
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
|
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 |
|
|
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 -->
|
|
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 -->
|
|
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.
|
@bors-servo r+ |
|
|
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 -->
|
|
|
@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 -->
|
|
|
@bors-servo retry |
|
|
|
|
jonleighton commentedFeb 1, 2018
•
edited by SimonSapin
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