Skip to content

Commit f42ae6d

Browse files
committed
Squashed commit of the following: commit d877734 Author: Michael Arthur <[email protected]> Date: Mon Sep 20 19:40:23 2021 +1200 set container and a few other styles so existing css styles dont conflict causing baseline calculation to be wrong
1 parent f20c9f7 commit f42ae6d

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/render/font-metrics.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,21 +28,28 @@ export class FontMetrics {
2828
container.style.margin = '0';
2929
container.style.padding = '0';
3030
container.style.whiteSpace = 'nowrap';
31+
container.style.position = 'absolute';
32+
container.style.top = '-1000px';
3133

3234
body.appendChild(container);
3335

3436
img.src = SMALL_IMAGE;
3537
img.width = 1;
3638
img.height = 1;
39+
img.style.width = '1px';
40+
img.style.height = '1px';
3741

3842
img.style.margin = '0';
3943
img.style.padding = '0';
4044
img.style.verticalAlign = 'baseline';
45+
img.style.display = 'inline-block';
4146

4247
span.style.fontFamily = fontFamily;
4348
span.style.fontSize = fontSize;
4449
span.style.margin = '0';
4550
span.style.padding = '0';
51+
span.style.lineHeight = 'normal';
52+
span.style.height = 'auto';
4653

4754
span.appendChild(this._document.createTextNode(SAMPLE_TEXT));
4855
container.appendChild(span);

tests/reftests/text/text.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<style>
88
body {
99
font-family: Arial;
10+
display: flex;
1011
}
1112

1213
.small {

0 commit comments

Comments
 (0)