Skip to content

Commit 1c8b972

Browse files
prraceslowhog
authored andcommittedJul 21, 2021
8262477: Enhance String Conclusions
Reviewed-by: rhalade, mschoene, psadhukhan, jdv, serb
1 parent 9accf7c commit 1c8b972

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed
 

‎src/java.desktop/share/classes/sun/font/TrueTypeFont.java

+16-4
Original file line numberDiff line numberDiff line change
@@ -985,24 +985,36 @@ private void setStyle(ByteBuffer os_2Table) {
985985

986986
private void setStrikethroughMetrics(ByteBuffer os_2Table, int upem) {
987987
if (os_2Table == null || os_2Table.capacity() < 30 || upem < 0) {
988-
stSize = .05f;
989-
stPos = -.4f;
988+
stSize = 0.05f;
989+
stPos = -0.4f;
990990
return;
991991
}
992992
ShortBuffer sb = os_2Table.asShortBuffer();
993993
stSize = sb.get(13) / (float)upem;
994994
stPos = -sb.get(14) / (float)upem;
995+
if (stSize < 0f) {
996+
stSize = 0.05f;
997+
}
998+
if (Math.abs(stPos) > 2.0f) {
999+
stPos = -0.4f;
1000+
}
9951001
}
9961002

9971003
private void setUnderlineMetrics(ByteBuffer postTable, int upem) {
9981004
if (postTable == null || postTable.capacity() < 12 || upem < 0) {
999-
ulSize = .05f;
1000-
ulPos = .1f;
1005+
ulSize = 0.05f;
1006+
ulPos = 0.1f;
10011007
return;
10021008
}
10031009
ShortBuffer sb = postTable.asShortBuffer();
10041010
ulSize = sb.get(5) / (float)upem;
10051011
ulPos = -sb.get(4) / (float)upem;
1012+
if (ulSize < 0f) {
1013+
ulSize = 0.05f;
1014+
}
1015+
if (Math.abs(ulPos) > 2.0f) {
1016+
ulPos = 0.1f;
1017+
}
10061018
}
10071019

10081020
@Override

0 commit comments

Comments
 (0)
Please sign in to comment.