aboutsummaryrefslogtreecommitdiffstats
path: root/fop-core
diff options
context:
space:
mode:
authorSimon Steiner <ssteiner@apache.org>2017-03-09 13:07:05 +0000
committerSimon Steiner <ssteiner@apache.org>2017-03-09 13:07:05 +0000
commit324dac2ba2cdbf7d6124a3d346215faf22564a69 (patch)
treeae31bf0a60154e97f2ea49eaeacf4f183a181e03 /fop-core
parentbe8fcffac2745206394e0b23c454c1cbea2dddb5 (diff)
downloadxmlgraphics-fop-324dac2ba2cdbf7d6124a3d346215faf22564a69.tar.gz
xmlgraphics-fop-324dac2ba2cdbf7d6124a3d346215faf22564a69.zip
OTF code cleanup
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1786161 13f79535-47bb-0310-9956-ffa450edef68
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
*/