Skip to content

Commit 56c2d2a

Browse files
author
Andrei Stryhelski
committed
Update cmp files, add tests with vertical-align Middle and Truetype Fonts
DEVSIX-8963
1 parent f381eb4 commit 56c2d2a

File tree

8 files changed

+98
-0
lines changed

8 files changed

+98
-0
lines changed

src/test/java/com/itextpdf/html2pdf/css/VerticalAlignmentTest.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,4 +146,15 @@ public void verticalAlignOnNestedInlines01() throws IOException, InterruptedExce
146146
public void verticalAlignOnNestedInlines02() throws IOException, InterruptedException {
147147
convertToPdfAndCompare("verticalAlignOnNestedInlines02", sourceFolder, destinationFolder);
148148
}
149+
150+
@Test
151+
public void verticalAlignMiddleWithTtfOS2Version4() throws IOException, InterruptedException {
152+
convertToPdfAndCompare("verticalAlignMiddleWithTtfOS2Version4", sourceFolder, destinationFolder);
153+
}
154+
155+
@Test
156+
// TODO DEVSIX-8994 Improve vertical-align css property related calculations
157+
public void verticalAlignMiddleWithTtfOS2Version1() throws IOException, InterruptedException {
158+
convertToPdfAndCompare("verticalAlignMiddleWithTtfOS2Version1", sourceFolder, destinationFolder);
159+
}
149160
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>Vertical Align Middle Example</title>
6+
<style>
7+
@font-face {
8+
font-family: 'FreeSans';
9+
src: url('../../fonts/FreeSans.ttf') format('truetype');
10+
}
11+
12+
.test {
13+
height: 2em;
14+
font: 40px/60px 'FreeSans';
15+
color: orange;
16+
}
17+
18+
.box {
19+
display: inline-block;
20+
width: 100px;
21+
height: 100px;
22+
background-color: lightgray;
23+
text-align: center;
24+
font-size: 16px;
25+
line-height: 100px;
26+
}
27+
.middle {
28+
vertical-align: middle;
29+
background-color: lightblue;
30+
height: 200px;
31+
line-height: 200px;
32+
border: 3px solid darkblue;
33+
}
34+
</style>
35+
</head>
36+
<body>
37+
<div class="test">
38+
<div class="box">Left</div>
39+
<div class="box middle">Middle</div>
40+
<div class="box">Right</div>
41+
</div>
42+
</body>
43+
</html>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>Vertical Align Middle Example</title>
6+
<style>
7+
@font-face {
8+
font-family: 'NotoSans-Regular';
9+
src: url('../../fonts/NotoSans-Regular.ttf') format('truetype');
10+
}
11+
12+
.test {
13+
height: 2em;
14+
font: 40px/60px 'NotoSans-Regular';
15+
color: orange;
16+
}
17+
18+
.box {
19+
display: inline-block;
20+
width: 100px;
21+
height: 100px;
22+
background-color: lightgray;
23+
text-align: center;
24+
font-size: 16px;
25+
line-height: 100px;
26+
}
27+
.middle {
28+
vertical-align: middle;
29+
background-color: lightblue;
30+
height: 200px;
31+
line-height: 200px;
32+
border: 3px solid darkblue;
33+
}
34+
</style>
35+
</head>
36+
<body>
37+
<div class="test">
38+
<div class="box">Left</div>
39+
<div class="box middle">Middle</div>
40+
<div class="box">Right</div>
41+
</div>
42+
</body>
43+
</html>
Binary file not shown.

src/test/resources/com/itextpdf/html2pdf/fonts/NOTICE.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
| OpenSans-Regular.ttf | OFL-1.1 | OFL.txt |(07.05.2024)
1414
| OpenSans-Bold.ttf | OFL-1.1 | OFL.txt |(07.05.2024)
1515
| Roboto-Regular.ttf | Apache-2.0 | LICENSE.txt |(17.11.2024)
16+
| FreeSans.ttf | GPL | GPL license you can find following the link: https://www.gnu.org/licenses |
1617

1718
------------------------------------------------------------------------------------------------------------------------
1819

0 commit comments

Comments
 (0)