8262477: Enhance String Conclusions

Reviewed-by: rhalade, mschoene, psadhukhan, jdv, serb
This commit is contained in:
Phil Race 2021-03-29 18:10:12 +00:00 committed by Henry Jen
parent 9accf7c894
commit 1c8b9727b7

View File

@ -985,24 +985,36 @@ public class TrueTypeFont extends FileFont {
private void setStrikethroughMetrics(ByteBuffer os_2Table, int upem) {
if (os_2Table == null || os_2Table.capacity() < 30 || upem < 0) {
stSize = .05f;
stPos = -.4f;
stSize = 0.05f;
stPos = -0.4f;
return;
}
ShortBuffer sb = os_2Table.asShortBuffer();
stSize = sb.get(13) / (float)upem;
stPos = -sb.get(14) / (float)upem;
if (stSize < 0f) {
stSize = 0.05f;
}
if (Math.abs(stPos) > 2.0f) {
stPos = -0.4f;
}
}
private void setUnderlineMetrics(ByteBuffer postTable, int upem) {
if (postTable == null || postTable.capacity() < 12 || upem < 0) {
ulSize = .05f;
ulPos = .1f;
ulSize = 0.05f;
ulPos = 0.1f;
return;
}
ShortBuffer sb = postTable.asShortBuffer();
ulSize = sb.get(5) / (float)upem;
ulPos = -sb.get(4) / (float)upem;
if (ulSize < 0f) {
ulSize = 0.05f;
}
if (Math.abs(ulPos) > 2.0f) {
ulPos = 0.1f;
}
}
@Override