6753173: No need to read all the TrueType 'post' table to get underline info
Reviewed-by: igor, jgodinez
This commit is contained in:
parent
b2f54efed2
commit
8b6fca5d9f
@ -543,17 +543,6 @@ public class TrueTypeFont extends FileFont {
|
|||||||
ByteBuffer os2_Table = getTableBuffer(os_2Tag);
|
ByteBuffer os2_Table = getTableBuffer(os_2Tag);
|
||||||
setStyle(os2_Table);
|
setStyle(os2_Table);
|
||||||
setCJKSupport(os2_Table);
|
setCJKSupport(os2_Table);
|
||||||
|
|
||||||
ByteBuffer head_Table = getTableBuffer(headTag);
|
|
||||||
int upem = -1;
|
|
||||||
if (head_Table != null && head_Table.capacity() >= 18) {
|
|
||||||
ShortBuffer sb = head_Table.asShortBuffer();
|
|
||||||
upem = sb.get(9) & 0xffff;
|
|
||||||
}
|
|
||||||
setStrikethroughMetrics(os2_Table, upem);
|
|
||||||
|
|
||||||
ByteBuffer post_Table = getTableBuffer(postTag);
|
|
||||||
setUnderlineMetrics(post_Table, upem);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The array index corresponds to a bit offset in the TrueType
|
/* The array index corresponds to a bit offset in the TrueType
|
||||||
@ -1011,8 +1000,26 @@ public class TrueTypeFont extends FileFont {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void getStyleMetrics(float pointSize, float[] metrics, int offset) {
|
public void getStyleMetrics(float pointSize, float[] metrics, int offset) {
|
||||||
|
|
||||||
|
if (ulSize == 0f && ulPos == 0f) {
|
||||||
|
|
||||||
|
ByteBuffer head_Table = getTableBuffer(headTag);
|
||||||
|
int upem = -1;
|
||||||
|
if (head_Table != null && head_Table.capacity() >= 18) {
|
||||||
|
ShortBuffer sb = head_Table.asShortBuffer();
|
||||||
|
upem = sb.get(9) & 0xffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
ByteBuffer os2_Table = getTableBuffer(os_2Tag);
|
||||||
|
setStrikethroughMetrics(os2_Table, upem);
|
||||||
|
|
||||||
|
ByteBuffer post_Table = getTableBuffer(postTag);
|
||||||
|
setUnderlineMetrics(post_Table, upem);
|
||||||
|
}
|
||||||
|
|
||||||
metrics[offset] = stPos * pointSize;
|
metrics[offset] = stPos * pointSize;
|
||||||
metrics[offset+1] = stSize * pointSize;
|
metrics[offset+1] = stSize * pointSize;
|
||||||
|
|
||||||
metrics[offset+2] = ulPos * pointSize;
|
metrics[offset+2] = ulPos * pointSize;
|
||||||
metrics[offset+3] = ulSize * pointSize;
|
metrics[offset+3] = ulSize * pointSize;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user