Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refined text glyph snapping #1465

Merged
merged 1 commit into from Jul 13, 2017
Merged

Refined text glyph snapping #1465

merged 1 commit into from Jul 13, 2017

Conversation

@kvark
Copy link
Member

kvark commented Jul 10, 2017

This PR truncates the sub-pixel offset of the glyphs coming to GPU in order to fix the snapping. With FontRenderMode::Subpixel, that offset is already taken into account when the glyph is rasterized. With the other rendering modes, I'm not completely sure if it's fine to truncate the fractional part, but I also don't see how the current snapping code is better anyway.

r? @glennw


This change is Reviewable

@kvark kvark force-pushed the kvark:snap-superb branch from 6c1e9c0 to 4f49771 Jul 11, 2017
@kvark
Copy link
Member Author

kvark commented Jul 11, 2017

Fixed to pass test-wpt now. The fix was to keep the old snapping behavior for the non-subpixel text.
This PR should be ready for the review now.

Copy link
Member

glennw left a comment

This looks good, but ideally I'd like to hold off until we get the WR update landed with the font size / hinting changes - just so I can verify all the changes work nicely together.

],
// The sub-pixel offset has already been taken into account
// by the glyph rasterizer, thus the truncating here.
FontRenderMode::Subpixel => [

This comment has been minimized.

@glennw

glennw Jul 12, 2017

Member

Instead of a conditional here, can we do this in the prepare_prim_for_render when the glyph_instances array is created? That would mean only doing it once, not each time it needs to get added to the cache.

@bors-servo
Copy link
Contributor

bors-servo commented Jul 12, 2017

The latest upstream changes (presumably #1469) made this pull request unmergeable. Please resolve the merge conflicts.

@kvark kvark force-pushed the kvark:snap-superb branch from 4f49771 to 30cb0f2 Jul 13, 2017
@glennw
Copy link
Member

glennw commented Jul 13, 2017

@kvark Looks good. We have zero coverage in Servo tests for alpha / subpixel text - we currently only run the tests with text AA disabled. We should add some test coverage to wrench for the various render modes and snap configurations.

@bors-servo r+

@bors-servo
Copy link
Contributor

bors-servo commented Jul 13, 2017

📌 Commit 30cb0f2 has been approved by glennw

@bors-servo
Copy link
Contributor

bors-servo commented Jul 13, 2017

Testing commit 30cb0f2 with merge e209a44...

bors-servo added a commit that referenced this pull request Jul 13, 2017
Refined text glyph snapping

This PR truncates the sub-pixel offset of the glyphs coming to GPU in order to fix the snapping. With  `FontRenderMode::Subpixel`, that offset is already taken into account when the glyph is rasterized. With the other rendering modes, I'm not completely sure if it's fine to truncate the fractional part, but I also don't see how the current snapping code is better anyway.

r? @glennw

<!-- 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/1465)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Jul 13, 2017

☀️ Test successful - status-travis
Approved by: glennw
Pushing e209a44 to master...

@bors-servo bors-servo merged commit 30cb0f2 into servo:master Jul 13, 2017
3 checks passed
3 checks passed
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
@kvark kvark deleted the kvark:snap-superb branch Jul 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.