quixote
quixote copied to clipboard
Font metrics
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.
See https://github.com/jamesshore/quixote/issues/41#issuecomment-293987088
v0.13 adds QElement.calculatePixelValues()
, which might be enough to satisfy this need.