You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ti...@apache.org on 2020/02/09 14:48:21 UTC

svn commit: r1873831 - /pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/TTFSubsetter.java

Author: tilman
Date: Sun Feb  9 14:48:21 2020
New Revision: 1873831

URL: http://svn.apache.org/viewvc?rev=1873831&view=rev
Log:
PDFBOX-4071: SonarQube fix

Modified:
    pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/TTFSubsetter.java

Modified: pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/TTFSubsetter.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/TTFSubsetter.java?rev=1873831&r1=1873830&r2=1873831&view=diff
==============================================================================
--- pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/TTFSubsetter.java (original)
+++ pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/TTFSubsetter.java Sun Feb  9 14:48:21 2020
@@ -722,7 +722,7 @@ public final class TTFSubsetter
         // encoding record
         writeUint16(out, CmapTable.PLATFORM_WINDOWS); // platformID
         writeUint16(out, CmapTable.ENCODING_WIN_UNICODE_BMP); // platformSpecificID
-        writeUint32(out, 4 * 2 + 4); // offset
+        writeUint32(out, 12); // offset 4 * 2 + 4
 
         // build Format 4 subtable (Unicode BMP)
         Iterator<Entry<Integer, Integer>> it = uniToGID.entrySet().iterator();
@@ -914,7 +914,7 @@ public final class TTFSubsetter
                 if (glyphId <= lastgid)
                 {
                     // copy width and lsb
-                    offset = glyphId * 4;
+                    offset = glyphId * 4l;
                     lastOffset = copyBytes(is, bos, offset, lastOffset, 4);
                 }
                 else 
@@ -924,14 +924,14 @@ public final class TTFSubsetter
                         // one time only: copy width from lastgid, whose width applies
                         // to all later glyphs
                         needLastGidWidth = false;
-                        offset = lastgid * 4;
+                        offset = lastgid * 4l;
                         lastOffset = copyBytes(is, bos, offset, lastOffset, 2);
 
                         // then go on with lsb from actual glyph (lsb are individual even in monotype fonts)
                     }
 
                     // copy lsb only, as we are beyond numOfHMetrics
-                    offset = h.getNumberOfHMetrics() * 4 + (glyphId - h.getNumberOfHMetrics()) * 2;
+                    offset = h.getNumberOfHMetrics() * 4l + (glyphId - h.getNumberOfHMetrics()) * 2l;
                     lastOffset = copyBytes(is, bos, offset, lastOffset, 2);
                 }
             }