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

Font metrics #44

Open
jamesshore opened this issue Apr 13, 2017 · 2 comments
Open

Font metrics #44

jamesshore opened this issue Apr 13, 2017 · 2 comments

Comments

@jamesshore
Copy link
Owner

Even when using web fonts, font metrics vary across browsers. We need the ability to easily do relative comparisons to the current browser's font metrics.

For example, if we want to test that buttons have 10px of padding, this doesn't work cross browser:

button.assert({
  height: 38
});

Instead, we need to do this:

button.assert({
  height: font.height.plus(10)
});

It's possible to emulate this now by creating an element with the font in it, but I would like this to be foolproof and easy. A dedicated 'font' descriptor would also open up opportunities for useful comparisons such as x-height, m-width, and so forth.

@jamesshore
Copy link
Owner Author

See #41 (comment)

@jamesshore
Copy link
Owner Author

jamesshore commented Oct 30, 2017

v0.13 adds QElement.calculatePixelValues(), which might be enough to satisfy this need.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant