From 338c0bb57ca0582318e5f4ae86d5e6382c4e02f6 Mon Sep 17 00:00:00 2001 From: Peter Bernard West Date: Sat, 13 Mar 2004 08:46:05 +0000 Subject: [PATCH] Tidied up to suppress Eclipse nagging git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/FOP_0-20-0_Alt-Design@197445 13f79535-47bb-0310-9956-ffa450edef68 --- .../fop/fonts/truetype/FontFileReader.java | 6 ++-- .../apache/fop/fonts/truetype/TTFFile.java | 36 +++++++++---------- .../fop/fonts/truetype/TTFSubSetFile.java | 29 +++++++-------- .../org/apache/fop/fonts/type1/PFMFile.java | 4 +-- .../apache/fop/render/AbstractRenderer.java | 2 +- src/java/org/apache/fop/render/Renderer.java | 2 +- .../apache/fop/render/RendererContext.java | 2 +- .../apache/fop/render/awt/AWTRenderer.java | 4 --- 8 files changed, 38 insertions(+), 47 deletions(-) diff --git a/src/java/org/apache/fop/fonts/truetype/FontFileReader.java b/src/java/org/apache/fop/fonts/truetype/FontFileReader.java index f83b597ca..cc1ecfc98 100644 --- a/src/java/org/apache/fop/fonts/truetype/FontFileReader.java +++ b/src/java/org/apache/fop/fonts/truetype/FontFileReader.java @@ -161,9 +161,9 @@ public class FontFileReader { final byte buf = read(); if (buf < 0) { - return (int)(256 + buf); + return 256 + buf; } else { - return (int)buf; + return buf; } } @@ -187,7 +187,7 @@ public class FontFileReader { */ public final int readTTFUShort() throws IOException { final int ret = (readTTFUByte() << 8) + readTTFUByte(); - return (int)ret; + return ret; } /** diff --git a/src/java/org/apache/fop/fonts/truetype/TTFFile.java b/src/java/org/apache/fop/fonts/truetype/TTFFile.java index e56297d5f..419502a65 100644 --- a/src/java/org/apache/fop/fonts/truetype/TTFFile.java +++ b/src/java/org/apache/fop/fonts/truetype/TTFFile.java @@ -380,7 +380,7 @@ public class TTFFile extends AbstractLogEnabled { ansiIndex = new java.util.HashMap(); for (int i = 32; i < Glyphs.WINANSI_ENCODING.length; i++) { Integer ansi = new Integer(i); - Integer uni = new Integer((int)Glyphs.WINANSI_ENCODING[i]); + Integer uni = new Integer(Glyphs.WINANSI_ENCODING[i]); List v = (List)ansiIndex.get(uni); if (v == null) { @@ -515,7 +515,7 @@ public class TTFFile extends AbstractLogEnabled { * @return int The CapHeight */ public int getCapHeight() { - return (int)convertTTFUnit2PDFUnit(capHeight); + return convertTTFUnit2PDFUnit(capHeight); } /** @@ -523,7 +523,7 @@ public class TTFFile extends AbstractLogEnabled { * @return int The XHeight */ public int getXHeight() { - return (int)convertTTFUnit2PDFUnit(xHeight); + return convertTTFUnit2PDFUnit(xHeight); } /** @@ -575,10 +575,10 @@ public class TTFFile extends AbstractLogEnabled { */ public int[] getFontBBox() { final int[] fbb = new int[4]; - fbb[0] = (int)convertTTFUnit2PDFUnit(fontBBox1); - fbb[1] = (int)convertTTFUnit2PDFUnit(fontBBox2); - fbb[2] = (int)convertTTFUnit2PDFUnit(fontBBox3); - fbb[3] = (int)convertTTFUnit2PDFUnit(fontBBox4); + fbb[0] = convertTTFUnit2PDFUnit(fontBBox1); + fbb[1] = convertTTFUnit2PDFUnit(fontBBox2); + fbb[2] = convertTTFUnit2PDFUnit(fontBBox3); + fbb[3] = convertTTFUnit2PDFUnit(fontBBox4); return fbb; } @@ -588,7 +588,7 @@ public class TTFFile extends AbstractLogEnabled { * @return int The LowerCaseAscent */ public int getLowerCaseAscent() { - return (int)convertTTFUnit2PDFUnit(ascender); + return convertTTFUnit2PDFUnit(ascender); } /** @@ -596,7 +596,7 @@ public class TTFFile extends AbstractLogEnabled { * @return int The LowerCaseDescent */ public int getLowerCaseDescent() { - return (int)convertTTFUnit2PDFUnit(descender); + return convertTTFUnit2PDFUnit(descender); } /** @@ -623,7 +623,7 @@ public class TTFFile extends AbstractLogEnabled { public int[] getWidths() { int[] wx = new int[mtxTab.length]; for (int i = 0; i < wx.length; i++) { - wx[i] = (int)convertTTFUnit2PDFUnit(mtxTab[i].getWx()); + wx[i] = convertTTFUnit2PDFUnit(mtxTab[i].getWx()); } return wx; @@ -635,7 +635,7 @@ public class TTFFile extends AbstractLogEnabled { * @return int Standard width */ public int getCharWidth(int idx) { - return (int)convertTTFUnit2PDFUnit(ansiWidth[idx]); + return convertTTFUnit2PDFUnit(ansiWidth[idx]); } /** @@ -1092,7 +1092,7 @@ public class TTFFile extends AbstractLogEnabled { adjTab = new java.util.HashMap(); } adjTab.put(new Integer(j), - new Integer((int)convertTTFUnit2PDFUnit(kpx))); + new Integer(convertTTFUnit2PDFUnit(kpx))); kerningTab.put(iObj, adjTab); } } @@ -1231,8 +1231,8 @@ public class TTFFile extends AbstractLogEnabled { System.out.println("Family name: " + familyName); System.out.println("Subfamily name: " + subFamilyName); System.out.println("Notice: " + notice); - System.out.println("xHeight: " + (int)convertTTFUnit2PDFUnit(xHeight)); - System.out.println("capheight: " + (int)convertTTFUnit2PDFUnit(capHeight)); + System.out.println("xHeight: " + convertTTFUnit2PDFUnit(xHeight)); + System.out.println("capheight: " + convertTTFUnit2PDFUnit(capHeight)); int italic = (int)(italicAngle >> 16); System.out.println("Italic: " + italic); @@ -1245,10 +1245,10 @@ public class TTFFile extends AbstractLogEnabled { System.out.println(); System.out.println("Ascender: " + convertTTFUnit2PDFUnit(ascender)); System.out.println("Descender: " + convertTTFUnit2PDFUnit(descender)); - System.out.println("FontBBox: [" + (int)convertTTFUnit2PDFUnit(fontBBox1) - + " " + (int)convertTTFUnit2PDFUnit(fontBBox2) + " " - + (int)convertTTFUnit2PDFUnit(fontBBox3) + " " - + (int)convertTTFUnit2PDFUnit(fontBBox4) + "]"); + System.out.println("FontBBox: [" + convertTTFUnit2PDFUnit(fontBBox1) + + " " + convertTTFUnit2PDFUnit(fontBBox2) + " " + + convertTTFUnit2PDFUnit(fontBBox3) + " " + + convertTTFUnit2PDFUnit(fontBBox4) + "]"); } /** diff --git a/src/java/org/apache/fop/fonts/truetype/TTFSubSetFile.java b/src/java/org/apache/fop/fonts/truetype/TTFSubSetFile.java index 5d7812eab..95f6d75b0 100644 --- a/src/java/org/apache/fop/fonts/truetype/TTFSubSetFile.java +++ b/src/java/org/apache/fop/fonts/truetype/TTFSubSetFile.java @@ -198,7 +198,7 @@ public class TTFSubSetFile extends TTFFile { /** * Create an empty loca table without updating checksum */ - private void createLoca(int size) throws IOException { + private void createLoca(int size) { pad4(); locaOffset = currentPos; writeULong(locaDirOffset + 4, currentPos); @@ -657,12 +657,7 @@ public class TTFSubSetFile extends TTFFile { //log.error("TrueType warning: " + ex.getMessage()); } - try { - createLoca(glyphs.size()); // create empty loca table - } catch (IOException ex) { - // Loca is optional (only required for OpenType (MS) fonts) - //log.error("TrueType warning: " + ex.getMessage()); - } + createLoca(glyphs.size()); // create empty loca table try { createGlyf(in, glyphs); @@ -771,15 +766,15 @@ public class TTFSubSetFile extends TTFFile { * Read a unsigned short value at given position */ private int readUShort(int pos) { - int ret = (int)output[pos]; + int ret = output[pos]; if (ret < 0) { ret += 256; } ret = ret << 8; - if ((int)output[pos + 1] < 0) { - ret |= (int)output[pos + 1] + 256; + if (output[pos + 1] < 0) { + ret |= output[pos + 1] + 256; } else { - ret |= (int)output[pos + 1]; + ret |= output[pos + 1]; } return ret; @@ -802,7 +797,7 @@ public class TTFSubSetFile extends TTFFile { */ private int maxPow2(int max) { int i = 0; - while (Math.pow(2, (double)i) < max) { + while (Math.pow(2, i) < max) { i++; } @@ -810,7 +805,7 @@ public class TTFSubSetFile extends TTFFile { } private int log2(int num) { - return (int)(Math.log((double)num) / Math.log(2)); + return (int)(Math.log(num) / Math.log(2)); } @@ -829,10 +824,10 @@ public class TTFSubSetFile extends TTFFile { long sum = 0; for (int i = 0; i < size; i += 4) { - int l = (int)(output[start + i] << 24); - l += (int)(output[start + i + 1] << 16); - l += (int)(output[start + i + 2] << 16); - l += (int)(output[start + i + 3] << 16); + int l = output[start + i] << 24; + l += output[start + i + 1] << 16; + l += output[start + i + 2] << 16; + l += output[start + i + 3] << 16; sum += l; if (sum > 0xffffffff) { sum = sum - 0xffffffff; diff --git a/src/java/org/apache/fop/fonts/type1/PFMFile.java b/src/java/org/apache/fop/fonts/type1/PFMFile.java index c0ff6e415..cbf9cb1a1 100644 --- a/src/java/org/apache/fop/fonts/type1/PFMFile.java +++ b/src/java/org/apache/fop/fonts/type1/PFMFile.java @@ -164,10 +164,10 @@ public class PFMFile extends AbstractLogEnabled { getLogger().info(i + " kerning pairs"); while (i > 0) { - int g1 = (int)inStream.readByte(); + int g1 = inStream.readByte(); i--; - int g2 = (int)inStream.readByte(); + int g2 = inStream.readByte(); int adj = inStream.readShort(); if (adj > 0x8000) { diff --git a/src/java/org/apache/fop/render/AbstractRenderer.java b/src/java/org/apache/fop/render/AbstractRenderer.java index 6ec80fe47..40dce8d6f 100644 --- a/src/java/org/apache/fop/render/AbstractRenderer.java +++ b/src/java/org/apache/fop/render/AbstractRenderer.java @@ -30,8 +30,8 @@ import org.w3c.dom.Document; import org.apache.fop.area.CoordTransformer; import org.apache.fop.area.PageViewport; import org.apache.fop.area.RegionViewport; -import org.apache.fop.apps.FOUserAgent; import org.apache.fop.apps.Fop; +import org.apache.fop.configuration.FOUserAgent; import org.apache.avalon.framework.configuration.Configurable; import org.apache.avalon.framework.configuration.Configuration; diff --git a/src/java/org/apache/fop/render/Renderer.java b/src/java/org/apache/fop/render/Renderer.java index db9686e20..4507b635d 100644 --- a/src/java/org/apache/fop/render/Renderer.java +++ b/src/java/org/apache/fop/render/Renderer.java @@ -27,7 +27,7 @@ import java.util.Map; // FOP import org.apache.fop.apps.FOPException; import org.apache.fop.area.PageViewport; -import org.apache.fop.apps.FOUserAgent; +import org.apache.fop.configuration.FOUserAgent; /** * Interface implemented by all renderers. This interface is used to control diff --git a/src/java/org/apache/fop/render/RendererContext.java b/src/java/org/apache/fop/render/RendererContext.java index 998a53701..dfb6ceaec 100644 --- a/src/java/org/apache/fop/render/RendererContext.java +++ b/src/java/org/apache/fop/render/RendererContext.java @@ -22,7 +22,7 @@ package org.apache.fop.render; import java.util.Map; //FOP -import org.apache.fop.apps.FOUserAgent; +import org.apache.fop.configuration.FOUserAgent; /** * The Render Context for external handlers. This provides a rendering context diff --git a/src/java/org/apache/fop/render/awt/AWTRenderer.java b/src/java/org/apache/fop/render/awt/AWTRenderer.java index dc62bc919..ad0b695dd 100644 --- a/src/java/org/apache/fop/render/awt/AWTRenderer.java +++ b/src/java/org/apache/fop/render/awt/AWTRenderer.java @@ -29,13 +29,9 @@ package org.apache.fop.render.awt; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.RenderingHints; import java.awt.Toolkit; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; -import java.awt.geom.AffineTransform; -import java.awt.geom.Rectangle2D; import java.awt.image.BufferedImage; import java.awt.print.PageFormat; import java.awt.print.Pageable; -- 2.39.5