aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSven Göthel <[email protected]>2024-02-03 00:31:42 +0100
committerSven Göthel <[email protected]>2024-02-03 02:44:54 +0100
commitfcf10b35daeab6356e389487a37196f14523df71 (patch)
treecf2e39f86f75ee9d976b87bfdcb204156685286e /src
parent6c84171b109fb2de8400e20cab191e5801f3e6c6 (diff)
Cleanup (static, final, whitespace, ..) post Hausmacher Merge
Diffstat (limited to 'src')
-rw-r--r--src/jogl/classes/jogamp/graph/font/typecast/ot/Disassembler.java32
-rw-r--r--src/jogl/classes/jogamp/graph/font/typecast/ot/OTFont.java18
-rw-r--r--src/jogl/classes/jogamp/graph/font/typecast/ot/TTFont.java10
-rw-r--r--src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat2.java78
-rw-r--r--src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfCompositeDescript.java60
-rw-r--r--src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfDescript.java26
-rw-r--r--src/jogl/classes/jogamp/graph/font/typecast/ot/table/HdmxTable.java1
-rw-r--r--src/jogl/classes/jogamp/graph/font/typecast/ot/table/HeadTable.java212
-rw-r--r--src/jogl/classes/jogamp/graph/font/typecast/ot/table/HheaTable.java37
-rw-r--r--src/jogl/classes/jogamp/graph/font/typecast/ot/table/HmtxTable.java58
-rw-r--r--src/jogl/classes/jogamp/graph/font/typecast/ot/table/ID.java12
-rw-r--r--src/jogl/classes/jogamp/graph/font/typecast/ot/table/LocaTable.java44
-rw-r--r--src/jogl/classes/jogamp/graph/font/typecast/ot/table/MaxpTable.java17
-rw-r--r--src/jogl/classes/jogamp/graph/font/typecast/ot/table/NameRecord.java35
-rw-r--r--src/jogl/classes/jogamp/graph/font/typecast/ot/table/NameTable.java2
-rw-r--r--src/jogl/classes/jogamp/graph/font/typecast/ot/table/Table.java82
-rw-r--r--src/jogl/classes/jogamp/graph/font/typecast/ot/table/VdmxTable.java85
-rw-r--r--src/jogl/classes/jogamp/graph/font/typecast/ot/table/VheaTable.java31
-rw-r--r--src/jogl/classes/jogamp/graph/font/typecast/ot/table/VmtxTable.java19
19 files changed, 433 insertions, 426 deletions
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 988c65d21..e9263fa70 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/Disassembler.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/Disassembler.java
@@ -1,9 +1,9 @@
/*****************************************************************************
* Copyright (C) The Apache Software Foundation. All rights reserved. *
- * ------------------------------------------------------------------------- *
- * This software is published under the terms of the Apache Software License *
- * version 1.1, a copy of which has been included with this distribution in *
- * the LICENSE file. *
+ * ------------------------------------------------------------------------- *
+ * This software is published under the terms of the Apache Software License *
+ * version 1.1, a copy of which has been included with this distribution in *
+ * the LICENSE file. *
*****************************************************************************/
package jogamp.graph.font.typecast.ot;
@@ -21,7 +21,7 @@ public class Disassembler {
* @param ip The current instruction pointer
* @return The new instruction pointer
*/
- private static int advanceIP(short[] instructions, int ip) {
+ private static int advanceIP(final short[] instructions, int ip) {
// The high word specifies font, cvt, or glyph program
int i = ip & 0xffff;
@@ -45,8 +45,8 @@ public class Disassembler {
return ip;
}
- private static short getPushCount(short[] instructions, int ip) {
- short instr = instructions[ip & 0xffff];
+ private 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))) {
@@ -55,11 +55,11 @@ public class Disassembler {
return 0;
}
- private 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];
+ private 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];
@@ -80,8 +80,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++) {
@@ -90,8 +90,8 @@ public class Disassembler {
sb.append(Fmt.pad(3, ip)).append(": ");
sb.append(Mnemonic.getMnemonic(instructions[ip]));
if (getPushCount(instructions, ip) > 0) {
- int[] data = getPushData(instructions, ip);
- for (int datum : data) {
+ final int[] data = getPushData(instructions, ip);
+ for (final int datum : data) {
if ((instructions[ip] == Mnemonic.PUSHW) ||
(instructions[ip] == Mnemonic.NPUSHW)) {
sb.append(" ").append((short) datum);
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 fa98ccae7..c380d2fee 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/OTFont.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/OTFont.java
@@ -68,7 +68,7 @@ public abstract class OTFont {
*/
OTFont(final DataInputStream dis, final TableDirectory tableDirectory, final int tablesOrigin) throws IOException {
_tableDirectory = tableDirectory;
-
+
// Load some prerequisite tables
// (These are tables that are referenced by other tables, so we need to load
// them first)
@@ -107,7 +107,7 @@ public abstract class OTFont {
_gsub = null; // FIXME: delete?
}
-
+
/**
* {@link TableDirectory} with all font tables.
*/
@@ -210,14 +210,14 @@ public abstract class OTFont {
public String toString() {
return _head.toString();
}
-
+
/**
* Dumps information of all tables to the given {@link Writer}.
*/
- public void dumpTo(Writer out) throws IOException {
+ public void dumpTo(final Writer out) throws IOException {
out.write(getTableDirectory().toString());
out.write("\n");
-
+
dump(out, getHeadTable());
dump(out, getOS2Table());
dump(out, getCmapTable());
@@ -230,16 +230,16 @@ public abstract class OTFont {
dump(out, getGsubTable());
}
- /**
+ /**
* Writes the toString() representation of the given table to the given {@link Writer}.
*/
- protected static void dump(Writer out, Table table) throws IOException {
+ protected static void dump(final Writer out, final Table table) throws IOException {
if (table != null) {
table.dump(out);
out.write("\n");
out.write("\n");
}
}
-
-
+
+
}
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/TTFont.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/TTFont.java
index 2650ab308..ffd48d744 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/TTFont.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/TTFont.java
@@ -120,8 +120,8 @@ public class TTFont extends OTFont {
// 'loca' is required by 'glyf'
int length = seekTable(tableDirectory, dis, tablesOrigin, Table.loca);
if (length > 0) {
- LocaTable loca = new LocaTable(dis, length, this.getHeadTable(), this.getMaxpTable());
-
+ final LocaTable loca = new LocaTable(dis, length, this.getHeadTable(), this.getMaxpTable());
+
// If this is a TrueType outline, then we'll have at least the
// 'glyf' table (along with the 'loca' table)
length = seekTable(tableDirectory, dis, tablesOrigin, Table.glyf);
@@ -129,7 +129,7 @@ public class TTFont extends OTFont {
} else {
_glyf = null;
}
-
+
length = seekTable(tableDirectory, dis, tablesOrigin, Table.svg);
if (length > 0) {
_svg = new SVGTable(dis);
@@ -169,7 +169,7 @@ public class TTFont extends OTFont {
public GlyfTable getGlyfTable() {
return _glyf;
}
-
+
/**
* Optional {@link SVGTable}.
*/
@@ -210,7 +210,7 @@ public class TTFont extends OTFont {
}
@Override
- public void dumpTo(Writer out) throws IOException {
+ public void dumpTo(final Writer out) throws IOException {
super.dumpTo(out);
dump(out, getGlyfTable());
dump(out, getSvgTable());
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 cd4da47ee..9c256c117 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
@@ -25,28 +25,28 @@ import java.util.Arrays;
/**
* Format 2: High-byte mapping through table.
- *
+ *
* @see "https://docs.microsoft.com/en-us/typography/opentype/spec/cmap#format-2-high-byte-mapping-through-table"
- *
+ *
* @author <a href="mailto:[email protected]">David Schweinsberg</a>
*/
public class CmapFormat2 extends CmapFormat {
- static class SubHeader {
+ private static class SubHeader {
/**
* uint16
- *
+ *
* First valid low byte for this SubHeader.
- *
+ *
* @see #_entryCount
*/
int _firstCode;
-
+
/**
* uint16
- *
+ *
* Number of valid low bytes for this SubHeader.
- *
+ *
* <p>
* The {@link #_firstCode} and {@link #_entryCount} values specify a
* subrange that begins at {@link #_firstCode} and has a length equal to
@@ -69,7 +69,7 @@ public class CmapFormat2 extends CmapFormat {
* </p>
*/
int _entryCount;
-
+
/**
* @see #_entryCount
*/
@@ -82,47 +82,47 @@ public class CmapFormat2 extends CmapFormat {
int _arrayIndex;
}
-
+
/**
* uint16
- *
+ *
* @see #getLength()
*/
private final int _length;
/**
* uint16
- *
+ *
* @see #getLanguage()
*/
private final int _language;
-
+
/**
* uint16[256]
- *
+ *
* Array that maps high bytes to subHeaders: value is subHeader index × 8.
*/
private final int[] _subHeaderKeys = new int[256];
-
+
/**
* Variable-length array of SubHeader records.
*/
private final SubHeader[] _subHeaders;
-
+
/**
* uint16
- *
+ *
* Variable-length array containing subarrays used for mapping the low byte
* of 2-byte characters.
*/
private final int[] _glyphIndexArray;
- CmapFormat2(DataInput di) throws IOException {
+ CmapFormat2(final DataInput di) throws IOException {
_length = di.readUnsignedShort();
_language = di.readUnsignedShort();
-
+
int pos = 6;
-
+
// Read the subheader keys, noting the highest value, as this will
// determine the number of subheaders to read.
int highest = 0;
@@ -131,31 +131,31 @@ 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();
sh._idRangeOffset = di.readUnsignedShort();
-
+
// Calculate the offset into the _glyphIndexArray
pos += 8;
sh._arrayIndex =
(pos - 2 + sh._idRangeOffset - indexArrayOffset) / 2;
-
+
// What is the highest range within the glyphIndexArray?
highest = Math.max(highest, sh._arrayIndex + sh._entryCount);
-
+
_subHeaders[i] = sh;
}
-
+
// Read the glyphIndexArray
_glyphIndexArray = new int[highest];
for (int i = 0; i < _glyphIndexArray.length; ++i) {
@@ -182,13 +182,13 @@ public class CmapFormat2 extends CmapFormat {
public int getRangeCount() {
return _subHeaders.length;
}
-
+
@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();
}
-
+
// Find the high-byte (if any)
int highByte = 0;
if (index != 0) {
@@ -199,7 +199,7 @@ public class CmapFormat2 extends CmapFormat {
}
}
}
-
+
return new Range(
highByte | _subHeaders[index]._firstCode,
highByte | (_subHeaders[index]._firstCode +
@@ -207,23 +207,23 @@ 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;
}
-
+
// Now calculate the glyph index
int glyphIndex =
_glyphIndexArray[sh._arrayIndex + (lowByte - sh._firstCode)];
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 9c1e81b4e..0979c6c8f 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
@@ -52,7 +52,6 @@ package jogamp.graph.font.typecast.ot.table;
import java.io.DataInput;
import java.io.IOException;
-
import java.util.ArrayList;
import java.util.List;
@@ -72,7 +71,7 @@ public class GlyfCompositeDescript extends GlyfDescript {
/**
* Creates a {@link GlyfCompositeDescript} from the given reader.
- *
+ *
* <p>
* A composite glyph starts with two uint16 values (“flags” and
* “glyphIndex,” i.e. the index of the first contour in this composite
@@ -91,13 +90,13 @@ public class GlyfCompositeDescript extends GlyfDescript {
// Get all of the composite components
GlyfCompositeComp comp;
- int index = 0;
+ int firstIndex = 0;
int firstContour = 0;
do {
- _components.add(comp = new GlyfCompositeComp(index, firstContour, di));
- GlyfDescript desc = parentTable.getDescription(comp.getGlyphIndex());
+ _components.add(comp = new GlyfCompositeComp(firstIndex, firstContour, di));
+ final GlyfDescript desc = parentTable.getDescription(comp.getGlyphIndex());
if (desc != null) {
- index += desc.getPointCount();
+ firstIndex += desc.getPointCount();
firstContour += desc.getContourCount();
}
} while ((comp.getFlags() & GlyfCompositeComp.MORE_COMPONENTS) != 0);
@@ -109,8 +108,8 @@ public class GlyfCompositeDescript extends GlyfDescript {
}
@Override
- public int getEndPtOfContours(int contour) {
- GlyfCompositeComp c = getCompositeCompEndPt(contour);
+ public int getEndPtOfContours(final int contour) {
+ final GlyfCompositeComp c = getCompositeCompEndPt(contour);
if (c != null) {
final GlyphDescription gd = getReferencedGlyph(c);
return gd.getEndPtOfContours(contour - c.getFirstContour()) + c.getFirstIndex();
@@ -141,17 +140,18 @@ public class GlyfCompositeDescript extends GlyfDescript {
return 0;
}
- private GlyfDescript getReferencedGlyph(GlyfCompositeComp c) {
+ private GlyfDescript getReferencedGlyph(final GlyfCompositeComp c) {
return c.getReferencedGlyph(_parentTable);
}
- public short getYCoordinate(int i) {
- GlyfCompositeComp c = getCompositeComp(i);
+ @Override
+ public short getYCoordinate(final int i) {
+ final GlyfCompositeComp c = getCompositeComp(i);
if (c != null) {
- GlyphDescription gd = getReferencedGlyph(c);
- int n = i - c.getFirstIndex();
- int x = gd.getXCoordinate(n);
- int y = gd.getYCoordinate(n);
+ final GlyphDescription gd = getReferencedGlyph(c);
+ final int n = i - c.getFirstIndex();
+ final int x = gd.getXCoordinate(n);
+ final int y = gd.getYCoordinate(n);
return c.transformY(x, y);
}
return 0;
@@ -164,8 +164,8 @@ public class GlyfCompositeDescript extends GlyfDescript {
@Override
public int getPointCount() {
- GlyfCompositeComp last = lastComponent();
- GlyphDescription gd = getReferencedGlyph(last);
+ final GlyfCompositeComp last = lastComponent();
+ final GlyphDescription gd = getReferencedGlyph(last);
if (gd != null) {
return last.getFirstIndex() + gd.getPointCount();
} else {
@@ -175,7 +175,7 @@ public class GlyfCompositeDescript extends GlyfDescript {
@Override
public int getContourCount() {
- GlyfCompositeComp last = lastComponent();
+ final GlyfCompositeComp last = lastComponent();
return last.getFirstContour() + getReferencedGlyph(last).getContourCount();
}
@@ -189,7 +189,7 @@ public class GlyfCompositeDescript extends GlyfDescript {
/**
* The number of {@link GlyfCompositeComp} in this {@link GlyfCompositeDescript}.
- *
+ *
* @see #getComponent(int)
*/
public int getComponentCount() {
@@ -198,18 +198,18 @@ public class GlyfCompositeDescript extends GlyfDescript {
/**
* The {@link GlyfCompositeComp} with the given index.
- *
+ *
* @see #getComponentCount()
*/
- public GlyfCompositeComp getComponent(int i) {
+ public GlyfCompositeComp getComponent(final int i) {
return _components.get(i);
}
- private GlyfCompositeComp getCompositeComp(int i) {
+ private GlyfCompositeComp getCompositeComp(final int i) {
GlyfCompositeComp c;
- for (GlyfCompositeComp component : _components) {
+ for (final GlyfCompositeComp component : _components) {
c = component;
- GlyphDescription gd = getReferencedGlyph(c);
+ final GlyphDescription gd = getReferencedGlyph(c);
if (c.getFirstIndex() <= i && i < (c.getFirstIndex() + gd.getPointCount())) {
return c;
}
@@ -217,26 +217,26 @@ public class GlyfCompositeDescript extends GlyfDescript {
return null;
}
- private GlyfCompositeComp getCompositeCompEndPt(int i) {
+ private GlyfCompositeComp getCompositeCompEndPt(final int i) {
GlyfCompositeComp c;
- for (GlyfCompositeComp component : _components) {
+ for (final GlyfCompositeComp component : _components) {
c = component;
- GlyphDescription gd = getReferencedGlyph(c);
+ final GlyphDescription gd = getReferencedGlyph(c);
if (c.getFirstContour() <= i && i < (c.getFirstContour() + gd.getContourCount())) {
return c;
}
}
return null;
}
-
+
@Override
public String toString() {
- StringBuilder sb = new StringBuilder();
+ final StringBuilder sb = new StringBuilder();
sb.append(" Composite Glyph\n");
sb.append(" ---------------\n");
sb.append(super.toString());
sb.append("\n\n");
- for (GlyfCompositeComp component : _components) {
+ for (final GlyfCompositeComp component : _components) {
sb.append(" Component\n");
sb.append(" ---------\n");
sb.append(component.toString());
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 317c48d2c..c19252d40 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
@@ -55,7 +55,7 @@ import java.io.IOException;
/**
* Glyph description.
- *
+ *
* <p>
* Note: The glyph descriptions do not include side bearing information.
* {@link HmtxTable#getLeftSideBearing(int) Left side bearings} are provided in
@@ -72,9 +72,9 @@ import java.io.IOException;
* by glyph instructions. See the chapter Instructing TrueType Glyphs for more
* background on phantom points.
* </p>
- *
+ *
* @author <a href="mailto:[email protected]">David Schweinsberg</a>
- *
+ *
* @see "https://docs.microsoft.com/en-us/typography/opentype/spec/glyf"
*/
public abstract class GlyfDescript extends Program implements GlyphDescription {
@@ -83,21 +83,21 @@ public abstract class GlyfDescript extends Program implements GlyphDescription {
* Bit 0: If set, the point is on the curve; otherwise, it is off the curve.
*/
public static final byte ON_CURVE_POINT = 0x01;
-
+
/**
* Bit 1: If set, the corresponding x-coordinate is 1 byte long. If not set,
* it is two bytes long. For the sign of this value, see the description of
* the {@link #X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR} flag.
*/
public static final byte X_SHORT_VECTOR = 0x02;
-
+
/**
* Bit 2: If set, the corresponding y-coordinate is 1 byte long. If not set,
* it is two bytes long. For the sign of this value, see the description of
* the {@link #Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR} flag.
*/
public static final byte Y_SHORT_VECTOR = 0x04;
-
+
/**
* Bit 3: If set, the next byte (read as unsigned) specifies the number of
* additional times this flag byte is to be repeated in the logical flags
@@ -107,7 +107,7 @@ public abstract class GlyfDescript extends Program implements GlyphDescription {
* points in the glyph description.
*/
public static final byte REPEAT_FLAG = 0x08;
-
+
/**
* Bit 4: This flag has two meanings, depending on how the
* {@link #X_SHORT_VECTOR} flag is set. If {@link #X_SHORT_VECTOR} is set,
@@ -118,7 +118,7 @@ public abstract class GlyfDescript extends Program implements GlyphDescription {
* current x-coordinate is a signed 16-bit delta vector.
*/
public static final byte X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR = 0x10;
-
+
/**
* Bit 5: This flag has two meanings, depending on how the
* {@link #Y_SHORT_VECTOR} flag is set. If {@link #Y_SHORT_VECTOR} is set,
@@ -129,7 +129,7 @@ public abstract class GlyfDescript extends Program implements GlyphDescription {
* current y-coordinate is a signed 16-bit delta vector.
*/
public static final byte Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR = 0x20;
-
+
/**
* Bit 6: If set, contours in the glyph description may overlap. Use of this
* flag is not required in OpenType — that is, it is valid to have contours
@@ -138,7 +138,7 @@ public abstract class GlyfDescript extends Program implements GlyphDescription {
* Apple’s specification for details regarding behavior in Apple platforms.)
* When used, it must be set on the first flag byte for the glyph. See
* additional details below.
- *
+ *
* <p>
* A non-zero-fill algorithm is needed to avoid dropouts when contours
* overlap. The {@link #OVERLAP_SIMPLE} flag is used by some rasterizer
@@ -150,7 +150,7 @@ public abstract class GlyfDescript extends Program implements GlyphDescription {
* can be used in order to provide broad interoperability of fonts —
* particularly non-variable fonts — when glyphs have overlapping contours.
* </p>
- *
+ *
* <p>
* Note that variable fonts often make use of overlapping contours. This has
* implications for tools that generate static-font data for a specific
@@ -160,7 +160,7 @@ public abstract class GlyfDescript extends Program implements GlyphDescription {
* data, or else should merge contours to remove overlap of separate
* contours.
* </p>
- *
+ *
* <p>
* Note: The OVERLAP_COMPOUND flag, described below, has a similar purpose
* in relation to composite glyphs. The same considerations described for
@@ -190,7 +190,7 @@ public abstract class GlyfDescript extends Program implements GlyphDescription {
_xMax = di.readShort();
_yMax = di.readShort();
}
-
+
/**
* The {@link GlyfTable} this {@link GlyfDescript} belongs to.
*/
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 6663bb12d..36bcc887a 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
@@ -92,6 +92,7 @@ public class HdmxTable implements Table {
return hdmx;
}
+ @Override
public String toString() {
final StringBuilder sb = new StringBuilder();
sb.append("'hdmx' Table - Horizontal Device Metrics\n----------------------------------------\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 4398a6cbe..a6705f8ae 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
@@ -59,24 +59,24 @@ import jogamp.graph.font.typecast.ot.LongDateTime;
/**
* Font Header Table
- *
+ *
* This table gives global information about the font. The bounding box values
* ({@link #getXMin()}, {@link #getXMax()}, {@link #getYMin()},
* {@link #getYMax()}) should be computed using only glyphs that have contours.
* Glyphs with no contours should be ignored for the purposes of these
* calculations.
- *
+ *
* @see "https://docs.microsoft.com/en-us/typography/opentype/spec/head"
- *
+ *
* @author <a href="mailto:[email protected]">David Schweinsberg</a>
*/
public class HeadTable implements Table {
-
+
/**
* @see #getMagicNumber()
*/
public static final int MAGIC = 0x5F0F3CF5;
-
+
/**
* @see #getMajorVersion()
*/
@@ -86,7 +86,7 @@ public class HeadTable implements Table {
* @see #getMinorVersion()
*/
public static final int MINOR_VERSION = 0;
-
+
/**
* @see #getGlyphDataFormat()
*/
@@ -97,7 +97,7 @@ public class HeadTable implements Table {
* @see #getFontDirectionHint()
*/
public static final short FONT_DIRECTION_MIXED = 0;
-
+
/**
* 1: Only strongly left to right;
* @see #getFontDirectionHint()
@@ -115,98 +115,98 @@ public class HeadTable implements Table {
* @see #getFontDirectionHint()
*/
public static final short FONT_DIRECTION_RIGHT_TO_LEFT = -1;
-
+
/**
* -2: Like -1 but also contains neutrals.
* @see #getFontDirectionHint()
*/
public static final short FONT_DIRECTION_RIGHT_TO_LEFT_AND_NEUTRAL = -2;
-
+
/**
* @see #getMajorVersion()
*/
private int _majorVersion = MAJOR_VERSION;
-
+
/**
* @see #getMinorVersion()
*/
private int _minorVersion = MINOR_VERSION;
-
+
/**
* @see #getFontRevision()
*/
- private int _fontRevision;
-
+ private final int _fontRevision;
+
/**
* @see #getCheckSumAdjustment()
*/
- private int _checkSumAdjustment;
-
+ private final int _checkSumAdjustment;
+
/**
* @see #getMagicNumber()
*/
private int _magicNumber = MAGIC;
-
+
/**
* @see #getFlags()
*/
- private int _flags;
-
+ private final int _flags;
+
/**
* @see #getUnitsPerEm()
*/
- private int _unitsPerEm;
-
+ private final int _unitsPerEm;
+
/**
* @see #getCreated()
*/
- private long _created;
-
+ private final long _created;
+
/**
* @see #getModified()
*/
- private long _modified;
-
+ private final long _modified;
+
/**
* @see #getXMin()
*/
- private short _xMin;
-
+ private final short _xMin;
+
/**
* @see #getYMin()
*/
- private short _yMin;
-
+ private final short _yMin;
+
/**
* @see #getXMax()
*/
- private short _xMax;
-
+ private final short _xMax;
+
/**
* @see #getYMax()
*/
- private short _yMax;
-
+ private final short _yMax;
+
/**
* @see #getMacStyle()
*/
- private short _macStyle;
-
+ private final short _macStyle;
+
/**
* @see #getLowestRecPPEM()
*/
- private short _lowestRecPPEM;
-
+ private final short _lowestRecPPEM;
+
/**
* @see #getFontDirectionHint()
*/
private short _fontDirectionHint = FONT_DIRECTION_LEFT_TO_RIGHT_AND_NEUTRAL;
-
+
/**
* @see #getIndexToLocFormat()
*/
- private short _indexToLocFormat;
-
+ private final short _indexToLocFormat;
+
/**
* @see #getGlyphDataFormat()
*/
@@ -215,7 +215,7 @@ public class HeadTable implements Table {
/**
* Creates a {@link HeadTable} from binary encoding.
*/
- public HeadTable(DataInput di) throws IOException {
+ public HeadTable(final DataInput di) throws IOException {
_majorVersion = di.readUnsignedShort();
_minorVersion = di.readUnsignedShort();
_fontRevision = di.readInt();
@@ -240,14 +240,14 @@ public class HeadTable implements Table {
public int getType() {
return head;
}
-
+
/**
* uint16 majorVersion Major version number of the font header table — set to {@link #MAJOR_VERSION}.
*/
public int getMajorVersion() {
return _majorVersion;
}
-
+
/**
* uint16 minorVersion Minor version number of the font header table — set to {@link #MINOR_VERSION}.
*/
@@ -261,10 +261,10 @@ public class HeadTable implements Table {
public int getVersionNumber() {
return _majorVersion << 16 | _minorVersion;
}
-
+
/**
* Printable version number.
- *
+ *
* @see #getMajorVersion()
* @see #getMinorVersion()
*/
@@ -274,7 +274,7 @@ public class HeadTable implements Table {
/**
* Fixed Set by font manufacturer.
- *
+ *
* <p>
* For historical reasons, the fontRevision value contained in this table is
* not used by Windows to determine the version of a font. Instead, Windows
@@ -287,10 +287,10 @@ public class HeadTable implements Table {
/**
* uint32
- *
+ *
* To compute: set it to 0, sum the entire font as uint32, then store
* 0xB1B0AFBA - sum.
- *
+ *
* If the font is used as a component in a font collection file, the value
* of this field will be invalidated by changes to the file structure and
* font table directory, and must be ignored.
@@ -298,7 +298,7 @@ public class HeadTable implements Table {
public int getCheckSumAdjustment() {
return _checkSumAdjustment;
}
-
+
/**
* uint32 Set to {@link #MAGIC}.
*/
@@ -308,29 +308,29 @@ public class HeadTable implements Table {
/**
* uint16
- *
+ *
* Bit 0: Baseline for font at y=0;
- *
+ *
* Bit 1: Left sidebearing point at x=0 (relevant only for TrueType
* rasterizers) — see {@link #isLeftSidebearingNormalized()};
- *
+ *
* Bit 2: Instructions may depend on point size;
- *
+ *
* Bit 3: Force ppem to integer values for all internal scaler math; may use
* fractional ppem sizes if this bit is clear;
- *
+ *
* Bit 4: Instructions may alter advance width (the advance widths might not
* scale linearly);
- *
+ *
* Bit 5: This bit is not used in OpenType, and should not be set in order
* to ensure compatible behavior on all platforms. If set, it may result in
* different behavior for vertical layout in some platforms. (See Apple’s
* specification for details regarding behavior in Apple platforms.)
- *
+ *
* Bits 6–10: These bits are not used in Opentype and should always be
* cleared. (See Apple’s specification for details regarding legacy used in
* Apple platforms.)
- *
+ *
* Bit 11: Font data is “lossless” as a result of having been subjected to
* optimizing transformation and/or compression (such as e.g. compression
* mechanisms defined by ISO/IEC 14496-18, MicroType Express, WOFF 2.0 or
@@ -338,25 +338,25 @@ public class HeadTable implements Table {
* but the binary compatibility between input and output font files is not
* guaranteed. As a result of the applied transform, the DSIG table may also
* be invalidated.
- *
+ *
* Bit 12: Font converted (produce compatible metrics)
- *
+ *
* Bit 13: Font optimized for ClearType™. Note, fonts that rely on embedded
* bitmaps (EBDT) for rendering should not be considered optimized for
* ClearType, and therefore should keep this bit cleared.
- *
+ *
* Bit 14: Last Resort font. If set, indicates that the glyphs encoded in
* the 'cmap' subtables are simply generic symbolic representations of code
* point ranges and don’t truly represent support for those code points. If
* unset, indicates that the glyphs encoded in the 'cmap' subtables
* represent proper support for those code points.
- *
+ *
* Bit 15: Reserved, set to 0
- *
+ *
* Note that, in a variable font with TrueType outlines, the left side
* bearing for each glyph must equal {@link #_xMin}, and bit 1 in the flags
- * field must be set.
- *
+ * field must be set.
+ *
* Also, bit 5 must be cleared in all variable fonts. For
* general information on OpenType Font Variations, see the chapter,
* OpenType Font Variations Overview.
@@ -364,11 +364,11 @@ public class HeadTable implements Table {
public int getFlags() {
return _flags;
}
-
+
/**
* The Left sidebearing point is at x=0 for all glyphs (relevant only for
* TrueType rasterizers)
- *
+ *
* <p>
* Note: The scaler will perform better if the glyph coordinates have been
* created such that the xMin is equal to the lsb. For example, if the lsb
@@ -383,7 +383,7 @@ public class HeadTable implements Table {
/**
* uint16
- *
+ *
* Set to a value from 16 to 16384. Any value in this range is valid. In
* fonts that have TrueType outlines, a power of 2 is recommended as this
* allows performance optimizations in some rasterizers.
@@ -394,7 +394,7 @@ public class HeadTable implements Table {
/**
* LONGDATETIME
- *
+ *
* Number of seconds since 12:00 midnight that started January 1st 1904 in
* GMT/UTC time zone. 64-bit integer
*/
@@ -404,7 +404,7 @@ public class HeadTable implements Table {
/**
* LONGDATETIME
- *
+ *
* Number of seconds since 12:00 midnight that started January 1st 1904 in
* GMT/UTC time zone. 64-bit integer
*/
@@ -413,8 +413,8 @@ public class HeadTable implements Table {
}
/**
- * int16
- *
+ * int16
+ *
* For all glyph bounding boxes.
*/
public short getXMin() {
@@ -422,8 +422,8 @@ public class HeadTable implements Table {
}
/**
- * int16
- *
+ * int16
+ *
* For all glyph bounding boxes.
*/
public short getYMin() {
@@ -431,8 +431,8 @@ public class HeadTable implements Table {
}
/**
- * int16
- *
+ * int16
+ *
* For all glyph bounding boxes.
*/
public short getXMax() {
@@ -440,8 +440,8 @@ public class HeadTable implements Table {
}
/**
- * int16
- *
+ * int16
+ *
* For all glyph bounding boxes.
*/
public short getYMax() {
@@ -450,25 +450,25 @@ public class HeadTable implements Table {
/**
* uint16
- *
+ *
* Contains information concerning the nature of the font patterns.
- *
+ *
* Bit 0: Bold (if set to 1);
- *
+ *
* Bit 1: Italic (if set to 1)
- *
+ *
* Bit 2: Underline (if set to 1)
- *
+ *
* Bit 3: Outline (if set to 1)
- *
+ *
* Bit 4: Shadow (if set to 1)
- *
+ *
* Bit 5: Condensed (if set to 1)
- *
+ *
* Bit 6: Extended (if set to 1)
- *
+ *
* Bits 7–15: Reserved (set to 0).
- *
+ *
* Note that the macStyle bits must agree with the OS/2 table
* {@link Os2Table#getSelection() fsSelection} bits. The fsSelection bits
* are used over the macStyle bits in Microsoft Windows. The PANOSE values
@@ -477,10 +477,10 @@ public class HeadTable implements Table {
public short getMacStyle() {
return _macStyle;
}
-
+
/**
* Whether the glyphs are emboldened.
- *
+ *
* @see #getMacStyle()
*/
public boolean isMacBold() {
@@ -489,59 +489,59 @@ public class HeadTable implements Table {
/**
* Font contains italic or oblique glyphs, otherwise they are upright.
- *
+ *
* @see #getMacStyle()
*/
public boolean isMacItalic() {
return Bits.bit(_macStyle, 1);
}
-
+
/**
* Glyphs are underscored.
- *
+ *
* @see #getMacStyle()
*/
public boolean isMacUnderline() {
return Bits.bit(_macStyle, 2);
}
-
+
/**
* Outline (hollow) glyphs, otherwise they are solid.
- *
+ *
* @see #getMacStyle()
*/
public boolean isMacOutline() {
return Bits.bit(_macStyle, 3);
}
-
+
/**
* Whether the font has shadow.
- *
+ *
* @see #getMacStyle()
*/
public boolean isMacShadow() {
return Bits.bit(_macStyle, 4);
}
-
+
/**
* Whether the font is condensed.
- *
+ *
* @see #getMacStyle()
*/
public boolean isMacCondensed() {
return Bits.bit(_macStyle, 5);
}
-
+
/**
* @see #getMacStyle()
*/
public boolean isMacExtended() {
return Bits.bit(_macStyle, 6);
}
-
+
/**
- * uint16
- *
+ * uint16
+ *
* Smallest readable size in pixels.
*/
public short getLowestRecPPEM() {
@@ -550,9 +550,9 @@ public class HeadTable implements Table {
/**
* int16
- *
+ *
* Deprecated (Set to {@link #FONT_DIRECTION_LEFT_TO_RIGHT_AND_NEUTRAL}).
- *
+ *
* (A neutral character has no inherent directionality; it is not a
* character with zero (0) width. Spaces and punctuation are examples of
* neutral characters. Non-neutral characters are those with inherent
@@ -560,7 +560,7 @@ public class HeadTable implements Table {
* letters (right-to-left) have directionality. In a “normal” Roman font
* where spaces and punctuation are present, the font direction hints should
* be set to two (2).)
- *
+ *
* @see #FONT_DIRECTION_MIXED
* @see #FONT_DIRECTION_LEFT_TO_RIGHT
* @see #FONT_DIRECTION_LEFT_TO_RIGHT_AND_NEUTRAL
@@ -573,7 +573,7 @@ public class HeadTable implements Table {
/**
* int16
- *
+ *
* 0 for short offsets (Offset16), 1 for long (Offset32).
*/
public short getIndexToLocFormat() {
@@ -589,7 +589,7 @@ public class HeadTable implements Table {
/**
* int16
- *
+ *
* {@link #GLYPH_DATA_FORMAT} for current format.
*/
public short getGlyphDataFormat() {
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 97f201104..8afad74bc 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
@@ -1,9 +1,9 @@
/*****************************************************************************
* Copyright (C) The Apache Software Foundation. All rights reserved. *
- * ------------------------------------------------------------------------- *
- * This software is published under the terms of the Apache Software License *
- * version 1.1, a copy of which has been included with this distribution in *
- * the LICENSE file. *
+ * ------------------------------------------------------------------------- *
+ * This software is published under the terms of the Apache Software License *
+ * version 1.1, a copy of which has been included with this distribution in *
+ * the LICENSE file. *
*****************************************************************************/
package jogamp.graph.font.typecast.ot.table;
@@ -17,20 +17,20 @@ import jogamp.graph.font.typecast.ot.Fixed;
*/
public class HheaTable implements Table {
- 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;
-
- public HheaTable(DataInput di) throws IOException {
+ 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;
+
+ public HheaTable(final DataInput di) throws IOException {
version = di.readInt();
ascender = di.readShort();
descender = di.readShort();
@@ -97,6 +97,7 @@ public class HheaTable implements Table {
return xMaxExtent;
}
+ @Override
public String toString() {
return "'hhea' Table - Horizontal Header\n--------------------------------" +
"\n 'hhea' version: " + Fixed.floatValue(version) +
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 86bc29215..a546c5c1d 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
@@ -57,7 +57,7 @@ import jogamp.graph.font.typecast.ot.Fmt;
/**
* Horizontal Metrics Table
- *
+ *
* <p>
* Glyph metrics used for horizontal text layout include glyph advance widths,
* side bearings and X-direction min and max values (xMin, xMax). These are
@@ -65,7 +65,7 @@ import jogamp.graph.font.typecast.ot.Fmt;
* CFF2) and the horizontal metrics table. The horizontal metrics ('hmtx') table
* provides glyph advance widths and left side bearings.
* </p>
- *
+ *
* <p>
* In a font with TrueType outline data, the 'glyf' table provides xMin and xMax
* values, but not advance widths or side bearings. The advance width is always
@@ -78,7 +78,7 @@ import jogamp.graph.font.typecast.ot.Fmt;
* side bearing values from the 'hmtx' table, plus bounding-box information in
* the glyph description — see below for more details.
* </p>
- *
+ *
* <p>
* In a variable font with TrueType outline data, the left side bearing value in
* the 'hmtx' table must always be equal to xMin (bit 1 of the 'head'
@@ -90,7 +90,7 @@ import jogamp.graph.font.typecast.ot.Fmt;
* for additional details), or by applying variation data in the HVAR table to
* default-instance values from the 'glyf' or 'hmtx' table.
* </p>
- *
+ *
* <p>
* In a font with CFF version 1 outline data, the 'CFF ' table does include
* advance widths. These values are used by PostScript processors, but are not
@@ -108,7 +108,7 @@ import jogamp.graph.font.typecast.ot.Fmt;
* left side bearing and advance width values for non-default instances should
* be obtained by combining information from the 'hmtx' and HVAR tables.
* </p>
- *
+ *
* <p>
* The table uses a longHorMetric record to give the advance width and left side
* bearing of a glyph. Records are indexed by glyph ID. As an optimization, the
@@ -119,23 +119,23 @@ import jogamp.graph.font.typecast.ot.Fmt;
* appropriately). The number of longHorMetric records is determined by the
* numberOfHMetrics field in the 'hhea' table.
* </p>
- *
+ *
* <p>
* If the longHorMetric array is less than the total number of glyphs, then that
* array is followed by an array for the left side bearing values of the
* remaining glyphs. The number of elements in the left side bearing will be
* derived from numberOfHMetrics plus the numGlyphs field in the 'maxp' table.
* </p>
- *
+ *
* @see "https://docs.microsoft.com/en-us/typography/opentype/spec/hmtx"
- *
+ *
* @author <a href="mailto:[email protected]">David Schweinsberg</a>
*/
public class HmtxTable implements Table {
- private int[] _hMetrics;
- private short[] _leftSideBearing;
- private int _length;
+ private final int[] _hMetrics;
+ private final short[] _leftSideBearing;
+ private final int _length;
/**
* Creates a {@link HmtxTable}.
@@ -150,11 +150,11 @@ public class HmtxTable implements Table {
* The corresponding {@link MaxpTable}.
*/
public HmtxTable(
- DataInput di,
- int length,
- HheaTable hhea,
- MaxpTable maxp) throws IOException {
-
+ final DataInput di,
+ final int length,
+ final HheaTable hhea,
+ final MaxpTable maxp) throws IOException {
+
// Paired advance width and left side bearing values for each glyph.
// Records are indexed by glyph ID.
_hMetrics = new int[hhea.getNumberOfHMetrics()];
@@ -165,10 +165,10 @@ public class HmtxTable implements Table {
| di.readUnsignedByte()<<8
| di.readUnsignedByte();
}
-
+
// Left side bearings for glyph IDs greater than or equal to
// numberOfHMetrics.
- 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();
@@ -183,9 +183,9 @@ public class HmtxTable implements Table {
/**
* uint16
- *
+ *
* Advance width, in font design units.
- *
+ *
* <p>
* The baseline is an imaginary line that is used to ‘guide’ glyphs when
* rendering text. It can be horizontal (e.g., Latin, Cyrillic, Arabic) or
@@ -193,20 +193,20 @@ public class HmtxTable implements Table {
* a virtual point, located on the baseline, called the pen position or
* origin, is used to locate glyphs.
* </p>
- *
+ *
* <p>
* The distance between two successive pen positions is glyph-specific and
* is called the advance width. Note that its value is always positive, even
* for right-to-left oriented scripts like Arabic. This introduces some
* differences in the way text is rendered.
* </p>
- *
+ *
* @param i
* The glyph index, see {@link GlyfTable#getNumGlyphs()}.
- *
+ *
* @see "https://www.freetype.org/freetype2/docs/glyphs/glyphs-3.html"
*/
- public int getAdvanceWidth(int i) {
+ public int getAdvanceWidth(final int i) {
if (_hMetrics == null) {
return 0;
}
@@ -219,9 +219,9 @@ public class HmtxTable implements Table {
/**
* int16
- *
+ *
* Glyph left side bearing, in font design units.
- *
+ *
* <p>
* The horizontal distance from the current pen position to the glyph's left
* bbox edge. It is positive for horizontal layouts, and in most cases
@@ -230,10 +230,10 @@ public class HmtxTable implements Table {
*
* @param i
* The glyph index, see {@link GlyfTable#getNumGlyphs()}.
- *
+ *
* @see "https://www.freetype.org/freetype2/docs/glyphs/glyphs-3.html"
*/
- public short getLeftSideBearing(int i) {
+ public short getLeftSideBearing(final int i) {
if (_hMetrics == null) {
return 0;
}
@@ -246,7 +246,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");
sb.append("---------------------------------\n");
sb.append(" Size: ").append(_length).append(" bytes\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 e3aa6523c..4fc189ae4 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
@@ -38,7 +38,7 @@ public abstract class ID {
private static final short encodingUnicode20Semantics = 4;
private static final short encodingUnicodeVariationSequences = 5;
private static final short encodingFullUnicodeCoverage = 6;
-
+
// Microsoft Encoding IDs
// public static final short encodingUndefined = 0;
// public static final short encodingUGL = 1;
@@ -190,7 +190,7 @@ public abstract class ID {
private static final short nameSampleText = 19;
private 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,10 +200,10 @@ 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) {
-
+
// Unicode specific encodings
switch (encodingId) {
case encodingUnicode10Semantics: return "Unicode 1.0 semantics";
@@ -287,7 +287,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) {
@@ -374,7 +374,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/LocaTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LocaTable.java
index 3a1dcd037..883f6963f 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
@@ -1,9 +1,9 @@
/*****************************************************************************
* Copyright (C) The Apache Software Foundation. All rights reserved. *
- * ------------------------------------------------------------------------- *
- * This software is published under the terms of the Apache Software License *
- * version 1.1, a copy of which has been included with this distribution in *
- * the LICENSE file. *
+ * ------------------------------------------------------------------------- *
+ * This software is published under the terms of the Apache Software License *
+ * version 1.1, a copy of which has been included with this distribution in *
+ * the LICENSE file. *
*****************************************************************************/
package jogamp.graph.font.typecast.ot.table;
@@ -13,14 +13,14 @@ import java.io.IOException;
/**
* Index to Location table
- *
+ *
* <p>
* The indexToLoc table stores the offsets to the locations of the glyphs in the
* font, relative to the beginning of the glyphData table. In order to compute
* the length of the last glyph element, there is an extra entry after the last
* valid index.
* </p>
- *
+ *
* <p>
* By definition, index zero points to the “missing character”, which is the
* character that appears if a character is not found in the font. The missing
@@ -32,31 +32,31 @@ import java.io.IOException;
* loca[n] will be equal the length of the glyph data ('glyf') table. The
* offsets must be in ascending order with loca[n] <= loca[n+1].
* </p>
- *
+ *
* <p>
* Most routines will look at the 'maxp' table to determine the number of glyphs
* in the font, but the value in the 'loca' table must agree.
* </p>
- *
+ *
* <p>
* There are two versions of this table: a short version, and a long version.
* The version is specified in the indexToLocFormat entry in the 'head' table.
* </p>
- *
+ *
* @author <a href="mailto:[email protected]">David Schweinsberg</a>
*/
public class LocaTable implements Table {
- private int[] _offsets;
- private int _length;
+ private final int[] _offsets;
+ private final int _length;
public LocaTable(
- DataInput di,
- int length,
- HeadTable head,
- MaxpTable maxp) throws IOException {
+ final DataInput di,
+ final int length,
+ final HeadTable head,
+ final MaxpTable maxp) throws IOException {
_offsets = new int[maxp.getNumGlyphs() + 1];
- boolean shortEntries = head.useShortEntries();
+ final boolean shortEntries = head.useShortEntries();
// FIXME boolean shortEntries = head.getIndexToLocFormat() == 0;
if (shortEntries) {
for (int i = 0; i <= maxp.getNumGlyphs(); i++) {
@@ -67,11 +67,11 @@ public class LocaTable implements Table {
_offsets[i] = di.readInt();
}
}
-
+
// Check the validity of the offsets
int lastOffset = 0;
int index = 0;
- for (int offset : _offsets) {
+ for (final int offset : _offsets) {
if (offset < lastOffset) {
System.err.printf("LocaTable: Offset at index %d is bad (%d < %d)%n", index, offset, lastOffset);
}
@@ -80,13 +80,13 @@ public class LocaTable implements Table {
}
_length = length;
}
-
+
@Override
public int getType() {
return loca;
}
- public int getOffset(int i) {
+ public int getOffset(final int i) {
if (_offsets == null) {
return 0;
}
@@ -95,7 +95,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(_length).append(" bytes, ")
.append(_offsets.length).append(" entries\n");
@@ -105,5 +105,5 @@ public class LocaTable implements Table {
}
return sb.toString();
}
-
+
}
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 48a9aaa66..357a53dd6 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
@@ -1,9 +1,9 @@
/*****************************************************************************
* Copyright (C) The Apache Software Foundation. All rights reserved. *
- * ------------------------------------------------------------------------- *
- * This software is published under the terms of the Apache Software License *
- * version 1.1, a copy of which has been included with this distribution in *
- * the LICENSE file. *
+ * ------------------------------------------------------------------------- *
+ * This software is published under the terms of the Apache Software License *
+ * version 1.1, a copy of which has been included with this distribution in *
+ * the LICENSE file. *
*****************************************************************************/
package jogamp.graph.font.typecast.ot.table;
@@ -17,7 +17,7 @@ import jogamp.graph.font.typecast.ot.Fixed;
*/
public class MaxpTable implements Table {
- private int versionNumber;
+ private final int versionNumber;
private int numGlyphs;
private int maxPoints;
private int maxContours;
@@ -33,9 +33,9 @@ public class MaxpTable implements Table {
private int maxComponentElements;
private int maxComponentDepth;
- public MaxpTable(DataInput di) throws IOException {
+ public MaxpTable(final DataInput di) throws IOException {
versionNumber = di.readInt();
-
+
// CFF fonts use version 0.5, TrueType fonts use version 1.0
if (versionNumber == 0x00005000) {
numGlyphs = di.readUnsignedShort();
@@ -122,8 +122,9 @@ public class MaxpTable implements Table {
return numGlyphs;
}
+ @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 36e0fc6e8..b62fab0e6 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
@@ -58,15 +58,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;
- NameRecord(DataInput di) throws IOException {
+ NameRecord(final DataInput di) throws IOException {
_platformId = di.readShort();
_encodingId = di.readShort();
_languageId = di.readShort();
@@ -74,19 +74,19 @@ public class NameRecord {
_stringLength = di.readShort();
_stringOffset = di.readShort();
}
-
+
public short getEncodingId() {
return _encodingId;
}
-
+
public short getLanguageId() {
return _languageId;
}
-
+
public short getNameId() {
return _nameId;
}
-
+
public short getPlatformId() {
return _platformId;
}
@@ -95,11 +95,11 @@ public class NameRecord {
return _record;
}
- void loadString(DataInput di) throws IOException {
- StringBuilder sb = new StringBuilder();
+ void loadString(final DataInput di) throws IOException {
+ final StringBuilder sb = new StringBuilder();
di.skipBytes(_stringOffset);
if (_platformId == ID.platformUnicode) {
-
+
// Unicode (big-endian)
for (int i = 0; i < _stringLength/2; i++) {
sb.append(di.readChar());
@@ -111,13 +111,13 @@ public class NameRecord {
sb.append((char) di.readByte());
}
} else if (_platformId == ID.platformISO) {
-
+
// ISO encoding, ASCII
for (int i = 0; i < _stringLength; i++) {
sb.append((char) di.readByte());
}
} else if (_platformId == ID.platformMicrosoft) {
-
+
// Microsoft encoding, Unicode
char c;
for (int i = 0; i < _stringLength/2; i++) {
@@ -128,9 +128,10 @@ public class NameRecord {
_record = sb.toString();
}
+ @Override
public String toString() {
- String sb = " Platform ID: " + _platformId +
+ final String sb = " Platform ID: " + _platformId +
"\n Specific ID: " + _encodingId +
"\n Language ID: " + _languageId +
"\n Name ID: " + _nameId +
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 161a56914..8b1767380 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
@@ -123,7 +123,7 @@ public class NameTable implements Table {
public short getNumberOfNameRecords() {
return _numberOfNameRecords;
}
-
+
/**
* Offset16 stringOffset Offset to start of string storage (from start of table).
*/
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Table.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Table.java
index 499fa7492..9fb5f31b5 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Table.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Table.java
@@ -26,54 +26,54 @@ import java.io.Writer;
public interface Table {
// Table constants
- int BASE = 0x42415345; // Baseline data [OpenType]
- int CFF = 0x43464620; // PostScript font program (compact font format) [PostScript]
- int COLR = 0x434f4c52; // Color Table
- int CPAL = 0x4350414c; // Color Palette Table
- int DSIG = 0x44534947; // Digital signature
- int EBDT = 0x45424454; // Embedded bitmap data
- int EBLC = 0x45424c43; // Embedded bitmap location data
- int EBSC = 0x45425343; // Embedded bitmap scaling data
- int GDEF = 0x47444546; // Glyph definition data [OpenType]
- int GPOS = 0x47504f53; // Glyph positioning data [OpenType]
- int GSUB = 0x47535542; // Glyph substitution data [OpenType]
- int JSTF = 0x4a535446; // Justification data [OpenType]
- int LTSH = 0x4c545348; // Linear threshold table
- int MMFX = 0x4d4d4658; // Multiple master font metrics [PostScript]
- int MMSD = 0x4d4d5344; // Multiple master supplementary data [PostScript]
- int OS_2 = 0x4f532f32; // OS/2 and Windows specific metrics [r]
- int PCLT = 0x50434c54; // PCL5
- int VDMX = 0x56444d58; // Vertical Device Metrics table
- int cmap = 0x636d6170; // character to glyph mapping [r]
- int cvt = 0x63767420; // Control Value Table
- int fpgm = 0x6670676d; // font program
- int fvar = 0x66766172; // Apple's font variations table [PostScript]
- int gasp = 0x67617370; // grid-fitting and scan conversion procedure (grayscale)
- int glyf = 0x676c7966; // glyph data [r]
- int hdmx = 0x68646d78; // horizontal device metrics
- int head = 0x68656164; // font header [r]
- int hhea = 0x68686561; // horizontal header [r]
- int hmtx = 0x686d7478; // horizontal metrics [r]
- int kern = 0x6b65726e; // kerning
- int loca = 0x6c6f6361; // index to location [r]
- int maxp = 0x6d617870; // maximum profile [r]
- int name = 0x6e616d65; // naming table [r]
- int prep = 0x70726570; // CVT Program
- int post = 0x706f7374; // PostScript information [r]
- int sbix = 0x73626978; // Extended Bitmaps
- int vhea = 0x76686561; // Vertical Metrics header
- int vmtx = 0x766d7478; // Vertical Metrics
- int svg = TableDirectory.fromStringTag("SVG "); // SVG outlines
-
+ static final int BASE = 0x42415345; // Baseline data [OpenType]
+ static final int CFF = 0x43464620; // PostScript font program (compact font format) [PostScript]
+ static final int COLR = 0x434f4c52; // Color Table
+ static final int CPAL = 0x4350414c; // Color Palette Table
+ static final int DSIG = 0x44534947; // Digital signature
+ static final int EBDT = 0x45424454; // Embedded bitmap data
+ static final int EBLC = 0x45424c43; // Embedded bitmap location data
+ static final int EBSC = 0x45425343; // Embedded bitmap scaling data
+ static final int GDEF = 0x47444546; // Glyph definition data [OpenType]
+ static final int GPOS = 0x47504f53; // Glyph positioning data [OpenType]
+ static final int GSUB = 0x47535542; // Glyph substitution data [OpenType]
+ static final int JSTF = 0x4a535446; // Justification data [OpenType]
+ static final int LTSH = 0x4c545348; // Linear threshold table
+ static final int MMFX = 0x4d4d4658; // Multiple master font metrics [PostScript]
+ static final int MMSD = 0x4d4d5344; // Multiple master supplementary data [PostScript]
+ static final int OS_2 = 0x4f532f32; // OS/2 and Windows specific metrics [r]
+ static final int PCLT = 0x50434c54; // PCL5
+ static final int VDMX = 0x56444d58; // Vertical Device Metrics table
+ static final int cmap = 0x636d6170; // character to glyph mapping [r]
+ static final int cvt = 0x63767420; // Control Value Table
+ static final int fpgm = 0x6670676d; // font program
+ static final int fvar = 0x66766172; // Apple's font variations table [PostScript]
+ static final int gasp = 0x67617370; // grid-fitting and scan conversion procedure (grayscale)
+ static final int glyf = 0x676c7966; // glyph data [r]
+ static final int hdmx = 0x68646d78; // horizontal device metrics
+ static final int head = 0x68656164; // font header [r]
+ static final int hhea = 0x68686561; // horizontal header [r]
+ static final int hmtx = 0x686d7478; // horizontal metrics [r]
+ static final int kern = 0x6b65726e; // kerning
+ static final int loca = 0x6c6f6361; // index to location [r]
+ static final int maxp = 0x6d617870; // maximum profile [r]
+ static final int name = 0x6e616d65; // naming table [r]
+ static final int prep = 0x70726570; // CVT Program
+ static final int post = 0x706f7374; // PostScript information [r]
+ static final int sbix = 0x73626978; // Extended Bitmaps
+ static final int vhea = 0x76686561; // Vertical Metrics header
+ static final int vmtx = 0x766d7478; // Vertical Metrics
+ static final int svg = TableDirectory.fromStringTag("SVG "); // SVG outlines
+
/**
* The type code of this {@link Table}.
*/
int getType();
- /**
+ /**
* Writes full debug information to the given writer.
*/
- default void dump(Writer out) throws IOException {
+ default void dump(final Writer out) throws IOException {
out.write(toString());
}
}
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 a38035e53..d787d6ea2 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
@@ -28,13 +28,13 @@ import java.io.IOException;
public class VdmxTable implements Table {
private static class Ratio {
-
- private byte _bCharSet;
- private byte _xRatio;
- private byte _yStartRatio;
- private byte _yEndRatio;
-
- Ratio(DataInput di) throws IOException {
+
+ private final byte _bCharSet;
+ private final byte _xRatio;
+ private final byte _yStartRatio;
+ private final byte _yEndRatio;
+
+ Ratio(final DataInput di) throws IOException {
_bCharSet = di.readByte();
_xRatio = di.readByte();
_yStartRatio = di.readByte();
@@ -44,27 +44,27 @@ public class VdmxTable implements Table {
byte getBCharSet() {
return _bCharSet;
}
-
+
byte getXRatio() {
return _xRatio;
}
-
+
byte getYStartRatio() {
return _yStartRatio;
}
-
+
byte getYEndRatio() {
return _yEndRatio;
}
}
-
+
private static class VTableRecord {
-
- private int _yPelHeight;
- private short _yMax;
- private short _yMin;
-
- VTableRecord(DataInput di) throws IOException {
+
+ private final int _yPelHeight;
+ private final short _yMax;
+ private final short _yMin;
+
+ VTableRecord(final DataInput di) throws IOException {
_yPelHeight = di.readUnsignedShort();
_yMax = di.readShort();
_yMin = di.readShort();
@@ -73,24 +73,24 @@ public class VdmxTable implements Table {
int getYPelHeight() {
return _yPelHeight;
}
-
+
short getYMax() {
return _yMax;
}
-
+
short getYMin() {
return _yMin;
}
}
-
+
private static class Group {
-
- private int _recs;
- private int _startsz;
- private int _endsz;
- private VTableRecord[] _entry;
-
- Group(DataInput di) throws IOException {
+
+ private final int _recs;
+ private final int _startsz;
+ private final int _endsz;
+ private final VTableRecord[] _entry;
+
+ Group(final DataInput di) throws IOException {
_recs = di.readUnsignedShort();
_startsz = di.readUnsignedByte();
_endsz = di.readUnsignedByte();
@@ -103,29 +103,29 @@ public class VdmxTable implements Table {
int getRecs() {
return _recs;
}
-
+
int getStartSZ() {
return _startsz;
}
-
+
int getEndSZ() {
return _endsz;
}
-
+
VTableRecord[] getEntry() {
return _entry;
}
}
-
- private int _version;
- private int _numRecs;
- private int _numRatios;
- private Ratio[] _ratRange;
- private int[] _offset;
- private Group[] _groups;
-
+
+ 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 */
- public VdmxTable(DataInput di) throws IOException {
+ public VdmxTable(final DataInput di) throws IOException {
_version = di.readUnsignedShort();
_numRecs = di.readUnsignedShort();
_numRatios = di.readUnsignedShort();
@@ -142,14 +142,15 @@ public class VdmxTable implements Table {
_groups[i] = new Group(di);
}
}
-
+
@Override
public int getType() {
return VDMX;
}
+ @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")
@@ -166,7 +167,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 d7685be74..f842fd9f1 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
@@ -28,20 +28,20 @@ import jogamp.graph.font.typecast.ot.Fixed;
*/
public class VheaTable implements Table {
- 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;
-
- public VheaTable(DataInput di) throws IOException {
+ 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;
+
+ public VheaTable(final DataInput di) throws IOException {
_version = di.readInt();
_ascent = di.readShort();
_descent = di.readShort();
@@ -108,6 +108,7 @@ public class VheaTable implements Table {
return _yMaxExtent;
}
+ @Override
public String toString() {
return "'vhea' Table - Vertical Header\n------------------------------" +
"\n 'vhea' version: " + Fixed.floatValue(_version) +
@@ -128,5 +129,5 @@ public class VheaTable implements Table {
"\n metricDataFormat: " + _metricDataFormat +
"\n numOf_LongVerMetrics: " + _numberOfLongVerMetrics;
}
-
+
}
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 a63b299fc..b4c9ff2b6 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
@@ -27,13 +27,13 @@ import java.io.IOException;
*/
class VmtxTable implements Table {
- private int[] _vMetrics;
- private short[] _topSideBearing;
+ private final int[] _vMetrics;
+ private final short[] _topSideBearing;
protected VmtxTable(
- DataInput di,
- VheaTable vhea,
- MaxpTable maxp) throws IOException {
+ final DataInput di,
+ final VheaTable vhea,
+ final MaxpTable maxp) throws IOException {
_vMetrics = new int[vhea.getNumberOfLongVerMetrics()];
for (int i = 0; i < vhea.getNumberOfLongVerMetrics(); ++i) {
_vMetrics[i] =
@@ -42,7 +42,7 @@ 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();
@@ -54,7 +54,7 @@ class VmtxTable implements Table {
return vmtx;
}
- private int getAdvanceHeight(int i) {
+ public int getAdvanceHeight(final int i) {
if (_vMetrics == null) {
return 0;
}
@@ -65,7 +65,7 @@ class VmtxTable implements Table {
}
}
- public short getTopSideBearing(int i) {
+ public short getTopSideBearing(final int i) {
if (_vMetrics == null) {
return 0;
}
@@ -76,8 +76,9 @@ 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, ")
sb.append(_vMetrics.length).append(" entries\n");