Take line-height into account when measuring text height

This commit is contained in:
ahocevar
2019-03-09 08:25:09 +01:00
parent d25a534dea
commit 4a7b3cde56
2 changed files with 19 additions and 11 deletions

View File

@@ -76,6 +76,14 @@ describe('ol.render.canvas', function() {
});
describe('measureTextHeight', function() {
it('respects line-height', function() {
const height = render.measureTextHeight('12px/1.2 sans-serif');
expect(render.measureTextHeight('12px/2.4 sans-serif')).to.be.greaterThan(height);
expect(render.measureTextHeight('12px/0.1 sans-serif')).to.be.lessThan(height);
});
});
describe('rotateAtOffset', function() {
it('rotates a canvas at an offset point', function() {