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 upImplement font rendering on Windows (MSVC) #13371
Comments
|
I wold like to help with this but have no idea where to begin. Would it be possible to use FreeType on (Windows, MSVC)? What are other browsers out there doing? |
|
Other browsers, such as Firefox Chrome IE Edge are all using DirectWrite to render text. It is possible to use freetype, but it's not recommended. |
|
After investigating a little bit, I think I don't have enough time to implement this in the short term. The main problem I see is that I would need to get familiar with font rendering in the first place, which seems to be a very complex topic. For anyone trying to implement this, maybe the directwrite crate can be a starting point. |
|
Today I investigated a little bit more and implemented some functionality on top of the directwrite crate (you can check out the diff). This seems to be the way to go. Take a look at the examples directory to see the new code in action. So far, two big blockers are:
This means that, though the current implementation seems to work, I am unsure about memory safety and absence of memory leaks. Feel free to take a look at it and point out any issues (it would actually be great for someone to mentor) |
|
@aochagavia The link you provided seems to be wrong ... |
|
@Boddlnagg Thanks for the heads up! I just fixed the link. |
|
You might be interested in this: https://gist.github.com/metajack/e75da24fa22d7bbbc6d454513161f8c5 I wrote this quite a while ago, but shows how to use COM from Rust (including implementing your own objects) and implements some of the functionality needed by webrender. |
|
Is this the sole blocker for msvc? |
|
What about using RustType for font rendering? |
Add support for DirectWrite font rendering on Windows <!-- Please describe your changes on the following line: --> This PR adds support for DirectWrite text rendering using a thin wrapper for dwrite, as well as similar functionality added to WebRender. In doing so it removes the FreeType dep from the Windows build. There is still work to be done here, but this is a good starting point for future cleanup and fixes. --- <!-- 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 - [ ] `./mach test-tidy` does not report any errors - [X] These changes fix #13371 (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [X] These changes do not require tests because they are already tested by other tests <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- 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/14153) <!-- Reviewable:end -->
Add support for DirectWrite font rendering on Windows <!-- Please describe your changes on the following line: --> This PR adds support for DirectWrite text rendering using a thin wrapper for dwrite, as well as similar functionality added to WebRender. In doing so it removes the FreeType dep from the Windows build. There is still work to be done here, but this is a good starting point for future cleanup and fixes. --- <!-- 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 - [ ] `./mach test-tidy` does not report any errors - [X] These changes fix #13371 (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [X] These changes do not require tests because they are already tested by other tests <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- 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/14153) <!-- Reviewable:end -->
The dummy implementation in
components/gfx/platform/mod.rsshould be replaced by a real one:Currently, the lack of a proper implementation causes Servo to show a blank screen upon being launched (see #13257).