Commit 1c8b972 authored and committed Jul 21, 2021
1 parent 9accf7c commit 1c8b972 Copy full SHA for 1c8b972
File tree 1 file changed +16
-4
lines changed
src/java.desktop/share/classes/sun/font
1 file changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -985,24 +985,36 @@ private void setStyle(ByteBuffer os_2Table) {
985
985
986
986
private void setStrikethroughMetrics (ByteBuffer os_2Table , int upem ) {
987
987
if (os_2Table == null || os_2Table .capacity () < 30 || upem < 0 ) {
988
- stSize = .05f ;
989
- stPos = -.4f ;
988
+ stSize = 0 .05f ;
989
+ stPos = -0 .4f ;
990
990
return ;
991
991
}
992
992
ShortBuffer sb = os_2Table .asShortBuffer ();
993
993
stSize = sb .get (13 ) / (float )upem ;
994
994
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
+ }
995
1001
}
996
1002
997
1003
private void setUnderlineMetrics (ByteBuffer postTable , int upem ) {
998
1004
if (postTable == null || postTable .capacity () < 12 || upem < 0 ) {
999
- ulSize = .05f ;
1000
- ulPos = .1f ;
1005
+ ulSize = 0 .05f ;
1006
+ ulPos = 0 .1f ;
1001
1007
return ;
1002
1008
}
1003
1009
ShortBuffer sb = postTable .asShortBuffer ();
1004
1010
ulSize = sb .get (5 ) / (float )upem ;
1005
1011
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
+ }
1006
1018
}
1007
1019
1008
1020
@ Override
You can’t perform that action at this time.
0 commit comments