Skip to content

windows: fix line height handling - #17340

Merged
bors-servo merged 1 commit into
servo:masterfrom
hinaria:master
Jun 15, 2017
Merged

bors-servo merged 1 commit into
servo:masterfrom
hinaria:master

Conversation

@hinaria

@hinaria hinaria commented Jun 15, 2017 •

Copy link
Copy Markdown
Contributor

hi there!

on windows, this change properly scales a font's line height by its size.

previously, line height was not scaled to the font's size at all, which meant line heights become worse and worse the further you scaled away from the font's design size (in either direction, larger or smaller).

this change makes the line_gap ratio and size scale with the font size. i've hand checked that the new computed line_gap matches the effective heights in chrome and firefox when line-height = normal for a bunch of system fonts. (servo's rendering quality on windows is a different story, though).

demonstration

i believe this also solves #16476.


  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors

This change is Reviewable

@highfive

Copy link
Copy Markdown

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.

@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Jun 15, 2017
@highfive

Copy link
Copy Markdown

warning Warning warning

  • These commits modify gfx code, but no tests are modified. Please consider adding a test!

@stshine

stshine commented Jun 15, 2017

Copy link
Copy Markdown
Contributor

@bors-servo try

@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Trying commit ead828d with merge 2554198...

bors-servo pushed a commit that referenced this pull request Jun 15, 2017
windows: fix line height handling

hi there!

on windows, this change properly scales a font's line height by its size. before, this was not being done at all, which resulted in super ugly text at larger em sizes.

![demonstration](https://user-images.githubusercontent.com/975570/27185401-8e27023a-5228-11e7-8475-9e4223730d25.png)

i'm not sure what to do about tests: i wasn't able to find any similar tests, and the previous change (#16034) did not include any tests either.

i believe this also solves #16476.

---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors

<!-- 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/17340)
<!-- Reviewable:end -->
@jdm

jdm commented Jun 15, 2017

Copy link
Copy Markdown
Member

@stshine Not sure that a try build is very meaningful, since we don't run tests on Windows.

@jdm

jdm commented Jun 15, 2017

Copy link
Copy Markdown
Member

@jonathandturner Are you able to try this out?

@stshine

stshine commented Jun 15, 2017

Copy link
Copy Markdown
Contributor

@jdm whoops, my bad.

@bors-servo

Copy link
Copy Markdown
Contributor

@atouchet

Copy link
Copy Markdown
Contributor

I tested this PR out and it appears to fix the spacing issues on Hacker News as well. Looks good!

@sophiajt

Copy link
Copy Markdown

@jdm - building it now

@sophiajt

Copy link
Copy Markdown

Hmmm, looks like my main computer (which is getting repaired as we speak) has my working Windows Servo environment. Seeing if I can put another one together

@sophiajt

Copy link
Copy Markdown

Apologies for the delay. Initial testing looks good. Agreed that I don't see the issue with #16476 anymore. Other sites, like Hacker News and reddit, look okay.

@jdm - I'd say we're good.

@jdm

jdm commented Jun 15, 2017

Copy link
Copy Markdown
Member

@bors-servo: r+
Thanks!

@bors-servo

Copy link
Copy Markdown
Contributor

📌 Commit ead828d has been approved by jdm

@highfive highfive assigned jdm and unassigned asajeffrey Jun 15, 2017
@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-awaiting-review There is new code that needs to be reviewed. labels Jun 15, 2017
@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Testing commit ead828d with merge 8fd7dc8...

bors-servo pushed a commit that referenced this pull request Jun 15, 2017
windows: fix line height handling

hi there!

on windows, this change properly scales a font's line height by its size.

previously, line height was not scaled to the font's size at all, which meant line heights become worse and worse the further you scaled away from the font's design size (in either direction, larger or smaller).

this change makes the `line_gap` ratio and size scale with the font size. i've hand checked that the new computed `line_gap` matches the effective heights in chrome and firefox when `line-height = normal` for a bunch of system fonts. (servo's rendering quality on windows is a different story, though).

![demonstration](https://user-images.githubusercontent.com/975570/27185401-8e27023a-5228-11e7-8475-9e4223730d25.png)

i believe this also solves #16476.

---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors

<!-- 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/17340)
<!-- Reviewable:end -->
@bors-servo

Copy link
Copy Markdown
Contributor

☀️ Test successful - android, arm32, arm64, linux-dev, linux-rel-css, linux-rel-wpt, mac-dev-unit, mac-rel-css1, mac-rel-css2, mac-rel-wpt1, mac-rel-wpt2, mac-rel-wpt3, mac-rel-wpt4, windows-msvc-dev
Approved by: jdm
Pushing 8fd7dc8 to master...

@bors-servo
bors-servo merged commit ead828d into servo:master Jun 15, 2017
@highfive highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Jun 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants