quixote icon indicating copy to clipboard operation
quixote copied to clipboard

Font metrics

Open jamesshore opened this issue 7 years ago • 2 comments

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 avatar Apr 13 '17 18:04 jamesshore

See https://github.com/jamesshore/quixote/issues/41#issuecomment-293987088

jamesshore avatar Apr 13 '17 18:04 jamesshore

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

jamesshore avatar Oct 30 '17 05:10 jamesshore