aboutsummaryrefslogtreecommitdiffstats
path: root/fop-core
diff options
context:
space:
mode:
Diffstat (limited to 'fop-core')
-rw-r--r--fop-core/src/main/java/org/apache/fop/fonts/truetype/OTFSubSetFile.java24
1 files changed, 14 insertions, 10 deletions
diff --git a/fop-core/src/main/java/org/apache/fop/fonts/truetype/OTFSubSetFile.java b/fop-core/src/main/java/org/apache/fop/fonts/truetype/OTFSubSetFile.java
index 0cf05a618..6db00575f 100644
--- a/fop-core/src/main/java/org/apache/fop/fonts/truetype/OTFSubSetFile.java
+++ b/fop-core/src/main/java/org/apache/fop/fonts/truetype/OTFSubSetFile.java
@@ -952,16 +952,7 @@ public class OTFSubSetFile extends OTFFile {
for (byte[] aDataArray1 : dataArray) {
totLength += aDataArray1.length;
}
- int offSize = 1;
- if (totLength < (1 << 8)) {
- offSize = 1;
- } else if (totLength < (1 << 16)) {
- offSize = 2;
- } else if (totLength < (1 << 24)) {
- offSize = 3;
- } else {
- offSize = 4;
- }
+ int offSize = getOffSize(totLength);
this.writeByte(offSize);
//Count the first offset 1
hdrTotal += offSize;
@@ -1008,6 +999,19 @@ public class OTFSubSetFile extends OTFFile {
return hdrTotal + total;
}
+ private int getOffSize(int totLength) {
+ int offSize = 1;
+ if (totLength < (1 << 8)) {
+ offSize = 1;
+ } else if (totLength < (1 << 16)) {
+ offSize = 2;
+ } else if (totLength < (1 << 24)) {
+ offSize = 3;
+ } else {
+ offSize = 4;
+ }
+ return offSize;
+ }
/**
* A class used to store the last number operand and also it's size in bytes
*/