From 324dac2ba2cdbf7d6124a3d346215faf22564a69 Mon Sep 17 00:00:00 2001 From: Simon Steiner Date: Thu, 9 Mar 2017 13:07:05 +0000 Subject: [PATCH] OTF code cleanup git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1786161 13f79535-47bb-0310-9956-ffa450edef68 --- .../fop/fonts/truetype/OTFSubSetFile.java | 24 +++++++++++-------- 1 file 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 */ -- 2.39.5