From: Simon Steiner Date: Thu, 9 Mar 2017 13:07:05 +0000 (+0000) Subject: OTF code cleanup X-Git-Tag: fop-2_2~11 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=324dac2ba2cdbf7d6124a3d346215faf22564a69;p=xmlgraphics-fop.git OTF code cleanup git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1786161 13f79535-47bb-0310-9956-ffa450edef68 --- 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 */