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 upFont fallback #20506
Font fallback #20506
Conversation
highfive
commented
Apr 3, 2018
|
Heads up! This PR modifies the following files:
|
highfive
commented
Apr 3, 2018
|
This looks amazing! \o/ |
|
Reviewed 17 of 23 files at r1. components/gfx/platform/freetype/font.rs, line 102 at r1 (raw file):
One of the reasons for making FT always load via memory here was so that the layout threads would never block on a synchronous file load. The idea was that the font cache thread would responsible for providing these. I'm not sure if that's really relevant or feasible, but that was the original idea, I think. components/gfx/text/util.rs, line 156 at r1 (raw file):
nit: could just be unicode_plane(codepoint) == 2 and remove the true / false here, unless there's more conditions to come in the future. Comments from Reviewable |
|
Partial review only so far - I'll try to work through the trickier bits today or tomorrow. Will need @mbrubeck to take a look at some of the text files that I'm not familiar with too. |
|
Reviewed 6 of 23 files at r1. components/layout/text.rs, line 218 at r1 (raw file):
Should get @mbrubeck to check this. Comments from Reviewable |
|
Reviewed the remaining files, they look good to me. I think it'd be worth getting @mbrubeck to do a quick pass over this too, as I'm not very up to date on text / font handling in Servo. My main question is related to the thread the font load occurs on (mentioned above). |
Thanks for the explanation. I note that the windows and macos implementations end up calling into platform APIs in this situation, do you know of calling those APIs results in any disk I/O? Without this change I observed a big slowdown on Linux where the bytes of all the fallback fonts would be passed over the ipc-channel. The slowdown was mostly due to the CPU cost of serialization and deserialization. Performance was a lot better when I tried the One thing it is worth pointing out, is that by the time a layout thread does the file read, the file has already been read by the font cache thread. Therefore, we might hope that the data is already in an OS cache and it might be that no actual disk reads need to occur. I don't know enough about how this works to make any firm statements about that though. Another thing to say is that I'm testing this on a laptop with an SSD hard drive, so I'm probably less likely to notice disk I/O slowdowns. Do you have any suggestions about how I could/should investigate this further so we can decide what the best approach is? |
|
I should add: when I looked into the bytes-over-IPC thing, I realised that the font code had originally been developed before a multiprocess architecture was implemented. Therefore, at the time, those bytes were not getting serialized or sent to a different process. Then, the multiprocess architecture came along and converted everything to IPC channels. I thought that perhaps it wasn't intentionally decided that the bytes should go over IPC, but instead just a consequence of how the code had evolved. It just seemed quite surprising to me to do this, but it might be that it's actually fine if we use |
|
You're exactly right - the original font code was built before any consideration for multi-process / ipc-channel, and serializing the bytes over the ipc channel was a side effect of that. I think it's fine to move the file read into the font contexts at this stage - this is certainly a big improvement on what we have now. We can re-consider the design of how / where we fetch the bytes as a separate issue for later - it's a big topic by itself. There's no other blockers from me, but it would be good to get @mbrubeck to do a quick pass over this before merging - he has much more experience with the Servo text / layout code than me. |
|
@bors-servo r+ Looks good to me. Thanks for this! |
|
|
Font fallback This implements more complete support for font fallback, see #17267. r? @glennw @mbrubeck <!-- 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/20506) <!-- Reviewable:end -->
|
|
|
Done
This wasn't actually 100% necessary for the fallback to work, though it's useful in terms of not doing unnecessary fallbacks for non-printing characters. I've split it out into a separate commit which gives a better explanation of what it does.
I've added a comment to the code linking to this discussion.
Fixed |
|
@bors-servo r+ |
|
@bors-servo r=emilio,mbrubeck |
|
|
Font fallback This implements more complete support for font fallback, see #17267. r? @glennw @mbrubeck <!-- 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/20506) <!-- Reviewable:end -->
|
|
|
o_O we managed to crash
|
|
@bors-servo retry |
Font fallback This implements more complete support for font fallback, see #17267. r? @glennw @mbrubeck <!-- 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/20506) <!-- Reviewable:end -->
|
|
This is a regression from servo#20506 which Gecko tests caught while trying to import this.
jonleighton commentedApr 3, 2018
•
edited by SimonSapin
This implements more complete support for font fallback, see #17267.
r? @glennw @mbrubeck
This change is