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 upGlyph snapping - revert of #1441 #1455
Conversation
|
We definitely need to snap text glyphs. Otherwise fractional components in the text position result in blurry text. |
|
Do you have an example page that needs snapping?
…On Jul 5, 2017 11:41 PM, "Glenn Watson" ***@***.***> wrote:
We definitely need to snap text glyphs. Otherwise fractional components in
the text position result in blurry text.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#1455 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAUTbRL8HxaDFP0GOVfno38hAJCOOzpWks5sLFdkgaJpZM4OPHgf>
.
|
|
@glennw Here is how I see it, sorry if some parts are obvious :) Glyph rasterization is hard, and we don't do it. Instead, we ask a platform-specific library to do the actual rasterization. That library works within an assumption that it renders on screen, and it takes into account all the details on how glyphs are placed, including sub-pixel offsets. If we do any sort of scaling, rotation, or translation by a fractional offset, after rasterization, we'll ruin the quality of rendered glyph. There is a simple way to ensure that snapping doesn't scale - just setting the snap rectangle size to 0. This PR has been updated to do it. |
|
@kvark Sadly it doesn't look like this PR fixes the problem. The reftest looks about the same as without the patch. Try push not fully done yet but R7 is failing still: Reftest analyzer link |
|
Thanks @staktrace ! I assume the test is done with the latest commit 63ee6f4 |
|
I just noticed why this change doesn't produce desired effect: // Ensure that the snap rect is at *least* one device pixel in size.
// TODO(gw): It's not clear to me that this is "correct". Specifically,
// how should it interact with sub-pixel snap rects when there
// is a layer transform with scale present? But it does fix
// the test cases we have in Servo that are failing without it
// and seem better than not having this at all.
snap_rect.size = max(snap_rect.size, vec2(1.0 / uDevicePixelRatio));@glennw what tests exactly are affected? As you mention in the comments, it doesn't make sense to adjust the size in local space anyway. |
|
I think that the simplest option for now is to revert that previous change which snaps to the primitive rect, and return it to how it was (snapping to the glyph rect). Then we can work out the "proper" solution after that, which will allow us to update WR in Gecko / Servo without reftest regressions? |
|
@bors-servo r+ |
|
|
Glyph snapping - revert of #1441 Fixes #1451 @staktrace I didn't see much of a difference locally. Would you be able to verify if this works? <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/webrender/1455) <!-- Reviewable:end -->
|
|
|
Verified that the revert fixed the reftest failure - try push. Thanks! |
kvark commentedJul 6, 2017
•
edited by larsbergstrom
Fixes #1451
@staktrace I didn't see much of a difference locally. Would you be able to verify if this works?
This change is