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 upAdd a simple implementation of CanvasRenderingContext2d.fillText #25782
Conversation
highfive
commented
Feb 17, 2020
|
Thanks for the pull request, and welcome! The Servo team is excited to review your changes, and you should hear from @asajeffrey (or someone else) soon. |
|
@bors-servo try=wpt |
Add a simple implementation of CanvasRenderingContext2d.fillText <!-- Please describe your changes on the following line: --> I added a simple implementation of CanvasRenderingContext2d.fillText. Some code are merged from @mikrut, and I fixed a bug about text scaling. Also, the bug of text rotation should be fixed after `raqote` merged my other PR. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #11681 (GitHub issue number if applicable) <!-- Either: --> - [X] There are tests for these changes <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
|
|
This means that you will need to run:
|
|
@jdm
How can I fix it? Does it mean I have to implement the |
|
@kaiakz I gave you the steps to fix it - the current implementation test fails because the reference rendering does not match the test rendering, because the font support isn't implemented. The steps I suggested update the expected test result to indicate that the test will not pass, so the test failure won't be reported as a problem. |
|
r? @pcwalton |
| pattern: canvas_data::Pattern, | ||
| draw_options: &DrawOptions, | ||
| ) { | ||
| let font = SystemSource::new() |
This comment has been minimized.
This comment has been minimized.
pcwalton
Feb 21, 2020
Contributor
Needs a TODO because this should eventually use the same infrastructure as layout (i.e. layout should be updated to use font-kit as well).
This comment has been minimized.
This comment has been minimized.
pcwalton
Feb 21, 2020
Contributor
Also, this is in the chrome process, right? It needs to not be in the content process because the content process shouldn't have access to the SystemSource. (It's too dangerous; on macOS for example it needs a connection to the font server, which has had a lot of security vulnerabilities.)
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
kaiakz
Feb 22, 2020
•
Author
Contributor
So, I need to do:
- add a TODO to
raqote_backend.rs - move
font_kitcode fromraqote_backend.rstocanvas_data.rsand pass theSystemSourcethings through` the parameter?(Well, my code made some compromised, since I am not familiar with all components.)
Also, this is in the chrome process, right? It needs to not be in the content process because the content process shouldn't have access to the
SystemSource.
I noticed there is a FontCacheThread, maybe I can use it?
This comment has been minimized.
This comment has been minimized.
jdm
Feb 24, 2020
Member
Let's keep the font_kit code in raqote_backend.rs for now until it's more clear how the proper font integration will work. The FontCacheThread is integrated with many other parts of the system, so converting that code to use font_kit will be part of resolving that TODO.
This comment has been minimized.
This comment has been minimized.
kaiakz
Feb 25, 2020
•
Author
Contributor
@jdm
If I understood well, I moved all font_kit code to raqote_backend.rs, including some functions:
replace_whitespace & get_text_width( They are parts of text preparation algorithm, in fact, I just moved the algorithm to raqote_backend.rs).
I would like to do the converting if have any spare time.
Add a simple implementation of CanvasRenderingContext2d.fillText <!-- Please describe your changes on the following line: --> I added a simple implementation of CanvasRenderingContext2d.fillText. Some code are merged from @mikrut, and I fixed a bug about text scaling. Also, the bug of text rotation should be fixed after `raqote` merged my other PR. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix (part of) #11681 (GitHub issue number if applicable) <!-- Either: --> - [X] There are tests for these changes <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
|
|
|
The layout-2020 equivalents must be updated as well (see #25940 (comment) for an explanation why). The layout-2020 tests' metadata files are located in
|
|
@pylbrecht |
|
Sorry, let's just wait for #25960 to merge. |
|
I did it manually: copying the corresponding .ini file from the regular |
|
@bors-servo retry |
Add a simple implementation of CanvasRenderingContext2d.fillText <!-- Please describe your changes on the following line: --> I added a simple implementation of CanvasRenderingContext2d.fillText. Some code are merged from @mikrut, and I fixed a bug about text scaling. Also, the bug of text rotation should be fixed after `raqote` merged my other PR. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix (part of) #11681 (GitHub issue number if applicable) <!-- Either: --> - [X] There are tests for these changes <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
|
|
|
@bors-servo retry |
|
|
|
This makes servo crash on Windows: #26015 |
kaiakz commentedFeb 17, 2020
•
edited by jdm
I added a simple implementation of CanvasRenderingContext2d.fillText.
Some code are merged from @mikrut, and I fixed a bug about text scaling.
Also, the bug of text rotation should be fixed after
raqotemerged my other PR../mach build -ddoes not report any errors./mach test-tidydoes not report any errors