diff options
author | Sven Gothel <[email protected]> | 2014-07-03 16:21:36 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-07-03 16:21:36 +0200 |
commit | 556d92b63555a085b25e32b1cd55afce24edd07a (patch) | |
tree | 6be2b02c62a77d5aba81ffbe34c46960608be163 /src/jogl/classes/jogamp/graph/font | |
parent | a90f4a51dffec3247278e3c683ed4462b1dd9ab5 (diff) |
Code Clean-Up based on our Recommended Settings (jogamp-scripting c47bc86ae2ee268a1f38c5580d11f93d7f8d6e74)
- Change non static accesses to static members using declaring type
- Change indirect accesses to static members to direct accesses (accesses through subtypes)
- Add final modifier to private fields
- Add final modifier to method parameters
- Add final modifier to local variables
- Remove unnecessary casts
- Remove unnecessary '$NON-NLS$' tags
- Remove trailing white spaces on all lines
Diffstat (limited to 'src/jogl/classes/jogamp/graph/font')
102 files changed, 1225 insertions, 1225 deletions
diff --git a/src/jogl/classes/jogamp/graph/font/JavaFontLoader.java b/src/jogl/classes/jogamp/graph/font/JavaFontLoader.java index e3df0af1d..1bb2bb5f3 100644 --- a/src/jogl/classes/jogamp/graph/font/JavaFontLoader.java +++ b/src/jogl/classes/jogamp/graph/font/JavaFontLoader.java @@ -78,7 +78,7 @@ public class JavaFontLoader implements FontSet { } } - static boolean is(int bits, int bit) { + static boolean is(final int bits, final int bit) { return 0 != ( bits & bit ) ; } @@ -88,7 +88,7 @@ public class JavaFontLoader implements FontSet { } @Override - public Font get(int family, int style) throws IOException { + public Font get(final int family, final int style) throws IOException { Font font = (Font)fontMap.get( ( family << 8 ) | style ); if (font != null) { return font; @@ -138,7 +138,7 @@ public class JavaFontLoader implements FontSet { return font; } - Font abspath(String fname, int family, int style) throws IOException { + Font abspath(final String fname, final int family, final int style) throws IOException { if(null == javaFontPath) { throw new GLException("java font path undefined"); } @@ -151,7 +151,7 @@ public class JavaFontLoader implements FontSet { return f; } throw new IOException (err); - } catch (IOException ioe) { + } catch (final IOException ioe) { throw new IOException(err, ioe); } } diff --git a/src/jogl/classes/jogamp/graph/font/UbuntuFontLoader.java b/src/jogl/classes/jogamp/graph/font/UbuntuFontLoader.java index c7efe143b..76947873e 100644 --- a/src/jogl/classes/jogamp/graph/font/UbuntuFontLoader.java +++ b/src/jogl/classes/jogamp/graph/font/UbuntuFontLoader.java @@ -76,7 +76,7 @@ public class UbuntuFontLoader implements FontSet { private UbuntuFontLoader() { } - static boolean is(int bits, int bit) { + static boolean is(final int bits, final int bit) { return 0 != ( bits & bit ) ; } @@ -86,7 +86,7 @@ public class UbuntuFontLoader implements FontSet { } @Override - public Font get(int family, int style) throws IOException { + public Font get(final int family, final int style) throws IOException { Font font = (Font)fontMap.get( ( family << 8 ) | style ); if (font != null) { return font; @@ -132,7 +132,7 @@ public class UbuntuFontLoader implements FontSet { private static boolean attemptedJARLoading = false; private static boolean useTempJarCache = false; - private synchronized Font abspath(String fname, int family, int style) throws IOException { + private synchronized Font abspath(final String fname, final int family, final int style) throws IOException { final String err = "Problem loading font "+fname+", stream "+relFontPath+fname; final Exception[] privErr = { null }; try { @@ -150,7 +150,7 @@ public class UbuntuFontLoader implements FontSet { public Object run() { try { TempJarCache.addResources(UbuntuFontLoader.class, uri); - } catch (Exception e) { privErr[0] = e; } + } catch (final Exception e) { privErr[0] = e; } return null; } } ); if( null == privErr[0] ) { @@ -162,7 +162,7 @@ public class UbuntuFontLoader implements FontSet { } } } - } catch(Exception e) { + } catch(final Exception e) { throw new IOException(err, e); } if( null != privErr[0] ) { @@ -182,7 +182,7 @@ public class UbuntuFontLoader implements FontSet { try { final URI uri = TempJarCache.getResource(absFontPath+fname); privConn[0] = null != uri ? uri.toURL().openConnection() : null; - } catch (Exception e) { privErr[0] = e; } + } catch (final Exception e) { privErr[0] = e; } return null; } } ); if( null != privErr[0] ) { diff --git a/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java b/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java index 5fb61387a..c48ef99ca 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java @@ -63,15 +63,15 @@ class TypecastFont implements Font { // FIXME: Generic attempt to find the best CmapTable, // which is assumed to be the one with the most entries (stupid 'eh?) - CmapTable cmapTable = font.getCmapTable(); - CmapFormat[] _cmapFormatP = { null, null, null, null }; + final CmapTable cmapTable = font.getCmapTable(); + final CmapFormat[] _cmapFormatP = { null, null, null, null }; int platform = -1; int platformLength = -1; int encoding = -1; for(int i=0; i<cmapTable.getNumTables(); i++) { - CmapIndexEntry cmapIdxEntry = cmapTable.getCmapIndexEntry(i); - int pidx = cmapIdxEntry.getPlatformId(); - CmapFormat cf = cmapIdxEntry.getFormat(); + final CmapIndexEntry cmapIdxEntry = cmapTable.getCmapIndexEntry(i); + final int pidx = cmapIdxEntry.getPlatformId(); + final CmapFormat cf = cmapIdxEntry.getFormat(); if(DEBUG) { System.err.println("CmapFormat["+i+"]: platform " + pidx + ", encoding "+cmapIdxEntry.getEncodingId() + ": "+cf); @@ -123,7 +123,7 @@ class TypecastFont implements Font { { int _cmapentries = 0; for (int i = 0; i < cmapFormat.getRangeCount(); ++i) { - CmapFormat.Range range = cmapFormat.getRange(i); + final CmapFormat.Range range = cmapFormat.getRange(i); _cmapentries += range.getEndCode() - range.getStartCode() + 1; // end included } cmapentries = _cmapentries; @@ -135,7 +135,7 @@ class TypecastFont implements Font { System.err.println("num cmap ranges: "+cmapFormat.getRangeCount()); for (int i = 0; i < cmapFormat.getRangeCount(); ++i) { - CmapFormat.Range range = cmapFormat.getRange(i); + final CmapFormat.Range range = cmapFormat.getRange(i); for (int j = range.getStartCode(); j <= range.getEndCode(); ++j) { final int code = cmapFormat.mapCharCode(j); if(code < 15) { @@ -149,15 +149,15 @@ class TypecastFont implements Font { } @Override - public StringBuilder getName(StringBuilder sb, int nameIndex) { + public StringBuilder getName(final StringBuilder sb, final int nameIndex) { return font.getName(nameIndex, sb); } @Override - public String getName(int nameIndex) { + public String getName(final int nameIndex) { return getName(null, nameIndex).toString(); } @Override - public StringBuilder getAllNames(StringBuilder sb, String separator) { + public StringBuilder getAllNames(final StringBuilder sb, final String separator) { return font.getAllNames(sb, separator); } @Override @@ -168,7 +168,7 @@ class TypecastFont implements Font { } @Override - public float getAdvanceWidth(int glyphID, float pixelSize) { + public float getAdvanceWidth(final int glyphID, final float pixelSize) { return font.getHmtxTable().getAdvanceWidth(glyphID) * metrics.getScale(pixelSize); } @@ -178,7 +178,7 @@ class TypecastFont implements Font { } @Override - public Glyph getGlyph(char symbol) { + public Glyph getGlyph(final char symbol) { TypecastGlyph result = (TypecastGlyph) char2Glyph.get(symbol); if (null == result) { // final short code = (short) char2Code.get(symbol); @@ -226,12 +226,12 @@ class TypecastFont implements Font { } @Override - public final float getPixelSize(float fontSize /* points per inch */, float resolution) { + public final float getPixelSize(final float fontSize /* points per inch */, final float resolution) { return fontSize * resolution / ( 72f /* points per inch */ ); } @Override - public float getLineHeight(float pixelSize) { + public float getLineHeight(final float pixelSize) { final Metrics metrics = getMetrics(); final float lineGap = metrics.getLineGap(pixelSize) ; // negative value! final float ascent = metrics.getAscent(pixelSize) ; // negative value! @@ -241,7 +241,7 @@ class TypecastFont implements Font { } @Override - public float getMetricWidth(CharSequence string, float pixelSize) { + public float getMetricWidth(final CharSequence string, final float pixelSize) { float width = 0; final int len = string.length(); for (int i=0; i< len; i++) { @@ -257,7 +257,7 @@ class TypecastFont implements Font { } @Override - public float getMetricHeight(CharSequence string, float pixelSize, final AABBox tmp) { + public float getMetricHeight(final CharSequence string, final float pixelSize, final AABBox tmp) { int height = 0; for (int i=0; i<string.length(); i++) { @@ -272,7 +272,7 @@ class TypecastFont implements Font { } @Override - public AABBox getMetricBounds(CharSequence string, float pixelSize) { + public AABBox getMetricBounds(final CharSequence string, final float pixelSize) { if (string == null) { return new AABBox(); } @@ -282,14 +282,14 @@ class TypecastFont implements Font { float totalWidth = 0; float curLineWidth = 0; for (int i=0; i<charCount; i++) { - char character = string.charAt(i); + final char character = string.charAt(i); if (character == '\n') { totalWidth = Math.max(curLineWidth, totalWidth); curLineWidth = 0; totalHeight += lineHeight; continue; } - Glyph glyph = getGlyph(character); + final Glyph glyph = getGlyph(character); curLineWidth += glyph.getAdvance(pixelSize, true); } if (curLineWidth > 0) { @@ -350,7 +350,7 @@ class TypecastFont implements Font { } @Override - public boolean isPrintableChar( char c ) { + public boolean isPrintableChar( final char c ) { return FontFactory.isPrintableChar(c); } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/TypecastFontConstructor.java b/src/jogl/classes/jogamp/graph/font/typecast/TypecastFontConstructor.java index d7db981b0..6154484d5 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/TypecastFontConstructor.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/TypecastFontConstructor.java @@ -45,14 +45,14 @@ public class TypecastFontConstructor implements FontConstructor { @Override public Font create(final File ffile) throws IOException { - Object o = AccessController.doPrivileged(new PrivilegedAction<Object>() { + final Object o = AccessController.doPrivileged(new PrivilegedAction<Object>() { @Override public Object run() { OTFontCollection fontset; try { fontset = OTFontCollection.create(ffile); return new TypecastFont(fontset); - } catch (IOException e) { + } catch (final IOException e) { return e; } } @@ -83,7 +83,7 @@ public class TypecastFontConstructor implements FontConstructor { } f = create(tf); tf.delete(); - } catch (IOException e) { + } catch (final IOException e) { e.printStackTrace(); } return f; diff --git a/src/jogl/classes/jogamp/graph/font/typecast/TypecastGlyph.java b/src/jogl/classes/jogamp/graph/font/typecast/TypecastGlyph.java index 2246b4a3c..7a3962f7c 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/TypecastGlyph.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/TypecastGlyph.java @@ -211,7 +211,7 @@ public class TypecastGlyph implements Font.Glyph { @Override public final int hashCode() { // 31 * x == (x << 5) - x - int hash = 31 + font.getName(Font.NAME_UNIQUNAME).hashCode(); + final int hash = 31 + font.getName(Font.NAME_UNIQUNAME).hashCode(); return ((hash << 5) - hash) + id; } } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/TypecastHMetrics.java b/src/jogl/classes/jogamp/graph/font/typecast/TypecastHMetrics.java index be8ab8f69..d5e30a500 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/TypecastHMetrics.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/TypecastHMetrics.java @@ -52,12 +52,12 @@ class TypecastHMetrics implements Metrics { // vheaTable = this.fontImpl.font.getVheaTable(); unitsPerEM_Inv = 1.0f / ( headTable.getUnitsPerEm() ); - int maxWidth = headTable.getXMax() - headTable.getXMin(); - int maxHeight = headTable.getYMax() - headTable.getYMin(); - float lowx= headTable.getXMin(); - float lowy = -(headTable.getYMin()+maxHeight); - float highx = lowx + maxWidth; - float highy = lowy + maxHeight; + final int maxWidth = headTable.getXMax() - headTable.getXMin(); + final int maxHeight = headTable.getYMax() - headTable.getYMin(); + final float lowx= headTable.getXMin(); + final float lowy = -(headTable.getYMin()+maxHeight); + final float highx = lowx + maxWidth; + final float highy = lowy + maxHeight; bbox = new AABBox(lowx, lowy, 0, highx, highy, 0); // invert } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/TypecastRenderer.java b/src/jogl/classes/jogamp/graph/font/typecast/TypecastRenderer.java index b6e9925d4..f78656b52 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/TypecastRenderer.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/TypecastRenderer.java @@ -45,23 +45,23 @@ import com.jogamp.graph.geom.Vertex.Factory; public class TypecastRenderer { private static final boolean DEBUG = Debug.debug("graph.font.Renderer"); - private static void addShapeMoveTo(final OutlineShape shape, Factory<? extends Vertex> vertexFactory, Point p1) { + private static void addShapeMoveTo(final OutlineShape shape, final Factory<? extends Vertex> vertexFactory, final Point p1) { if( DEBUG ) { System.err.println("Shape.MoveTo: "+p1); } shape.closeLastOutline(false); shape.addEmptyOutline(); shape.addVertex(0, vertexFactory.create(p1.x, p1.y, 0, p1.onCurve)); } - private static void addShapeLineTo(final OutlineShape shape, Factory<? extends Vertex> vertexFactory, Point p1) { + private static void addShapeLineTo(final OutlineShape shape, final Factory<? extends Vertex> vertexFactory, final Point p1) { if( DEBUG ) { System.err.println("Shape.LineTo: "+p1); } shape.addVertex(0, vertexFactory.create(p1.x, p1.y, 0, p1.onCurve)); } - private static void addShapeQuadTo(final OutlineShape shape, Factory<? extends Vertex> vertexFactory, Point p1, Point p2) { + private static void addShapeQuadTo(final OutlineShape shape, final Factory<? extends Vertex> vertexFactory, final Point p1, final Point p2) { if( DEBUG ) { System.err.println("Shape.QuadTo: "+p1+", "+p2); } shape.addVertex(0, vertexFactory.create(p1.x, p1.y, 0, p1.onCurve)); shape.addVertex(0, vertexFactory.create(p2.x, p2.y, 0, p2.onCurve)); } - private static void addShapeQuadTo(final OutlineShape shape, Factory<? extends Vertex> vertexFactory, Point p1, - float p2x, float p2y, boolean p2OnCurve) { + private static void addShapeQuadTo(final OutlineShape shape, final Factory<? extends Vertex> vertexFactory, final Point p1, + final float p2x, final float p2y, final boolean p2OnCurve) { if( DEBUG ) { System.err.println("Shape.QuadTo: "+p1+", p2 "+p2x+", "+p2y+", onCurve "+p2OnCurve); } shape.addVertex(0, vertexFactory.create(p1.x, p1.y, 0, p1.onCurve)); shape.addVertex(0, vertexFactory.create(p2x, p2y, 0, p2OnCurve)); @@ -73,7 +73,7 @@ public class TypecastRenderer { shape.addVertex(0, vertexFactory.create(p3.x, p3.y, 0, p3.onCurve)); } */ - public static OutlineShape buildShape(char symbol, OTGlyph glyph, Factory<? extends Vertex> vertexFactory) { + public static OutlineShape buildShape(final char symbol, final OTGlyph glyph, final Factory<? extends Vertex> vertexFactory) { // // See Typecast: GlyphPathFactory.addContourToPath(..) // @@ -108,7 +108,7 @@ public class TypecastRenderer { } } */ - private static void buildShapeImpl(final OutlineShape shape, char symbol, OTGlyph glyph, Factory<? extends Vertex> vertexFactory) { + private static void buildShapeImpl(final OutlineShape shape, final char symbol, final OTGlyph glyph, final Factory<? extends Vertex> vertexFactory) { // Iterate through all of the points in the glyph. Each time we find a // contour end point, add the point range to the path. int startIndex = 0; @@ -217,7 +217,7 @@ public class TypecastRenderer { } } - private static float midValue(float a, float b) { + private static float midValue(final float a, final float b) { return a + (b - a)/2f; } } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/Disassembler.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/Disassembler.java index 8b685659e..181f77ee4 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/Disassembler.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/Disassembler.java @@ -22,7 +22,7 @@ public class Disassembler { * @param ip The current instruction pointer * @return The new instruction pointer */ - public static int advanceIP(short[] instructions, int ip) { + public static int advanceIP(final short[] instructions, int ip) { // The high word specifies font, cvt, or glyph program int i = ip & 0xffff; @@ -46,8 +46,8 @@ public class Disassembler { return ip; } - public static short getPushCount(short[] instructions, int ip) { - short instr = instructions[ip & 0xffff]; + public static short getPushCount(final short[] instructions, final int ip) { + final short instr = instructions[ip & 0xffff]; if ((Mnemonic.NPUSHB == instr) || (Mnemonic.NPUSHW == instr)) { return instructions[(ip & 0xffff) + 1]; } else if ((Mnemonic.PUSHB == (instr & 0xf8)) || (Mnemonic.PUSHW == (instr & 0xf8))) { @@ -56,11 +56,11 @@ public class Disassembler { return 0; } - public static int[] getPushData(short[] instructions, int ip) { - int count = getPushCount(instructions, ip); - int[] data = new int[count]; - int i = ip & 0xffff; - short instr = instructions[i]; + public static int[] getPushData(final short[] instructions, final int ip) { + final int count = getPushCount(instructions, ip); + final int[] data = new int[count]; + final int i = ip & 0xffff; + final short instr = instructions[i]; if (Mnemonic.NPUSHB == instr) { for (int j = 0; j < count; j++) { data[j] = instructions[i + j + 2]; @@ -81,8 +81,8 @@ public class Disassembler { return data; } - public static String disassemble(short[] instructions, int leadingSpaces) { - StringBuilder sb = new StringBuilder(); + public static String disassemble(final short[] instructions, final int leadingSpaces) { + final StringBuilder sb = new StringBuilder(); int ip = 0; while (ip < instructions.length) { for (int i = 0; i < leadingSpaces; i++) { @@ -91,7 +91,7 @@ public class Disassembler { sb.append(ip).append(": "); sb.append(Mnemonic.getMnemonic(instructions[ip])); if (getPushCount(instructions, ip) > 0) { - int[] data = getPushData(instructions, ip); + final int[] data = getPushData(instructions, ip); for(int j = 0; j < data.length; j++) { if ((instructions[ip] == Mnemonic.PUSHW) || (instructions[ip] == Mnemonic.NPUSHW)) { diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/Fixed.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/Fixed.java index 0a4786f82..14e83814c 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/Fixed.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/Fixed.java @@ -812,7 +812,7 @@ public class Fixed { * @param num Input * @return Output */ - public static int arctan( int num ) { + public static int arctan( final int num ) { return 0; } @@ -822,7 +822,7 @@ public class Fixed { * @param num The 26.6 fixed number in question * @return The resulting square root */ - public static int squareRoot(int num) { + public static int squareRoot(final int num) { int n = num; int divisor = num; int nSquared; @@ -841,12 +841,12 @@ public class Fixed { return n; } - public static float floatValue(long fixed) { + public static float floatValue(final long fixed) { return (fixed >> 16) + (float)(fixed & 0xffff) / 0x10000; } - public static float roundedFloatValue(long fixed, int decimalPlaces) { - int factor = 10 * decimalPlaces; + public static float roundedFloatValue(final long fixed, final int decimalPlaces) { + final int factor = 10 * decimalPlaces; return (float)((int)(floatValue(fixed) * factor)) / factor; } } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/Mnemonic.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/Mnemonic.java index d6c9da268..6df892d4d 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/Mnemonic.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/Mnemonic.java @@ -143,7 +143,7 @@ public class Mnemonic { * @param opcode The opcode for which the mnemonic is required * @return The mnemonic, with a description */ - public static String getMnemonic(short opcode) { + public static String getMnemonic(final short opcode) { if (opcode >= MIRP) return "MIRP["+((opcode&16)==0?"nrp0,":"srp0,")+((opcode&8)==0?"nmd,":"md,")+((opcode&4)==0?"nrd,":"rd,")+(opcode&3)+"]"; else if (opcode >= MDRP) return "MDRP["+((opcode&16)==0?"nrp0,":"srp0,")+((opcode&8)==0?"nmd,":"md,")+((opcode&4)==0?"nrd,":"rd,")+(opcode&3)+"]"; else if (opcode >= PUSHW) return "PUSHW["+((opcode&7)+1)+"]"; @@ -269,7 +269,7 @@ public class Mnemonic { else return "????"; } - public static String getComment(short opcode) { + public static String getComment(final short opcode) { if (opcode >= MIRP) return "MIRP["+((opcode&16)==0?"nrp0,":"srp0,")+((opcode&8)==0?"nmd,":"md,")+((opcode&4)==0?"nrd,":"rd,")+(opcode&3)+"]\t\tMove Indirect Relative Point"; else if (opcode >= MDRP) return "MDRP["+((opcode&16)==0?"nrp0,":"srp0,")+((opcode&8)==0?"nmd,":"md,")+((opcode&4)==0?"nrd,":"rd,")+(opcode&3)+"]\t\tMove Direct Relative Point"; else if (opcode >= PUSHW) return "PUSHW["+((opcode&7)+1)+"]"; diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/OTFont.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/OTFont.java index 7c3b32e2c..e83a428ed 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/OTFont.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/OTFont.java @@ -79,7 +79,7 @@ import jogamp.graph.font.typecast.ot.table.VheaTable; */ public class OTFont { - private OTFontCollection _fc; + private final OTFontCollection _fc; private TableDirectory _tableDirectory = null; private Table[] _tables; private Os2Table _os2; @@ -98,17 +98,17 @@ public class OTFont { /** * Constructor */ - public OTFont(OTFontCollection fc) { + public OTFont(final OTFontCollection fc) { _fc = fc; } - public StringBuilder getName(int nameIndex, StringBuilder sb) { + public StringBuilder getName(final int nameIndex, StringBuilder sb) { if(null == sb) { sb = new StringBuilder(); } return _name.getRecordsRecordString(sb, nameIndex); } - public StringBuilder getAllNames(StringBuilder sb, String separator) { + public StringBuilder getAllNames(StringBuilder sb, final String separator) { if(null != _name) { if(null == sb) { sb = new StringBuilder(); @@ -120,7 +120,7 @@ public class OTFont { return sb; } - public Table getTable(int tableType) { + public Table getTable(final int tableType) { for (int i = 0; i < _tables.length; i++) { if ((_tables[i] != null) && (_tables[i].getType() == tableType)) { return _tables[i]; @@ -185,7 +185,7 @@ public class OTFont { return _maxp.getNumGlyphs(); } - public OTGlyph getGlyph(int i) { + public OTGlyph getGlyph(final int i) { final GlyfDescript _glyfDescr = _glyf.getDescription(i); return (null != _glyfDescr) @@ -201,11 +201,11 @@ public class OTFont { } private Table readTable( - DataInputStream dis, - int tablesOrigin, - int tag) throws IOException { + final DataInputStream dis, + final int tablesOrigin, + final int tag) throws IOException { dis.reset(); - DirectoryEntry entry = _tableDirectory.getEntryByTag(tag); + final DirectoryEntry entry = _tableDirectory.getEntryByTag(tag); if (entry == null) { return null; } @@ -225,9 +225,9 @@ public class OTFont { * individual font resource data. */ protected void read( - DataInputStream dis, - int directoryOffset, - int tablesOrigin) throws IOException { + final DataInputStream dis, + final int directoryOffset, + final int tablesOrigin) throws IOException { // Load the table directory dis.reset(); @@ -255,7 +255,7 @@ public class OTFont { // Load all other tables for (int i = 0; i < _tableDirectory.getNumTables(); i++) { - DirectoryEntry entry = _tableDirectory.getEntry(i); + final DirectoryEntry entry = _tableDirectory.getEntry(i); if (entry.getTag() == Table.head || entry.getTag() == Table.hhea || entry.getTag() == Table.maxp diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/OTFontCollection.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/OTFontCollection.java index c79380f16..e5ad2900a 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/OTFontCollection.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/OTFontCollection.java @@ -48,7 +48,7 @@ public class OTFontCollection { private String _fileName; private TTCHeader _ttcHeader; private OTFont[] _fonts; - private ArrayList<Table> _tables = new ArrayList<Table>(); + private final ArrayList<Table> _tables = new ArrayList<Table>(); private boolean _resourceFork = false; /** Creates new FontCollection */ @@ -58,8 +58,8 @@ public class OTFontCollection { /** * @param file The OpenType font file */ - public static OTFontCollection create(File file) throws IOException { - OTFontCollection fc = new OTFontCollection(); + public static OTFontCollection create(final File file) throws IOException { + final OTFontCollection fc = new OTFontCollection(); fc.read(file); return fc; } @@ -72,7 +72,7 @@ public class OTFontCollection { return _fileName; } - public OTFont getFont(int i) { + public OTFont getFont(final int i) { return _fonts[i]; } @@ -84,9 +84,9 @@ public class OTFontCollection { return _ttcHeader; } - public Table getTable(DirectoryEntry de) { + public Table getTable(final DirectoryEntry de) { for (int i = 0; i < _tables.size(); i++) { - Table table = _tables.get(i); + final Table table = _tables.get(i); if ((table.getDirectoryEntry().getTag() == de.getTag()) && (table.getDirectoryEntry().getOffset() == de.getOffset())) { return table; @@ -95,7 +95,7 @@ public class OTFontCollection { return null; } - public void addTable(Table table) { + public void addTable(final Table table) { _tables.add(table); } @@ -120,7 +120,7 @@ public class OTFontCollection { _resourceFork = true; } - DataInputStream dis = new DataInputStream( + final DataInputStream dis = new DataInputStream( new BufferedInputStream( new FileInputStream(file), (int) file.length())); dis.mark((int) file.length()); @@ -128,22 +128,22 @@ public class OTFontCollection { if (_resourceFork || _pathName.endsWith(".dfont")) { // This is a Macintosh font suitcase resource - ResourceHeader resourceHeader = new ResourceHeader(dis); + final ResourceHeader resourceHeader = new ResourceHeader(dis); // Seek to the map offset and read the map dis.reset(); dis.skip(resourceHeader.getMapOffset()); - ResourceMap map = new ResourceMap(dis); + final ResourceMap map = new ResourceMap(dis); // Get the 'sfnt' resources - ResourceType resourceType = map.getResourceType("sfnt"); + final ResourceType resourceType = map.getResourceType("sfnt"); // Load the font data _fonts = new OTFont[resourceType.getCount()]; for (int i = 0; i < resourceType.getCount(); i++) { - ResourceReference resourceReference = resourceType.getReference(i); + final ResourceReference resourceReference = resourceType.getReference(i); _fonts[i] = new OTFont(this); - int offset = resourceHeader.getDataOffset() + + final int offset = resourceHeader.getDataOffset() + resourceReference.getDataOffset() + 4; _fonts[i].read(dis, offset, offset); } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/OTGlyph.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/OTGlyph.java index 270507fec..7bfffd58c 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/OTGlyph.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/OTGlyph.java @@ -79,7 +79,7 @@ public class OTGlyph { * @param lsb The Left Side Bearing. * @param advance The advance width. */ - public OTGlyph(GlyphDescription gd, short lsb, int advance) { + public OTGlyph(final GlyphDescription gd, final short lsb, final int advance) { _leftSideBearing = lsb; _advanceWidth = advance; describe(gd); @@ -91,11 +91,11 @@ public class OTGlyph { * @param lsb The Left Side Bearing. * @param advance The advance width. */ - public OTGlyph(Charstring cs, short lsb, int advance) { + public OTGlyph(final Charstring cs, final short lsb, final int advance) { _leftSideBearing = lsb; _advanceWidth = advance; if (cs instanceof CharstringType2) { - T2Interpreter t2i = new T2Interpreter(); + final T2Interpreter t2i = new T2Interpreter(); _points = t2i.execute((CharstringType2) cs); } else { //throw unsupported charstring type @@ -118,7 +118,7 @@ public class OTGlyph { return _leftSideBearing; } - public Point getPoint(int i) { + public Point getPoint(final int i) { return _points[i]; } @@ -129,7 +129,7 @@ public class OTGlyph { /** * @param factor a 16.16 fixed value */ - public void scale(int factor) { + public void scale(final int factor) { for (int i = 0; i < _points.length; i++) { //points[i].x = ( points[i].x * factor ) >> 6; //points[i].y = ( points[i].y * factor ) >> 6; @@ -143,11 +143,11 @@ public class OTGlyph { /** * Set the points of a glyph from the GlyphDescription */ - private void describe(GlyphDescription gd) { + private void describe(final GlyphDescription gd) { int endPtIndex = 0; _points = new Point[gd.getPointCount() /* + 2 */ ]; for (int i = 0; i < gd.getPointCount(); i++) { - boolean endPt = gd.getEndPtOfContours(endPtIndex) == i; + final boolean endPt = gd.getEndPtOfContours(endPtIndex) == i; if (endPt) { endPtIndex++; } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/Point.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/Point.java index 0cac8ab44..76b0f90f3 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/Point.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/Point.java @@ -19,7 +19,7 @@ public class Point { public boolean onCurve = true; public boolean endOfContour = false; - public Point(int x, int y, boolean onCurve, boolean endOfContour) { + public Point(final int x, final int y, final boolean onCurve, final boolean endOfContour) { this.x = x; this.y = y; this.onCurve = onCurve; diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceData.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceData.java index 7a5b0c4d2..709ff9e91 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceData.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceData.java @@ -30,11 +30,11 @@ import java.io.IOException; */ public class ResourceData { - private byte[] data; + private final byte[] data; /** Creates new ResourceData */ - public ResourceData(DataInput di) throws IOException { - int dataLen = di.readInt(); + public ResourceData(final DataInput di) throws IOException { + final int dataLen = di.readInt(); data = new byte[dataLen]; di.readFully(data); } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceFile.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceFile.java index 468ab2e1c..767eafb6b 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceFile.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceFile.java @@ -31,11 +31,11 @@ import java.io.RandomAccessFile; */ public class ResourceFile { - private ResourceHeader header; - private ResourceMap map; + private final ResourceHeader header; + private final ResourceMap map; /** Creates new Resource */ - public ResourceFile(RandomAccessFile raf) throws IOException { + public ResourceFile(final RandomAccessFile raf) throws IOException { // Read header at the beginning of the file raf.seek(0); @@ -50,13 +50,13 @@ public class ResourceFile { return map; } - public static void main(String[] args) { + public static void main(final String[] args) { try { //RandomAccessFile raf = new RandomAccessFile("/Library/Fonts/GillSans.dfont", "r"); // Tests loading a font from a resource fork on Mac OS X - RandomAccessFile raf = new RandomAccessFile("/Library/Fonts/Georgia/..namedfork/rsrc", "r"); - ResourceFile resource = new ResourceFile(raf); + final RandomAccessFile raf = new RandomAccessFile("/Library/Fonts/Georgia/..namedfork/rsrc", "r"); + final ResourceFile resource = new ResourceFile(raf); for (int i = 0; i < resource.getResourceMap().getResourceTypeCount(); i++) { System.out.println(resource.getResourceMap().getResourceType(i).getTypeAsString()); } @@ -70,7 +70,7 @@ public class ResourceFile { reference = type.getReference(i); System.out.println(reference.getName()); } - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); } } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceHeader.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceHeader.java index de13b116f..dea0b9843 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceHeader.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceHeader.java @@ -30,13 +30,13 @@ import java.io.IOException; */ public class ResourceHeader { - private int dataOffset; - private int mapOffset; - private int dataLen; - private int mapLen; + private final int dataOffset; + private final int mapOffset; + private final int dataLen; + private final int mapLen; /** Creates new ResourceHeader */ - public ResourceHeader(DataInput di) throws IOException { + public ResourceHeader(final DataInput di) throws IOException { dataOffset = di.readInt(); mapOffset = di.readInt(); dataLen = di.readInt(); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceMap.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceMap.java index d348c645e..b22a06325 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceMap.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceMap.java @@ -30,21 +30,21 @@ import java.io.IOException; */ public class ResourceMap { - private byte[] headerCopy = new byte[16]; - private int nextResourceMap; - private int fileReferenceNumber; - private int attributes; - private ResourceType[] types; + private final byte[] headerCopy = new byte[16]; + private final int nextResourceMap; + private final int fileReferenceNumber; + private final int attributes; + private final ResourceType[] types; /** Creates new ResourceMap */ - public ResourceMap(DataInput di) throws IOException { + public ResourceMap(final DataInput di) throws IOException { di.readFully(headerCopy); nextResourceMap = di.readInt(); fileReferenceNumber = di.readUnsignedShort(); attributes = di.readUnsignedShort(); - int typeOffset = di.readUnsignedShort(); - int nameOffset = di.readUnsignedShort(); - int typeCount = di.readUnsignedShort() + 1; + final int typeOffset = di.readUnsignedShort(); + final int nameOffset = di.readUnsignedShort(); + final int typeCount = di.readUnsignedShort() + 1; // Read types types = new ResourceType[typeCount]; @@ -63,9 +63,9 @@ public class ResourceMap { } } - public ResourceType getResourceType(String typeName) { + public ResourceType getResourceType(final String typeName) { for (int i = 0; i < types.length; i++) { - String s = types[i].getTypeAsString(); + final String s = types[i].getTypeAsString(); if (types[i].getTypeAsString().equals(typeName)) { return types[i]; } @@ -73,7 +73,7 @@ public class ResourceMap { return null; } - public ResourceType getResourceType(int i) { + public ResourceType getResourceType(final int i) { return types[i]; } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceReference.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceReference.java index 9d1534821..f76b85cf4 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceReference.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceReference.java @@ -30,15 +30,15 @@ import java.io.IOException; */ public class ResourceReference { - private int id; - private short nameOffset; - private short attributes; - private int dataOffset; - private int handle; + private final int id; + private final short nameOffset; + private final short attributes; + private final int dataOffset; + private final int handle; private String name; /** Creates new ResourceReference */ - protected ResourceReference(DataInput di) throws IOException { + protected ResourceReference(final DataInput di) throws IOException { id = di.readUnsignedShort(); nameOffset = di.readShort(); attributes = (short) di.readUnsignedByte(); @@ -46,10 +46,10 @@ public class ResourceReference { handle = di.readInt(); } - protected void readName(DataInput di) throws IOException { + protected void readName(final DataInput di) throws IOException { if (nameOffset > -1) { - int len = di.readUnsignedByte(); - byte[] buf = new byte[len]; + final int len = di.readUnsignedByte(); + final byte[] buf = new byte[len]; di.readFully(buf); name = new String(buf); } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceType.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceType.java index 2ad002e6a..903fe1a48 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceType.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceType.java @@ -30,26 +30,26 @@ import java.io.IOException; */ public class ResourceType { - private int type; - private int count; - private int offset; - private ResourceReference[] references; + private final int type; + private final int count; + private final int offset; + private final ResourceReference[] references; /** Creates new ResourceType */ - protected ResourceType(DataInput di) throws IOException { + protected ResourceType(final DataInput di) throws IOException { type = di.readInt(); count = di.readUnsignedShort() + 1; offset = di.readUnsignedShort(); references = new ResourceReference[count]; } - protected void readRefs(DataInput di) throws IOException { + protected void readRefs(final DataInput di) throws IOException { for (int i = 0; i < count; i++) { references[i] = new ResourceReference(di); } } - protected void readNames(DataInput di) throws IOException { + protected void readNames(final DataInput di) throws IOException { for (int i = 0; i < count; i++) { references[i].readName(di); } @@ -76,7 +76,7 @@ public class ResourceType { return offset; } - public ResourceReference getReference(int i) { + public ResourceReference getReference(final int i) { return references[i]; } } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/BaseTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/BaseTable.java index 60975dd52..49ab1d474 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/BaseTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/BaseTable.java @@ -41,9 +41,9 @@ public class BaseTable implements Table { private class BaseCoordFormat1 extends BaseCoord { - private short _coordinate; + private final short _coordinate; - protected BaseCoordFormat1(DataInput di) throws IOException { + protected BaseCoordFormat1(final DataInput di) throws IOException { _coordinate = di.readShort(); } @@ -61,11 +61,11 @@ public class BaseTable implements Table { private class BaseCoordFormat2 extends BaseCoord { - private short _coordinate; - private int _referenceGlyph; - private int _baseCoordPoint; + private final short _coordinate; + private final int _referenceGlyph; + private final int _baseCoordPoint; - protected BaseCoordFormat2(DataInput di) throws IOException { + protected BaseCoordFormat2(final DataInput di) throws IOException { _coordinate = di.readShort(); _referenceGlyph = di.readUnsignedShort(); _baseCoordPoint = di.readUnsignedShort(); @@ -85,10 +85,10 @@ public class BaseTable implements Table { private class BaseCoordFormat3 extends BaseCoord { - private short _coordinate; - private int _deviceTableOffset; + private final short _coordinate; + private final int _deviceTableOffset; - protected BaseCoordFormat3(DataInput di) throws IOException { + protected BaseCoordFormat3(final DataInput di) throws IOException { _coordinate = di.readShort(); _deviceTableOffset = di.readUnsignedShort(); } @@ -107,11 +107,11 @@ public class BaseTable implements Table { private class FeatMinMaxRecord { - private int _tag; - private int _minCoordOffset; - private int _maxCoordOffset; + private final int _tag; + private final int _minCoordOffset; + private final int _maxCoordOffset; - protected FeatMinMaxRecord(DataInput di) throws IOException { + protected FeatMinMaxRecord(final DataInput di) throws IOException { _tag = di.readInt(); _minCoordOffset = di.readUnsignedShort(); _maxCoordOffset = di.readUnsignedShort(); @@ -120,13 +120,13 @@ public class BaseTable implements Table { private class MinMax { - private int _minCoordOffset; - private int _maxCoordOffset; - private int _featMinMaxCount; - private FeatMinMaxRecord[] _featMinMaxRecord; + private final int _minCoordOffset; + private final int _maxCoordOffset; + private final int _featMinMaxCount; + private final FeatMinMaxRecord[] _featMinMaxRecord; - protected MinMax(int minMaxOffset) throws IOException { - DataInput di = getDataInputForOffset(minMaxOffset); + protected MinMax(final int minMaxOffset) throws IOException { + final DataInput di = getDataInputForOffset(minMaxOffset); _minCoordOffset = di.readUnsignedShort(); _maxCoordOffset = di.readUnsignedShort(); _featMinMaxCount = di.readUnsignedShort(); @@ -139,13 +139,13 @@ public class BaseTable implements Table { private class BaseValues { - private int _defaultIndex; - private int _baseCoordCount; - private int[] _baseCoordOffset; - private BaseCoord[] _baseCoords; + private final int _defaultIndex; + private final int _baseCoordCount; + private final int[] _baseCoordOffset; + private final BaseCoord[] _baseCoords; - protected BaseValues(int baseValuesOffset) throws IOException { - DataInput di = getDataInputForOffset(baseValuesOffset); + protected BaseValues(final int baseValuesOffset) throws IOException { + final DataInput di = getDataInputForOffset(baseValuesOffset); _defaultIndex = di.readUnsignedShort(); _baseCoordCount = di.readUnsignedShort(); _baseCoordOffset = new int[_baseCoordCount]; @@ -154,7 +154,7 @@ public class BaseTable implements Table { } _baseCoords = new BaseCoord[_baseCoordCount]; for (int i = 0; i < _baseCoordCount; ++i) { - int format = di.readUnsignedShort(); + final int format = di.readUnsignedShort(); switch (format) { case 1: _baseCoords[i] = new BaseCoordFormat1(di); @@ -172,10 +172,10 @@ public class BaseTable implements Table { private class BaseLangSysRecord { - private int _baseLangSysTag; - private int _minMaxOffset; + private final int _baseLangSysTag; + private final int _minMaxOffset; - protected BaseLangSysRecord(DataInput di) throws IOException { + protected BaseLangSysRecord(final DataInput di) throws IOException { _baseLangSysTag = di.readInt(); _minMaxOffset = di.readUnsignedShort(); } @@ -191,17 +191,17 @@ public class BaseTable implements Table { private class BaseScript { - private int _thisOffset; - private int _baseValuesOffset; - private int _defaultMinMaxOffset; - private int _baseLangSysCount; - private BaseLangSysRecord[] _baseLangSysRecord; + private final int _thisOffset; + private final int _baseValuesOffset; + private final int _defaultMinMaxOffset; + private final int _baseLangSysCount; + private final BaseLangSysRecord[] _baseLangSysRecord; private BaseValues _baseValues; private MinMax[] _minMax; - protected BaseScript(int baseScriptOffset) throws IOException { + protected BaseScript(final int baseScriptOffset) throws IOException { _thisOffset = baseScriptOffset; - DataInput di = getDataInputForOffset(baseScriptOffset); + final DataInput di = getDataInputForOffset(baseScriptOffset); _baseValuesOffset = di.readUnsignedShort(); _defaultMinMaxOffset = di.readUnsignedShort(); _baseLangSysCount = di.readUnsignedShort(); @@ -219,7 +219,7 @@ public class BaseTable implements Table { @Override public String toString() { - StringBuilder sb = new StringBuilder() + final StringBuilder sb = new StringBuilder() .append("\nBaseScript BaseScriptT").append(Integer.toHexString(_thisOffset)) .append("\nBaseValuesT").append(Integer.toHexString(_thisOffset + _baseValuesOffset)) .append("\nMinMaxT").append(Integer.toHexString(_thisOffset + _defaultMinMaxOffset)) @@ -241,10 +241,10 @@ public class BaseTable implements Table { private class BaseScriptRecord { - private int _baseScriptTag; - private int _baseScriptOffset; + private final int _baseScriptTag; + private final int _baseScriptOffset; - protected BaseScriptRecord(DataInput di) throws IOException { + protected BaseScriptRecord(final DataInput di) throws IOException { _baseScriptTag = di.readInt(); _baseScriptOffset = di.readUnsignedShort(); } @@ -260,14 +260,14 @@ public class BaseTable implements Table { private class BaseScriptList { - private int _thisOffset; - private int _baseScriptCount; - private BaseScriptRecord[] _baseScriptRecord; - private BaseScript[] _baseScripts; + private final int _thisOffset; + private final int _baseScriptCount; + private final BaseScriptRecord[] _baseScriptRecord; + private final BaseScript[] _baseScripts; - protected BaseScriptList(int baseScriptListOffset) throws IOException { + protected BaseScriptList(final int baseScriptListOffset) throws IOException { _thisOffset = baseScriptListOffset; - DataInput di = getDataInputForOffset(baseScriptListOffset); + final DataInput di = getDataInputForOffset(baseScriptListOffset); _baseScriptCount = di.readUnsignedShort(); _baseScriptRecord = new BaseScriptRecord[_baseScriptCount]; for (int i = 0; i < _baseScriptCount; ++i) { @@ -282,7 +282,7 @@ public class BaseTable implements Table { @Override public String toString() { - StringBuilder sb = new StringBuilder() + final StringBuilder sb = new StringBuilder() .append("\nBaseScriptList BaseScriptListT").append(Integer.toHexString(_thisOffset)) .append("\n").append(Integer.toHexString(_baseScriptCount)); for (int i = 0; i < _baseScriptCount; ++i) { @@ -299,13 +299,13 @@ public class BaseTable implements Table { private class BaseTagList { - private int _thisOffset; - private int _baseTagCount; - private int[] _baselineTag; + private final int _thisOffset; + private final int _baseTagCount; + private final int[] _baselineTag; - protected BaseTagList(int baseTagListOffset) throws IOException { + protected BaseTagList(final int baseTagListOffset) throws IOException { _thisOffset = baseTagListOffset; - DataInput di = getDataInputForOffset(baseTagListOffset); + final DataInput di = getDataInputForOffset(baseTagListOffset); _baseTagCount = di.readUnsignedShort(); _baselineTag = new int[_baseTagCount]; for (int i = 0; i < _baseTagCount; ++i) { @@ -315,7 +315,7 @@ public class BaseTable implements Table { @Override public String toString() { - StringBuilder sb = new StringBuilder() + final StringBuilder sb = new StringBuilder() .append("\nBaseTagList BaseTagListT").append(Integer.toHexString(_thisOffset)) .append("\n").append(Integer.toHexString(_baseTagCount)); for (int i = 0; i < _baseTagCount; ++i) { @@ -327,15 +327,15 @@ public class BaseTable implements Table { private class Axis { - private int _thisOffset; - private int _baseTagListOffset; - private int _baseScriptListOffset; + private final int _thisOffset; + private final int _baseTagListOffset; + private final int _baseScriptListOffset; private BaseTagList _baseTagList; private BaseScriptList _baseScriptList; - protected Axis(int axisOffset) throws IOException { + protected Axis(final int axisOffset) throws IOException { _thisOffset = axisOffset; - DataInput di = getDataInputForOffset(axisOffset); + final DataInput di = getDataInputForOffset(axisOffset); _baseTagListOffset = di.readUnsignedShort(); _baseScriptListOffset = di.readUnsignedShort(); if (_baseTagListOffset != 0) { @@ -359,22 +359,22 @@ public class BaseTable implements Table { } } - private DirectoryEntry _de; - private int _version; - private int _horizAxisOffset; - private int _vertAxisOffset; + private final DirectoryEntry _de; + private final int _version; + private final int _horizAxisOffset; + private final int _vertAxisOffset; private Axis _horizAxis; private Axis _vertAxis; private byte[] _buf; /** Creates a new instance of BaseTable */ - protected BaseTable(DirectoryEntry de, DataInput di) throws IOException { + protected BaseTable(final DirectoryEntry de, final DataInput di) throws IOException { _de = (DirectoryEntry) de.clone(); // Load entire table into a buffer, and create another input stream _buf = new byte[de.getLength()]; di.readFully(_buf); - DataInput di2 = getDataInputForOffset(0); + final DataInput di2 = getDataInputForOffset(0); _version = di2.readInt(); _horizAxisOffset = di2.readUnsignedShort(); @@ -390,7 +390,7 @@ public class BaseTable implements Table { _buf = null; } - private DataInput getDataInputForOffset(int offset) { + private DataInput getDataInputForOffset(final int offset) { return new DataInputStream(new ByteArrayInputStream( _buf, offset, _de.getLength() - offset)); @@ -404,8 +404,8 @@ public class BaseTable implements Table { // return String.format("%1$8x", value); // } - static protected String tagAsString(int tag) { - char[] c = new char[4]; + static protected String tagAsString(final int tag) { + final char[] c = new char[4]; c[0] = (char)((tag >> 24) & 0xff); c[1] = (char)((tag >> 16) & 0xff); c[2] = (char)((tag >> 8) & 0xff); @@ -420,7 +420,7 @@ public class BaseTable implements Table { @Override public String toString() { - StringBuilder sb = new StringBuilder() + final StringBuilder sb = new StringBuilder() .append("; 'BASE' Table - Baseline\n;-------------------------------------\n\n") .append("BASEHeader BASEHeaderT").append(Integer.toHexString(0)) .append("\n").append(Integer.toHexString(_version)) diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CffTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CffTable.java index a36a49923..b0acff575 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CffTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CffTable.java @@ -39,11 +39,11 @@ public class CffTable implements Table { public class Dict { - private Dictionary<Integer, Object> _entries = new Hashtable<Integer, Object>(); - private int[] _data; + private final Dictionary<Integer, Object> _entries = new Hashtable<Integer, Object>(); + private final int[] _data; private int _index; - protected Dict(int[] data, int offset, int length) { + protected Dict(final int[] data, final int offset, final int length) { _data = data; _index = offset; while (_index < offset + length) { @@ -51,12 +51,12 @@ public class CffTable implements Table { } } - public Object getValue(int key) { + public Object getValue(final int key) { return _entries.get(key); } private boolean addKeyAndValueEntry() { - ArrayList<Object> operands = new ArrayList<Object>(); + final ArrayList<Object> operands = new ArrayList<Object>(); Object operand = null; while (isOperandAtIndex()) { operand = nextOperand(); @@ -76,7 +76,7 @@ public class CffTable implements Table { } private boolean isOperandAtIndex() { - int b0 = _data[_index]; + final int b0 = _data[_index]; if ((32 <= b0 && b0 <= 254) || b0 == 28 || b0 == 29 @@ -87,7 +87,7 @@ public class CffTable implements Table { } private boolean isOperatorAtIndex() { - int b0 = _data[_index]; + final int b0 = _data[_index]; if (0 <= b0 && b0 <= 21) { return true; } @@ -95,7 +95,7 @@ public class CffTable implements Table { } private Object nextOperand() { - int b0 = _data[_index]; + final int b0 = _data[_index]; if (32 <= b0 && b0 <= 246) { // 1 byte integer @@ -104,35 +104,35 @@ public class CffTable implements Table { } else if (247 <= b0 && b0 <= 250) { // 2 byte integer - int b1 = _data[_index + 1]; + final int b1 = _data[_index + 1]; _index += 2; return new Integer((b0 - 247) * 256 + b1 + 108); } else if (251 <= b0 && b0 <= 254) { // 2 byte integer - int b1 = _data[_index + 1]; + final int b1 = _data[_index + 1]; _index += 2; return new Integer(-(b0 - 251) * 256 - b1 - 108); } else if (b0 == 28) { // 3 byte integer - int b1 = _data[_index + 1]; - int b2 = _data[_index + 2]; + final int b1 = _data[_index + 1]; + final int b2 = _data[_index + 2]; _index += 3; return new Integer(b1 << 8 | b2); } else if (b0 == 29) { // 5 byte integer - int b1 = _data[_index + 1]; - int b2 = _data[_index + 2]; - int b3 = _data[_index + 3]; - int b4 = _data[_index + 4]; + final int b1 = _data[_index + 1]; + final int b2 = _data[_index + 2]; + final int b3 = _data[_index + 3]; + final int b4 = _data[_index + 4]; _index += 5; return new Integer(b1 << 24 | b2 << 16 | b3 << 8 | b4); } else if (b0 == 30) { // Real number - StringBuilder fString = new StringBuilder(); + final StringBuilder fString = new StringBuilder(); int nibble1 = 0; int nibble2 = 0; ++_index; @@ -149,7 +149,7 @@ public class CffTable implements Table { } } - private String decodeRealNibble(int nibble) { + private String decodeRealNibble(final int nibble) { if (nibble < 0xa) { return Integer.toString(nibble); } else if (nibble == 0xa) { @@ -166,10 +166,10 @@ public class CffTable implements Table { @Override public String toString() { - StringBuilder sb = new StringBuilder(); - Enumeration<Integer> keys = _entries.keys(); + final StringBuilder sb = new StringBuilder(); + final Enumeration<Integer> keys = _entries.keys(); while (keys.hasMoreElements()) { - Integer key = keys.nextElement(); + final Integer key = keys.nextElement(); if ((key.intValue() & 0xc00) == 0xc00) { sb.append("12 ").append(key.intValue() & 0xff).append(": "); } else { @@ -183,12 +183,12 @@ public class CffTable implements Table { public class Index { - private int _count; - private int _offSize; - private int[] _offset; - private int[] _data; + private final int _count; + private final int _offSize; + private final int[] _offset; + private final int[] _data; - protected Index(DataInput di) throws IOException { + protected Index(final DataInput di) throws IOException { _count = di.readUnsignedShort(); _offset = new int[_count + 1]; _offSize = di.readUnsignedByte(); @@ -209,7 +209,7 @@ public class CffTable implements Table { return _count; } - public int getOffset(int index) { + public int getOffset(final int index) { return _offset[index]; } @@ -223,7 +223,7 @@ public class CffTable implements Table { @Override public String toString() { - StringBuilder sb = new StringBuilder(); + final StringBuilder sb = new StringBuilder(); sb.append("DICT\n"); sb.append("count: ").append(_count).append("\n"); sb.append("offSize: ").append(_offSize).append("\n"); @@ -246,19 +246,19 @@ public class CffTable implements Table { public class TopDictIndex extends Index { - protected TopDictIndex(DataInput di) throws IOException { + protected TopDictIndex(final DataInput di) throws IOException { super(di); } - public Dict getTopDict(int index) { - int offset = getOffset(index) - 1; - int len = getOffset(index + 1) - offset - 1; + public Dict getTopDict(final int index) { + final int offset = getOffset(index) - 1; + final int len = getOffset(index + 1) - offset - 1; return new Dict(getData(), offset, len); } @Override public String toString() { - StringBuilder sb = new StringBuilder(); + final StringBuilder sb = new StringBuilder(); for (int i = 0; i < getCount(); ++i) { sb.append(getTopDict(i).toString()).append("\n"); } @@ -268,18 +268,18 @@ public class CffTable implements Table { public class NameIndex extends Index { - protected NameIndex(DataInput di) throws IOException { + protected NameIndex(final DataInput di) throws IOException { super(di); } - public String getName(int index) { + public String getName(final int index) { String name = null; - int offset = getOffset(index) - 1; - int len = getOffset(index + 1) - offset - 1; + final int offset = getOffset(index) - 1; + final int len = getOffset(index + 1) - offset - 1; // Ensure the name hasn't been deleted if (getData()[offset] != 0) { - StringBuilder sb = new StringBuilder(); + final StringBuilder sb = new StringBuilder(); for (int i = offset; i < offset + len; ++i) { sb.append((char) getData()[i]); } @@ -292,7 +292,7 @@ public class CffTable implements Table { @Override public String toString() { - StringBuilder sb = new StringBuilder(); + final StringBuilder sb = new StringBuilder(); for (int i = 0; i < getCount(); ++i) { sb.append(getName(i)).append("\n"); } @@ -302,7 +302,7 @@ public class CffTable implements Table { public class StringIndex extends Index { - protected StringIndex(DataInput di) throws IOException { + protected StringIndex(final DataInput di) throws IOException { super(di); } @@ -314,10 +314,10 @@ public class CffTable implements Table { if (index >= getCount()) { return null; } - int offset = getOffset(index) - 1; - int len = getOffset(index + 1) - offset - 1; + final int offset = getOffset(index) - 1; + final int len = getOffset(index + 1) - offset - 1; - StringBuilder sb = new StringBuilder(); + final StringBuilder sb = new StringBuilder(); for (int i = offset; i < offset + len; ++i) { sb.append((char) getData()[i]); } @@ -327,8 +327,8 @@ public class CffTable implements Table { @Override public String toString() { - int nonStandardBase = CffStandardStrings.standardStrings.length; - StringBuilder sb = new StringBuilder(); + final int nonStandardBase = CffStandardStrings.standardStrings.length; + final StringBuilder sb = new StringBuilder(); for (int i = 0; i < getCount(); ++i) { sb.append(nonStandardBase + i).append(": "); sb.append(getString(nonStandardBase + i)).append("\n"); @@ -346,7 +346,7 @@ public class CffTable implements Table { return _first; } - protected void setFirst(int first) { + protected void setFirst(final int first) { _first = first; } @@ -354,14 +354,14 @@ public class CffTable implements Table { return _left; } - protected void setLeft(int left) { + protected void setLeft(final int left) { _left = left; } } private class CharsetRange1 extends CharsetRange { - protected CharsetRange1(DataInput di) throws IOException { + protected CharsetRange1(final DataInput di) throws IOException { setFirst(di.readUnsignedShort()); setLeft(di.readUnsignedByte()); } @@ -369,7 +369,7 @@ public class CffTable implements Table { private class CharsetRange2 extends CharsetRange { - protected CharsetRange2(DataInput di) throws IOException { + protected CharsetRange2(final DataInput di) throws IOException { setFirst(di.readUnsignedShort()); setLeft(di.readUnsignedShort()); } @@ -384,9 +384,9 @@ public class CffTable implements Table { private class CharsetFormat0 extends Charset { - private int[] _glyph; + private final int[] _glyph; - protected CharsetFormat0(DataInput di, int glyphCount) throws IOException { + protected CharsetFormat0(final DataInput di, final int glyphCount) throws IOException { _glyph = new int[glyphCount - 1]; // minus 1 because .notdef is omitted for (int i = 0; i < glyphCount - 1; ++i) { _glyph[i] = di.readUnsignedShort(); @@ -399,7 +399,7 @@ public class CffTable implements Table { } @Override - public int getSID(int gid) { + public int getSID(final int gid) { if (gid == 0) { return 0; } @@ -409,12 +409,12 @@ public class CffTable implements Table { private class CharsetFormat1 extends Charset { - private ArrayList<CharsetRange> _charsetRanges = new ArrayList<CharsetRange>(); + private final ArrayList<CharsetRange> _charsetRanges = new ArrayList<CharsetRange>(); - protected CharsetFormat1(DataInput di, int glyphCount) throws IOException { + protected CharsetFormat1(final DataInput di, final int glyphCount) throws IOException { int glyphsCovered = glyphCount - 1; // minus 1 because .notdef is omitted while (glyphsCovered > 0) { - CharsetRange range = new CharsetRange1(di); + final CharsetRange range = new CharsetRange1(di); _charsetRanges.add(range); glyphsCovered -= range.getLeft() + 1; } @@ -426,17 +426,17 @@ public class CffTable implements Table { } @Override - public int getSID(int gid) { + public int getSID(final int gid) { if (gid == 0) { return 0; } // Count through the ranges to find the one of interest int count = 0; - for (CharsetRange range : _charsetRanges) { + for (final CharsetRange range : _charsetRanges) { count += range.getLeft(); if (gid < count) { - int sid = gid - count + range.getFirst(); + final int sid = gid - count + range.getFirst(); return sid; } } @@ -446,12 +446,12 @@ public class CffTable implements Table { private class CharsetFormat2 extends Charset { - private ArrayList<CharsetRange> _charsetRanges = new ArrayList<CharsetRange>(); + private final ArrayList<CharsetRange> _charsetRanges = new ArrayList<CharsetRange>(); - protected CharsetFormat2(DataInput di, int glyphCount) throws IOException { + protected CharsetFormat2(final DataInput di, final int glyphCount) throws IOException { int glyphsCovered = glyphCount - 1; // minus 1 because .notdef is omitted while (glyphsCovered > 0) { - CharsetRange range = new CharsetRange2(di); + final CharsetRange range = new CharsetRange2(di); _charsetRanges.add(range); glyphsCovered -= range.getLeft() + 1; } @@ -463,16 +463,16 @@ public class CffTable implements Table { } @Override - public int getSID(int gid) { + public int getSID(final int gid) { if (gid == 0) { return 0; } // Count through the ranges to find the one of interest int count = 0; - for (CharsetRange range : _charsetRanges) { + for (final CharsetRange range : _charsetRanges) { if (gid < range.getLeft() + count) { - int sid = gid - count + range.getFirst() - 1; + final int sid = gid - count + range.getFirst() - 1; return sid; } count += range.getLeft(); @@ -481,23 +481,23 @@ public class CffTable implements Table { } } - private DirectoryEntry _de; - private int _major; - private int _minor; - private int _hdrSize; - private int _offSize; - private NameIndex _nameIndex; - private TopDictIndex _topDictIndex; - private StringIndex _stringIndex; - private Index _globalSubrIndex; - private Index _charStringsIndexArray[]; - private Charset[] _charsets; - private Charstring[][] _charstringsArray; - - private byte[] _buf; + private final DirectoryEntry _de; + private final int _major; + private final int _minor; + private final int _hdrSize; + private final int _offSize; + private final NameIndex _nameIndex; + private final TopDictIndex _topDictIndex; + private final StringIndex _stringIndex; + private final Index _globalSubrIndex; + private final Index _charStringsIndexArray[]; + private final Charset[] _charsets; + private final Charstring[][] _charstringsArray; + + private final byte[] _buf; /** Creates a new instance of CffTable */ - protected CffTable(DirectoryEntry de, DataInput di) throws IOException { + protected CffTable(final DirectoryEntry de, final DataInput di) throws IOException { _de = (DirectoryEntry) de.clone(); // Load entire table into a buffer, and create another input stream @@ -537,15 +537,15 @@ public class CffTable implements Table { // Charstrings INDEX // We load this before Charsets because we may need to know the number // of glyphs - Integer charStringsOffset = (Integer) _topDictIndex.getTopDict(i).getValue(17); + final Integer charStringsOffset = (Integer) _topDictIndex.getTopDict(i).getValue(17); di2 = getDataInputForOffset(charStringsOffset); _charStringsIndexArray[i] = new Index(di2); - int glyphCount = _charStringsIndexArray[i].getCount(); + final int glyphCount = _charStringsIndexArray[i].getCount(); // Charsets - Integer charsetOffset = (Integer) _topDictIndex.getTopDict(i).getValue(15); + final Integer charsetOffset = (Integer) _topDictIndex.getTopDict(i).getValue(15); di2 = getDataInputForOffset(charsetOffset); - int format = di2.readUnsignedByte(); + final int format = di2.readUnsignedByte(); switch (format) { case 0: _charsets[i] = new CharsetFormat0(di2, glyphCount); @@ -561,8 +561,8 @@ public class CffTable implements Table { // Create the charstrings _charstringsArray[i] = new Charstring[glyphCount]; for (int j = 0; j < glyphCount; ++j) { - int offset = _charStringsIndexArray[i].getOffset(j) - 1; - int len = _charStringsIndexArray[i].getOffset(j + 1) - offset - 1; + final int offset = _charStringsIndexArray[i].getOffset(j) - 1; + final int len = _charStringsIndexArray[i].getOffset(j + 1) - offset - 1; _charstringsArray[i][j] = new CharstringType2( i, _stringIndex.getString(_charsets[i].getSID(j)), @@ -575,7 +575,7 @@ public class CffTable implements Table { } } - private DataInput getDataInputForOffset(int offset) { + private DataInput getDataInputForOffset(final int offset) { return new DataInputStream(new ByteArrayInputStream( _buf, offset, _de.getLength() - offset)); @@ -585,15 +585,15 @@ public class CffTable implements Table { return _nameIndex; } - public Charset getCharset(int fontIndex) { + public Charset getCharset(final int fontIndex) { return _charsets[fontIndex]; } - public Charstring getCharstring(int fontIndex, int gid) { + public Charstring getCharstring(final int fontIndex, final int gid) { return _charstringsArray[fontIndex][gid]; } - public int getCharstringCount(int fontIndex) { + public int getCharstringCount(final int fontIndex) { return _charstringsArray[fontIndex].length; } @@ -604,7 +604,7 @@ public class CffTable implements Table { @Override public String toString() { - StringBuilder sb = new StringBuilder(); + final StringBuilder sb = new StringBuilder(); sb.append("'CFF' Table - Compact Font Format\n---------------------------------\n"); sb.append("\nName INDEX\n"); sb.append(_nameIndex.toString()); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CharstringType2.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CharstringType2.java index 7a7b51890..211499357 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CharstringType2.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CharstringType2.java @@ -106,24 +106,24 @@ public class CharstringType2 extends Charstring { "-Reserved-" }; - private int _index; - private String _name; - private int[] _data; - private int _offset; - private int _length; - private CffTable.Index _localSubrIndex; - private CffTable.Index _globalSubrIndex; + private final int _index; + private final String _name; + private final int[] _data; + private final int _offset; + private final int _length; + private final CffTable.Index _localSubrIndex; + private final CffTable.Index _globalSubrIndex; private int _ip; /** Creates a new instance of CharstringType2 */ protected CharstringType2( - int index, - String name, - int[] data, - int offset, - int length, - CffTable.Index localSubrIndex, - CffTable.Index globalSubrIndex) { + final int index, + final String name, + final int[] data, + final int offset, + final int length, + final CffTable.Index localSubrIndex, + final CffTable.Index globalSubrIndex) { _index = index; _name = name; _data = data; @@ -143,7 +143,7 @@ public class CharstringType2 extends Charstring { return _name; } - private void disassemble(StringBuilder sb) { + private void disassemble(final StringBuilder sb) { Number operand = null; while (isOperandAtIndex()) { operand = nextOperand(); @@ -170,7 +170,7 @@ public class CharstringType2 extends Charstring { } public boolean isOperandAtIndex() { - int b0 = _data[_ip]; + final int b0 = _data[_ip]; if ((32 <= b0 && b0 <= 255) || b0 == 28) { return true; } @@ -178,7 +178,7 @@ public class CharstringType2 extends Charstring { } public Number nextOperand() { - int b0 = _data[_ip]; + final int b0 = _data[_ip]; if (32 <= b0 && b0 <= 246) { // 1 byte integer @@ -187,29 +187,29 @@ public class CharstringType2 extends Charstring { } else if (247 <= b0 && b0 <= 250) { // 2 byte integer - int b1 = _data[_ip + 1]; + final int b1 = _data[_ip + 1]; _ip += 2; return new Integer((b0 - 247) * 256 + b1 + 108); } else if (251 <= b0 && b0 <= 254) { // 2 byte integer - int b1 = _data[_ip + 1]; + final int b1 = _data[_ip + 1]; _ip += 2; return new Integer(-(b0 - 251) * 256 - b1 - 108); } else if (b0 == 28) { // 3 byte integer - int b1 = _data[_ip + 1]; - int b2 = _data[_ip + 2]; + final int b1 = _data[_ip + 1]; + final int b2 = _data[_ip + 2]; _ip += 3; return new Integer(b1 << 8 | b2); } else if (b0 == 255) { // 16-bit signed integer with 16 bits of fraction - int b1 = (byte) _data[_ip + 1]; - int b2 = _data[_ip + 2]; - int b3 = _data[_ip + 3]; - int b4 = _data[_ip + 4]; + final int b1 = (byte) _data[_ip + 1]; + final int b2 = _data[_ip + 2]; + final int b3 = _data[_ip + 3]; + final int b4 = _data[_ip + 4]; _ip += 5; return new Float((b1 << 8 | b2) + ((b3 << 8 | b4) / 65536.0)); } else { @@ -227,7 +227,7 @@ public class CharstringType2 extends Charstring { @Override public String toString() { - StringBuilder sb = new StringBuilder(); + final StringBuilder sb = new StringBuilder(); resetIP(); while (moreBytes()) { disassemble(sb); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ClassDef.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ClassDef.java index 21698c76b..a65bcd525 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ClassDef.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ClassDef.java @@ -20,9 +20,9 @@ public abstract class ClassDef { public abstract int getFormat(); - protected static ClassDef read(RandomAccessFile raf) throws IOException { + protected static ClassDef read(final RandomAccessFile raf) throws IOException { ClassDef c = null; - int format = raf.readUnsignedShort(); + final int format = raf.readUnsignedShort(); if (format == 1) { c = new ClassDefFormat1(raf); } else if (format == 2) { diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ClassDefFormat1.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ClassDefFormat1.java index 94910e4f6..cbc05393f 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ClassDefFormat1.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ClassDefFormat1.java @@ -18,12 +18,12 @@ import java.io.RandomAccessFile; */ public class ClassDefFormat1 extends ClassDef { - private int startGlyph; - private int glyphCount; - private int[] classValues; + private final int startGlyph; + private final int glyphCount; + private final int[] classValues; /** Creates new ClassDefFormat1 */ - public ClassDefFormat1(RandomAccessFile raf) throws IOException { + public ClassDefFormat1(final RandomAccessFile raf) throws IOException { startGlyph = raf.readUnsignedShort(); glyphCount = raf.readUnsignedShort(); classValues = new int[glyphCount]; diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ClassDefFormat2.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ClassDefFormat2.java index 9906ecfb1..99283f026 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ClassDefFormat2.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ClassDefFormat2.java @@ -18,11 +18,11 @@ import java.io.RandomAccessFile; */ public class ClassDefFormat2 extends ClassDef { - private int classRangeCount; - private RangeRecord[] classRangeRecords; + private final int classRangeCount; + private final RangeRecord[] classRangeRecords; /** Creates new ClassDefFormat2 */ - public ClassDefFormat2(RandomAccessFile raf) throws IOException { + public ClassDefFormat2(final RandomAccessFile raf) throws IOException { classRangeCount = raf.readUnsignedShort(); classRangeRecords = new RangeRecord[classRangeCount]; for (int i = 0; i < classRangeCount; i++) { diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat.java index f7054852a..f29583ec4 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat.java @@ -61,10 +61,10 @@ public abstract class CmapFormat { public class Range { - private int _startCode; - private int _endCode; + private final int _startCode; + private final int _endCode; - protected Range(int startCode, int endCode) { + protected Range(final int startCode, final int endCode) { _startCode = startCode; _endCode = endCode; } @@ -82,12 +82,12 @@ public abstract class CmapFormat { protected int _length; protected int _language; - protected CmapFormat(DataInput di) throws IOException { + protected CmapFormat(final DataInput di) throws IOException { _length = di.readUnsignedShort(); _language = di.readUnsignedShort(); } - protected static CmapFormat create(int format, DataInput di) + protected static CmapFormat create(final int format, final DataInput di) throws IOException { switch(format) { case 0: diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat0.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat0.java index dd1ede232..505e8c942 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat0.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat0.java @@ -61,9 +61,9 @@ import java.io.IOException; */ public class CmapFormat0 extends CmapFormat { - private int[] _glyphIdArray = new int[256]; + private final int[] _glyphIdArray = new int[256]; - protected CmapFormat0(DataInput di) throws IOException { + protected CmapFormat0(final DataInput di) throws IOException { super(di); _format = 0; for (int i = 0; i < 256; i++) { @@ -77,7 +77,7 @@ public class CmapFormat0 extends CmapFormat { } @Override - public Range getRange(int index) throws ArrayIndexOutOfBoundsException { + public Range getRange(final int index) throws ArrayIndexOutOfBoundsException { if (index != 0) { throw new ArrayIndexOutOfBoundsException(); } @@ -85,7 +85,7 @@ public class CmapFormat0 extends CmapFormat { } @Override - public int mapCharCode(int charCode) { + public int mapCharCode(final int charCode) { if (0 <= charCode && charCode < 256) { return _glyphIdArray[charCode]; } else { diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat2.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat2.java index d071e9421..e57e509b4 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat2.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat2.java @@ -68,11 +68,11 @@ public class CmapFormat2 extends CmapFormat { int _arrayIndex; } - private int[] _subHeaderKeys = new int[256]; - private SubHeader[] _subHeaders; - private int[] _glyphIndexArray; + private final int[] _subHeaderKeys = new int[256]; + private final SubHeader[] _subHeaders; + private final int[] _glyphIndexArray; - protected CmapFormat2(DataInput di) throws IOException { + protected CmapFormat2(final DataInput di) throws IOException { super(di); _format = 2; @@ -86,15 +86,15 @@ public class CmapFormat2 extends CmapFormat { highest = Math.max(highest, _subHeaderKeys[i]); pos += 2; } - int subHeaderCount = highest / 8 + 1; + final int subHeaderCount = highest / 8 + 1; _subHeaders = new SubHeader[subHeaderCount]; // Read the subheaders, once again noting the highest glyphIndexArray // index range. - int indexArrayOffset = 8 * subHeaderCount + 518; + final int indexArrayOffset = 8 * subHeaderCount + 518; highest = 0; for (int i = 0; i < _subHeaders.length; ++i) { - SubHeader sh = new SubHeader(); + final SubHeader sh = new SubHeader(); sh._firstCode = di.readUnsignedShort(); sh._entryCount = di.readUnsignedShort(); sh._idDelta = di.readShort(); @@ -124,7 +124,7 @@ public class CmapFormat2 extends CmapFormat { } @Override - public Range getRange(int index) throws ArrayIndexOutOfBoundsException { + public Range getRange(final int index) throws ArrayIndexOutOfBoundsException { if (index < 0 || index >= _subHeaders.length) { throw new ArrayIndexOutOfBoundsException(); } @@ -147,18 +147,18 @@ public class CmapFormat2 extends CmapFormat { } @Override - public int mapCharCode(int charCode) { + public int mapCharCode(final int charCode) { // Get the appropriate subheader int index = 0; - int highByte = charCode >> 8; + final int highByte = charCode >> 8; if (highByte != 0) { index = _subHeaderKeys[highByte] / 8; } - SubHeader sh = _subHeaders[index]; + final SubHeader sh = _subHeaders[index]; // Is the charCode out-of-range? - int lowByte = charCode & 0xff; + final int lowByte = charCode & 0xff; if (lowByte < sh._firstCode || lowByte >= (sh._firstCode + sh._entryCount)) { return 0; diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat4.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat4.java index 2ae23d031..f84a4eab3 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat4.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat4.java @@ -59,18 +59,18 @@ import java.io.IOException; */ public class CmapFormat4 extends CmapFormat { - private int _segCountX2; - private int _searchRange; - private int _entrySelector; - private int _rangeShift; - private int[] _endCode; - private int[] _startCode; - private int[] _idDelta; - private int[] _idRangeOffset; - private int[] _glyphIdArray; - private int _segCount; - - protected CmapFormat4(DataInput di) throws IOException { + private final int _segCountX2; + private final int _searchRange; + private final int _entrySelector; + private final int _rangeShift; + private final int[] _endCode; + private final int[] _startCode; + private final int[] _idDelta; + private final int[] _idRangeOffset; + private final int[] _glyphIdArray; + private final int _segCount; + + protected CmapFormat4(final DataInput di) throws IOException { super(di); // 6 _format = 4; _segCountX2 = di.readUnsignedShort(); // +2 (8) @@ -97,7 +97,7 @@ public class CmapFormat4 extends CmapFormat { } // + 2*segCount (8*segCount + 16) // Whatever remains of this header belongs in glyphIdArray - int count = (_length - (8*_segCount + 16)) / 2; + final int count = (_length - (8*_segCount + 16)) / 2; _glyphIdArray = new int[count]; for (int i = 0; i < count; i++) { _glyphIdArray[i] = di.readUnsignedShort(); @@ -116,7 +116,7 @@ public class CmapFormat4 extends CmapFormat { } @Override - public Range getRange(int index) throws ArrayIndexOutOfBoundsException { + public Range getRange(final int index) throws ArrayIndexOutOfBoundsException { if (index < 0 || index >= _segCount) { throw new ArrayIndexOutOfBoundsException(); } @@ -124,7 +124,7 @@ public class CmapFormat4 extends CmapFormat { } @Override - public int mapCharCode(int charCode) { + public int mapCharCode(final int charCode) { try { for (int i = 0; i < _segCount; i++) { if (_endCode[i] >= charCode) { @@ -139,7 +139,7 @@ public class CmapFormat4 extends CmapFormat { } } } - } catch (ArrayIndexOutOfBoundsException e) { + } catch (final ArrayIndexOutOfBoundsException e) { System.err.println("error: Array out of bounds - " + e.getMessage()); } return 0; diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat6.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat6.java index 2a33d8d40..eff3d2fb1 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat6.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat6.java @@ -64,7 +64,7 @@ public class CmapFormat6 extends CmapFormat { private short _entryCount; private short[] _glyphIdArray; - protected CmapFormat6(DataInput di) throws IOException { + protected CmapFormat6(final DataInput di) throws IOException { super(di); _format = 6; @@ -79,12 +79,12 @@ public class CmapFormat6 extends CmapFormat { } @Override - public Range getRange(int index) throws ArrayIndexOutOfBoundsException { + public Range getRange(final int index) throws ArrayIndexOutOfBoundsException { throw new ArrayIndexOutOfBoundsException(); } @Override - public int mapCharCode(int charCode) { + public int mapCharCode(final int charCode) { return 0; } } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormatUnknown.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormatUnknown.java index 392683bcd..e9aa1d4e0 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormatUnknown.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormatUnknown.java @@ -32,7 +32,7 @@ import java.io.IOException; public class CmapFormatUnknown extends CmapFormat { /** Creates a new instance of CmapFormatUnknown */ - protected CmapFormatUnknown(int format, DataInput di) throws IOException { + protected CmapFormatUnknown(final int format, final DataInput di) throws IOException { super(di); _format = format; @@ -46,12 +46,12 @@ public class CmapFormatUnknown extends CmapFormat { } @Override - public Range getRange(int index) throws ArrayIndexOutOfBoundsException { + public Range getRange(final int index) throws ArrayIndexOutOfBoundsException { throw new ArrayIndexOutOfBoundsException(); } @Override - public int mapCharCode(int charCode) { + public int mapCharCode(final int charCode) { return 0; } } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapIndexEntry.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapIndexEntry.java index 4833318d5..1f2c80286 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapIndexEntry.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapIndexEntry.java @@ -59,12 +59,12 @@ import java.io.IOException; */ public class CmapIndexEntry implements Comparable { - private int _platformId; - private int _encodingId; - private int _offset; + private final int _platformId; + private final int _encodingId; + private final int _offset; private CmapFormat _format; - protected CmapIndexEntry(DataInput di) throws IOException { + protected CmapIndexEntry(final DataInput di) throws IOException { _platformId = di.readUnsignedShort(); _encodingId = di.readUnsignedShort(); _offset = di.readInt(); @@ -86,7 +86,7 @@ public class CmapIndexEntry implements Comparable { return _format; } - public void setFormat(CmapFormat format) { + public void setFormat(final CmapFormat format) { _format = format; } @@ -106,8 +106,8 @@ public class CmapIndexEntry implements Comparable { } @Override - public int compareTo(java.lang.Object obj) { - CmapIndexEntry entry = (CmapIndexEntry) obj; + public int compareTo(final java.lang.Object obj) { + final CmapIndexEntry entry = (CmapIndexEntry) obj; if (getOffset() < entry.getOffset()) { return -1; } else if (getOffset() > entry.getOffset()) { diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapTable.java index 2cdddb3ef..4623eb5cf 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapTable.java @@ -61,12 +61,12 @@ import java.util.Arrays; */ public class CmapTable implements Table { - private DirectoryEntry _de; - private int _version; - private int _numTables; - private CmapIndexEntry[] _entries; + private final DirectoryEntry _de; + private final int _version; + private final int _numTables; + private final CmapIndexEntry[] _entries; - protected CmapTable(DirectoryEntry de, DataInput di) throws IOException { + protected CmapTable(final DirectoryEntry de, final DataInput di) throws IOException { _de = (DirectoryEntry) de.clone(); _version = di.readUnsignedShort(); _numTables = di.readUnsignedShort(); @@ -98,7 +98,7 @@ public class CmapTable implements Table { // Something is amiss throw new IOException(); } - int formatType = di.readUnsignedShort(); + final int formatType = di.readUnsignedShort(); lastFormat = CmapFormat.create(formatType, di); lastOffset = _entries[i].getOffset(); _entries[i].setFormat(lastFormat); @@ -114,11 +114,11 @@ public class CmapTable implements Table { return _numTables; } - public CmapIndexEntry getCmapIndexEntry(int i) { + public CmapIndexEntry getCmapIndexEntry(final int i) { return _entries[i]; } - public CmapFormat getCmapFormat(short platformId, short encodingId) { + public CmapFormat getCmapFormat(final short platformId, final short encodingId) { // Find the requested format for (int i = 0; i < _numTables; i++) { @@ -137,7 +137,7 @@ public class CmapTable implements Table { @Override public String toString() { - StringBuilder sb = new StringBuilder().append("cmap\n"); + final StringBuilder sb = new StringBuilder().append("cmap\n"); // Get each of the index entries for (int i = 0; i < _numTables; i++) { diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Coverage.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Coverage.java index 4f526f51d..a6f994f95 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Coverage.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Coverage.java @@ -69,9 +69,9 @@ public abstract class Coverage { */ public abstract int findGlyph(int glyphId); - protected static Coverage read(DataInput di) throws IOException { + protected static Coverage read(final DataInput di) throws IOException { Coverage c = null; - int format = di.readUnsignedShort(); + final int format = di.readUnsignedShort(); if (format == 1) { c = new CoverageFormat1(di); } else if (format == 2) { diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CoverageFormat1.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CoverageFormat1.java index 715bf11ec..3deb60202 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CoverageFormat1.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CoverageFormat1.java @@ -60,11 +60,11 @@ import java.io.IOException; */ public class CoverageFormat1 extends Coverage { - private int _glyphCount; - private int[] _glyphIds; + private final int _glyphCount; + private final int[] _glyphIds; /** Creates new CoverageFormat1 */ - protected CoverageFormat1(DataInput di) throws IOException { + protected CoverageFormat1(final DataInput di) throws IOException { _glyphCount = di.readUnsignedShort(); _glyphIds = new int[_glyphCount]; for (int i = 0; i < _glyphCount; i++) { @@ -78,7 +78,7 @@ public class CoverageFormat1 extends Coverage { } @Override - public int findGlyph(int glyphId) { + public int findGlyph(final int glyphId) { for (int i = 0; i < _glyphCount; i++) { if (_glyphIds[i] == glyphId) { return i; diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CoverageFormat2.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CoverageFormat2.java index bd2a28f79..9397f376d 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CoverageFormat2.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CoverageFormat2.java @@ -60,11 +60,11 @@ import java.io.IOException; */ public class CoverageFormat2 extends Coverage { - private int _rangeCount; - private RangeRecord[] _rangeRecords; + private final int _rangeCount; + private final RangeRecord[] _rangeRecords; /** Creates new CoverageFormat2 */ - protected CoverageFormat2(DataInput di) throws IOException { + protected CoverageFormat2(final DataInput di) throws IOException { _rangeCount = di.readUnsignedShort(); _rangeRecords = new RangeRecord[_rangeCount]; for (int i = 0; i < _rangeCount; i++) { @@ -78,9 +78,9 @@ public class CoverageFormat2 extends Coverage { } @Override - public int findGlyph(int glyphId) { + public int findGlyph(final int glyphId) { for (int i = 0; i < _rangeCount; i++) { - int n = _rangeRecords[i].getCoverageIndex(glyphId); + final int n = _rangeRecords[i].getCoverageIndex(glyphId); if (n > -1) { return n; } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CvtTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CvtTable.java index 9e1c47de9..7f62d26ab 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CvtTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CvtTable.java @@ -17,12 +17,12 @@ import java.io.IOException; */ public class CvtTable implements Table { - private DirectoryEntry de; - private short[] values; + private final DirectoryEntry de; + private final short[] values; - protected CvtTable(DirectoryEntry de, DataInput di) throws IOException { + protected CvtTable(final DirectoryEntry de, final DataInput di) throws IOException { this.de = (DirectoryEntry) de.clone(); - int len = de.getLength() / 2; + final int len = de.getLength() / 2; values = new short[len]; for (int i = 0; i < len; i++) { values[i] = di.readShort(); @@ -40,7 +40,7 @@ public class CvtTable implements Table { @Override public String toString() { - StringBuilder sb = new StringBuilder(); + final StringBuilder sb = new StringBuilder(); sb.append("'cvt ' Table - Control Value Table\n----------------------------------\n"); sb.append("Size = ").append(0).append(" bytes, ").append(values.length).append(" entries\n"); sb.append(" Values\n ------\n"); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Device.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Device.java index 5451f4502..a0b10e187 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Device.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Device.java @@ -18,13 +18,13 @@ import java.io.RandomAccessFile; */ public class Device extends Object { - private int startSize; - private int endSize; - private int deltaFormat; - private int[] deltaValues; + private final int startSize; + private final int endSize; + private final int deltaFormat; + private final int[] deltaValues; /** Creates new Device */ - public Device(RandomAccessFile raf) throws IOException { + public Device(final RandomAccessFile raf) throws IOException { startSize = raf.readUnsignedShort(); endSize = raf.readUnsignedShort(); deltaFormat = raf.readUnsignedShort(); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/DirectoryEntry.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/DirectoryEntry.java index e34fa32e8..54684b8e9 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/DirectoryEntry.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/DirectoryEntry.java @@ -59,12 +59,12 @@ import java.io.IOException; */ public class DirectoryEntry implements Cloneable { - private int _tag; - private int _checksum; - private int _offset; - private int _length; + private final int _tag; + private final int _checksum; + private final int _offset; + private final int _length; - protected DirectoryEntry(DataInput di) throws IOException { + protected DirectoryEntry(final DataInput di) throws IOException { _tag = di.readInt(); _checksum = di.readInt(); _offset = di.readInt(); @@ -75,7 +75,7 @@ public class DirectoryEntry implements Cloneable { public Object clone() { try { return super.clone(); - } catch (CloneNotSupportedException e) { + } catch (final CloneNotSupportedException e) { return null; } } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/DsigEntry.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/DsigEntry.java index 4a09a4c34..ec7b503f1 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/DsigEntry.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/DsigEntry.java @@ -18,12 +18,12 @@ import java.io.DataInput; */ public class DsigEntry { - private int format; - private int length; - private int offset; + private final int format; + private final int length; + private final int offset; /** Creates new DsigEntry */ - protected DsigEntry(DataInput di) throws IOException { + protected DsigEntry(final DataInput di) throws IOException { format = di.readInt(); length = di.readInt(); offset = di.readInt(); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/DsigTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/DsigTable.java index 2b85f52d8..f2b1322c0 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/DsigTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/DsigTable.java @@ -18,15 +18,15 @@ import java.io.DataInput; */ public class DsigTable implements Table { - private DirectoryEntry de; - private int version; - private int numSigs; - private int flag; - private DsigEntry[] dsigEntry; - private SignatureBlock[] sigBlocks; + private final DirectoryEntry de; + private final int version; + private final int numSigs; + private final int flag; + private final DsigEntry[] dsigEntry; + private final SignatureBlock[] sigBlocks; /** Creates new DsigTable */ - protected DsigTable(DirectoryEntry de, DataInput di) throws IOException { + protected DsigTable(final DirectoryEntry de, final DataInput di) throws IOException { this.de = (DirectoryEntry) de.clone(); version = di.readInt(); numSigs = di.readUnsignedShort(); @@ -63,7 +63,7 @@ public class DsigTable implements Table { @Override public String toString() { - StringBuilder sb = new StringBuilder().append("DSIG\n"); + final StringBuilder sb = new StringBuilder().append("DSIG\n"); for (int i = 0; i < numSigs; i++) { sb.append(sigBlocks[i].toString()); } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Feature.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Feature.java index ee27896a4..c6f912569 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Feature.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Feature.java @@ -60,12 +60,12 @@ import java.io.IOException; */ public class Feature { - private int _featureParams; - private int _lookupCount; - private int[] _lookupListIndex; + private final int _featureParams; + private final int _lookupCount; + private final int[] _lookupListIndex; /** Creates new Feature */ - protected Feature(DataInput di) throws IOException { + protected Feature(final DataInput di) throws IOException { _featureParams = di.readUnsignedShort(); _lookupCount = di.readUnsignedShort(); _lookupListIndex = new int[_lookupCount]; @@ -78,7 +78,7 @@ public class Feature { return _lookupCount; } - public int getLookupListIndex(int i) { + public int getLookupListIndex(final int i) { return _lookupListIndex[i]; } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/FeatureList.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/FeatureList.java index fdedca94a..933378068 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/FeatureList.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/FeatureList.java @@ -60,12 +60,12 @@ import java.io.IOException; */ public class FeatureList { - private int _featureCount; - private FeatureRecord[] _featureRecords; - private Feature[] _features; + private final int _featureCount; + private final FeatureRecord[] _featureRecords; + private final Feature[] _features; /** Creates new FeatureList */ - public FeatureList(DataInputStream dis, int offset) throws IOException { + public FeatureList(final DataInputStream dis, final int offset) throws IOException { // Ensure we're in the right place dis.reset(); @@ -89,19 +89,19 @@ public class FeatureList { return _featureCount; } - public FeatureRecord getFeatureRecord(int i) { + public FeatureRecord getFeatureRecord(final int i) { return _featureRecords[i]; } - public Feature getFeature(int i) { + public Feature getFeature(final int i) { return _features[i]; } - public Feature findFeature(LangSys langSys, String tag) { + public Feature findFeature(final LangSys langSys, final String tag) { if (tag.length() != 4) { return null; } - int tagVal = ((tag.charAt(0)<<24) + final int tagVal = ((tag.charAt(0)<<24) | (tag.charAt(1)<<16) | (tag.charAt(2)<<8) | tag.charAt(3)); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/FeatureRecord.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/FeatureRecord.java index 1da74f4d5..06506904f 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/FeatureRecord.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/FeatureRecord.java @@ -60,11 +60,11 @@ import java.io.IOException; */ public class FeatureRecord { - private int _tag; - private int _offset; + private final int _tag; + private final int _offset; /** Creates new FeatureRecord */ - protected FeatureRecord(DataInput di) throws IOException { + protected FeatureRecord(final DataInput di) throws IOException { _tag = di.readInt(); _offset = di.readUnsignedShort(); } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/FpgmTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/FpgmTable.java index 467a4f360..e44acfa02 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/FpgmTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/FpgmTable.java @@ -19,9 +19,9 @@ import jogamp.graph.font.typecast.ot.Disassembler; */ public class FpgmTable extends Program implements Table { - private DirectoryEntry de; + private final DirectoryEntry de; - protected FpgmTable(DirectoryEntry de, DataInput di) throws IOException { + protected FpgmTable(final DirectoryEntry de, final DataInput di) throws IOException { this.de = (DirectoryEntry) de.clone(); readInstructions(di, de.getLength()); } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GaspRange.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GaspRange.java index cc87b19a4..cebc51646 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GaspRange.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GaspRange.java @@ -21,18 +21,18 @@ public class GaspRange { public static final int GASP_GRIDFIT = 1; public static final int GASP_DOGRAY = 2; - private int rangeMaxPPEM; - private int rangeGaspBehavior; + private final int rangeMaxPPEM; + private final int rangeGaspBehavior; /** Creates new GaspRange */ - protected GaspRange(DataInput di) throws IOException { + protected GaspRange(final DataInput di) throws IOException { rangeMaxPPEM = di.readUnsignedShort(); rangeGaspBehavior = di.readUnsignedShort(); } @Override public String toString() { - StringBuilder sb = new StringBuilder(); + final StringBuilder sb = new StringBuilder(); sb.append(" rangeMaxPPEM: ").append(rangeMaxPPEM) .append("\n rangeGaspBehavior: 0x").append(rangeGaspBehavior); if ((rangeGaspBehavior & GASP_GRIDFIT) != 0) { diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GaspTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GaspTable.java index 8f91e6d00..7bf7f96cc 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GaspTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GaspTable.java @@ -18,13 +18,13 @@ import java.io.IOException; */ public class GaspTable implements Table { - private DirectoryEntry de; - private int version; - private int numRanges; - private GaspRange[] gaspRange; + private final DirectoryEntry de; + private final int version; + private final int numRanges; + private final GaspRange[] gaspRange; /** Creates new GaspTable */ - protected GaspTable(DirectoryEntry de, DataInput di) throws IOException { + protected GaspTable(final DirectoryEntry de, final DataInput di) throws IOException { this.de = (DirectoryEntry) de.clone(); version = di.readUnsignedShort(); numRanges = di.readUnsignedShort(); @@ -41,7 +41,7 @@ public class GaspTable implements Table { @Override public String toString() { - StringBuilder sb = new StringBuilder(); + final StringBuilder sb = new StringBuilder(); sb.append("'gasp' Table - Grid-fitting And Scan-conversion Procedure\n---------------------------------------------------------"); sb.append("\n 'gasp' version: ").append(version); sb.append("\n numRanges: ").append(numRanges); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfCompositeComp.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfCompositeComp.java index e5c86873e..4db4ddcc2 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfCompositeComp.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfCompositeComp.java @@ -69,12 +69,12 @@ public class GlyfCompositeComp { public static final short WE_HAVE_INSTRUCTIONS = 0x0100; public static final short USE_MY_METRICS = 0x0200; - private int _firstIndex; - private int _firstContour; + private final int _firstIndex; + private final int _firstContour; private short _argument1; private short _argument2; - private int _flags; - private int _glyphIndex; + private final int _flags; + private final int _glyphIndex; private double _xscale = 1.0; private double _yscale = 1.0; private double _scale01 = 0.0; @@ -84,7 +84,7 @@ public class GlyfCompositeComp { private int _point1 = 0; private int _point2 = 0; - protected GlyfCompositeComp(int firstIndex, int firstContour, DataInput di) + protected GlyfCompositeComp(final int firstIndex, final int firstContour, final DataInput di) throws IOException { _firstIndex = firstIndex; _firstContour = firstContour; @@ -96,8 +96,8 @@ public class GlyfCompositeComp { _argument1 = di.readShort(); _argument2 = di.readShort(); } else { - _argument1 = (short) di.readByte(); - _argument2 = (short) di.readByte(); + _argument1 = di.readByte(); + _argument2 = di.readByte(); } // Assign the arguments according to the flags @@ -111,7 +111,7 @@ public class GlyfCompositeComp { // Get the scale values (if any) if ((_flags & WE_HAVE_A_SCALE) != 0) { - int i = di.readShort(); + final int i = di.readShort(); _xscale = _yscale = (double) i / (double) 0x4000; } else if ((_flags & WE_HAVE_AN_X_AND_Y_SCALE) != 0) { short i = di.readShort(); @@ -184,8 +184,8 @@ public class GlyfCompositeComp { * @param y The y-coordinate of the point to transform * @return The transformed x-coordinate */ - public int scaleX(int x, int y) { - return (int)((double) x * _xscale + (double) y * _scale10); + public int scaleX(final int x, final int y) { + return (int)(x * _xscale + y * _scale10); } /** @@ -194,7 +194,7 @@ public class GlyfCompositeComp { * @param y The y-coordinate of the point to transform * @return The transformed y-coordinate */ - public int scaleY(int x, int y) { - return (int)((double) x * _scale01 + (double) y * _yscale); + public int scaleY(final int x, final int y) { + return (int)(x * _scale01 + y * _yscale); } } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfCompositeDescript.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfCompositeDescript.java index fabc71a77..3879da02a 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfCompositeDescript.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfCompositeDescript.java @@ -69,9 +69,9 @@ public class GlyfCompositeDescript extends GlyfDescript { new ArrayList<GlyfCompositeComp>(); public GlyfCompositeDescript( - GlyfTable parentTable, - int glyphIndex, - DataInput di) throws IOException { + final GlyfTable parentTable, + final int glyphIndex, + final DataInput di) throws IOException { super(parentTable, glyphIndex, (short) -1, di); // Get all of the composite components @@ -81,7 +81,7 @@ public class GlyfCompositeDescript extends GlyfDescript { try { do { _components.add(comp = new GlyfCompositeComp(firstIndex, firstContour, di)); - GlyfDescript desc = parentTable.getDescription(comp.getGlyphIndex()); + final GlyfDescript desc = parentTable.getDescription(comp.getGlyphIndex()); if (desc != null) { firstIndex += desc.getPointCount(); firstContour += desc.getContourCount(); @@ -92,7 +92,7 @@ public class GlyfCompositeDescript extends GlyfDescript { if ((comp.getFlags() & GlyfCompositeComp.WE_HAVE_INSTRUCTIONS) != 0) { readInstructions(di, di.readShort()); } - } catch (IOException e) { + } catch (final IOException e) { throw e; // } catch (Exception e) { // int foo = 0; @@ -100,33 +100,33 @@ public class GlyfCompositeDescript extends GlyfDescript { } @Override - public int getEndPtOfContours(int i) { - GlyfCompositeComp c = getCompositeCompEndPt(i); + public int getEndPtOfContours(final int i) { + final GlyfCompositeComp c = getCompositeCompEndPt(i); if (c != null) { - GlyphDescription gd = _parentTable.getDescription(c.getGlyphIndex()); + final GlyphDescription gd = _parentTable.getDescription(c.getGlyphIndex()); return gd.getEndPtOfContours(i - c.getFirstContour()) + c.getFirstIndex(); } return 0; } @Override - public byte getFlags(int i) { - GlyfCompositeComp c = getCompositeComp(i); + public byte getFlags(final int i) { + final GlyfCompositeComp c = getCompositeComp(i); if (c != null) { - GlyphDescription gd = _parentTable.getDescription(c.getGlyphIndex()); + final GlyphDescription gd = _parentTable.getDescription(c.getGlyphIndex()); return gd.getFlags(i - c.getFirstIndex()); } return 0; } @Override - public short getXCoordinate(int i) { - GlyfCompositeComp c = getCompositeComp(i); + public short getXCoordinate(final int i) { + final GlyfCompositeComp c = getCompositeComp(i); if (c != null) { - GlyphDescription gd = _parentTable.getDescription(c.getGlyphIndex()); - int n = i - c.getFirstIndex(); - int x = gd.getXCoordinate(n); - int y = gd.getYCoordinate(n); + final GlyphDescription gd = _parentTable.getDescription(c.getGlyphIndex()); + final int n = i - c.getFirstIndex(); + final int x = gd.getXCoordinate(n); + final int y = gd.getYCoordinate(n); short x1 = (short) c.scaleX(x, y); x1 += c.getXTranslate(); return x1; @@ -135,13 +135,13 @@ public class GlyfCompositeDescript extends GlyfDescript { } @Override - public short getYCoordinate(int i) { - GlyfCompositeComp c = getCompositeComp(i); + public short getYCoordinate(final int i) { + final GlyfCompositeComp c = getCompositeComp(i); if (c != null) { - GlyphDescription gd = _parentTable.getDescription(c.getGlyphIndex()); - int n = i - c.getFirstIndex(); - int x = gd.getXCoordinate(n); - int y = gd.getYCoordinate(n); + final GlyphDescription gd = _parentTable.getDescription(c.getGlyphIndex()); + final int n = i - c.getFirstIndex(); + final int x = gd.getXCoordinate(n); + final int y = gd.getYCoordinate(n); short y1 = (short) c.scaleY(x, y); y1 += c.getYTranslate(); return y1; @@ -156,8 +156,8 @@ public class GlyfCompositeDescript extends GlyfDescript { @Override public int getPointCount() { - GlyfCompositeComp c = _components.get(_components.size()-1); - GlyphDescription gd = _parentTable.getDescription(c.getGlyphIndex()); + final GlyfCompositeComp c = _components.get(_components.size()-1); + final GlyphDescription gd = _parentTable.getDescription(c.getGlyphIndex()); if (gd != null) { return c.getFirstIndex() + gd.getPointCount(); } else { @@ -172,7 +172,7 @@ public class GlyfCompositeDescript extends GlyfDescript { return c.getFirstContour() + ( null != d ? d.getContourCount() : 0 ); } - public int getComponentIndex(int i) { + public int getComponentIndex(final int i) { return _components.get(i).getFirstIndex(); } @@ -180,15 +180,15 @@ public class GlyfCompositeDescript extends GlyfDescript { return _components.size(); } - public GlyfCompositeComp getComponent(int i) { + public GlyfCompositeComp getComponent(final int i) { return _components.get(i); } - protected GlyfCompositeComp getCompositeComp(int i) { + protected GlyfCompositeComp getCompositeComp(final int i) { GlyfCompositeComp c; for (int n = 0; n < _components.size(); n++) { c = _components.get(n); - GlyphDescription gd = _parentTable.getDescription(c.getGlyphIndex()); + final GlyphDescription gd = _parentTable.getDescription(c.getGlyphIndex()); if (c.getFirstIndex() <= i && i < (c.getFirstIndex() + gd.getPointCount())) { return c; } @@ -196,11 +196,11 @@ public class GlyfCompositeDescript extends GlyfDescript { return null; } - protected GlyfCompositeComp getCompositeCompEndPt(int i) { + protected GlyfCompositeComp getCompositeCompEndPt(final int i) { GlyfCompositeComp c; for (int j = 0; j < _components.size(); j++) { c = _components.get(j); - GlyphDescription gd = _parentTable.getDescription(c.getGlyphIndex()); + final GlyphDescription gd = _parentTable.getDescription(c.getGlyphIndex()); if (c.getFirstContour() <= i && i < (c.getFirstContour() + gd.getContourCount())) { return c; } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfDescript.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfDescript.java index 6b06eb3de..3d2154d5a 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfDescript.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfDescript.java @@ -69,17 +69,17 @@ public abstract class GlyfDescript extends Program implements GlyphDescription { protected GlyfTable _parentTable; private int _glyphIndex; - private int _numberOfContours; - private short _xMin; - private short _yMin; - private short _xMax; - private short _yMax; + private final int _numberOfContours; + private final short _xMin; + private final short _yMin; + private final short _xMax; + private final short _yMax; protected GlyfDescript( - GlyfTable parentTable, - int glyphIndex, - short numberOfContours, - DataInput di) throws IOException { + final GlyfTable parentTable, + final int glyphIndex, + final short numberOfContours, + final DataInput di) throws IOException { _parentTable = parentTable; _numberOfContours = numberOfContours; _xMin = di.readShort(); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfSimpleDescript.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfSimpleDescript.java index c06ceaa13..041c0f04c 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfSimpleDescript.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfSimpleDescript.java @@ -61,17 +61,17 @@ import jogamp.graph.font.typecast.ot.Disassembler; */ public class GlyfSimpleDescript extends GlyfDescript { - private int[] _endPtsOfContours; - private byte[] _flags; - private short[] _xCoordinates; - private short[] _yCoordinates; - private int _count; + private final int[] _endPtsOfContours; + private final byte[] _flags; + private final short[] _xCoordinates; + private final short[] _yCoordinates; + private final int _count; public GlyfSimpleDescript( - GlyfTable parentTable, - int glyphIndex, - short numberOfContours, - DataInput di) throws IOException { + final GlyfTable parentTable, + final int glyphIndex, + final short numberOfContours, + final DataInput di) throws IOException { super(parentTable, glyphIndex, numberOfContours, di); // Simple glyph description @@ -86,29 +86,29 @@ public class GlyfSimpleDescript extends GlyfDescript { _xCoordinates = new short[_count]; _yCoordinates = new short[_count]; - int instructionCount = di.readShort(); + final int instructionCount = di.readShort(); readInstructions(di, instructionCount); readFlags(_count, di); readCoords(_count, di); } @Override - public int getEndPtOfContours(int i) { + public int getEndPtOfContours(final int i) { return _endPtsOfContours[i]; } @Override - public byte getFlags(int i) { + public byte getFlags(final int i) { return _flags[i]; } @Override - public short getXCoordinate(int i) { + public short getXCoordinate(final int i) { return _xCoordinates[i]; } @Override - public short getYCoordinate(int i) { + public short getYCoordinate(final int i) { return _yCoordinates[i]; } @@ -138,7 +138,7 @@ public class GlyfSimpleDescript extends GlyfDescript { /** * The table is stored as relative values, but we'll store them as absolutes */ - private void readCoords(int count, DataInput di) throws IOException { + private void readCoords(final int count, final DataInput di) throws IOException { short x = 0; short y = 0; for (int i = 0; i < count; i++) { @@ -175,26 +175,26 @@ public class GlyfSimpleDescript extends GlyfDescript { /** * The flags are run-length encoded */ - private void readFlags(int flagCount, DataInput di) throws IOException { + private void readFlags(final int flagCount, final DataInput di) throws IOException { try { for (int index = 0; index < flagCount; index++) { _flags[index] = di.readByte(); if ((_flags[index] & repeat) != 0) { - int repeats = di.readByte(); + final int repeats = di.readByte(); for (int i = 1; i <= repeats; i++) { _flags[index + i] = _flags[index]; } index += repeats; } } - } catch (ArrayIndexOutOfBoundsException e) { + } catch (final ArrayIndexOutOfBoundsException e) { System.out.println("error: array index out of bounds"); } } @Override public String toString() { - StringBuilder sb = new StringBuilder(); + final StringBuilder sb = new StringBuilder(); sb.append(super.toString()); sb.append("\n\n EndPoints\n ---------"); for (int i = 0; i < _endPtsOfContours.length; i++) { diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfTable.java index 4b196c9e2..6750e9394 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfTable.java @@ -61,30 +61,30 @@ import java.io.IOException; */ public class GlyfTable implements Table { - private DirectoryEntry _de; - private GlyfDescript[] _descript; + private final DirectoryEntry _de; + private final GlyfDescript[] _descript; protected GlyfTable( - DirectoryEntry de, - DataInput di, - MaxpTable maxp, - LocaTable loca) throws IOException { + final DirectoryEntry de, + final DataInput di, + final MaxpTable maxp, + final LocaTable loca) throws IOException { _de = (DirectoryEntry) de.clone(); _descript = new GlyfDescript[maxp.getNumGlyphs()]; // Buffer the whole table so we can randomly access it - byte[] buf = new byte[de.getLength()]; + final byte[] buf = new byte[de.getLength()]; di.readFully(buf); - ByteArrayInputStream bais = new ByteArrayInputStream(buf); + final ByteArrayInputStream bais = new ByteArrayInputStream(buf); // Process all the simple glyphs for (int i = 0; i < maxp.getNumGlyphs(); i++) { - int len = loca.getOffset(i + 1) - loca.getOffset(i); + final int len = loca.getOffset(i + 1) - loca.getOffset(i); if (len > 0) { bais.reset(); bais.skip(loca.getOffset(i)); - DataInputStream dis = new DataInputStream(bais); - short numberOfContours = dis.readShort(); + final DataInputStream dis = new DataInputStream(bais); + final short numberOfContours = dis.readShort(); if (numberOfContours >= 0) { _descript[i] = new GlyfSimpleDescript(this, i, numberOfContours, dis); } @@ -95,12 +95,12 @@ public class GlyfTable implements Table { // Now do all the composite glyphs for (int i = 0; i < maxp.getNumGlyphs(); i++) { - int len = loca.getOffset(i + 1) - loca.getOffset(i); + final int len = loca.getOffset(i + 1) - loca.getOffset(i); if (len > 0) { bais.reset(); bais.skip(loca.getOffset(i)); - DataInputStream dis = new DataInputStream(bais); - short numberOfContours = dis.readShort(); + final DataInputStream dis = new DataInputStream(bais); + final short numberOfContours = dis.readShort(); if (numberOfContours < 0) { _descript[i] = new GlyfCompositeDescript(this, i, dis); } @@ -108,7 +108,7 @@ public class GlyfTable implements Table { } } - public GlyfDescript getDescription(int i) { + public GlyfDescript getDescription(final int i) { if (i < _descript.length) { return _descript[i]; } else { diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GposTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GposTable.java index 30ecdd051..f10d4e299 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GposTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GposTable.java @@ -30,16 +30,16 @@ import java.io.IOException; */ public class GposTable implements Table { - private DirectoryEntry _de; + private final DirectoryEntry _de; - protected GposTable(DirectoryEntry de, DataInput di) throws IOException { + protected GposTable(final DirectoryEntry de, final DataInput di) throws IOException { _de = (DirectoryEntry) de.clone(); // GPOS Header - int version = di.readInt(); - int scriptList = di.readInt(); - int featureList = di.readInt(); - int lookupList = di.readInt(); + final int version = di.readInt(); + final int scriptList = di.readInt(); + final int featureList = di.readInt(); + final int lookupList = di.readInt(); } /** Get the table type, as a table directory value. diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GsubTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GsubTable.java index c23d420a8..f09973f99 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GsubTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GsubTable.java @@ -62,24 +62,24 @@ import java.io.IOException; */ public class GsubTable implements Table, LookupSubtableFactory { - private DirectoryEntry _de; - private ScriptList _scriptList; - private FeatureList _featureList; - private LookupList _lookupList; + private final DirectoryEntry _de; + private final ScriptList _scriptList; + private final FeatureList _featureList; + private final LookupList _lookupList; - protected GsubTable(DirectoryEntry de, DataInput di) throws IOException { + protected GsubTable(final DirectoryEntry de, final DataInput di) throws IOException { _de = (DirectoryEntry) de.clone(); // Load into a temporary buffer, and create another input stream - byte[] buf = new byte[de.getLength()]; + final byte[] buf = new byte[de.getLength()]; di.readFully(buf); - DataInputStream dis = new DataInputStream(new ByteArrayInputStream(buf)); + final DataInputStream dis = new DataInputStream(new ByteArrayInputStream(buf)); // GSUB Header - int version = dis.readInt(); - int scriptListOffset = dis.readUnsignedShort(); - int featureListOffset = dis.readUnsignedShort(); - int lookupListOffset = dis.readUnsignedShort(); + final int version = dis.readInt(); + final int scriptListOffset = dis.readUnsignedShort(); + final int featureListOffset = dis.readUnsignedShort(); + final int lookupListOffset = dis.readUnsignedShort(); // Script List _scriptList = new ScriptList(dis, scriptListOffset); @@ -101,9 +101,9 @@ public class GsubTable implements Table, LookupSubtableFactory { */ @Override public LookupSubtable read( - int type, - DataInputStream dis, - int offset) throws IOException { + final int type, + final DataInputStream dis, + final int offset) throws IOException { LookupSubtable s = null; switch (type) { case 1: @@ -153,7 +153,7 @@ public class GsubTable implements Table, LookupSubtableFactory { return "GSUB"; } - public static String lookupTypeAsString(int type) { + public static String lookupTypeAsString(final int type) { switch (type) { case 1: return "Single"; diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HdmxTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HdmxTable.java index 64f5e6415..c3b875a2c 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HdmxTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HdmxTable.java @@ -33,11 +33,11 @@ public class HdmxTable implements Table { public class DeviceRecord { - private short _pixelSize; - private short _maxWidth; - private short[] _widths; + private final short _pixelSize; + private final short _maxWidth; + private final short[] _widths; - protected DeviceRecord(int numGlyphs, DataInput di) throws IOException { + protected DeviceRecord(final int numGlyphs, final DataInput di) throws IOException { _pixelSize = di.readByte(); _maxWidth = di.readByte(); _widths = new short[numGlyphs]; @@ -58,20 +58,20 @@ public class HdmxTable implements Table { return _widths; } - public short getWidth(int glyphidx) { + public short getWidth(final int glyphidx) { return _widths[glyphidx]; } } - private DirectoryEntry _de; - private int _version; - private short _numRecords; - private int _sizeDeviceRecords; - private DeviceRecord[] _records; + private final DirectoryEntry _de; + private final int _version; + private final short _numRecords; + private final int _sizeDeviceRecords; + private final DeviceRecord[] _records; /** Creates a new instance of HdmxTable */ - protected HdmxTable(DirectoryEntry de, DataInput di, MaxpTable maxp) + protected HdmxTable(final DirectoryEntry de, final DataInput di, final MaxpTable maxp) throws IOException { _de = (DirectoryEntry) de.clone(); _version = di.readUnsignedShort(); @@ -89,7 +89,7 @@ public class HdmxTable implements Table { return _numRecords; } - public DeviceRecord getRecord(int i) { + public DeviceRecord getRecord(final int i) { return _records[i]; } @@ -100,7 +100,7 @@ public class HdmxTable implements Table { @Override public String toString() { - StringBuilder sb = new StringBuilder(); + final StringBuilder sb = new StringBuilder(); sb.append("'hdmx' Table - Horizontal Device Metrics\n----------------------------------------\n"); sb.append("Size = ").append(_de.getLength()).append(" bytes\n") .append("\t'hdmx' version: ").append(_version).append("\n") diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HeadTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HeadTable.java index 47e60f900..85158ea3e 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HeadTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HeadTable.java @@ -62,26 +62,26 @@ import jogamp.graph.font.typecast.ot.Fixed; */ public class HeadTable implements Table { - private DirectoryEntry _de; - private int _versionNumber; - private int _fontRevision; - private int _checkSumAdjustment; - private int _magicNumber; - private short _flags; - private short _unitsPerEm; - private long _created; - private long _modified; - private short _xMin; - private short _yMin; - private short _xMax; - private short _yMax; - private short _macStyle; - private short _lowestRecPPEM; - private short _fontDirectionHint; - private short _indexToLocFormat; - private short _glyphDataFormat; - - protected HeadTable(DirectoryEntry de, DataInput di) throws IOException { + private final DirectoryEntry _de; + private final int _versionNumber; + private final int _fontRevision; + private final int _checkSumAdjustment; + private final int _magicNumber; + private final short _flags; + private final short _unitsPerEm; + private final long _created; + private final long _modified; + private final short _xMin; + private final short _yMin; + private final short _xMax; + private final short _yMax; + private final short _macStyle; + private final short _lowestRecPPEM; + private final short _fontDirectionHint; + private final short _indexToLocFormat; + private final short _glyphDataFormat; + + protected HeadTable(final DirectoryEntry de, final DataInput di) throws IOException { this._de = (DirectoryEntry) de.clone(); _versionNumber = di.readInt(); _fontRevision = di.readInt(); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HheaTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HheaTable.java index 242c9b139..e67a03777 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HheaTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HheaTable.java @@ -19,21 +19,21 @@ import jogamp.graph.font.typecast.ot.Fixed; */ public class HheaTable implements Table { - private DirectoryEntry de; - private int version; - private short ascender; - private short descender; - private short lineGap; - private short advanceWidthMax; - private short minLeftSideBearing; - private short minRightSideBearing; - private short xMaxExtent; - private short caretSlopeRise; - private short caretSlopeRun; - private short metricDataFormat; - private int numberOfHMetrics; - - protected HheaTable(DirectoryEntry de, DataInput di) throws IOException { + private final DirectoryEntry de; + private final int version; + private final short ascender; + private final short descender; + private final short lineGap; + private final short advanceWidthMax; + private final short minLeftSideBearing; + private final short minRightSideBearing; + private final short xMaxExtent; + private final short caretSlopeRise; + private final short caretSlopeRun; + private final short metricDataFormat; + private final int numberOfHMetrics; + + protected HheaTable(final DirectoryEntry de, final DataInput di) throws IOException { this.de = (DirectoryEntry) de.clone(); version = di.readInt(); ascender = di.readShort(); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HmtxTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HmtxTable.java index 122a0a826..3a9672a92 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HmtxTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HmtxTable.java @@ -59,15 +59,15 @@ import java.io.IOException; */ public class HmtxTable implements Table { - private DirectoryEntry _de; + private final DirectoryEntry _de; private int[] _hMetrics = null; private short[] _leftSideBearing = null; protected HmtxTable( - DirectoryEntry de, - DataInput di, - HheaTable hhea, - MaxpTable maxp) throws IOException { + final DirectoryEntry de, + final DataInput di, + final HheaTable hhea, + final MaxpTable maxp) throws IOException { _de = (DirectoryEntry) de.clone(); _hMetrics = new int[hhea.getNumberOfHMetrics()]; for (int i = 0; i < hhea.getNumberOfHMetrics(); ++i) { @@ -77,14 +77,14 @@ public class HmtxTable implements Table { | di.readUnsignedByte()<<8 | di.readUnsignedByte(); } - int lsbCount = maxp.getNumGlyphs() - hhea.getNumberOfHMetrics(); + final int lsbCount = maxp.getNumGlyphs() - hhea.getNumberOfHMetrics(); _leftSideBearing = new short[lsbCount]; for (int i = 0; i < lsbCount; ++i) { _leftSideBearing[i] = di.readShort(); } } - public int getAdvanceWidth(int i) { + public int getAdvanceWidth(final int i) { if (_hMetrics == null) { return 0; } @@ -95,7 +95,7 @@ public class HmtxTable implements Table { } } - public short getLeftSideBearing(int i) { + public short getLeftSideBearing(final int i) { if (_hMetrics == null) { return 0; } @@ -113,7 +113,7 @@ public class HmtxTable implements Table { @Override public String toString() { - StringBuilder sb = new StringBuilder(); + final StringBuilder sb = new StringBuilder(); sb.append("'hmtx' Table - Horizontal Metrics\n---------------------------------\n"); sb.append("Size = ").append(_de.getLength()).append(" bytes, ") .append(_hMetrics.length).append(" entries\n"); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ID.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ID.java index eed8c1841..ad7e4e376 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ID.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ID.java @@ -190,7 +190,7 @@ public abstract class ID { public static final short nameSampleText = 19; public static final short namePostScriptCIDFindfontName = 20; - public static String getPlatformName(short platformId) { + public static String getPlatformName(final short platformId) { switch (platformId) { case platformUnicode: return "Unicode"; case platformMacintosh: return "Macintosh"; @@ -200,7 +200,7 @@ public abstract class ID { } } - public static String getEncodingName(short platformId, short encodingId) { + public static String getEncodingName(final short platformId, final short encodingId) { if (platformId == platformUnicode) { @@ -284,7 +284,7 @@ public abstract class ID { return ""; } - public static String getLanguageName(short platformId, short languageId) { + public static String getLanguageName(final short platformId, final short languageId) { if (platformId == platformMacintosh) { switch (languageId) { @@ -371,7 +371,7 @@ public abstract class ID { return ""; } - public static String getNameName(short nameId) { + public static String getNameName(final short nameId) { switch (nameId) { case nameCopyrightNotice: return "Copyright notice"; case nameFontFamilyName: return "Font Family name"; diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernSubtable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernSubtable.java index 04fd646a7..df5d0394f 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernSubtable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernSubtable.java @@ -26,12 +26,12 @@ public abstract class KernSubtable { public abstract KerningPair getKerningPair(int i); - public static KernSubtable read(DataInput di) throws IOException { + public static KernSubtable read(final DataInput di) throws IOException { KernSubtable table = null; - int version = di.readUnsignedShort(); - int length = di.readUnsignedShort(); - int coverage = di.readUnsignedShort(); - int format = coverage >> 8; + final int version = di.readUnsignedShort(); + final int length = di.readUnsignedShort(); + final int coverage = di.readUnsignedShort(); + final int format = coverage >> 8; switch (format) { case 0: diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernSubtableFormat0.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernSubtableFormat0.java index 1e7ff8c2d..2d1acddd5 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernSubtableFormat0.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernSubtableFormat0.java @@ -18,14 +18,14 @@ import java.io.IOException; */ public class KernSubtableFormat0 extends KernSubtable { - private int nPairs; - private int searchRange; - private int entrySelector; - private int rangeShift; - private KerningPair[] kerningPairs; + private final int nPairs; + private final int searchRange; + private final int entrySelector; + private final int rangeShift; + private final KerningPair[] kerningPairs; /** Creates new KernSubtableFormat0 */ - protected KernSubtableFormat0(DataInput di) throws IOException { + protected KernSubtableFormat0(final DataInput di) throws IOException { nPairs = di.readUnsignedShort(); searchRange = di.readUnsignedShort(); entrySelector = di.readUnsignedShort(); @@ -42,7 +42,7 @@ public class KernSubtableFormat0 extends KernSubtable { } @Override - public KerningPair getKerningPair(int i) { + public KerningPair getKerningPair(final int i) { return kerningPairs[i]; } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernSubtableFormat2.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernSubtableFormat2.java index 9c7fc81f9..deb56c96d 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernSubtableFormat2.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernSubtableFormat2.java @@ -18,13 +18,13 @@ import java.io.IOException; */ public class KernSubtableFormat2 extends KernSubtable { - private int rowWidth; - private int leftClassTable; - private int rightClassTable; - private int array; + private final int rowWidth; + private final int leftClassTable; + private final int rightClassTable; + private final int array; /** Creates new KernSubtableFormat2 */ - protected KernSubtableFormat2(DataInput di) throws IOException { + protected KernSubtableFormat2(final DataInput di) throws IOException { rowWidth = di.readUnsignedShort(); leftClassTable = di.readUnsignedShort(); rightClassTable = di.readUnsignedShort(); @@ -37,7 +37,7 @@ public class KernSubtableFormat2 extends KernSubtable { } @Override - public KerningPair getKerningPair(int i) { + public KerningPair getKerningPair(final int i) { return null; } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernTable.java index 006a86895..6f1d682e1 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernTable.java @@ -18,13 +18,13 @@ import java.io.IOException; */ public class KernTable implements Table { - private DirectoryEntry de; - private int version; - private int nTables; - private KernSubtable[] tables; + private final DirectoryEntry de; + private final int version; + private final int nTables; + private final KernSubtable[] tables; /** Creates new KernTable */ - protected KernTable(DirectoryEntry de, DataInput di) throws IOException { + protected KernTable(final DirectoryEntry de, final DataInput di) throws IOException { this.de = (DirectoryEntry) de.clone(); version = di.readUnsignedShort(); nTables = di.readUnsignedShort(); @@ -38,7 +38,7 @@ public class KernTable implements Table { return nTables; } - public KernSubtable getSubtable(int i) { + public KernSubtable getSubtable(final int i) { return tables[i]; } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KerningPair.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KerningPair.java index 52f82cc85..dd5d0ba06 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KerningPair.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KerningPair.java @@ -18,12 +18,12 @@ import java.io.IOException; */ public class KerningPair { - private int left; - private int right; - private short value; + private final int left; + private final int right; + private final short value; /** Creates new KerningPair */ - protected KerningPair(DataInput di) throws IOException { + protected KerningPair(final DataInput di) throws IOException { left = di.readUnsignedShort(); right = di.readUnsignedShort(); value = di.readShort(); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LangSys.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LangSys.java index 1ab112a78..e12d2e2e7 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LangSys.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LangSys.java @@ -60,13 +60,13 @@ import java.io.IOException; */ public class LangSys { - private int _lookupOrder; - private int _reqFeatureIndex; - private int _featureCount; - private int[] _featureIndex; + private final int _lookupOrder; + private final int _reqFeatureIndex; + private final int _featureCount; + private final int[] _featureIndex; /** Creates new LangSys */ - protected LangSys(DataInput di) throws IOException { + protected LangSys(final DataInput di) throws IOException { _lookupOrder = di.readUnsignedShort(); _reqFeatureIndex = di.readUnsignedShort(); _featureCount = di.readUnsignedShort(); @@ -88,11 +88,11 @@ public class LangSys { return _featureCount; } - public int getFeatureIndex(int i) { + public int getFeatureIndex(final int i) { return _featureIndex[i]; } - protected boolean isFeatureIndexed(int n) { + protected boolean isFeatureIndexed(final int n) { for (int i = 0; i < _featureCount; i++) { if (_featureIndex[i] == n) { return true; diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LangSysRecord.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LangSysRecord.java index f3befe3b6..08ea719f3 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LangSysRecord.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LangSysRecord.java @@ -60,11 +60,11 @@ import java.io.IOException; */ public class LangSysRecord { - private int _tag; - private int _offset; + private final int _tag; + private final int _offset; /** Creates new LangSysRecord */ - public LangSysRecord(DataInput di) throws IOException { + public LangSysRecord(final DataInput di) throws IOException { _tag = di.readInt(); _offset = di.readUnsignedShort(); } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Ligature.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Ligature.java index de862a983..dfd19e7ac 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Ligature.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Ligature.java @@ -60,12 +60,12 @@ import java.io.IOException; */ public class Ligature { - private int _ligGlyph; - private int _compCount; - private int[] _components; + private final int _ligGlyph; + private final int _compCount; + private final int[] _components; /** Creates new Ligature */ - public Ligature(DataInput di) throws IOException { + public Ligature(final DataInput di) throws IOException { _ligGlyph = di.readUnsignedShort(); _compCount = di.readUnsignedShort(); _components = new int[_compCount - 1]; @@ -78,7 +78,7 @@ public class Ligature { return _compCount; } - public int getGlyphId(int i) { + public int getGlyphId(final int i) { return (i == 0) ? _ligGlyph : _components[i-1]; } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LigatureSet.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LigatureSet.java index e261f3a88..8b7738992 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LigatureSet.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LigatureSet.java @@ -60,12 +60,12 @@ import java.io.IOException; */ public class LigatureSet { - private int _ligatureCount; - private int[] _ligatureOffsets; - private Ligature[] _ligatures; + private final int _ligatureCount; + private final int[] _ligatureOffsets; + private final Ligature[] _ligatures; /** Creates new LigatureSet */ - public LigatureSet(DataInputStream dis, int offset) throws IOException { + public LigatureSet(final DataInputStream dis, final int offset) throws IOException { dis.reset(); dis.skipBytes(offset); _ligatureCount = dis.readUnsignedShort(); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LigatureSubst.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LigatureSubst.java index c0570cde9..36a44a11e 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LigatureSubst.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LigatureSubst.java @@ -60,10 +60,10 @@ import java.io.IOException; */ public abstract class LigatureSubst extends LookupSubtable { - public static LigatureSubst read(DataInputStream dis, int offset) throws IOException { + public static LigatureSubst read(final DataInputStream dis, final int offset) throws IOException { dis.reset(); dis.skipBytes(offset); - int format = dis.readUnsignedShort(); + final int format = dis.readUnsignedShort(); if (format == 1) { return new LigatureSubstFormat1(dis, offset); } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LigatureSubstFormat1.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LigatureSubstFormat1.java index 1979ea586..02d4479b3 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LigatureSubstFormat1.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LigatureSubstFormat1.java @@ -60,16 +60,16 @@ import java.io.IOException; */ public class LigatureSubstFormat1 extends LigatureSubst { - private int _coverageOffset; - private int _ligSetCount; - private int[] _ligatureSetOffsets; - private Coverage _coverage; - private LigatureSet[] _ligatureSets; + private final int _coverageOffset; + private final int _ligSetCount; + private final int[] _ligatureSetOffsets; + private final Coverage _coverage; + private final LigatureSet[] _ligatureSets; /** Creates new LigatureSubstFormat1 */ protected LigatureSubstFormat1( - DataInputStream dis, - int offset) throws IOException { + final DataInputStream dis, + final int offset) throws IOException { _coverageOffset = dis.readUnsignedShort(); _ligSetCount = dis.readUnsignedShort(); _ligatureSetOffsets = new int[_ligSetCount]; diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LocaTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LocaTable.java index 2c7079fec..a955ad3e5 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LocaTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LocaTable.java @@ -17,18 +17,18 @@ import java.io.IOException; */ public class LocaTable implements Table { - private DirectoryEntry _de; + private final DirectoryEntry _de; private int[] _offsets = null; private short _factor = 0; protected LocaTable( - DirectoryEntry de, - DataInput di, - HeadTable head, - MaxpTable maxp) throws IOException { + final DirectoryEntry de, + final DataInput di, + final HeadTable head, + final MaxpTable maxp) throws IOException { _de = (DirectoryEntry) de.clone(); _offsets = new int[maxp.getNumGlyphs() + 1]; - boolean shortEntries = head.getIndexToLocFormat() == 0; + final boolean shortEntries = head.getIndexToLocFormat() == 0; if (shortEntries) { _factor = 2; for (int i = 0; i <= maxp.getNumGlyphs(); i++) { @@ -42,7 +42,7 @@ public class LocaTable implements Table { } } - public int getOffset(int i) { + public int getOffset(final int i) { if (_offsets == null) { return 0; } @@ -56,7 +56,7 @@ public class LocaTable implements Table { @Override public String toString() { - StringBuilder sb = new StringBuilder(); + final StringBuilder sb = new StringBuilder(); sb.append("'loca' Table - Index To Location Table\n--------------------------------------\n") .append("Size = ").append(_de.getLength()).append(" bytes, ") .append(_offsets.length).append(" entries\n"); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Lookup.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Lookup.java index 6496c3791..b80ebbee4 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Lookup.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Lookup.java @@ -66,14 +66,14 @@ public class Lookup { public static final int IGNORE_BASE_MARKS = 0x0008; public static final int MARK_ATTACHMENT_TYPE = 0xFF00; - private int _type; - private int _flag; - private int _subTableCount; - private int[] _subTableOffsets; - private LookupSubtable[] _subTables; + private final int _type; + private final int _flag; + private final int _subTableCount; + private final int[] _subTableOffsets; + private final LookupSubtable[] _subTables; /** Creates new Lookup */ - public Lookup(LookupSubtableFactory factory, DataInputStream dis, int offset) + public Lookup(final LookupSubtableFactory factory, final DataInputStream dis, final int offset) throws IOException { // Ensure we're in the right place @@ -102,7 +102,7 @@ public class Lookup { return _subTableCount; } - public LookupSubtable getSubtable(int i) { + public LookupSubtable getSubtable(final int i) { return _subTables[i]; } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LookupList.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LookupList.java index e70a932e4..6d8ca2a6c 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LookupList.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LookupList.java @@ -60,12 +60,12 @@ import java.io.IOException; */ public class LookupList { - private int _lookupCount; - private int[] _lookupOffsets; - private Lookup[] _lookups; + private final int _lookupCount; + private final int[] _lookupOffsets; + private final Lookup[] _lookups; /** Creates new LookupList */ - public LookupList(DataInputStream dis, int offset, LookupSubtableFactory factory) + public LookupList(final DataInputStream dis, final int offset, final LookupSubtableFactory factory) throws IOException { // Ensure we're in the right place @@ -88,17 +88,17 @@ public class LookupList { return _lookupCount; } - public int getLookupOffset(int i) { + public int getLookupOffset(final int i) { return _lookupOffsets[i]; } - public Lookup getLookup(int i) { + public Lookup getLookup(final int i) { return _lookups[i]; } - public Lookup getLookup(Feature feature, int index) { + public Lookup getLookup(final Feature feature, final int index) { if (feature.getLookupCount() > index) { - int i = feature.getLookupListIndex(index); + final int i = feature.getLookupListIndex(index); return _lookups[i]; } return null; diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LtshTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LtshTable.java index 47874cc56..efafe7bb6 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LtshTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LtshTable.java @@ -18,13 +18,13 @@ import java.io.IOException; */ public class LtshTable implements Table { - private DirectoryEntry de; - private int version; - private int numGlyphs; - private int[] yPels; + private final DirectoryEntry de; + private final int version; + private final int numGlyphs; + private final int[] yPels; /** Creates new LtshTable */ - protected LtshTable(DirectoryEntry de, DataInput di) throws IOException { + protected LtshTable(final DirectoryEntry de, final DataInput di) throws IOException { this.de = (DirectoryEntry) de.clone(); version = di.readUnsignedShort(); numGlyphs = di.readUnsignedShort(); @@ -45,7 +45,7 @@ public class LtshTable implements Table { @Override public String toString() { - StringBuilder sb = new StringBuilder(); + final StringBuilder sb = new StringBuilder(); sb.append("'LTSH' Table - Linear Threshold Table\n-------------------------------------") .append("\n 'LTSH' Version: ").append(version) .append("\n Number of Glyphs: ").append(numGlyphs) diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/MaxpTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/MaxpTable.java index abb6047fc..0e9a6177f 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/MaxpTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/MaxpTable.java @@ -19,8 +19,8 @@ import jogamp.graph.font.typecast.ot.Fixed; */ public class MaxpTable implements Table { - private DirectoryEntry de; - private int versionNumber; + private final DirectoryEntry de; + private final int versionNumber; private int numGlyphs; private int maxPoints; private int maxContours; @@ -36,7 +36,7 @@ public class MaxpTable implements Table { private int maxComponentElements; private int maxComponentDepth; - protected MaxpTable(DirectoryEntry de, DataInput di) throws IOException { + protected MaxpTable(final DirectoryEntry de, final DataInput di) throws IOException { this.de = (DirectoryEntry) de.clone(); versionNumber = di.readInt(); @@ -128,7 +128,7 @@ public class MaxpTable implements Table { @Override public String toString() { - StringBuilder sb = new StringBuilder(); + final StringBuilder sb = new StringBuilder(); sb.append("'maxp' Table - Maximum Profile\n------------------------------") .append("\n 'maxp' version: ").append(Fixed.floatValue(versionNumber)) .append("\n numGlyphs: ").append(numGlyphs); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/NameRecord.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/NameRecord.java index a1787e3e7..5ac9ada29 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/NameRecord.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/NameRecord.java @@ -59,15 +59,15 @@ import java.io.IOException; */ public class NameRecord { - private short _platformId; - private short _encodingId; - private short _languageId; - private short _nameId; - private short _stringLength; - private short _stringOffset; + private final short _platformId; + private final short _encodingId; + private final short _languageId; + private final short _nameId; + private final short _stringLength; + private final short _stringOffset; private String _record; - protected NameRecord(DataInput di) throws IOException { + protected NameRecord(final DataInput di) throws IOException { _platformId = di.readShort(); _encodingId = di.readShort(); _languageId = di.readShort(); @@ -92,13 +92,13 @@ public class NameRecord { return _platformId; } - public StringBuilder getRecordString(StringBuilder sb) { + public StringBuilder getRecordString(final StringBuilder sb) { sb.append(_record); return sb; } - protected void loadString(DataInput di) throws IOException { - StringBuilder sb = new StringBuilder(); + protected void loadString(final DataInput di) throws IOException { + final StringBuilder sb = new StringBuilder(); di.skipBytes(_stringOffset); if (_platformId == ID.platformUnicode) { @@ -132,7 +132,7 @@ public class NameRecord { @Override public String toString() { - StringBuilder sb = new StringBuilder(); + final StringBuilder sb = new StringBuilder(); sb.append(" Platform ID: ").append(_platformId) .append("\n Specific ID: ").append(_encodingId) diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/NameTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/NameTable.java index ad8198b7f..ba9292a4b 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/NameTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/NameTable.java @@ -63,13 +63,13 @@ import java.io.IOException; * @author <a href="mailto:[email protected]">David Schweinsberg</a> */ public class NameTable implements Table { - private DirectoryEntry _de; - private short _formatSelector; - private short _numberOfNameRecords; - private short _stringStorageOffset; - private NameRecord[] _records; + private final DirectoryEntry _de; + private final short _formatSelector; + private final short _numberOfNameRecords; + private final short _stringStorageOffset; + private final NameRecord[] _records; - protected NameTable(DirectoryEntry de, DataInput di) throws IOException { + protected NameTable(final DirectoryEntry de, final DataInput di) throws IOException { _de = (DirectoryEntry) de.clone(); _formatSelector = di.readShort(); _numberOfNameRecords = di.readShort(); @@ -84,7 +84,7 @@ public class NameTable implements Table { // Load the string data into a buffer so the records can copy out the // bits they are interested in - byte[] buffer = new byte[_de.getLength() - _stringStorageOffset]; + final byte[] buffer = new byte[_de.getLength() - _stringStorageOffset]; di.readFully(buffer); // Now let the records get their hands on them @@ -99,14 +99,14 @@ public class NameTable implements Table { } - public NameRecord getRecord(int i) { + public NameRecord getRecord(final int i) { if(_numberOfNameRecords > i) { return _records[i]; } return null; } - public StringBuilder getRecordsRecordString(StringBuilder sb, int i) { + public StringBuilder getRecordsRecordString(final StringBuilder sb, final int i) { if(_numberOfNameRecords > i) { _records[i].getRecordString(sb); } else { @@ -115,7 +115,7 @@ public class NameTable implements Table { return sb; } - public StringBuilder getNamedRecordString(StringBuilder sb, short nameId) { + public StringBuilder getNamedRecordString(final StringBuilder sb, final short nameId) { // Search for the first instance of this name ID boolean done = false; for (int i = 0; !done && i < _numberOfNameRecords; i++) { diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Os2Table.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Os2Table.java index 5340b297c..c91127303 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Os2Table.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Os2Table.java @@ -59,46 +59,46 @@ import java.io.IOException; */ public class Os2Table implements Table { - private DirectoryEntry _de; - private int _version; - private short _xAvgCharWidth; - private int _usWeightClass; - private int _usWidthClass; - private short _fsType; - private short _ySubscriptXSize; - private short _ySubscriptYSize; - private short _ySubscriptXOffset; - private short _ySubscriptYOffset; - private short _ySuperscriptXSize; - private short _ySuperscriptYSize; - private short _ySuperscriptXOffset; - private short _ySuperscriptYOffset; - private short _yStrikeoutSize; - private short _yStrikeoutPosition; - private short _sFamilyClass; - private Panose _panose; - private int _ulUnicodeRange1; - private int _ulUnicodeRange2; - private int _ulUnicodeRange3; - private int _ulUnicodeRange4; - private int _achVendorID; - private short _fsSelection; - private int _usFirstCharIndex; - private int _usLastCharIndex; - private short _sTypoAscender; - private short _sTypoDescender; - private short _sTypoLineGap; - private int _usWinAscent; - private int _usWinDescent; - private int _ulCodePageRange1; - private int _ulCodePageRange2; + private final DirectoryEntry _de; + private final int _version; + private final short _xAvgCharWidth; + private final int _usWeightClass; + private final int _usWidthClass; + private final short _fsType; + private final short _ySubscriptXSize; + private final short _ySubscriptYSize; + private final short _ySubscriptXOffset; + private final short _ySubscriptYOffset; + private final short _ySuperscriptXSize; + private final short _ySuperscriptYSize; + private final short _ySuperscriptXOffset; + private final short _ySuperscriptYOffset; + private final short _yStrikeoutSize; + private final short _yStrikeoutPosition; + private final short _sFamilyClass; + private final Panose _panose; + private final int _ulUnicodeRange1; + private final int _ulUnicodeRange2; + private final int _ulUnicodeRange3; + private final int _ulUnicodeRange4; + private final int _achVendorID; + private final short _fsSelection; + private final int _usFirstCharIndex; + private final int _usLastCharIndex; + private final short _sTypoAscender; + private final short _sTypoDescender; + private final short _sTypoLineGap; + private final int _usWinAscent; + private final int _usWinDescent; + private final int _ulCodePageRange1; + private final int _ulCodePageRange2; private short _sxHeight; private short _sCapHeight; private int _usDefaultChar; private int _usBreakChar; private int _usMaxContext; - protected Os2Table(DirectoryEntry de, DataInput di) throws IOException { + protected Os2Table(final DirectoryEntry de, final DataInput di) throws IOException { this._de = (DirectoryEntry) de.clone(); _version = di.readUnsignedShort(); _xAvgCharWidth = di.readShort(); @@ -116,7 +116,7 @@ public class Os2Table implements Table { _yStrikeoutSize = di.readShort(); _yStrikeoutPosition = di.readShort(); _sFamilyClass = di.readShort(); - byte[] buf = new byte[10]; + final byte[] buf = new byte[10]; di.readFully(buf); _panose = new Panose(buf); _ulUnicodeRange1 = di.readInt(); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Panose.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Panose.java index 771318108..493f43baa 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Panose.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Panose.java @@ -26,7 +26,7 @@ public class Panose { byte bXHeight = 0; /** Creates new Panose */ - public Panose(byte[] panose) { + public Panose(final byte[] panose) { bFamilyType = panose[0]; bSerifStyle = panose[1]; bWeight = panose[2]; @@ -81,7 +81,7 @@ public class Panose { @Override public String toString() { - StringBuilder sb = new StringBuilder(); + final StringBuilder sb = new StringBuilder(); sb.append(String.valueOf(bFamilyType)).append(" ") .append(String.valueOf(bSerifStyle)).append(" ") .append(String.valueOf(bWeight)).append(" ") diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PcltTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PcltTable.java index a1f603d8f..63399cf0e 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PcltTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PcltTable.java @@ -18,25 +18,25 @@ import java.io.IOException; */ public class PcltTable implements Table { - private DirectoryEntry de; - private int version; - private long fontNumber; - private int pitch; - private int xHeight; - private int style; - private int typeFamily; - private int capHeight; - private int symbolSet; - private char[] typeface = new char[16]; - private short[] characterComplement = new short[8]; - private char[] fileName = new char[6]; - private short strokeWeight; - private short widthType; - private byte serifStyle; - private byte reserved; + private final DirectoryEntry de; + private final int version; + private final long fontNumber; + private final int pitch; + private final int xHeight; + private final int style; + private final int typeFamily; + private final int capHeight; + private final int symbolSet; + private final char[] typeface = new char[16]; + private final short[] characterComplement = new short[8]; + private final char[] fileName = new char[6]; + private final short strokeWeight; + private final short widthType; + private final byte serifStyle; + private final byte reserved; /** Creates new PcltTable */ - protected PcltTable(DirectoryEntry de, DataInput di) throws IOException { + protected PcltTable(final DirectoryEntry de, final DataInput di) throws IOException { this.de = (DirectoryEntry) de.clone(); version = di.readInt(); fontNumber = di.readInt(); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PostTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PostTable.java index 188b441ac..faeecf909 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PostTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PostTable.java @@ -284,16 +284,16 @@ public class PostTable implements Table { "" // 257 }; - private DirectoryEntry de; - private int version; - private int italicAngle; - private short underlinePosition; - private short underlineThickness; - private int isFixedPitch; - private int minMemType42; - private int maxMemType42; - private int minMemType1; - private int maxMemType1; + private final DirectoryEntry de; + private final int version; + private final int italicAngle; + private final short underlinePosition; + private final short underlineThickness; + private final int isFixedPitch; + private final int minMemType42; + private final int maxMemType42; + private final int minMemType1; + private final int maxMemType1; // v2 private int numGlyphs; @@ -301,7 +301,7 @@ public class PostTable implements Table { private String[] psGlyphName; /** Creates new PostTable */ - protected PostTable(DirectoryEntry de, DataInput di) throws IOException { + protected PostTable(final DirectoryEntry de, final DataInput di) throws IOException { this.de = (DirectoryEntry) de.clone(); version = di.readInt(); italicAngle = di.readInt(); @@ -324,8 +324,8 @@ public class PostTable implements Table { h -= 257; psGlyphName = new String[h]; for (int i = 0; i < h; i++) { - int len = di.readUnsignedByte(); - byte[] buf = new byte[len]; + final int len = di.readUnsignedByte(); + final byte[] buf = new byte[len]; di.readFully(buf); psGlyphName[i] = new String(buf); } @@ -349,7 +349,7 @@ public class PostTable implements Table { return high; } - public String getGlyphName(int i) { + public String getGlyphName(final int i) { if (version == 0x00020000) { return (glyphNameIndex[i] > 257) ? psGlyphName[glyphNameIndex[i] - 258] @@ -359,7 +359,7 @@ public class PostTable implements Table { } } - private boolean isMacGlyphName(int i) { + private boolean isMacGlyphName(final int i) { if (version == 0x00020000) { return glyphNameIndex[i] <= 257; } else { @@ -377,7 +377,7 @@ public class PostTable implements Table { @Override public String toString() { - StringBuilder sb = new StringBuilder(); + final StringBuilder sb = new StringBuilder(); sb.append("'post' Table - PostScript Metrics\n---------------------------------\n") .append("\n 'post' version: ").append(Fixed.floatValue(version)) .append("\n italicAngle: ").append(Fixed.floatValue(italicAngle)) diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PrepTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PrepTable.java index 4c64673b7..039789d62 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PrepTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PrepTable.java @@ -19,9 +19,9 @@ import jogamp.graph.font.typecast.ot.Disassembler; */ public class PrepTable extends Program implements Table { - private DirectoryEntry de; + private final DirectoryEntry de; - public PrepTable(DirectoryEntry de, DataInput di) throws IOException { + public PrepTable(final DirectoryEntry de, final DataInput di) throws IOException { this.de = (DirectoryEntry) de.clone(); readInstructions(di, de.getLength()); } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Program.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Program.java index e3beabef8..c0d2c1b9d 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Program.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Program.java @@ -23,7 +23,7 @@ public abstract class Program { return instructions; } - protected void readInstructions(DataInput di, int count) throws IOException { + protected void readInstructions(final DataInput di, final int count) throws IOException { instructions = new short[count]; for (int i = 0; i < count; i++) { instructions[i] = (short) di.readUnsignedByte(); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/RangeRecord.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/RangeRecord.java index 40ddf4215..417779703 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/RangeRecord.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/RangeRecord.java @@ -61,22 +61,22 @@ import java.io.IOException; */ public class RangeRecord { - private int _start; - private int _end; - private int _startCoverageIndex; + private final int _start; + private final int _end; + private final int _startCoverageIndex; /** Creates new RangeRecord */ - public RangeRecord(DataInput di) throws IOException { + public RangeRecord(final DataInput di) throws IOException { _start = di.readUnsignedShort(); _end = di.readUnsignedShort(); _startCoverageIndex = di.readUnsignedShort(); } - public boolean isInRange(int glyphId) { + public boolean isInRange(final int glyphId) { return (_start <= glyphId && glyphId <= _end); } - public int getCoverageIndex(int glyphId) { + public int getCoverageIndex(final int glyphId) { if (isInRange(glyphId)) { return _startCoverageIndex + glyphId - _start; } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Script.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Script.java index 04781a8f9..8846de5f0 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Script.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Script.java @@ -60,14 +60,14 @@ import java.io.IOException; */ public class Script { - private int _defaultLangSysOffset; - private int _langSysCount; + private final int _defaultLangSysOffset; + private final int _langSysCount; private LangSysRecord[] _langSysRecords; private LangSys _defaultLangSys; private LangSys[] _langSys; /** Creates new ScriptTable */ - protected Script(DataInputStream dis, int offset) throws IOException { + protected Script(final DataInputStream dis, final int offset) throws IOException { // Ensure we're in the right place dis.reset(); @@ -103,7 +103,7 @@ public class Script { return _langSysCount; } - public LangSysRecord getLangSysRecord(int i) { + public LangSysRecord getLangSysRecord(final int i) { return _langSysRecords[i]; } @@ -111,7 +111,7 @@ public class Script { return _defaultLangSys; } - public LangSys getLangSys(int i) { + public LangSys getLangSys(final int i) { return _langSys[i]; } } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ScriptList.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ScriptList.java index 18589b712..1c1be0d2b 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ScriptList.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ScriptList.java @@ -61,11 +61,11 @@ import java.io.IOException; public class ScriptList { private int _scriptCount = 0; - private ScriptRecord[] _scriptRecords; - private Script[] _scripts; + private final ScriptRecord[] _scriptRecords; + private final Script[] _scripts; /** Creates new ScriptList */ - protected ScriptList(DataInputStream dis, int offset) throws IOException { + protected ScriptList(final DataInputStream dis, final int offset) throws IOException { // Ensure we're in the right place dis.reset(); @@ -87,19 +87,19 @@ public class ScriptList { return _scriptCount; } - public ScriptRecord getScriptRecord(int i) { + public ScriptRecord getScriptRecord(final int i) { return _scriptRecords[i]; } - public Script getScript(int i) { + public Script getScript(final int i) { return _scripts[i]; } - public Script findScript(String tag) { + public Script findScript(final String tag) { if (tag.length() != 4) { return null; } - int tagVal = ((tag.charAt(0)<<24) + final int tagVal = ((tag.charAt(0)<<24) | (tag.charAt(1)<<16) | (tag.charAt(2)<<8) | tag.charAt(3)); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ScriptRecord.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ScriptRecord.java index 183ca2ffd..18eefe5a7 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ScriptRecord.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ScriptRecord.java @@ -60,11 +60,11 @@ import java.io.IOException; */ public class ScriptRecord { - private int _tag; - private int _offset; + private final int _tag; + private final int _offset; /** Creates new ScriptRecord */ - protected ScriptRecord(DataInput di) throws IOException { + protected ScriptRecord(final DataInput di) throws IOException { _tag = di.readInt(); _offset = di.readUnsignedShort(); } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SignatureBlock.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SignatureBlock.java index 31a2d17c9..e6841b94c 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SignatureBlock.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SignatureBlock.java @@ -18,13 +18,13 @@ import java.io.DataInput; */ public class SignatureBlock { - private int reserved1; - private int reserved2; - private int signatureLen; - private byte[] signature; + private final int reserved1; + private final int reserved2; + private final int signatureLen; + private final byte[] signature; /** Creates new SignatureBlock */ - protected SignatureBlock(DataInput di) throws IOException { + protected SignatureBlock(final DataInput di) throws IOException { reserved1 = di.readUnsignedShort(); reserved2 = di.readUnsignedShort(); signatureLen = di.readInt(); @@ -34,7 +34,7 @@ public class SignatureBlock { @Override public String toString() { - StringBuilder sb = new StringBuilder(); + final StringBuilder sb = new StringBuilder(); for (int i = 0; i < signatureLen; i += 16) { if (signatureLen - i >= 16) { sb.append(new String(signature, i, 16)).append("\n"); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SingleSubst.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SingleSubst.java index e31281f2e..c398b4fbb 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SingleSubst.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SingleSubst.java @@ -64,11 +64,11 @@ public abstract class SingleSubst extends LookupSubtable { public abstract int substitute(int glyphId); - public static SingleSubst read(DataInputStream dis, int offset) throws IOException { + public static SingleSubst read(final DataInputStream dis, final int offset) throws IOException { SingleSubst s = null; dis.reset(); dis.skipBytes(offset); - int format = dis.readUnsignedShort(); + final int format = dis.readUnsignedShort(); if (format == 1) { s = new SingleSubstFormat1(dis, offset); } else if (format == 2) { diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SingleSubstFormat1.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SingleSubstFormat1.java index e97e62a58..b2e65dded 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SingleSubstFormat1.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SingleSubstFormat1.java @@ -60,12 +60,12 @@ import java.io.IOException; */ public class SingleSubstFormat1 extends SingleSubst { - private int _coverageOffset; - private short _deltaGlyphID; - private Coverage _coverage; + private final int _coverageOffset; + private final short _deltaGlyphID; + private final Coverage _coverage; /** Creates new SingleSubstFormat1 */ - protected SingleSubstFormat1(DataInputStream dis, int offset) throws IOException { + protected SingleSubstFormat1(final DataInputStream dis, final int offset) throws IOException { _coverageOffset = dis.readUnsignedShort(); _deltaGlyphID = dis.readShort(); dis.reset(); @@ -79,8 +79,8 @@ public class SingleSubstFormat1 extends SingleSubst { } @Override - public int substitute(int glyphId) { - int i = _coverage.findGlyph(glyphId); + public int substitute(final int glyphId) { + final int i = _coverage.findGlyph(glyphId); if (i > -1) { return glyphId + _deltaGlyphID; } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SingleSubstFormat2.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SingleSubstFormat2.java index 4d46b07b4..449c14c7a 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SingleSubstFormat2.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SingleSubstFormat2.java @@ -60,13 +60,13 @@ import java.io.IOException; */ public class SingleSubstFormat2 extends SingleSubst { - private int _coverageOffset; - private int _glyphCount; - private int[] _substitutes; - private Coverage _coverage; + private final int _coverageOffset; + private final int _glyphCount; + private final int[] _substitutes; + private final Coverage _coverage; /** Creates new SingleSubstFormat2 */ - protected SingleSubstFormat2(DataInputStream dis, int offset) throws IOException { + protected SingleSubstFormat2(final DataInputStream dis, final int offset) throws IOException { _coverageOffset = dis.readUnsignedShort(); _glyphCount = dis.readUnsignedShort(); _substitutes = new int[_glyphCount]; @@ -84,8 +84,8 @@ public class SingleSubstFormat2 extends SingleSubst { } @Override - public int substitute(int glyphId) { - int i = _coverage.findGlyph(glyphId); + public int substitute(final int glyphId) { + final int i = _coverage.findGlyph(glyphId); if (i > -1) { return _substitutes[i]; } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/TTCHeader.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/TTCHeader.java index f7c7d99b5..a6ec61887 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/TTCHeader.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/TTCHeader.java @@ -20,16 +20,16 @@ public class TTCHeader { public static final int ttcf = 0x74746366; - private int ttcTag; - private int version; - private int directoryCount; - private int[] tableDirectory; + private final int ttcTag; + private final int version; + private final int directoryCount; + private final int[] tableDirectory; private int dsigTag; - private int dsigLength; - private int dsigOffset; + private final int dsigLength; + private final int dsigOffset; /** Creates new TTCHeader */ - public TTCHeader(DataInput di) throws IOException { + public TTCHeader(final DataInput di) throws IOException { ttcTag = di.readInt(); version = di.readInt(); directoryCount = di.readInt(); @@ -48,12 +48,12 @@ public class TTCHeader { return directoryCount; } - public int getTableDirectory(int i) { + public int getTableDirectory(final int i) { return tableDirectory[i]; } - public static boolean isTTC(DataInput di) throws IOException { - int ttcTag = di.readInt(); + public static boolean isTTC(final DataInput di) throws IOException { + final int ttcTag = di.readInt(); return ttcTag == ttcf; } } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/TableDirectory.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/TableDirectory.java index 23ecba804..b9448cc72 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/TableDirectory.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/TableDirectory.java @@ -66,9 +66,9 @@ public class TableDirectory { private short _searchRange = 0; private short _entrySelector = 0; private short _rangeShift = 0; - private DirectoryEntry[] _entries; + private final DirectoryEntry[] _entries; - public TableDirectory(DataInput di) throws IOException { + public TableDirectory(final DataInput di) throws IOException { _version = di.readInt(); _numTables = di.readShort(); _searchRange = di.readShort(); @@ -80,11 +80,11 @@ public class TableDirectory { } } - public DirectoryEntry getEntry(int index) { + public DirectoryEntry getEntry(final int index) { return _entries[index]; } - public DirectoryEntry getEntryByTag(int tag) { + public DirectoryEntry getEntryByTag(final int tag) { for (int i = 0; i < _numTables; i++) { if (_entries[i].getTag() == tag) { return _entries[i]; @@ -115,7 +115,7 @@ public class TableDirectory { @Override public String toString() { - StringBuilder sb = new StringBuilder() + final StringBuilder sb = new StringBuilder() .append("Offset Table\n------ -----") .append("\n sfnt version: ").append(Fixed.floatValue(_version)) .append("\n numTables = ").append(_numTables) diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/TableException.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/TableException.java index 65aa84bff..e0433f098 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/TableException.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/TableException.java @@ -40,7 +40,7 @@ public class TableException extends java.lang.Exception { * Constructs an instance of <code>TableException</code> with the specified detail message. * @param msg the detail message. */ - public TableException(String msg) { + public TableException(final String msg) { super(msg); } } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/TableFactory.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/TableFactory.java index 956d1aecd..d24f3b3ae 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/TableFactory.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/TableFactory.java @@ -64,10 +64,10 @@ import jogamp.graph.font.typecast.ot.OTFontCollection; public class TableFactory { public static Table create( - OTFontCollection fc, - OTFont font, - DirectoryEntry de, - DataInputStream dis) throws IOException { + final OTFontCollection fc, + final OTFont font, + final DirectoryEntry de, + final DataInputStream dis) throws IOException { Table t = null; // First, if we have a font collection, look for the table there diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/VdmxTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/VdmxTable.java index bebd7f946..1a390f86d 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/VdmxTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/VdmxTable.java @@ -32,12 +32,12 @@ public class VdmxTable implements Table { private class Ratio { - private byte _bCharSet; - private byte _xRatio; - private byte _yStartRatio; - private byte _yEndRatio; + private final byte _bCharSet; + private final byte _xRatio; + private final byte _yStartRatio; + private final byte _yEndRatio; - protected Ratio(DataInput di) throws IOException { + protected Ratio(final DataInput di) throws IOException { _bCharSet = di.readByte(); _xRatio = di.readByte(); _yStartRatio = di.readByte(); @@ -63,11 +63,11 @@ public class VdmxTable implements Table { private class VTableRecord { - private int _yPelHeight; - private short _yMax; - private short _yMin; + private final int _yPelHeight; + private final short _yMax; + private final short _yMin; - protected VTableRecord(DataInput di) throws IOException { + protected VTableRecord(final DataInput di) throws IOException { _yPelHeight = di.readUnsignedShort(); _yMax = di.readShort(); _yMin = di.readShort(); @@ -88,12 +88,12 @@ public class VdmxTable implements Table { private class Group { - private int _recs; - private int _startsz; - private int _endsz; - private VTableRecord[] _entry; + private final int _recs; + private final int _startsz; + private final int _endsz; + private final VTableRecord[] _entry; - protected Group(DataInput di) throws IOException { + protected Group(final DataInput di) throws IOException { _recs = di.readUnsignedShort(); _startsz = di.readUnsignedByte(); _endsz = di.readUnsignedByte(); @@ -120,16 +120,16 @@ public class VdmxTable implements Table { } } - private DirectoryEntry _de; - private int _version; - private int _numRecs; - private int _numRatios; - private Ratio[] _ratRange; - private int _offset[]; - private Group[] _groups; + private final DirectoryEntry _de; + private final int _version; + private final int _numRecs; + private final int _numRatios; + private final Ratio[] _ratRange; + private final int _offset[]; + private final Group[] _groups; /** Creates a new instance of VdmxTable */ - protected VdmxTable(DirectoryEntry de, DataInput di) throws IOException { + protected VdmxTable(final DirectoryEntry de, final DataInput di) throws IOException { _de = (DirectoryEntry) de.clone(); _version = di.readUnsignedShort(); _numRecs = di.readUnsignedShort(); @@ -155,7 +155,7 @@ public class VdmxTable implements Table { @Override public String toString() { - StringBuilder sb = new StringBuilder(); + final StringBuilder sb = new StringBuilder(); sb.append("'VDMX' Table - Precomputed Vertical Device Metrics\n") .append("--------------------------------------------------\n") .append(" Version: ").append(_version).append("\n") @@ -172,7 +172,7 @@ public class VdmxTable implements Table { sb.append("\n VDMX Height Record Groups\n") .append(" -------------------------\n"); for (int i = 0; i < _numRecs; ++i) { - Group group = _groups[i]; + final Group group = _groups[i]; sb.append(" ").append(i + 1) .append(". Number of Hgt Records ").append(group.getRecs()).append("\n") .append(" Starting Y Pel Height ").append(group.getStartSZ()).append("\n") diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/VheaTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/VheaTable.java index 521b87cc8..cef7b5297 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/VheaTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/VheaTable.java @@ -32,21 +32,21 @@ import jogamp.graph.font.typecast.ot.Fixed; */ public class VheaTable implements Table { - private DirectoryEntry _de; - private int _version; - private short _ascent; - private short _descent; - private short _lineGap; - private short _advanceHeightMax; - private short _minTopSideBearing; - private short _minBottomSideBearing; - private short _yMaxExtent; - private short _caretSlopeRise; - private short _caretSlopeRun; - private short _metricDataFormat; - private int _numberOfLongVerMetrics; - - protected VheaTable(DirectoryEntry de, DataInput di) throws IOException { + private final DirectoryEntry _de; + private final int _version; + private final short _ascent; + private final short _descent; + private final short _lineGap; + private final short _advanceHeightMax; + private final short _minTopSideBearing; + private final short _minBottomSideBearing; + private final short _yMaxExtent; + private final short _caretSlopeRise; + private final short _caretSlopeRun; + private final short _metricDataFormat; + private final int _numberOfLongVerMetrics; + + protected VheaTable(final DirectoryEntry de, final DataInput di) throws IOException { _de = (DirectoryEntry) de.clone(); _version = di.readInt(); _ascent = di.readShort(); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/VmtxTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/VmtxTable.java index 1b77a6fdc..b76ed7e15 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/VmtxTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/VmtxTable.java @@ -30,15 +30,15 @@ import java.io.IOException; */ public class VmtxTable implements Table { - private DirectoryEntry _de; + private final DirectoryEntry _de; private int[] _vMetrics = null; private short[] _topSideBearing = null; protected VmtxTable( - DirectoryEntry de, - DataInput di, - VheaTable vhea, - MaxpTable maxp) throws IOException { + final DirectoryEntry de, + final DataInput di, + final VheaTable vhea, + final MaxpTable maxp) throws IOException { _de = (DirectoryEntry) de.clone(); _vMetrics = new int[vhea.getNumberOfLongVerMetrics()]; for (int i = 0; i < vhea.getNumberOfLongVerMetrics(); ++i) { @@ -48,14 +48,14 @@ public class VmtxTable implements Table { | di.readUnsignedByte()<<8 | di.readUnsignedByte(); } - int tsbCount = maxp.getNumGlyphs() - vhea.getNumberOfLongVerMetrics(); + final int tsbCount = maxp.getNumGlyphs() - vhea.getNumberOfLongVerMetrics(); _topSideBearing = new short[tsbCount]; for (int i = 0; i < tsbCount; ++i) { _topSideBearing[i] = di.readShort(); } } - public int getAdvanceHeight(int i) { + public int getAdvanceHeight(final int i) { if (_vMetrics == null) { return 0; } @@ -66,7 +66,7 @@ public class VmtxTable implements Table { } } - public short getTopSideBearing(int i) { + public short getTopSideBearing(final int i) { if (_vMetrics == null) { return 0; } @@ -84,7 +84,7 @@ public class VmtxTable implements Table { @Override public String toString() { - StringBuilder sb = new StringBuilder(); + final StringBuilder sb = new StringBuilder(); sb.append("'vmtx' Table - Vertical Metrics\n-------------------------------\n"); sb.append("Size = ").append(_de.getLength()).append(" bytes, ") .append(_vMetrics.length).append(" entries\n"); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/t2/T2Interpreter.java b/src/jogl/classes/jogamp/graph/font/typecast/t2/T2Interpreter.java index 73f26b27c..7bfb8cbd5 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/t2/T2Interpreter.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/t2/T2Interpreter.java @@ -56,10 +56,10 @@ public class T2Interpreter { * (dx1, dy1). */ private void _rmoveto() { - int dy1 = popArg().intValue(); - int dx1 = popArg().intValue(); + final int dy1 = popArg().intValue(); + final int dx1 = popArg().intValue(); clearArg(); - Point lastPoint = getLastPoint(); + final Point lastPoint = getLastPoint(); moveTo(lastPoint.x + dx1, lastPoint.y + dy1); } @@ -67,9 +67,9 @@ public class T2Interpreter { * Moves the current point dx1 units in the horizontal direction. */ private void _hmoveto() { - int dx1 = popArg().intValue(); + final int dx1 = popArg().intValue(); clearArg(); - Point lastPoint = getLastPoint(); + final Point lastPoint = getLastPoint(); moveTo(lastPoint.x + dx1, lastPoint.y); } @@ -77,9 +77,9 @@ public class T2Interpreter { * Moves the current point dy1 units in the vertical direction. */ private void _vmoveto() { - int dy1 = popArg().intValue(); + final int dy1 = popArg().intValue(); clearArg(); - Point lastPoint = getLastPoint(); + final Point lastPoint = getLastPoint(); moveTo(lastPoint.x, lastPoint.y + dy1); } @@ -90,15 +90,15 @@ public class T2Interpreter { * lines is determined from the number of arguments on the stack. */ private void _rlineto() { - int count = getArgCount() / 2; - int[] dx = new int[count]; - int[] dy = new int[count]; + final int count = getArgCount() / 2; + final int[] dx = new int[count]; + final int[] dy = new int[count]; for (int i = 0; i < count; ++i) { dy[count - i - 1] = popArg().intValue(); dx[count - i - 1] = popArg().intValue(); } for (int i = 0; i < count; ++i) { - Point lastPoint = getLastPoint(); + final Point lastPoint = getLastPoint(); lineTo(lastPoint.x + dx[i], lastPoint.y + dy[i]); } clearArg(); @@ -115,13 +115,13 @@ public class T2Interpreter { * number of arguments on the stack. */ private void _hlineto() { - int count = getArgCount(); - Number[] nums = new Number[count]; + final int count = getArgCount(); + final Number[] nums = new Number[count]; for (int i = 0; i < count; ++i) { nums[count - i - 1] = popArg(); } for (int i = 0; i < count; ++i) { - Point lastPoint = getLastPoint(); + final Point lastPoint = getLastPoint(); if (i % 2 == 0) { lineTo(lastPoint.x + nums[i].intValue(), lastPoint.y); } else { @@ -142,13 +142,13 @@ public class T2Interpreter { * number of arguments on the stack. */ private void _vlineto() { - int count = getArgCount(); - Number[] nums = new Number[count]; + final int count = getArgCount(); + final Number[] nums = new Number[count]; for (int i = 0; i < count; ++i) { nums[count - i - 1] = popArg(); } for (int i = 0; i < count; ++i) { - Point lastPoint = getLastPoint(); + final Point lastPoint = getLastPoint(); if (i % 2 == 0) { lineTo(lastPoint.x, lastPoint.y + nums[i].intValue()); } else { @@ -167,13 +167,13 @@ public class T2Interpreter { * stack. */ private void _rrcurveto() { - int count = getArgCount() / 6; - int[] dxa = new int[count]; - int[] dya = new int[count]; - int[] dxb = new int[count]; - int[] dyb = new int[count]; - int[] dxc = new int[count]; - int[] dyc = new int[count]; + final int count = getArgCount() / 6; + final int[] dxa = new int[count]; + final int[] dya = new int[count]; + final int[] dxb = new int[count]; + final int[] dyb = new int[count]; + final int[] dxc = new int[count]; + final int[] dyc = new int[count]; for (int i = 0; i < count; ++i) { dyc[count - i - 1] = popArg().intValue(); dxc[count - i - 1] = popArg().intValue(); @@ -183,13 +183,13 @@ public class T2Interpreter { dxa[count - i - 1] = popArg().intValue(); } for (int i = 0; i < count; ++i) { - Point lastPoint = getLastPoint(); - int xa = lastPoint.x + dxa[i]; - int ya = lastPoint.y + dya[i]; - int xb = xa + dxb[i]; - int yb = ya + dyb[i]; - int xc = xb + dxc[i]; - int yc = yb + dyc[i]; + final Point lastPoint = getLastPoint(); + final int xa = lastPoint.x + dxa[i]; + final int ya = lastPoint.y + dya[i]; + final int xb = xa + dxb[i]; + final int yb = ya + dyb[i]; + final int xc = xb + dxc[i]; + final int yc = yb + dyc[i]; curveTo(xa, ya, xb, yb, xc, yc); } clearArg(); @@ -203,12 +203,12 @@ public class T2Interpreter { * case). Note the argument order for the odd argument case. */ private void _hhcurveto() { - int count = getArgCount() / 4; + final int count = getArgCount() / 4; int dy1 = 0; - int[] dxa = new int[count]; - int[] dxb = new int[count]; - int[] dyb = new int[count]; - int[] dxc = new int[count]; + final int[] dxa = new int[count]; + final int[] dxb = new int[count]; + final int[] dyb = new int[count]; + final int[] dxc = new int[count]; for (int i = 0; i < count; ++i) { dxc[count - i - 1] = popArg().intValue(); dyb[count - i - 1] = popArg().intValue(); @@ -219,13 +219,13 @@ public class T2Interpreter { dy1 = popArg().intValue(); } for (int i = 0; i < count; ++i) { - Point lastPoint = getLastPoint(); - int xa = lastPoint.x + dxa[i]; - int ya = lastPoint.y + (i == 0 ? dy1 : 0); - int xb = xa + dxb[i]; - int yb = ya + dyb[i]; - int xc = xb + dxc[i]; - int yc = yb; + final Point lastPoint = getLastPoint(); + final int xa = lastPoint.x + dxa[i]; + final int ya = lastPoint.y + (i == 0 ? dy1 : 0); + final int xb = xa + dxb[i]; + final int yb = ya + dyb[i]; + final int xc = xb + dxc[i]; + final int yc = yb; curveTo(xa, ya, xb, yb, xc, yc); } clearArg(); @@ -243,15 +243,15 @@ public class T2Interpreter { */ private void _hvcurveto() { if (getArgCount() % 8 <= 1) { - int count = getArgCount() / 8; - int[] dxa = new int[count]; - int[] dxb = new int[count]; - int[] dyb = new int[count]; - int[] dyc = new int[count]; - int[] dyd = new int[count]; - int[] dxe = new int[count]; - int[] dye = new int[count]; - int[] dxf = new int[count]; + final int count = getArgCount() / 8; + final int[] dxa = new int[count]; + final int[] dxb = new int[count]; + final int[] dyb = new int[count]; + final int[] dyc = new int[count]; + final int[] dyd = new int[count]; + final int[] dxe = new int[count]; + final int[] dye = new int[count]; + final int[] dxf = new int[count]; int dyf = 0; if (getArgCount() % 8 == 1) { dyf = popArg().intValue(); @@ -267,32 +267,32 @@ public class T2Interpreter { dxa[count - i - 1] = popArg().intValue(); } for (int i = 0; i < count; ++i) { - Point lastPoint = getLastPoint(); - int xa = lastPoint.x + dxa[i]; - int ya = lastPoint.y; - int xb = xa + dxb[i]; - int yb = ya + dyb[i]; - int xc = xb; - int yc = yb + dyc[i]; - int xd = xc; - int yd = yc + dyd[i]; - int xe = xd + dxe[i]; - int ye = yd + dye[i]; - int xf = xe + dxf[i]; - int yf = ye + dyf; + final Point lastPoint = getLastPoint(); + final int xa = lastPoint.x + dxa[i]; + final int ya = lastPoint.y; + final int xb = xa + dxb[i]; + final int yb = ya + dyb[i]; + final int xc = xb; + final int yc = yb + dyc[i]; + final int xd = xc; + final int yd = yc + dyd[i]; + final int xe = xd + dxe[i]; + final int ye = yd + dye[i]; + final int xf = xe + dxf[i]; + final int yf = ye + dyf; curveTo(xa, ya, xb, yb, xc, yc); curveTo(xd, yd, xe, ye, xf, yf); } } else { - int count = getArgCount() / 8; - int[] dya = new int[count]; - int[] dxb = new int[count]; - int[] dyb = new int[count]; - int[] dxc = new int[count]; - int[] dxd = new int[count]; - int[] dxe = new int[count]; - int[] dye = new int[count]; - int[] dyf = new int[count]; + final int count = getArgCount() / 8; + final int[] dya = new int[count]; + final int[] dxb = new int[count]; + final int[] dyb = new int[count]; + final int[] dxc = new int[count]; + final int[] dxd = new int[count]; + final int[] dxe = new int[count]; + final int[] dye = new int[count]; + final int[] dyf = new int[count]; int dxf = 0; if (getArgCount() % 8 == 1) { dxf = popArg().intValue(); @@ -307,24 +307,24 @@ public class T2Interpreter { dxb[count - i - 1] = popArg().intValue(); dya[count - i - 1] = popArg().intValue(); } - int dy3 = popArg().intValue(); - int dy2 = popArg().intValue(); - int dx2 = popArg().intValue(); - int dx1 = popArg().intValue(); + final int dy3 = popArg().intValue(); + final int dy2 = popArg().intValue(); + final int dx2 = popArg().intValue(); + final int dx1 = popArg().intValue(); for (int i = 0; i < count; ++i) { - Point lastPoint = getLastPoint(); - int xa = lastPoint.x; - int ya = lastPoint.y + dya[i]; - int xb = xa + dxb[i]; - int yb = ya + dyb[i]; - int xc = xb + dxc[i]; - int yc = yb; - int xd = xc + dxd[i]; - int yd = yc; - int xe = xd + dxe[i]; - int ye = yd + dye[i]; - int xf = xe + dxf; - int yf = ye + dyf[i]; + final Point lastPoint = getLastPoint(); + final int xa = lastPoint.x; + final int ya = lastPoint.y + dya[i]; + final int xb = xa + dxb[i]; + final int yb = ya + dyb[i]; + final int xc = xb + dxc[i]; + final int yc = yb; + final int xd = xc + dxd[i]; + final int yd = yc; + final int xe = xd + dxe[i]; + final int ye = yd + dye[i]; + final int xf = xe + dxf; + final int yf = ye + dyf[i]; curveTo(xa, ya, xb, yb, xc, yc); curveTo(xd, yd, xe, ye, xf, yf); @@ -341,15 +341,15 @@ public class T2Interpreter { * on the argument stack. */ private void _rcurveline() { - int count = (getArgCount() - 2) / 6; - int[] dxa = new int[count]; - int[] dya = new int[count]; - int[] dxb = new int[count]; - int[] dyb = new int[count]; - int[] dxc = new int[count]; - int[] dyc = new int[count]; - int dyd = popArg().intValue(); - int dxd = popArg().intValue(); + final int count = (getArgCount() - 2) / 6; + final int[] dxa = new int[count]; + final int[] dya = new int[count]; + final int[] dxb = new int[count]; + final int[] dyb = new int[count]; + final int[] dxc = new int[count]; + final int[] dyc = new int[count]; + final int dyd = popArg().intValue(); + final int dxd = popArg().intValue(); for (int i = 0; i < count; ++i) { dyc[count - i - 1] = popArg().intValue(); dxc[count - i - 1] = popArg().intValue(); @@ -361,11 +361,11 @@ public class T2Interpreter { int xc = 0; int yc = 0; for (int i = 0; i < count; ++i) { - Point lastPoint = getLastPoint(); - int xa = lastPoint.x + dxa[i]; - int ya = lastPoint.y + dya[i]; - int xb = xa + dxb[i]; - int yb = ya + dyb[i]; + final Point lastPoint = getLastPoint(); + final int xa = lastPoint.x + dxa[i]; + final int ya = lastPoint.y + dya[i]; + final int xb = xa + dxb[i]; + final int yb = ya + dyb[i]; xc = xb + dxc[i]; yc = yb + dyc[i]; curveTo(xa, ya, xb, yb, xc, yc); @@ -381,15 +381,15 @@ public class T2Interpreter { * items on the argument stack. */ private void _rlinecurve() { - int count = (getArgCount() - 6) / 2; - int[] dxa = new int[count]; - int[] dya = new int[count]; - int dyd = popArg().intValue(); - int dxd = popArg().intValue(); - int dyc = popArg().intValue(); - int dxc = popArg().intValue(); - int dyb = popArg().intValue(); - int dxb = popArg().intValue(); + final int count = (getArgCount() - 6) / 2; + final int[] dxa = new int[count]; + final int[] dya = new int[count]; + final int dyd = popArg().intValue(); + final int dxd = popArg().intValue(); + final int dyc = popArg().intValue(); + final int dxc = popArg().intValue(); + final int dyb = popArg().intValue(); + final int dxb = popArg().intValue(); for (int i = 0; i < count; ++i) { dya[count - i - 1] = popArg().intValue(); dxa[count - i - 1] = popArg().intValue(); @@ -397,17 +397,17 @@ public class T2Interpreter { int xa = 0; int ya = 0; for (int i = 0; i < count; ++i) { - Point lastPoint = getLastPoint(); + final Point lastPoint = getLastPoint(); xa = lastPoint.x + dxa[i]; ya = lastPoint.y + dya[i]; lineTo(xa, ya); } - int xb = xa + dxb; - int yb = ya + dyb; - int xc = xb + dxc; - int yc = yb + dyc; - int xd = xc + dxd; - int yd = yc + dyd; + final int xb = xa + dxb; + final int yb = ya + dyb; + final int xc = xb + dxc; + final int yc = yb + dyc; + final int xd = xc + dxd; + final int yd = yc + dyd; curveTo(xb, yb, xc, yc, xd, yd); clearArg(); } @@ -420,15 +420,15 @@ public class T2Interpreter { */ private void _vhcurveto() { if (getArgCount() % 8 <= 1) { - int count = getArgCount() / 8; - int[] dya = new int[count]; - int[] dxb = new int[count]; - int[] dyb = new int[count]; - int[] dxc = new int[count]; - int[] dxd = new int[count]; - int[] dxe = new int[count]; - int[] dye = new int[count]; - int[] dyf = new int[count]; + final int count = getArgCount() / 8; + final int[] dya = new int[count]; + final int[] dxb = new int[count]; + final int[] dyb = new int[count]; + final int[] dxc = new int[count]; + final int[] dxd = new int[count]; + final int[] dxe = new int[count]; + final int[] dye = new int[count]; + final int[] dyf = new int[count]; int dxf = 0; if (getArgCount() % 8 == 1) { dxf = popArg().intValue(); @@ -444,24 +444,24 @@ public class T2Interpreter { dya[count - i - 1] = popArg().intValue(); } for (int i = 0; i < count; ++i) { - Point lastPoint = getLastPoint(); - int xa = lastPoint.x; - int ya = lastPoint.y + dya[i]; - int xb = xa + dxb[i]; - int yb = ya + dyb[i]; - int xc = xb + dxc[i]; - int yc = yb; - int xd = xc + dxd[i]; - int yd = yc; - int xe = xd + dxe[i]; - int ye = yd + dye[i]; - int xf = xe + dxf; - int yf = ye + dyf[i]; + final Point lastPoint = getLastPoint(); + final int xa = lastPoint.x; + final int ya = lastPoint.y + dya[i]; + final int xb = xa + dxb[i]; + final int yb = ya + dyb[i]; + final int xc = xb + dxc[i]; + final int yc = yb; + final int xd = xc + dxd[i]; + final int yd = yc; + final int xe = xd + dxe[i]; + final int ye = yd + dye[i]; + final int xf = xe + dxf; + final int yf = ye + dyf[i]; curveTo(xa, ya, xb, yb, xc, yc); curveTo(xd, yd, xe, ye, xf, yf); } } else { - int foo = 0; + final int foo = 0; } clearArg(); } @@ -565,7 +565,7 @@ public class T2Interpreter { * Returns the absolute value of num. */ private void _abs() { - double num = popArg().doubleValue(); + final double num = popArg().doubleValue(); pushArg(Math.abs(num)); } @@ -573,8 +573,8 @@ public class T2Interpreter { * Returns the sum of the two numbers num1 and num2. */ private void _add() { - double num2 = popArg().doubleValue(); - double num1 = popArg().doubleValue(); + final double num2 = popArg().doubleValue(); + final double num1 = popArg().doubleValue(); pushArg(num1 + num2); } @@ -582,8 +582,8 @@ public class T2Interpreter { * Returns the result of subtracting num2 from num1. */ private void _sub() { - double num2 = popArg().doubleValue(); - double num1 = popArg().doubleValue(); + final double num2 = popArg().doubleValue(); + final double num1 = popArg().doubleValue(); pushArg(num1 - num2); } @@ -592,8 +592,8 @@ public class T2Interpreter { * undefined if overflow occurs and is zero for underflow. */ private void _div() { - double num2 = popArg().doubleValue(); - double num1 = popArg().doubleValue(); + final double num2 = popArg().doubleValue(); + final double num1 = popArg().doubleValue(); pushArg(num1 / num2); } @@ -601,7 +601,7 @@ public class T2Interpreter { * Returns the negative of num. */ private void _neg() { - double num = popArg().doubleValue(); + final double num = popArg().doubleValue(); pushArg(-num); } @@ -618,8 +618,8 @@ public class T2Interpreter { * result is undefined, and zero is returned for underflow. */ private void _mul() { - double num2 = popArg().doubleValue(); - double num1 = popArg().doubleValue(); + final double num2 = popArg().doubleValue(); + final double num1 = popArg().doubleValue(); pushArg(num1 * num2); } @@ -628,7 +628,7 @@ public class T2Interpreter { * undefined. */ private void _sqrt() { - double num = popArg().doubleValue(); + final double num = popArg().doubleValue(); pushArg(Math.sqrt(num)); } @@ -643,8 +643,8 @@ public class T2Interpreter { * Exchanges the top two elements on the argument stack. */ private void _exch() { - Number num2 = popArg(); - Number num1 = popArg(); + final Number num2 = popArg(); + final Number num1 = popArg(); pushArg(num2); pushArg(num1); } @@ -656,8 +656,8 @@ public class T2Interpreter { * undefined. */ private void _index() { - int i = popArg().intValue(); - Number[] nums = new Number[i]; + final int i = popArg().intValue(); + final Number[] nums = new Number[i]; for (int j = 0; j < i; ++j) { nums[j] = popArg(); } @@ -675,9 +675,9 @@ public class T2Interpreter { * operation is undefined. */ private void _roll() { - int j = popArg().intValue(); - int n = popArg().intValue(); - Number[] nums = new Number[n]; + final int j = popArg().intValue(); + final int n = popArg().intValue(); + final Number[] nums = new Number[n]; for (int i = 0; i < n; ++i) { nums[i] = popArg(); } @@ -690,7 +690,7 @@ public class T2Interpreter { * Duplicates the top element on the argument stack. */ private void _dup() { - Number any = popArg(); + final Number any = popArg(); pushArg(any); pushArg(any); } @@ -699,8 +699,8 @@ public class T2Interpreter { * Stores val into the transient array at the location given by i. */ private void _put() { - int i = popArg().intValue(); - Number val = popArg(); + final int i = popArg().intValue(); + final Number val = popArg(); _transientArray[i] = val; } @@ -711,7 +711,7 @@ public class T2Interpreter { * charstring, the value returned is undefined. */ private void _get() { - int i = popArg().intValue(); + final int i = popArg().intValue(); pushArg(_transientArray[i]); } @@ -720,8 +720,8 @@ public class T2Interpreter { * puts a 0 on the stack if either argument is zero. */ private void _and() { - double num2 = popArg().doubleValue(); - double num1 = popArg().doubleValue(); + final double num2 = popArg().doubleValue(); + final double num1 = popArg().doubleValue(); pushArg((num1!=0.0) && (num2!=0.0) ? 1 : 0); } @@ -730,8 +730,8 @@ public class T2Interpreter { * puts a 0 on the stack if both arguments are zero. */ private void _or() { - double num2 = popArg().doubleValue(); - double num1 = popArg().doubleValue(); + final double num2 = popArg().doubleValue(); + final double num1 = popArg().doubleValue(); pushArg((num1!=0.0) || (num2!=0.0) ? 1 : 0); } @@ -739,7 +739,7 @@ public class T2Interpreter { * Returns a 0 if num1 is non-zero; returns a 1 if num1 is zero. */ private void _not() { - double num1 = popArg().doubleValue(); + final double num1 = popArg().doubleValue(); pushArg((num1!=0.0) ? 0 : 1); } @@ -748,8 +748,8 @@ public class T2Interpreter { * is put on the stack. */ private void _eq() { - double num2 = popArg().doubleValue(); - double num1 = popArg().doubleValue(); + final double num2 = popArg().doubleValue(); + final double num1 = popArg().doubleValue(); pushArg(num1 == num2 ? 1 : 0); } @@ -759,10 +759,10 @@ public class T2Interpreter { * number of a subroutine. */ private void _ifelse() { - double v2 = popArg().doubleValue(); - double v1 = popArg().doubleValue(); - Number s2 = popArg(); - Number s1 = popArg(); + final double v2 = popArg().doubleValue(); + final double v1 = popArg().doubleValue(); + final Number s2 = popArg(); + final Number s1 = popArg(); pushArg(v1 <= v2 ? s1 : s2); } @@ -796,7 +796,7 @@ public class T2Interpreter { } - public Point[] execute(CharstringType2 cs) { + public Point[] execute(final CharstringType2 cs) { _points = new ArrayList<Point>(); cs.resetIP(); while (cs.moreBytes()) { @@ -964,7 +964,7 @@ public class T2Interpreter { } } } - Point[] pointArray = new Point[_points.size()]; + final Point[] pointArray = new Point[_points.size()]; _points.toArray(pointArray); return pointArray; } @@ -986,7 +986,7 @@ public class T2Interpreter { /** * Push a value on to the argument stack */ - private void pushArg(Number n) { + private void pushArg(final Number n) { _argStack[_argStackIndex++] = n; } @@ -1000,7 +1000,7 @@ public class T2Interpreter { /** * Push a value on to the subroutine stack */ - private void pushSubr(int n) { + private void pushSubr(final int n) { _subrStack[_subrStackIndex++] = n; } @@ -1012,7 +1012,7 @@ public class T2Interpreter { } private Point getLastPoint() { - int size = _points.size(); + final int size = _points.size(); if (size > 0) { return _points.get(size - 1); } else { @@ -1020,23 +1020,23 @@ public class T2Interpreter { } } - private void moveTo(int x, int y) { + private void moveTo(final int x, final int y) { endContour(); _points.add(new Point(x, y, true, false)); } - private void lineTo(int x, int y) { + private void lineTo(final int x, final int y) { _points.add(new Point(x, y, true, false)); } - private void curveTo(int cx1, int cy1, int cx2, int cy2, int x, int y) { + private void curveTo(final int cx1, final int cy1, final int cx2, final int cy2, final int x, final int y) { _points.add(new Point(cx1, cy1, false, false)); _points.add(new Point(cx2, cy2, false, false)); _points.add(new Point(x, y, true, false)); } private void endContour() { - Point lastPoint = getLastPoint(); + final Point lastPoint = getLastPoint(); if (lastPoint != null) { lastPoint.endOfContour = true; } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/tt/engine/Interpreter.java b/src/jogl/classes/jogamp/graph/font/typecast/tt/engine/Interpreter.java index 2bb5cec0c..b296886cc 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/tt/engine/Interpreter.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/tt/engine/Interpreter.java @@ -33,16 +33,16 @@ import jogamp.graph.font.typecast.ot.Point; public class Interpreter { private Parser parser = null; - private GraphicsState gs = new GraphicsState(); - private Point[][] zone = new Point[2][]; + private final GraphicsState gs = new GraphicsState(); + private final Point[][] zone = new Point[2][]; private int[] stack = null; private int[] store = null; - private int[] cvt = new int[256]; + private final int[] cvt = new int[256]; private int[] functionMap = null; private int stackIndex = 0; private boolean inFuncDef = false; - public Interpreter(int stackMax, int storeMax, int funcMax) { + public Interpreter(final int stackMax, final int storeMax, final int funcMax) { zone[0] = new Point[256]; zone[1] = new Point[256]; stack = new int[stackMax]; @@ -54,7 +54,7 @@ public class Interpreter { * ABSolute value */ private void _abs() { - int n = pop(); + final int n = pop(); if (n >= 0) { push(n); } else { @@ -66,8 +66,8 @@ public class Interpreter { * ADD */ private void _add() { - int n1 = pop(); - int n2 = pop(); + final int n1 = pop(); + final int n2 = pop(); push(n2 + n1); } @@ -92,8 +92,8 @@ public class Interpreter { * logical AND */ private void _and() { - int e2 = pop(); - int e1 = pop(); + final int e2 = pop(); + final int e1 = pop(); push(((e1 != 0) && (e2 != 0)) ? 1 : 0); } @@ -108,7 +108,7 @@ public class Interpreter { * CEILING */ private void _ceiling() { - int n = pop(); + final int n = pop(); if (n >= 0) { push((n & 0xffc0) + (((n & 0x3f) != 0) ? 0x40 : 0)); } else { @@ -138,7 +138,7 @@ public class Interpreter { * DELTA exception C1 */ private void _deltac1() { - int n = pop(); + final int n = pop(); for (int i = 0; i < n; i++) { pop(); // pn pop(); // argn @@ -149,7 +149,7 @@ public class Interpreter { * DELTA exception C2 */ private void _deltac2() { - int n = pop(); + final int n = pop(); for (int i = 0; i < n; i++) { pop(); // pn pop(); // argn @@ -160,7 +160,7 @@ public class Interpreter { * DELTA exception C3 */ private void _deltac3() { - int n = pop(); + final int n = pop(); for (int i = 0; i < n; i++) { pop(); // pn pop(); // argn @@ -171,7 +171,7 @@ public class Interpreter { * DELTA exception P1 */ private void _deltap1() { - int n = pop(); + final int n = pop(); for (int i = 0; i < n; i++) { pop(); // pn pop(); // argn @@ -182,7 +182,7 @@ public class Interpreter { * DELTA exception P2 */ private void _deltap2() { - int n = pop(); + final int n = pop(); for (int i = 0; i < n; i++) { pop(); // pn pop(); // argn @@ -193,7 +193,7 @@ public class Interpreter { * DELTA exception P3 */ private void _deltap3() { - int n = pop(); + final int n = pop(); for (int i = 0; i < n; i++) { pop(); // pn pop(); // argn @@ -211,8 +211,8 @@ public class Interpreter { * DIVide */ private void _div() { - int n1 = pop(); - int n2 = pop(); + final int n1 = pop(); + final int n2 = pop(); push((n2 / n1) >> 6); } @@ -220,7 +220,7 @@ public class Interpreter { * DUPlicate top stack element */ private void _dup() { - int n = pop(); + final int n = pop(); push(n); push(n); } @@ -228,7 +228,7 @@ public class Interpreter { /** * ELSE */ - private int _else(int instructionIndex) { + private int _else(final int instructionIndex) { return parser.handleElse(instructionIndex); } @@ -236,8 +236,8 @@ public class Interpreter { * EQual */ private void _eq() { - int e2 = pop(); - int e1 = pop(); + final int e2 = pop(); + final int e1 = pop(); push((e1 == e2) ? 1 : 0); } @@ -249,7 +249,7 @@ public class Interpreter { /** * Function DEFinition */ - private void _fdef(int instructionIndex) { + private void _fdef(final int instructionIndex) { functionMap[pop()] = instructionIndex; inFuncDef = true; } @@ -275,7 +275,7 @@ public class Interpreter { */ private void _flippt() { while(gs.loop-- > 0) { - int index = pop(); + final int index = pop(); zone[gs.zp0][index].onCurve = !zone[gs.zp0][index].onCurve; } gs.loop = 1; @@ -285,8 +285,8 @@ public class Interpreter { * FLIP RanGe OFF */ private void _fliprgoff() { - int end = pop(); - int start = pop(); + final int end = pop(); + final int start = pop(); for (int i = start; i <= end; i++) { zone[1][i].onCurve = false; } @@ -296,8 +296,8 @@ public class Interpreter { * FLIP RanGe ON */ private void _fliprgon() { - int end = pop(); - int start = pop(); + final int end = pop(); + final int start = pop(); for (int i = start; i <= end; i++) { zone[1][i].onCurve = true; } @@ -307,7 +307,7 @@ public class Interpreter { * FLOOR */ private void _floor() { - int n = pop(); + final int n = pop(); if (n >= 0) { push(n & 0xffc0); } else { @@ -315,7 +315,7 @@ public class Interpreter { } } - private void _gc(short param) { + private void _gc(final short param) { pop(); push(0); } @@ -345,8 +345,8 @@ public class Interpreter { * Greater Than */ private void _gt() { - int e2 = pop(); - int e1 = pop(); + final int e2 = pop(); + final int e1 = pop(); push((e1 > e2) ? 1 : 0); } @@ -354,8 +354,8 @@ public class Interpreter { * Greater Than or EQual */ private void _gteq() { - int e2 = pop(); - int e1 = pop(); + final int e2 = pop(); + final int e1 = pop(); push((e1 >= e2) ? 1 : 0); } @@ -370,7 +370,7 @@ public class Interpreter { /** * IF test */ - private int _if(int instructionIndex) { + private int _if(final int instructionIndex) { return parser.handleIf(pop() != 0, instructionIndex); } @@ -425,8 +425,8 @@ public class Interpreter { * will be used in glyph instructions. */ private void _instctrl() { - int s = pop(); - int v = pop(); + final int s = pop(); + final int v = pop(); if (s == 1) { gs.instruction_control |= v; } else if (s == 2) { @@ -446,7 +446,7 @@ public class Interpreter { pop(); } - private void _iup(short param) { + private void _iup(final short param) { } /** @@ -460,8 +460,8 @@ public class Interpreter { * Jump Relative On False */ private int _jrof(int instructionIndex) { - boolean test = pop() != 0; - int offset = pop(); + final boolean test = pop() != 0; + final int offset = pop(); if (!test) { instructionIndex += offset - 1; } @@ -472,8 +472,8 @@ public class Interpreter { * Jump Relative On True */ private int _jrot(int instructionIndex) { - boolean test = pop() != 0; - int offset = pop(); + final boolean test = pop() != 0; + final int offset = pop(); if (test) { instructionIndex += offset - 1; } @@ -484,8 +484,8 @@ public class Interpreter { * LOOP and CALL function */ private void _loopcall() { - int index = pop(); - int count = pop(); + final int index = pop(); + final int count = pop(); for (int i = 0; i < count; i++) { execute(functionMap[i]); } @@ -495,8 +495,8 @@ public class Interpreter { * Less Than */ private void _lt() { - int e2 = pop(); - int e1 = pop(); + final int e2 = pop(); + final int e1 = pop(); push((e1 < e2) ? 1 : 0); } @@ -504,8 +504,8 @@ public class Interpreter { * Less Than or EQual */ private void _lteq() { - int e2 = pop(); - int e1 = pop(); + final int e2 = pop(); + final int e1 = pop(); push((e1 <= e2) ? 1 : 0); } @@ -513,26 +513,26 @@ public class Interpreter { * MAXimum of top two stack elements */ private void _max() { - int n1 = pop(); - int n2 = pop(); + final int n1 = pop(); + final int n2 = pop(); push((n1 > n2) ? n1 : n2); } - private void _md(short param) { + private void _md(final short param) { pop(); pop(); push(0); } - private void _mdap(short param) { + private void _mdap(final short param) { pop(); } - private void _mdrp(short param) { + private void _mdrp(final short param) { pop(); } - private void _miap(short param) { + private void _miap(final short param) { pop(); pop(); } @@ -540,8 +540,8 @@ public class Interpreter { * MINimum of top two stack elements */ private void _min() { - int n1 = pop(); - int n2 = pop(); + final int n1 = pop(); + final int n2 = pop(); push((n1 < n2) ? n1 : n2); } @@ -550,15 +550,15 @@ public class Interpreter { */ private void _mindex() { // Move the indexed element to stackIndex, and shift the others down - int k = pop(); - int e = stack[stackIndex - k]; + final int k = pop(); + final int e = stack[stackIndex - k]; for (int i = stackIndex - k; i < stackIndex - 1; i++) { stack[i] = stack[i+1]; } stack[stackIndex - 1] = e; } - private void _mirp(short param) { + private void _mirp(final short param) { pop(); pop(); } @@ -571,7 +571,7 @@ public class Interpreter { push(0); } - private void _msirp(short param) { + private void _msirp(final short param) { pop(); pop(); } @@ -580,8 +580,8 @@ public class Interpreter { * MULtiply */ private void _mul() { - int n1 = pop(); - int n2 = pop(); + final int n1 = pop(); + final int n2 = pop(); push((n1 * n2) >> 6); } @@ -596,8 +596,8 @@ public class Interpreter { * Not EQual */ private void _neq() { - int e2 = pop(); - int e1 = pop(); + final int e2 = pop(); + final int e1 = pop(); push((e1 != e2) ? 1 : 0); } @@ -608,7 +608,7 @@ public class Interpreter { push((pop() != 0) ? 0 : 1); } - private void _nround(short param) { + private void _nround(final short param) { pop(); push(0); } @@ -622,8 +622,8 @@ public class Interpreter { * logical OR */ private void _or() { - int e2 = pop(); - int e1 = pop(); + final int e2 = pop(); + final int e1 = pop(); push(((e1 != 0) || (e2 != 0)) ? 1 : 0); } @@ -633,7 +633,7 @@ public class Interpreter { * PUSH Bytes * PUSH Words */ - private void _push(int[] data) { + private void _push(final int[] data) { for (int j = 0; j < data.length; j++) { push(data[j]); } @@ -664,15 +664,15 @@ public class Interpreter { * ROLL the top three stack elements */ private void _roll() { - int a = pop(); - int b = pop(); - int c = pop(); + final int a = pop(); + final int b = pop(); + final int c = pop(); push(b); push(a); push(c); } - private void _round(short param) { + private void _round(final short param) { pop(); push(0); } @@ -907,7 +907,7 @@ public class Interpreter { /** * Set Dual Projection_Vector To Line */ - private void _sdpvtl(short param) { + private void _sdpvtl(final short param) { pop(); pop(); } @@ -930,7 +930,7 @@ public class Interpreter { /* * Set Freedom_Vector to Coordinate Axis */ - private void _sfvtca(short param) { + private void _sfvtca(final short param) { if (param == 1) { gs.freedom_vector[0] = 0x4000; gs.freedom_vector[1] = 0x0000; @@ -943,7 +943,7 @@ public class Interpreter { /* * Set Freedom_Vector To Line */ - private void _sfvtl(short param) { + private void _sfvtl(final short param) { pop(); pop(); if (param == 1) { @@ -963,7 +963,7 @@ public class Interpreter { gs.freedom_vector[1] = gs.projection_vector[1]; } - private void _shc(short param) { + private void _shc(final short param) { pop(); } @@ -972,7 +972,7 @@ public class Interpreter { * * USES: loop */ - private void _shp(short param) { + private void _shp(final short param) { while(gs.loop-- > 0) { pop(); if(param == 0) { @@ -995,7 +995,7 @@ public class Interpreter { gs.loop = 1; } - private void _shz(short param) { + private void _shz(final short param) { pop(); } @@ -1024,7 +1024,7 @@ public class Interpreter { /* * Set Projection_Vector To Coordinate Axis */ - private void _spvtca(short param) { + private void _spvtca(final short param) { if (param == 1) { gs.projection_vector[0] = 0x4000; gs.projection_vector[1] = 0x0000; @@ -1037,14 +1037,14 @@ public class Interpreter { /** * Set Projection_Vector To Line */ - private void _spvtl(short param) { + private void _spvtl(final short param) { // We'll get a copy of the line and normalize it - // divide the x- and y-coords by the vector's dot product. - Point p1 = zone[gs.zp2][pop()]; - Point p2 = zone[gs.zp1][pop()]; - int x = p2.x - p1.x; - int y = p2.y - p1.y; + final Point p1 = zone[gs.zp2][pop()]; + final Point p2 = zone[gs.zp1][pop()]; + final int x = p2.x - p1.x; + final int y = p2.y - p1.y; if(param == 1) { gs.projection_vector[0] = 0x0000; gs.projection_vector[1] = 0x0000; @@ -1097,15 +1097,15 @@ public class Interpreter { * SUBtract */ private void _sub() { - int n1 = pop(); - int n2 = pop(); + final int n1 = pop(); + final int n2 = pop(); push(n2 - n1); } /** * Set freedom and projection Vectors To Coordinate Axis */ - private void _svtca(short param) { + private void _svtca(final short param) { if (param == 1) { gs.projection_vector[0] = 0x4000; gs.projection_vector[1] = 0x0000; @@ -1123,8 +1123,8 @@ public class Interpreter { * SWAP the top two elements on the stack */ private void _swap() { - int n1 = pop(); - int n2 = pop(); + final int n1 = pop(); + final int n2 = pop(); push(n1); push(n2); } @@ -1165,7 +1165,7 @@ public class Interpreter { * Write Control Value Table in FUnits */ private void _wcvtf() { - int value = pop(); + final int value = pop(); // Conversion of value goes here cvt[pop()] = value; } @@ -1174,7 +1174,7 @@ public class Interpreter { * Write Control Value Table in Pixel units */ private void _wcvtp() { - int value = pop(); + final int value = pop(); // Conversion of value goes here cvt[pop()] = value; } @@ -1188,7 +1188,7 @@ public class Interpreter { public void execute(int ip) { while (ip < ((ip & 0xffff0000) | parser.getISLength(ip >> 16))) { - short opcode = parser.getOpcode(ip); + final short opcode = parser.getOpcode(ip); if (inFuncDef) { // We're within a function definition, so don't execute the code @@ -1332,7 +1332,7 @@ public class Interpreter { return stack[--stackIndex]; } - private void push(int i) { + private void push(final int i) { stack[stackIndex++] = i; } @@ -1351,7 +1351,7 @@ public class Interpreter { } } - public void setParser(Parser p) { + public void setParser(final Parser p) { parser = p; } } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/tt/engine/Parser.java b/src/jogl/classes/jogamp/graph/font/typecast/tt/engine/Parser.java index 1159b2c17..ff1795a28 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/tt/engine/Parser.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/tt/engine/Parser.java @@ -28,7 +28,7 @@ import jogamp.graph.font.typecast.ot.Mnemonic; */ public class Parser { - private short[][] instructions = new short[3][]; + private final short[][] instructions = new short[3][]; /** * Advance the instruction pointer to the next executable opcode. @@ -41,7 +41,7 @@ public class Parser { public int advanceIP(int ip) { // The high word specifies font, cvt, or glyph program - int prog = ip >> 16; + final int prog = ip >> 16; int i = ip & 0xffff; int dataCount; ip++; @@ -63,16 +63,16 @@ public class Parser { return ip; } - public int getISLength(int prog) { + public int getISLength(final int prog) { return instructions[prog].length; } - public short getOpcode(int ip) { + public short getOpcode(final int ip) { return instructions[ip >> 16][ip & 0xffff]; } - public short getPushCount(int ip) { - short instr = instructions[ip >> 16][ip & 0xffff]; + public short getPushCount(final int ip) { + final short instr = instructions[ip >> 16][ip & 0xffff]; if ((Mnemonic.NPUSHB == instr) || (Mnemonic.NPUSHW == instr)) { return instructions[ip >> 16][(ip & 0xffff) + 1]; } else if ((Mnemonic.PUSHB == (instr & 0xf8)) || (Mnemonic.PUSHW == (instr & 0xf8))) { @@ -81,12 +81,12 @@ public class Parser { return 0; } - public int[] getPushData(int ip) { - int count = getPushCount(ip); - int[] data = new int[count]; - int prog = ip >> 16; - int i = ip & 0xffff; - short instr = instructions[prog][i]; + public int[] getPushData(final int ip) { + final int count = getPushCount(ip); + final int[] data = new int[count]; + final int prog = ip >> 16; + final int i = ip & 0xffff; + final short instr = instructions[prog][i]; if (Mnemonic.NPUSHB == instr) { for (int j = 0; j < count; j++) { data[j] = instructions[prog][i + j + 2]; @@ -114,7 +114,7 @@ public class Parser { return ip; } - public int handleIf(boolean test, int ip) { + public int handleIf(final boolean test, int ip) { if (test == false) { // The TrueType spec says that we merely jump to the *next* ELSE or EIF // instruction in the instruction stream. So therefore no nesting! @@ -130,32 +130,32 @@ public class Parser { /** * This program is run everytime we scale the font */ - public void setCvtProgram(short[] program) { + public void setCvtProgram(final short[] program) { instructions[1] = program; } /** * This program is only run once */ - public void setFontProgram(short[] program) { + public void setFontProgram(final short[] program) { instructions[0] = program; } /** * This program is run everytime we scale the glyph */ - public void setGlyphProgram(short[] program) { + public void setGlyphProgram(final short[] program) { instructions[2] = program; } @Override public String toString() { - StringBuilder sb = new StringBuilder(); + final StringBuilder sb = new StringBuilder(); int ip = 0; while (ip < instructions[0].length) { sb.append(Mnemonic.getMnemonic(getOpcode(ip))); if (getPushCount(ip) > 0) { - int[] data = getPushData(ip); + final int[] data = getPushData(ip); for(int j = 0; j < data.length; j++) sb.append(" ").append(data[j]); } @@ -167,7 +167,7 @@ public class Parser { while (ip < (0x10000 | instructions[1].length)) { sb.append(Mnemonic.getMnemonic(getOpcode(ip))); if(getPushCount(ip) > 0) { - int[] data = getPushData(ip); + final int[] data = getPushData(ip); for (int j = 0; j < data.length; j++) { sb.append(" ").append(data[j]); } @@ -180,7 +180,7 @@ public class Parser { while (ip < (0x20000 | instructions[2].length)) { sb.append(Mnemonic.getMnemonic(getOpcode(ip))); if (getPushCount(ip) > 0) { - int[] data = getPushData(ip); + final int[] data = getPushData(ip); for (int j = 0; j < data.length; j++) { sb.append(" ").append(data[j]); } |