You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by vh...@apache.org on 2013/04/09 19:31:45 UTC
svn commit: r1466146 [6/20] - in /xmlgraphics/fop/trunk: ./
src/codegen/unicode/java/org/apache/fop/complexscripts/bidi/
src/codegen/unicode/java/org/apache/fop/text/linebreak/
src/java/org/apache/fop/afp/ src/java/org/apache/fop/afp/modca/
src/java/or...
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/complexscripts/fonts/GlyphPositioningTable.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/complexscripts/fonts/GlyphPositioningTable.java?rev=1466146&r1=1466145&r2=1466146&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/complexscripts/fonts/GlyphPositioningTable.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/complexscripts/fonts/GlyphPositioningTable.java Tue Apr 9 17:31:41 2013
@@ -74,17 +74,17 @@ public class GlyphPositioningTable exten
* @param lookups a map of lookup specifications to subtable identifier strings
* @param subtables a list of identified subtables
*/
- public GlyphPositioningTable ( GlyphDefinitionTable gdef, Map lookups, List subtables ) {
- super ( gdef, lookups );
- if ( ( subtables == null ) || ( subtables.size() == 0 ) ) {
- throw new AdvancedTypographicTableFormatException ( "subtables must be non-empty" );
+ public GlyphPositioningTable (GlyphDefinitionTable gdef, Map lookups, List subtables) {
+ super (gdef, lookups);
+ if ((subtables == null) || (subtables.size() == 0)) {
+ throw new AdvancedTypographicTableFormatException ("subtables must be non-empty");
} else {
- for ( Iterator it = subtables.iterator(); it.hasNext();) {
+ for (Iterator it = subtables.iterator(); it.hasNext();) {
Object o = it.next();
- if ( o instanceof GlyphPositioningSubtable ) {
- addSubtable ( (GlyphSubtable) o );
+ if (o instanceof GlyphPositioningSubtable) {
+ addSubtable ((GlyphSubtable) o);
} else {
- throw new AdvancedTypographicTableFormatException ( "subtable must be a glyph positioning subtable" );
+ throw new AdvancedTypographicTableFormatException ("subtable must be a glyph positioning subtable");
}
}
freezeSubtables();
@@ -96,26 +96,26 @@ public class GlyphPositioningTable exten
* @param name lookup type name
* @return lookup type
*/
- public static int getLookupTypeFromName ( String name ) {
+ public static int getLookupTypeFromName (String name) {
int t;
String s = name.toLowerCase();
- if ( "single".equals ( s ) ) {
+ if ("single".equals (s)) {
t = GPOS_LOOKUP_TYPE_SINGLE;
- } else if ( "pair".equals ( s ) ) {
+ } else if ("pair".equals (s)) {
t = GPOS_LOOKUP_TYPE_PAIR;
- } else if ( "cursive".equals ( s ) ) {
+ } else if ("cursive".equals (s)) {
t = GPOS_LOOKUP_TYPE_CURSIVE;
- } else if ( "marktobase".equals ( s ) ) {
+ } else if ("marktobase".equals (s)) {
t = GPOS_LOOKUP_TYPE_MARK_TO_BASE;
- } else if ( "marktoligature".equals ( s ) ) {
+ } else if ("marktoligature".equals (s)) {
t = GPOS_LOOKUP_TYPE_MARK_TO_LIGATURE;
- } else if ( "marktomark".equals ( s ) ) {
+ } else if ("marktomark".equals (s)) {
t = GPOS_LOOKUP_TYPE_MARK_TO_MARK;
- } else if ( "contextual".equals ( s ) ) {
+ } else if ("contextual".equals (s)) {
t = GPOS_LOOKUP_TYPE_CONTEXTUAL;
- } else if ( "chainedcontextual".equals ( s ) ) {
+ } else if ("chainedcontextual".equals (s)) {
t = GPOS_LOOKUP_TYPE_CHAINED_CONTEXTUAL;
- } else if ( "extensionpositioning".equals ( s ) ) {
+ } else if ("extensionpositioning".equals (s)) {
t = GPOS_LOOKUP_TYPE_EXTENSION_POSITIONING;
} else {
t = -1;
@@ -128,9 +128,9 @@ public class GlyphPositioningTable exten
* @param type lookup type
* @return lookup type name
*/
- public static String getLookupTypeName ( int type ) {
+ public static String getLookupTypeName (int type) {
String tn;
- switch ( type ) {
+ switch (type) {
case GPOS_LOOKUP_TYPE_SINGLE:
tn = "single";
break;
@@ -176,32 +176,32 @@ public class GlyphPositioningTable exten
* @param entries subtable entries
* @return a glyph subtable instance
*/
- public static GlyphSubtable createSubtable ( int type, String id, int sequence, int flags, int format, GlyphCoverageTable coverage, List entries ) {
+ public static GlyphSubtable createSubtable (int type, String id, int sequence, int flags, int format, GlyphCoverageTable coverage, List entries) {
GlyphSubtable st = null;
- switch ( type ) {
+ switch (type) {
case GPOS_LOOKUP_TYPE_SINGLE:
- st = SingleSubtable.create ( id, sequence, flags, format, coverage, entries );
+ st = SingleSubtable.create (id, sequence, flags, format, coverage, entries);
break;
case GPOS_LOOKUP_TYPE_PAIR:
- st = PairSubtable.create ( id, sequence, flags, format, coverage, entries );
+ st = PairSubtable.create (id, sequence, flags, format, coverage, entries);
break;
case GPOS_LOOKUP_TYPE_CURSIVE:
- st = CursiveSubtable.create ( id, sequence, flags, format, coverage, entries );
+ st = CursiveSubtable.create (id, sequence, flags, format, coverage, entries);
break;
case GPOS_LOOKUP_TYPE_MARK_TO_BASE:
- st = MarkToBaseSubtable.create ( id, sequence, flags, format, coverage, entries );
+ st = MarkToBaseSubtable.create (id, sequence, flags, format, coverage, entries);
break;
case GPOS_LOOKUP_TYPE_MARK_TO_LIGATURE:
- st = MarkToLigatureSubtable.create ( id, sequence, flags, format, coverage, entries );
+ st = MarkToLigatureSubtable.create (id, sequence, flags, format, coverage, entries);
break;
case GPOS_LOOKUP_TYPE_MARK_TO_MARK:
- st = MarkToMarkSubtable.create ( id, sequence, flags, format, coverage, entries );
+ st = MarkToMarkSubtable.create (id, sequence, flags, format, coverage, entries);
break;
case GPOS_LOOKUP_TYPE_CONTEXTUAL:
- st = ContextualSubtable.create ( id, sequence, flags, format, coverage, entries );
+ st = ContextualSubtable.create (id, sequence, flags, format, coverage, entries);
break;
case GPOS_LOOKUP_TYPE_CHAINED_CONTEXTUAL:
- st = ChainedContextualSubtable.create ( id, sequence, flags, format, coverage, entries );
+ st = ChainedContextualSubtable.create (id, sequence, flags, format, coverage, entries);
break;
default:
break;
@@ -220,8 +220,8 @@ public class GlyphPositioningTable exten
* @param entries subtable entries
* @return a glyph subtable instance
*/
- public static GlyphSubtable createSubtable ( int type, String id, int sequence, int flags, int format, List coverage, List entries ) {
- return createSubtable ( type, id, sequence, flags, format, GlyphCoverageTable.createCoverageTable ( coverage ), entries );
+ public static GlyphSubtable createSubtable (int type, String id, int sequence, int flags, int format, List coverage, List entries) {
+ return createSubtable (type, id, sequence, flags, format, GlyphCoverageTable.createCoverageTable (coverage), entries);
}
/**
@@ -235,39 +235,39 @@ public class GlyphPositioningTable exten
* with one 4-tuple for each element of glyph sequence
* @return true if some adjustment is not zero; otherwise, false
*/
- public boolean position ( GlyphSequence gs, String script, String language, int fontSize, int[] widths, int[][] adjustments ) {
- Map/*<LookupSpec,List<LookupTable>>*/ lookups = matchLookups ( script, language, "*" );
- if ( ( lookups != null ) && ( lookups.size() > 0 ) ) {
- ScriptProcessor sp = ScriptProcessor.getInstance ( script );
- return sp.position ( this, gs, script, language, fontSize, lookups, widths, adjustments );
+ public boolean position (GlyphSequence gs, String script, String language, int fontSize, int[] widths, int[][] adjustments) {
+ Map/*<LookupSpec,List<LookupTable>>*/ lookups = matchLookups (script, language, "*");
+ if ((lookups != null) && (lookups.size() > 0)) {
+ ScriptProcessor sp = ScriptProcessor.getInstance (script);
+ return sp.position (this, gs, script, language, fontSize, lookups, widths, adjustments);
} else {
return false;
}
}
private abstract static class SingleSubtable extends GlyphPositioningSubtable {
- SingleSubtable ( String id, int sequence, int flags, int format, GlyphCoverageTable coverage, List entries ) {
- super ( id, sequence, flags, format, coverage );
+ SingleSubtable (String id, int sequence, int flags, int format, GlyphCoverageTable coverage, List entries) {
+ super (id, sequence, flags, format, coverage);
}
/** {@inheritDoc} */
public int getType() {
return GPOS_LOOKUP_TYPE_SINGLE;
}
/** {@inheritDoc} */
- public boolean isCompatible ( GlyphSubtable subtable ) {
+ public boolean isCompatible (GlyphSubtable subtable) {
return subtable instanceof SingleSubtable;
}
/** {@inheritDoc} */
- public boolean position ( GlyphPositioningState ps ) {
+ public boolean position (GlyphPositioningState ps) {
int gi = ps.getGlyph();
int ci;
- if ( ( ci = getCoverageIndex ( gi ) ) < 0 ) {
+ if ((ci = getCoverageIndex (gi)) < 0) {
return false;
} else {
- Value v = getValue ( ci, gi );
- if ( v != null ) {
- if ( ps.adjust(v) ) {
- ps.setAdjusted ( true );
+ Value v = getValue (ci, gi);
+ if (v != null) {
+ if (ps.adjust(v)) {
+ ps.setAdjusted (true);
}
ps.consume(1);
}
@@ -280,12 +280,12 @@ public class GlyphPositioningTable exten
* @param gi input glyph index
* @return positioning value or null if none applies
*/
- public abstract Value getValue ( int ci, int gi );
- static GlyphPositioningSubtable create ( String id, int sequence, int flags, int format, GlyphCoverageTable coverage, List entries ) {
- if ( format == 1 ) {
- return new SingleSubtableFormat1 ( id, sequence, flags, format, coverage, entries );
- } else if ( format == 2 ) {
- return new SingleSubtableFormat2 ( id, sequence, flags, format, coverage, entries );
+ public abstract Value getValue (int ci, int gi);
+ static GlyphPositioningSubtable create (String id, int sequence, int flags, int format, GlyphCoverageTable coverage, List entries) {
+ if (format == 1) {
+ return new SingleSubtableFormat1 (id, sequence, flags, format, coverage, entries);
+ } else if (format == 2) {
+ return new SingleSubtableFormat2 (id, sequence, flags, format, coverage, entries);
} else {
throw new UnsupportedOperationException();
}
@@ -295,38 +295,38 @@ public class GlyphPositioningTable exten
private static class SingleSubtableFormat1 extends SingleSubtable {
private Value value;
private int ciMax;
- SingleSubtableFormat1 ( String id, int sequence, int flags, int format, GlyphCoverageTable coverage, List entries ) {
- super ( id, sequence, flags, format, coverage, entries );
- populate ( entries );
+ SingleSubtableFormat1 (String id, int sequence, int flags, int format, GlyphCoverageTable coverage, List entries) {
+ super (id, sequence, flags, format, coverage, entries);
+ populate (entries);
}
/** {@inheritDoc} */
public List getEntries() {
- if ( value != null ) {
- List entries = new ArrayList ( 1 );
- entries.add ( value );
+ if (value != null) {
+ List entries = new ArrayList (1);
+ entries.add (value);
return entries;
} else {
return null;
}
}
/** {@inheritDoc} */
- public Value getValue ( int ci, int gi ) {
- if ( ( value != null ) && ( ci <= ciMax ) ) {
+ public Value getValue (int ci, int gi) {
+ if ((value != null) && (ci <= ciMax)) {
return value;
} else {
return null;
}
}
- private void populate ( List entries ) {
- if ( ( entries == null ) || ( entries.size() != 1 ) ) {
- throw new AdvancedTypographicTableFormatException ( "illegal entries, must be non-null and contain exactly one entry" );
+ private void populate (List entries) {
+ if ((entries == null) || (entries.size() != 1)) {
+ throw new AdvancedTypographicTableFormatException ("illegal entries, must be non-null and contain exactly one entry");
} else {
Value v;
Object o = entries.get(0);
- if ( o instanceof Value ) {
+ if (o instanceof Value) {
v = (Value) o;
} else {
- throw new AdvancedTypographicTableFormatException ( "illegal entries entry, must be Value, but is: " + ( ( o != null ) ? o.getClass() : null ) );
+ throw new AdvancedTypographicTableFormatException ("illegal entries entry, must be Value, but is: " + ((o != null) ? o.getClass() : null));
}
assert this.value == null;
this.value = v;
@@ -337,16 +337,16 @@ public class GlyphPositioningTable exten
private static class SingleSubtableFormat2 extends SingleSubtable {
private Value[] values;
- SingleSubtableFormat2 ( String id, int sequence, int flags, int format, GlyphCoverageTable coverage, List entries ) {
- super ( id, sequence, flags, format, coverage, entries );
- populate ( entries );
+ SingleSubtableFormat2 (String id, int sequence, int flags, int format, GlyphCoverageTable coverage, List entries) {
+ super (id, sequence, flags, format, coverage, entries);
+ populate (entries);
}
/** {@inheritDoc} */
public List getEntries() {
- if ( values != null ) {
- List entries = new ArrayList ( values.length );
- for ( int i = 0, n = values.length; i < n; i++ ) {
- entries.add ( values[i] );
+ if (values != null) {
+ List entries = new ArrayList (values.length);
+ for (int i = 0, n = values.length; i < n; i++) {
+ entries.add (values[i]);
}
return entries;
} else {
@@ -354,26 +354,26 @@ public class GlyphPositioningTable exten
}
}
/** {@inheritDoc} */
- public Value getValue ( int ci, int gi ) {
- if ( ( values != null ) && ( ci < values.length ) ) {
+ public Value getValue (int ci, int gi) {
+ if ((values != null) && (ci < values.length)) {
return values [ ci ];
} else {
return null;
}
}
- private void populate ( List entries ) {
- if ( entries == null ) {
- throw new AdvancedTypographicTableFormatException ( "illegal entries, must be non-null" );
- } else if ( entries.size() != 1 ) {
- throw new AdvancedTypographicTableFormatException ( "illegal entries, " + entries.size() + " entries present, but requires 1 entry" );
+ private void populate (List entries) {
+ if (entries == null) {
+ throw new AdvancedTypographicTableFormatException ("illegal entries, must be non-null");
+ } else if (entries.size() != 1) {
+ throw new AdvancedTypographicTableFormatException ("illegal entries, " + entries.size() + " entries present, but requires 1 entry");
} else {
Object o;
- if ( ( ( o = entries.get(0) ) == null ) || ! ( o instanceof Value[] ) ) {
- throw new AdvancedTypographicTableFormatException ( "illegal entries, single entry must be a Value[], but is: " + ( ( o != null ) ? o.getClass() : null ) );
+ if (((o = entries.get(0)) == null) || ! (o instanceof Value[])) {
+ throw new AdvancedTypographicTableFormatException ("illegal entries, single entry must be a Value[], but is: " + ((o != null) ? o.getClass() : null));
} else {
Value[] va = (Value[]) o;
- if ( va.length != getCoverageSize() ) {
- throw new AdvancedTypographicTableFormatException ( "illegal values array, " + entries.size() + " values present, but requires " + getCoverageSize() + " values" );
+ if (va.length != getCoverageSize()) {
+ throw new AdvancedTypographicTableFormatException ("illegal values array, " + entries.size() + " values present, but requires " + getCoverageSize() + " values");
} else {
assert this.values == null;
this.values = va;
@@ -384,35 +384,35 @@ public class GlyphPositioningTable exten
}
private abstract static class PairSubtable extends GlyphPositioningSubtable {
- PairSubtable ( String id, int sequence, int flags, int format, GlyphCoverageTable coverage, List entries ) {
- super ( id, sequence, flags, format, coverage );
+ PairSubtable (String id, int sequence, int flags, int format, GlyphCoverageTable coverage, List entries) {
+ super (id, sequence, flags, format, coverage);
}
/** {@inheritDoc} */
public int getType() {
return GPOS_LOOKUP_TYPE_PAIR;
}
/** {@inheritDoc} */
- public boolean isCompatible ( GlyphSubtable subtable ) {
+ public boolean isCompatible (GlyphSubtable subtable) {
return subtable instanceof PairSubtable;
}
/** {@inheritDoc} */
- public boolean position ( GlyphPositioningState ps ) {
+ public boolean position (GlyphPositioningState ps) {
boolean applied = false;
int gi = ps.getGlyph(0);
int ci;
- if ( ( ci = getCoverageIndex ( gi ) ) >= 0 ) {
- int[] counts = ps.getGlyphsAvailable ( 0 );
+ if ((ci = getCoverageIndex (gi)) >= 0) {
+ int[] counts = ps.getGlyphsAvailable (0);
int nga = counts[0];
- if ( nga > 1 ) {
- int[] iga = ps.getGlyphs ( 0, 2, null, counts );
- if ( ( iga != null ) && ( iga.length == 2 ) ) {
- PairValues pv = getPairValues ( ci, iga[0], iga[1] );
- if ( pv != null ) {
+ if (nga > 1) {
+ int[] iga = ps.getGlyphs (0, 2, null, counts);
+ if ((iga != null) && (iga.length == 2)) {
+ PairValues pv = getPairValues (ci, iga[0], iga[1]);
+ if (pv != null) {
int offset = 0;
int offsetLast = counts[0] + counts[1];
// skip any ignored glyphs prior to first non-ignored glyph
- for ( ; offset < offsetLast; ++offset ) {
- if ( ! ps.isIgnoredGlyph ( offset ) ) {
+ for ( ; offset < offsetLast; ++offset) {
+ if (! ps.isIgnoredGlyph (offset)) {
break;
} else {
ps.consume(1);
@@ -420,16 +420,16 @@ public class GlyphPositioningTable exten
}
// adjust first non-ignored glyph if first value isn't null
Value v1 = pv.getValue1();
- if ( v1 != null ) {
- if ( ps.adjust(v1, offset) ) {
- ps.setAdjusted ( true );
+ if (v1 != null) {
+ if (ps.adjust(v1, offset)) {
+ ps.setAdjusted (true);
}
ps.consume(1); // consume first non-ignored glyph
++offset;
}
// skip any ignored glyphs prior to second non-ignored glyph
- for ( ; offset < offsetLast; ++offset ) {
- if ( ! ps.isIgnoredGlyph ( offset ) ) {
+ for ( ; offset < offsetLast; ++offset) {
+ if (! ps.isIgnoredGlyph (offset)) {
break;
} else {
ps.consume(1);
@@ -437,9 +437,9 @@ public class GlyphPositioningTable exten
}
// adjust second non-ignored glyph if second value isn't null
Value v2 = pv.getValue2();
- if ( v2 != null ) {
- if ( ps.adjust(v2, offset) ) {
- ps.setAdjusted ( true );
+ if (v2 != null) {
+ if (ps.adjust(v2, offset)) {
+ ps.setAdjusted (true);
}
ps.consume(1); // consume second non-ignored glyph
++offset;
@@ -458,12 +458,12 @@ public class GlyphPositioningTable exten
* @param gi2 second input glyph index
* @return pair values or null if none applies
*/
- public abstract PairValues getPairValues ( int ci, int gi1, int gi2 );
- static GlyphPositioningSubtable create ( String id, int sequence, int flags, int format, GlyphCoverageTable coverage, List entries ) {
- if ( format == 1 ) {
- return new PairSubtableFormat1 ( id, sequence, flags, format, coverage, entries );
- } else if ( format == 2 ) {
- return new PairSubtableFormat2 ( id, sequence, flags, format, coverage, entries );
+ public abstract PairValues getPairValues (int ci, int gi1, int gi2);
+ static GlyphPositioningSubtable create (String id, int sequence, int flags, int format, GlyphCoverageTable coverage, List entries) {
+ if (format == 1) {
+ return new PairSubtableFormat1 (id, sequence, flags, format, coverage, entries);
+ } else if (format == 2) {
+ return new PairSubtableFormat2 (id, sequence, flags, format, coverage, entries);
} else {
throw new UnsupportedOperationException();
}
@@ -472,31 +472,31 @@ public class GlyphPositioningTable exten
private static class PairSubtableFormat1 extends PairSubtable {
private PairValues[][] pvm; // pair values matrix
- PairSubtableFormat1 ( String id, int sequence, int flags, int format, GlyphCoverageTable coverage, List entries ) {
- super ( id, sequence, flags, format, coverage, entries );
- populate ( entries );
+ PairSubtableFormat1 (String id, int sequence, int flags, int format, GlyphCoverageTable coverage, List entries) {
+ super (id, sequence, flags, format, coverage, entries);
+ populate (entries);
}
/** {@inheritDoc} */
public List getEntries() {
- if ( pvm != null ) {
- List entries = new ArrayList ( 1 );
- entries.add ( pvm );
+ if (pvm != null) {
+ List entries = new ArrayList (1);
+ entries.add (pvm);
return entries;
} else {
return null;
}
}
/** {@inheritDoc} */
- public PairValues getPairValues ( int ci, int gi1, int gi2 ) {
- if ( ( pvm != null ) && ( ci < pvm.length ) ) {
+ public PairValues getPairValues (int ci, int gi1, int gi2) {
+ if ((pvm != null) && (ci < pvm.length)) {
PairValues[] pvt = pvm [ ci ];
- for ( int i = 0, n = pvt.length; i < n; i++ ) {
+ for (int i = 0, n = pvt.length; i < n; i++) {
PairValues pv = pvt [ i ];
- if ( pv != null ) {
+ if (pv != null) {
int g = pv.getGlyph();
- if ( g < gi2 ) {
+ if (g < gi2) {
continue;
- } else if ( g == gi2 ) {
+ } else if (g == gi2) {
return pv;
} else {
break;
@@ -506,15 +506,15 @@ public class GlyphPositioningTable exten
}
return null;
}
- private void populate ( List entries ) {
- if ( entries == null ) {
- throw new AdvancedTypographicTableFormatException ( "illegal entries, must be non-null" );
- } else if ( entries.size() != 1 ) {
- throw new AdvancedTypographicTableFormatException ( "illegal entries, " + entries.size() + " entries present, but requires 1 entry" );
+ private void populate (List entries) {
+ if (entries == null) {
+ throw new AdvancedTypographicTableFormatException ("illegal entries, must be non-null");
+ } else if (entries.size() != 1) {
+ throw new AdvancedTypographicTableFormatException ("illegal entries, " + entries.size() + " entries present, but requires 1 entry");
} else {
Object o;
- if ( ( ( o = entries.get(0) ) == null ) || ! ( o instanceof PairValues[][] ) ) {
- throw new AdvancedTypographicTableFormatException ( "illegal entries, first (and only) entry must be a PairValues[][], but is: " + ( ( o != null ) ? o.getClass() : null ) );
+ if (((o = entries.get(0)) == null) || ! (o instanceof PairValues[][])) {
+ throw new AdvancedTypographicTableFormatException ("illegal entries, first (and only) entry must be a PairValues[][], but is: " + ((o != null) ? o.getClass() : null));
} else {
pvm = (PairValues[][]) o;
}
@@ -528,33 +528,33 @@ public class GlyphPositioningTable exten
private int nc1; // class 1 count
private int nc2; // class 2 count
private PairValues[][] pvm; // pair values matrix
- PairSubtableFormat2 ( String id, int sequence, int flags, int format, GlyphCoverageTable coverage, List entries ) {
- super ( id, sequence, flags, format, coverage, entries );
- populate ( entries );
+ PairSubtableFormat2 (String id, int sequence, int flags, int format, GlyphCoverageTable coverage, List entries) {
+ super (id, sequence, flags, format, coverage, entries);
+ populate (entries);
}
/** {@inheritDoc} */
public List getEntries() {
- if ( pvm != null ) {
- List entries = new ArrayList ( 5 );
- entries.add ( cdt1 );
- entries.add ( cdt2 );
- entries.add ( Integer.valueOf ( nc1 ) );
- entries.add ( Integer.valueOf ( nc2 ) );
- entries.add ( pvm );
+ if (pvm != null) {
+ List entries = new ArrayList (5);
+ entries.add (cdt1);
+ entries.add (cdt2);
+ entries.add (Integer.valueOf (nc1));
+ entries.add (Integer.valueOf (nc2));
+ entries.add (pvm);
return entries;
} else {
return null;
}
}
/** {@inheritDoc} */
- public PairValues getPairValues ( int ci, int gi1, int gi2 ) {
- if ( pvm != null ) {
- int c1 = cdt1.getClassIndex ( gi1, 0 );
- if ( ( c1 >= 0 ) && ( c1 < nc1 ) && ( c1 < pvm.length ) ) {
+ public PairValues getPairValues (int ci, int gi1, int gi2) {
+ if (pvm != null) {
+ int c1 = cdt1.getClassIndex (gi1, 0);
+ if ((c1 >= 0) && (c1 < nc1) && (c1 < pvm.length)) {
PairValues[] pvt = pvm [ c1 ];
- if ( pvt != null ) {
- int c2 = cdt2.getClassIndex ( gi2, 0 );
- if ( ( c2 >= 0 ) && ( c2 < nc2 ) && ( c2 < pvt.length ) ) {
+ if (pvt != null) {
+ int c2 = cdt2.getClassIndex (gi2, 0);
+ if ((c2 >= 0) && (c2 < nc2) && (c2 < pvt.length)) {
return pvt [ c2 ];
}
}
@@ -562,35 +562,35 @@ public class GlyphPositioningTable exten
}
return null;
}
- private void populate ( List entries ) {
- if ( entries == null ) {
- throw new AdvancedTypographicTableFormatException ( "illegal entries, must be non-null" );
- } else if ( entries.size() != 5 ) {
- throw new AdvancedTypographicTableFormatException ( "illegal entries, " + entries.size() + " entries present, but requires 5 entries" );
+ private void populate (List entries) {
+ if (entries == null) {
+ throw new AdvancedTypographicTableFormatException ("illegal entries, must be non-null");
+ } else if (entries.size() != 5) {
+ throw new AdvancedTypographicTableFormatException ("illegal entries, " + entries.size() + " entries present, but requires 5 entries");
} else {
Object o;
- if ( ( ( o = entries.get(0) ) == null ) || ! ( o instanceof GlyphClassTable ) ) {
- throw new AdvancedTypographicTableFormatException ( "illegal entries, first entry must be an GlyphClassTable, but is: " + ( ( o != null ) ? o.getClass() : null ) );
+ if (((o = entries.get(0)) == null) || ! (o instanceof GlyphClassTable)) {
+ throw new AdvancedTypographicTableFormatException ("illegal entries, first entry must be an GlyphClassTable, but is: " + ((o != null) ? o.getClass() : null));
} else {
cdt1 = (GlyphClassTable) o;
}
- if ( ( ( o = entries.get(1) ) == null ) || ! ( o instanceof GlyphClassTable ) ) {
- throw new AdvancedTypographicTableFormatException ( "illegal entries, second entry must be an GlyphClassTable, but is: " + ( ( o != null ) ? o.getClass() : null ) );
+ if (((o = entries.get(1)) == null) || ! (o instanceof GlyphClassTable)) {
+ throw new AdvancedTypographicTableFormatException ("illegal entries, second entry must be an GlyphClassTable, but is: " + ((o != null) ? o.getClass() : null));
} else {
cdt2 = (GlyphClassTable) o;
}
- if ( ( ( o = entries.get(2) ) == null ) || ! ( o instanceof Integer ) ) {
- throw new AdvancedTypographicTableFormatException ( "illegal entries, third entry must be an Integer, but is: " + ( ( o != null ) ? o.getClass() : null ) );
+ if (((o = entries.get(2)) == null) || ! (o instanceof Integer)) {
+ throw new AdvancedTypographicTableFormatException ("illegal entries, third entry must be an Integer, but is: " + ((o != null) ? o.getClass() : null));
} else {
nc1 = ((Integer)(o)).intValue();
}
- if ( ( ( o = entries.get(3) ) == null ) || ! ( o instanceof Integer ) ) {
- throw new AdvancedTypographicTableFormatException ( "illegal entries, fourth entry must be an Integer, but is: " + ( ( o != null ) ? o.getClass() : null ) );
+ if (((o = entries.get(3)) == null) || ! (o instanceof Integer)) {
+ throw new AdvancedTypographicTableFormatException ("illegal entries, fourth entry must be an Integer, but is: " + ((o != null) ? o.getClass() : null));
} else {
nc2 = ((Integer)(o)).intValue();
}
- if ( ( ( o = entries.get(4) ) == null ) || ! ( o instanceof PairValues[][] ) ) {
- throw new AdvancedTypographicTableFormatException ( "illegal entries, fifth entry must be a PairValues[][], but is: " + ( ( o != null ) ? o.getClass() : null ) );
+ if (((o = entries.get(4)) == null) || ! (o instanceof PairValues[][])) {
+ throw new AdvancedTypographicTableFormatException ("illegal entries, fifth entry must be a PairValues[][], but is: " + ((o != null) ? o.getClass() : null));
} else {
pvm = (PairValues[][]) o;
}
@@ -599,47 +599,47 @@ public class GlyphPositioningTable exten
}
private abstract static class CursiveSubtable extends GlyphPositioningSubtable {
- CursiveSubtable ( String id, int sequence, int flags, int format, GlyphCoverageTable coverage, List entries ) {
- super ( id, sequence, flags, format, coverage );
+ CursiveSubtable (String id, int sequence, int flags, int format, GlyphCoverageTable coverage, List entries) {
+ super (id, sequence, flags, format, coverage);
}
/** {@inheritDoc} */
public int getType() {
return GPOS_LOOKUP_TYPE_CURSIVE;
}
/** {@inheritDoc} */
- public boolean isCompatible ( GlyphSubtable subtable ) {
+ public boolean isCompatible (GlyphSubtable subtable) {
return subtable instanceof CursiveSubtable;
}
/** {@inheritDoc} */
- public boolean position ( GlyphPositioningState ps ) {
+ public boolean position (GlyphPositioningState ps) {
boolean applied = false;
int gi = ps.getGlyph(0);
int ci;
- if ( ( ci = getCoverageIndex ( gi ) ) >= 0 ) {
- int[] counts = ps.getGlyphsAvailable ( 0 );
+ if ((ci = getCoverageIndex (gi)) >= 0) {
+ int[] counts = ps.getGlyphsAvailable (0);
int nga = counts[0];
- if ( nga > 1 ) {
- int[] iga = ps.getGlyphs ( 0, 2, null, counts );
- if ( ( iga != null ) && ( iga.length == 2 ) ) {
+ if (nga > 1) {
+ int[] iga = ps.getGlyphs (0, 2, null, counts);
+ if ((iga != null) && (iga.length == 2)) {
// int gi1 = gi;
int ci1 = ci;
int gi2 = iga [ 1 ];
- int ci2 = getCoverageIndex ( gi2 );
- Anchor[] aa = getExitEntryAnchors ( ci1, ci2 );
- if ( aa != null ) {
+ int ci2 = getCoverageIndex (gi2);
+ Anchor[] aa = getExitEntryAnchors (ci1, ci2);
+ if (aa != null) {
Anchor exa = aa [ 0 ];
Anchor ena = aa [ 1 ];
// int exw = ps.getWidth ( gi1 );
- int enw = ps.getWidth ( gi2 );
- if ( ( exa != null ) && ( ena != null ) ) {
- Value v = ena.getAlignmentAdjustment ( exa );
- v.adjust ( - enw, 0, 0, 0 );
- if ( ps.adjust ( v ) ) {
- ps.setAdjusted ( true );
+ int enw = ps.getWidth (gi2);
+ if ((exa != null) && (ena != null)) {
+ Value v = ena.getAlignmentAdjustment (exa);
+ v.adjust (- enw, 0, 0, 0);
+ if (ps.adjust (v)) {
+ ps.setAdjusted (true);
}
}
// consume only first glyph of exit/entry glyph pair
- ps.consume ( 1 );
+ ps.consume (1);
applied = true;
}
}
@@ -656,10 +656,10 @@ public class GlyphPositioningTable exten
* missing, where the first entry is the exit anchor of the first glyph and the second entry is the
* entry anchor of the second glyph
*/
- public abstract Anchor[] getExitEntryAnchors ( int ci1, int ci2 );
- static GlyphPositioningSubtable create ( String id, int sequence, int flags, int format, GlyphCoverageTable coverage, List entries ) {
- if ( format == 1 ) {
- return new CursiveSubtableFormat1 ( id, sequence, flags, format, coverage, entries );
+ public abstract Anchor[] getExitEntryAnchors (int ci1, int ci2);
+ static GlyphPositioningSubtable create (String id, int sequence, int flags, int format, GlyphCoverageTable coverage, List entries) {
+ if (format == 1) {
+ return new CursiveSubtableFormat1 (id, sequence, flags, format, coverage, entries);
} else {
throw new UnsupportedOperationException();
}
@@ -668,46 +668,46 @@ public class GlyphPositioningTable exten
private static class CursiveSubtableFormat1 extends CursiveSubtable {
private Anchor[] aa; // anchor array, where even entries are entry anchors, and odd entries are exit anchors
- CursiveSubtableFormat1 ( String id, int sequence, int flags, int format, GlyphCoverageTable coverage, List entries ) {
- super ( id, sequence, flags, format, coverage, entries );
- populate ( entries );
+ CursiveSubtableFormat1 (String id, int sequence, int flags, int format, GlyphCoverageTable coverage, List entries) {
+ super (id, sequence, flags, format, coverage, entries);
+ populate (entries);
}
/** {@inheritDoc} */
public List getEntries() {
- if ( aa != null ) {
- List entries = new ArrayList ( 1 );
- entries.add ( aa );
+ if (aa != null) {
+ List entries = new ArrayList (1);
+ entries.add (aa);
return entries;
} else {
return null;
}
}
/** {@inheritDoc} */
- public Anchor[] getExitEntryAnchors ( int ci1, int ci2 ) {
- if ( ( ci1 >= 0 ) && ( ci2 >= 0 ) ) {
- int ai1 = ( ci1 * 2 ) + 1; // ci1 denotes glyph with exit anchor
- int ai2 = ( ci2 * 2 ) + 0; // ci2 denotes glyph with entry anchor
- if ( ( aa != null ) && ( ai1 < aa.length ) && ( ai2 < aa.length ) ) {
+ public Anchor[] getExitEntryAnchors (int ci1, int ci2) {
+ if ((ci1 >= 0) && (ci2 >= 0)) {
+ int ai1 = (ci1 * 2) + 1; // ci1 denotes glyph with exit anchor
+ int ai2 = (ci2 * 2) + 0; // ci2 denotes glyph with entry anchor
+ if ((aa != null) && (ai1 < aa.length) && (ai2 < aa.length)) {
Anchor exa = aa [ ai1 ];
Anchor ena = aa [ ai2 ];
- if ( ( exa != null ) && ( ena != null ) ) {
+ if ((exa != null) && (ena != null)) {
return new Anchor[] { exa, ena };
}
}
}
return null;
}
- private void populate ( List entries ) {
- if ( entries == null ) {
- throw new AdvancedTypographicTableFormatException ( "illegal entries, must be non-null" );
- } else if ( entries.size() != 1 ) {
- throw new AdvancedTypographicTableFormatException ( "illegal entries, " + entries.size() + " entries present, but requires 1 entry" );
+ private void populate (List entries) {
+ if (entries == null) {
+ throw new AdvancedTypographicTableFormatException ("illegal entries, must be non-null");
+ } else if (entries.size() != 1) {
+ throw new AdvancedTypographicTableFormatException ("illegal entries, " + entries.size() + " entries present, but requires 1 entry");
} else {
Object o;
- if ( ( ( o = entries.get(0) ) == null ) || ! ( o instanceof Anchor[] ) ) {
- throw new AdvancedTypographicTableFormatException ( "illegal entries, first (and only) entry must be a Anchor[], but is: " + ( ( o != null ) ? o.getClass() : null ) );
- } else if ( ( ( (Anchor[]) o ) . length % 2 ) != 0 ) {
- throw new AdvancedTypographicTableFormatException ( "illegal entries, Anchor[] array must have an even number of entries, but has: " + ( (Anchor[]) o ) . length );
+ if (((o = entries.get(0)) == null) || ! (o instanceof Anchor[])) {
+ throw new AdvancedTypographicTableFormatException ("illegal entries, first (and only) entry must be a Anchor[], but is: " + ((o != null) ? o.getClass() : null));
+ } else if ((((Anchor[]) o) . length % 2) != 0) {
+ throw new AdvancedTypographicTableFormatException ("illegal entries, Anchor[] array must have an even number of entries, but has: " + ((Anchor[]) o) . length);
} else {
aa = (Anchor[]) o;
}
@@ -716,41 +716,41 @@ public class GlyphPositioningTable exten
}
private abstract static class MarkToBaseSubtable extends GlyphPositioningSubtable {
- MarkToBaseSubtable ( String id, int sequence, int flags, int format, GlyphCoverageTable coverage, List entries ) {
- super ( id, sequence, flags, format, coverage );
+ MarkToBaseSubtable (String id, int sequence, int flags, int format, GlyphCoverageTable coverage, List entries) {
+ super (id, sequence, flags, format, coverage);
}
/** {@inheritDoc} */
public int getType() {
return GPOS_LOOKUP_TYPE_MARK_TO_BASE;
}
/** {@inheritDoc} */
- public boolean isCompatible ( GlyphSubtable subtable ) {
+ public boolean isCompatible (GlyphSubtable subtable) {
return subtable instanceof MarkToBaseSubtable;
}
/** {@inheritDoc} */
- public boolean position ( GlyphPositioningState ps ) {
+ public boolean position (GlyphPositioningState ps) {
boolean applied = false;
int giMark = ps.getGlyph();
int ciMark;
- if ( ( ciMark = getCoverageIndex ( giMark ) ) >= 0 ) {
- MarkAnchor ma = getMarkAnchor ( ciMark, giMark );
- if ( ma != null ) {
- for ( int i = 0, n = ps.getPosition(); i < n; i++ ) {
- int gi = ps.getGlyph ( - ( i + 1 ) );
- if ( ps.isMark ( gi ) ) {
+ if ((ciMark = getCoverageIndex (giMark)) >= 0) {
+ MarkAnchor ma = getMarkAnchor (ciMark, giMark);
+ if (ma != null) {
+ for (int i = 0, n = ps.getPosition(); i < n; i++) {
+ int gi = ps.getGlyph (- (i + 1));
+ if (ps.isMark (gi)) {
continue;
} else {
- Anchor a = getBaseAnchor ( gi, ma.getMarkClass() );
- if ( a != null ) {
- Value v = a.getAlignmentAdjustment ( ma );
+ Anchor a = getBaseAnchor (gi, ma.getMarkClass());
+ if (a != null) {
+ Value v = a.getAlignmentAdjustment (ma);
// start experimental fix for END OF AYAH in Lateef/Scheherazade
int[] aa = ps.getAdjustment();
- if ( aa[2] == 0 ) {
- v.adjust ( 0, 0, - ps.getWidth ( giMark ), 0 );
+ if (aa[2] == 0) {
+ v.adjust (0, 0, - ps.getWidth (giMark), 0);
}
// end experimental fix for END OF AYAH in Lateef/Scheherazade
- if ( ps.adjust ( v ) ) {
- ps.setAdjusted ( true );
+ if (ps.adjust (v)) {
+ ps.setAdjusted (true);
}
}
ps.consume(1);
@@ -768,17 +768,17 @@ public class GlyphPositioningTable exten
* @param giMark input glyph index of mark glyph
* @return mark anchor or null if none applies
*/
- public abstract MarkAnchor getMarkAnchor ( int ciMark, int giMark );
+ public abstract MarkAnchor getMarkAnchor (int ciMark, int giMark);
/**
* Obtain anchor associated with base glyph index and mark class.
* @param giBase input glyph index of base glyph
* @param markClass class number of mark glyph
* @return anchor or null if none applies
*/
- public abstract Anchor getBaseAnchor ( int giBase, int markClass );
- static GlyphPositioningSubtable create ( String id, int sequence, int flags, int format, GlyphCoverageTable coverage, List entries ) {
- if ( format == 1 ) {
- return new MarkToBaseSubtableFormat1 ( id, sequence, flags, format, coverage, entries );
+ public abstract Anchor getBaseAnchor (int giBase, int markClass);
+ static GlyphPositioningSubtable create (String id, int sequence, int flags, int format, GlyphCoverageTable coverage, List entries) {
+ if (format == 1) {
+ return new MarkToBaseSubtableFormat1 (id, sequence, flags, format, coverage, entries);
} else {
throw new UnsupportedOperationException();
}
@@ -790,68 +790,68 @@ public class GlyphPositioningTable exten
private int nmc; // mark class count
private MarkAnchor[] maa; // mark anchor array, ordered by mark coverage index
private Anchor[][] bam; // base anchor matrix, ordered by base coverage index, then by mark class
- MarkToBaseSubtableFormat1 ( String id, int sequence, int flags, int format, GlyphCoverageTable coverage, List entries ) {
- super ( id, sequence, flags, format, coverage, entries );
- populate ( entries );
+ MarkToBaseSubtableFormat1 (String id, int sequence, int flags, int format, GlyphCoverageTable coverage, List entries) {
+ super (id, sequence, flags, format, coverage, entries);
+ populate (entries);
}
/** {@inheritDoc} */
public List getEntries() {
- if ( ( bct != null ) && ( maa != null ) && ( nmc > 0 ) && ( bam != null ) ) {
- List entries = new ArrayList ( 4 );
- entries.add ( bct );
- entries.add ( Integer.valueOf ( nmc ) );
- entries.add ( maa );
- entries.add ( bam );
+ if ((bct != null) && (maa != null) && (nmc > 0) && (bam != null)) {
+ List entries = new ArrayList (4);
+ entries.add (bct);
+ entries.add (Integer.valueOf (nmc));
+ entries.add (maa);
+ entries.add (bam);
return entries;
} else {
return null;
}
}
/** {@inheritDoc} */
- public MarkAnchor getMarkAnchor ( int ciMark, int giMark ) {
- if ( ( maa != null ) && ( ciMark < maa.length ) ) {
+ public MarkAnchor getMarkAnchor (int ciMark, int giMark) {
+ if ((maa != null) && (ciMark < maa.length)) {
return maa [ ciMark ];
} else {
return null;
}
}
/** {@inheritDoc} */
- public Anchor getBaseAnchor ( int giBase, int markClass ) {
+ public Anchor getBaseAnchor (int giBase, int markClass) {
int ciBase;
- if ( ( bct != null ) && ( ( ciBase = bct.getCoverageIndex ( giBase ) ) >= 0 ) ) {
- if ( ( bam != null ) && ( ciBase < bam.length ) ) {
+ if ((bct != null) && ((ciBase = bct.getCoverageIndex (giBase)) >= 0)) {
+ if ((bam != null) && (ciBase < bam.length)) {
Anchor[] ba = bam [ ciBase ];
- if ( ( ba != null ) && ( markClass < ba.length ) ) {
+ if ((ba != null) && (markClass < ba.length)) {
return ba [ markClass ];
}
}
}
return null;
}
- private void populate ( List entries ) {
- if ( entries == null ) {
- throw new AdvancedTypographicTableFormatException ( "illegal entries, must be non-null" );
- } else if ( entries.size() != 4 ) {
- throw new AdvancedTypographicTableFormatException ( "illegal entries, " + entries.size() + " entries present, but requires 4 entries" );
+ private void populate (List entries) {
+ if (entries == null) {
+ throw new AdvancedTypographicTableFormatException ("illegal entries, must be non-null");
+ } else if (entries.size() != 4) {
+ throw new AdvancedTypographicTableFormatException ("illegal entries, " + entries.size() + " entries present, but requires 4 entries");
} else {
Object o;
- if ( ( ( o = entries.get(0) ) == null ) || ! ( o instanceof GlyphCoverageTable ) ) {
- throw new AdvancedTypographicTableFormatException ( "illegal entries, first entry must be an GlyphCoverageTable, but is: " + ( ( o != null ) ? o.getClass() : null ) );
+ if (((o = entries.get(0)) == null) || ! (o instanceof GlyphCoverageTable)) {
+ throw new AdvancedTypographicTableFormatException ("illegal entries, first entry must be an GlyphCoverageTable, but is: " + ((o != null) ? o.getClass() : null));
} else {
bct = (GlyphCoverageTable) o;
}
- if ( ( ( o = entries.get(1) ) == null ) || ! ( o instanceof Integer ) ) {
- throw new AdvancedTypographicTableFormatException ( "illegal entries, second entry must be an Integer, but is: " + ( ( o != null ) ? o.getClass() : null ) );
+ if (((o = entries.get(1)) == null) || ! (o instanceof Integer)) {
+ throw new AdvancedTypographicTableFormatException ("illegal entries, second entry must be an Integer, but is: " + ((o != null) ? o.getClass() : null));
} else {
nmc = ((Integer)(o)).intValue();
}
- if ( ( ( o = entries.get(2) ) == null ) || ! ( o instanceof MarkAnchor[] ) ) {
- throw new AdvancedTypographicTableFormatException ( "illegal entries, third entry must be a MarkAnchor[], but is: " + ( ( o != null ) ? o.getClass() : null ) );
+ if (((o = entries.get(2)) == null) || ! (o instanceof MarkAnchor[])) {
+ throw new AdvancedTypographicTableFormatException ("illegal entries, third entry must be a MarkAnchor[], but is: " + ((o != null) ? o.getClass() : null));
} else {
maa = (MarkAnchor[]) o;
}
- if ( ( ( o = entries.get(3) ) == null ) || ! ( o instanceof Anchor[][] ) ) {
- throw new AdvancedTypographicTableFormatException ( "illegal entries, fourth entry must be a Anchor[][], but is: " + ( ( o != null ) ? o.getClass() : null ) );
+ if (((o = entries.get(3)) == null) || ! (o instanceof Anchor[][])) {
+ throw new AdvancedTypographicTableFormatException ("illegal entries, fourth entry must be a Anchor[][], but is: " + ((o != null) ? o.getClass() : null));
} else {
bam = (Anchor[][]) o;
}
@@ -860,35 +860,35 @@ public class GlyphPositioningTable exten
}
private abstract static class MarkToLigatureSubtable extends GlyphPositioningSubtable {
- MarkToLigatureSubtable ( String id, int sequence, int flags, int format, GlyphCoverageTable coverage, List entries ) {
- super ( id, sequence, flags, format, coverage );
+ MarkToLigatureSubtable (String id, int sequence, int flags, int format, GlyphCoverageTable coverage, List entries) {
+ super (id, sequence, flags, format, coverage);
}
/** {@inheritDoc} */
public int getType() {
return GPOS_LOOKUP_TYPE_MARK_TO_LIGATURE;
}
/** {@inheritDoc} */
- public boolean isCompatible ( GlyphSubtable subtable ) {
+ public boolean isCompatible (GlyphSubtable subtable) {
return subtable instanceof MarkToLigatureSubtable;
}
/** {@inheritDoc} */
- public boolean position ( GlyphPositioningState ps ) {
+ public boolean position (GlyphPositioningState ps) {
boolean applied = false;
int giMark = ps.getGlyph();
int ciMark;
- if ( ( ciMark = getCoverageIndex ( giMark ) ) >= 0 ) {
- MarkAnchor ma = getMarkAnchor ( ciMark, giMark );
+ if ((ciMark = getCoverageIndex (giMark)) >= 0) {
+ MarkAnchor ma = getMarkAnchor (ciMark, giMark);
int mxc = getMaxComponentCount();
- if ( ma != null ) {
- for ( int i = 0, n = ps.getPosition(); i < n; i++ ) {
- int gi = ps.getGlyph ( - ( i + 1 ) );
- if ( ps.isMark ( gi ) ) {
+ if (ma != null) {
+ for (int i = 0, n = ps.getPosition(); i < n; i++) {
+ int gi = ps.getGlyph (- (i + 1));
+ if (ps.isMark (gi)) {
continue;
} else {
- Anchor a = getLigatureAnchor ( gi, mxc, i, ma.getMarkClass() );
- if ( a != null ) {
- if ( ps.adjust ( a.getAlignmentAdjustment ( ma ) ) ) {
- ps.setAdjusted ( true );
+ Anchor a = getLigatureAnchor (gi, mxc, i, ma.getMarkClass());
+ if (a != null) {
+ if (ps.adjust (a.getAlignmentAdjustment (ma))) {
+ ps.setAdjusted (true);
}
}
ps.consume(1);
@@ -906,7 +906,7 @@ public class GlyphPositioningTable exten
* @param giMark input glyph index of mark glyph
* @return mark anchor or null if none applies
*/
- public abstract MarkAnchor getMarkAnchor ( int ciMark, int giMark );
+ public abstract MarkAnchor getMarkAnchor (int ciMark, int giMark);
/**
* Obtain maximum component count.
* @return maximum component count (>=0)
@@ -920,10 +920,10 @@ public class GlyphPositioningTable exten
* @param markClass class number of mark glyph
* @return anchor or null if none applies
*/
- public abstract Anchor getLigatureAnchor ( int giLig, int maxComponents, int component, int markClass );
- static GlyphPositioningSubtable create ( String id, int sequence, int flags, int format, GlyphCoverageTable coverage, List entries ) {
- if ( format == 1 ) {
- return new MarkToLigatureSubtableFormat1 ( id, sequence, flags, format, coverage, entries );
+ public abstract Anchor getLigatureAnchor (int giLig, int maxComponents, int component, int markClass);
+ static GlyphPositioningSubtable create (String id, int sequence, int flags, int format, GlyphCoverageTable coverage, List entries) {
+ if (format == 1) {
+ return new MarkToLigatureSubtableFormat1 (id, sequence, flags, format, coverage, entries);
} else {
throw new UnsupportedOperationException();
}
@@ -936,27 +936,27 @@ public class GlyphPositioningTable exten
private int mxc; // maximum ligature component count
private MarkAnchor[] maa; // mark anchor array, ordered by mark coverage index
private Anchor[][][] lam; // ligature anchor matrix, ordered by ligature coverage index, then ligature component, then mark class
- MarkToLigatureSubtableFormat1 ( String id, int sequence, int flags, int format, GlyphCoverageTable coverage, List entries ) {
- super ( id, sequence, flags, format, coverage, entries );
- populate ( entries );
+ MarkToLigatureSubtableFormat1 (String id, int sequence, int flags, int format, GlyphCoverageTable coverage, List entries) {
+ super (id, sequence, flags, format, coverage, entries);
+ populate (entries);
}
/** {@inheritDoc} */
public List getEntries() {
- if ( lam != null ) {
- List entries = new ArrayList ( 5 );
- entries.add ( lct );
- entries.add ( Integer.valueOf ( nmc ) );
- entries.add ( Integer.valueOf ( mxc ) );
- entries.add ( maa );
- entries.add ( lam );
+ if (lam != null) {
+ List entries = new ArrayList (5);
+ entries.add (lct);
+ entries.add (Integer.valueOf (nmc));
+ entries.add (Integer.valueOf (mxc));
+ entries.add (maa);
+ entries.add (lam);
return entries;
} else {
return null;
}
}
/** {@inheritDoc} */
- public MarkAnchor getMarkAnchor ( int ciMark, int giMark ) {
- if ( ( maa != null ) && ( ciMark < maa.length ) ) {
+ public MarkAnchor getMarkAnchor (int ciMark, int giMark) {
+ if ((maa != null) && (ciMark < maa.length)) {
return maa [ ciMark ];
} else {
return null;
@@ -967,14 +967,14 @@ public class GlyphPositioningTable exten
return mxc;
}
/** {@inheritDoc} */
- public Anchor getLigatureAnchor ( int giLig, int maxComponents, int component, int markClass ) {
+ public Anchor getLigatureAnchor (int giLig, int maxComponents, int component, int markClass) {
int ciLig;
- if ( ( lct != null ) && ( ( ciLig = lct.getCoverageIndex ( giLig ) ) >= 0 ) ) {
- if ( ( lam != null ) && ( ciLig < lam.length ) ) {
+ if ((lct != null) && ((ciLig = lct.getCoverageIndex (giLig)) >= 0)) {
+ if ((lam != null) && (ciLig < lam.length)) {
Anchor[][] lcm = lam [ ciLig ];
- if ( component < maxComponents ) {
+ if (component < maxComponents) {
Anchor[] la = lcm [ component ];
- if ( ( la != null ) && ( markClass < la.length ) ) {
+ if ((la != null) && (markClass < la.length)) {
return la [ markClass ];
}
}
@@ -982,35 +982,35 @@ public class GlyphPositioningTable exten
}
return null;
}
- private void populate ( List entries ) {
- if ( entries == null ) {
- throw new AdvancedTypographicTableFormatException ( "illegal entries, must be non-null" );
- } else if ( entries.size() != 5 ) {
- throw new AdvancedTypographicTableFormatException ( "illegal entries, " + entries.size() + " entries present, but requires 5 entries" );
+ private void populate (List entries) {
+ if (entries == null) {
+ throw new AdvancedTypographicTableFormatException ("illegal entries, must be non-null");
+ } else if (entries.size() != 5) {
+ throw new AdvancedTypographicTableFormatException ("illegal entries, " + entries.size() + " entries present, but requires 5 entries");
} else {
Object o;
- if ( ( ( o = entries.get(0) ) == null ) || ! ( o instanceof GlyphCoverageTable ) ) {
- throw new AdvancedTypographicTableFormatException ( "illegal entries, first entry must be an GlyphCoverageTable, but is: " + ( ( o != null ) ? o.getClass() : null ) );
+ if (((o = entries.get(0)) == null) || ! (o instanceof GlyphCoverageTable)) {
+ throw new AdvancedTypographicTableFormatException ("illegal entries, first entry must be an GlyphCoverageTable, but is: " + ((o != null) ? o.getClass() : null));
} else {
lct = (GlyphCoverageTable) o;
}
- if ( ( ( o = entries.get(1) ) == null ) || ! ( o instanceof Integer ) ) {
- throw new AdvancedTypographicTableFormatException ( "illegal entries, second entry must be an Integer, but is: " + ( ( o != null ) ? o.getClass() : null ) );
+ if (((o = entries.get(1)) == null) || ! (o instanceof Integer)) {
+ throw new AdvancedTypographicTableFormatException ("illegal entries, second entry must be an Integer, but is: " + ((o != null) ? o.getClass() : null));
} else {
nmc = ((Integer)(o)).intValue();
}
- if ( ( ( o = entries.get(2) ) == null ) || ! ( o instanceof Integer ) ) {
- throw new AdvancedTypographicTableFormatException ( "illegal entries, third entry must be an Integer, but is: " + ( ( o != null ) ? o.getClass() : null ) );
+ if (((o = entries.get(2)) == null) || ! (o instanceof Integer)) {
+ throw new AdvancedTypographicTableFormatException ("illegal entries, third entry must be an Integer, but is: " + ((o != null) ? o.getClass() : null));
} else {
mxc = ((Integer)(o)).intValue();
}
- if ( ( ( o = entries.get(3) ) == null ) || ! ( o instanceof MarkAnchor[] ) ) {
- throw new AdvancedTypographicTableFormatException ( "illegal entries, fourth entry must be a MarkAnchor[], but is: " + ( ( o != null ) ? o.getClass() : null ) );
+ if (((o = entries.get(3)) == null) || ! (o instanceof MarkAnchor[])) {
+ throw new AdvancedTypographicTableFormatException ("illegal entries, fourth entry must be a MarkAnchor[], but is: " + ((o != null) ? o.getClass() : null));
} else {
maa = (MarkAnchor[]) o;
}
- if ( ( ( o = entries.get(4) ) == null ) || ! ( o instanceof Anchor[][][] ) ) {
- throw new AdvancedTypographicTableFormatException ( "illegal entries, fifth entry must be a Anchor[][][], but is: " + ( ( o != null ) ? o.getClass() : null ) );
+ if (((o = entries.get(4)) == null) || ! (o instanceof Anchor[][][])) {
+ throw new AdvancedTypographicTableFormatException ("illegal entries, fifth entry must be a Anchor[][][], but is: " + ((o != null) ? o.getClass() : null));
} else {
lam = (Anchor[][][]) o;
}
@@ -1019,30 +1019,30 @@ public class GlyphPositioningTable exten
}
private abstract static class MarkToMarkSubtable extends GlyphPositioningSubtable {
- MarkToMarkSubtable ( String id, int sequence, int flags, int format, GlyphCoverageTable coverage, List entries ) {
- super ( id, sequence, flags, format, coverage );
+ MarkToMarkSubtable (String id, int sequence, int flags, int format, GlyphCoverageTable coverage, List entries) {
+ super (id, sequence, flags, format, coverage);
}
/** {@inheritDoc} */
public int getType() {
return GPOS_LOOKUP_TYPE_MARK_TO_MARK;
}
/** {@inheritDoc} */
- public boolean isCompatible ( GlyphSubtable subtable ) {
+ public boolean isCompatible (GlyphSubtable subtable) {
return subtable instanceof MarkToMarkSubtable;
}
/** {@inheritDoc} */
- public boolean position ( GlyphPositioningState ps ) {
+ public boolean position (GlyphPositioningState ps) {
boolean applied = false;
int giMark1 = ps.getGlyph();
int ciMark1;
- if ( ( ciMark1 = getCoverageIndex ( giMark1 ) ) >= 0 ) {
- MarkAnchor ma = getMark1Anchor ( ciMark1, giMark1 );
- if ( ma != null ) {
- if ( ps.hasPrev() ) {
- Anchor a = getMark2Anchor ( ps.getGlyph(-1), ma.getMarkClass() );
- if ( a != null ) {
- if ( ps.adjust ( a.getAlignmentAdjustment ( ma ) ) ) {
- ps.setAdjusted ( true );
+ if ((ciMark1 = getCoverageIndex (giMark1)) >= 0) {
+ MarkAnchor ma = getMark1Anchor (ciMark1, giMark1);
+ if (ma != null) {
+ if (ps.hasPrev()) {
+ Anchor a = getMark2Anchor (ps.getGlyph(-1), ma.getMarkClass());
+ if (a != null) {
+ if (ps.adjust (a.getAlignmentAdjustment (ma))) {
+ ps.setAdjusted (true);
}
}
ps.consume(1);
@@ -1058,17 +1058,17 @@ public class GlyphPositioningTable exten
* @param giMark1 input glyph index of mark 1 glyph
* @return mark 1 anchor or null if none applies
*/
- public abstract MarkAnchor getMark1Anchor ( int ciMark1, int giMark1 );
+ public abstract MarkAnchor getMark1Anchor (int ciMark1, int giMark1);
/**
* Obtain anchor associated with mark 2 glyph index and mark 1 class.
* @param giMark2 input glyph index of mark 2 glyph
* @param markClass class number of mark 1 glyph
* @return anchor or null if none applies
*/
- public abstract Anchor getMark2Anchor ( int giBase, int markClass );
- static GlyphPositioningSubtable create ( String id, int sequence, int flags, int format, GlyphCoverageTable coverage, List entries ) {
- if ( format == 1 ) {
- return new MarkToMarkSubtableFormat1 ( id, sequence, flags, format, coverage, entries );
+ public abstract Anchor getMark2Anchor (int giBase, int markClass);
+ static GlyphPositioningSubtable create (String id, int sequence, int flags, int format, GlyphCoverageTable coverage, List entries) {
+ if (format == 1) {
+ return new MarkToMarkSubtableFormat1 (id, sequence, flags, format, coverage, entries);
} else {
throw new UnsupportedOperationException();
}
@@ -1080,68 +1080,68 @@ public class GlyphPositioningTable exten
private int nmc; // mark class count
private MarkAnchor[] maa; // mark1 anchor array, ordered by mark1 coverage index
private Anchor[][] mam; // mark2 anchor matrix, ordered by mark2 coverage index, then by mark1 class
- MarkToMarkSubtableFormat1 ( String id, int sequence, int flags, int format, GlyphCoverageTable coverage, List entries ) {
- super ( id, sequence, flags, format, coverage, entries );
- populate ( entries );
+ MarkToMarkSubtableFormat1 (String id, int sequence, int flags, int format, GlyphCoverageTable coverage, List entries) {
+ super (id, sequence, flags, format, coverage, entries);
+ populate (entries);
}
/** {@inheritDoc} */
public List getEntries() {
- if ( ( mct2 != null ) && ( maa != null ) && ( nmc > 0 ) && ( mam != null ) ) {
- List entries = new ArrayList ( 4 );
- entries.add ( mct2 );
- entries.add ( Integer.valueOf ( nmc ) );
- entries.add ( maa );
- entries.add ( mam );
+ if ((mct2 != null) && (maa != null) && (nmc > 0) && (mam != null)) {
+ List entries = new ArrayList (4);
+ entries.add (mct2);
+ entries.add (Integer.valueOf (nmc));
+ entries.add (maa);
+ entries.add (mam);
return entries;
} else {
return null;
}
}
/** {@inheritDoc} */
- public MarkAnchor getMark1Anchor ( int ciMark1, int giMark1 ) {
- if ( ( maa != null ) && ( ciMark1 < maa.length ) ) {
+ public MarkAnchor getMark1Anchor (int ciMark1, int giMark1) {
+ if ((maa != null) && (ciMark1 < maa.length)) {
return maa [ ciMark1 ];
} else {
return null;
}
}
/** {@inheritDoc} */
- public Anchor getMark2Anchor ( int giMark2, int markClass ) {
+ public Anchor getMark2Anchor (int giMark2, int markClass) {
int ciMark2;
- if ( ( mct2 != null ) && ( ( ciMark2 = mct2.getCoverageIndex ( giMark2 ) ) >= 0 ) ) {
- if ( ( mam != null ) && ( ciMark2 < mam.length ) ) {
+ if ((mct2 != null) && ((ciMark2 = mct2.getCoverageIndex (giMark2)) >= 0)) {
+ if ((mam != null) && (ciMark2 < mam.length)) {
Anchor[] ma = mam [ ciMark2 ];
- if ( ( ma != null ) && ( markClass < ma.length ) ) {
+ if ((ma != null) && (markClass < ma.length)) {
return ma [ markClass ];
}
}
}
return null;
}
- private void populate ( List entries ) {
- if ( entries == null ) {
- throw new AdvancedTypographicTableFormatException ( "illegal entries, must be non-null" );
- } else if ( entries.size() != 4 ) {
- throw new AdvancedTypographicTableFormatException ( "illegal entries, " + entries.size() + " entries present, but requires 4 entries" );
+ private void populate (List entries) {
+ if (entries == null) {
+ throw new AdvancedTypographicTableFormatException ("illegal entries, must be non-null");
+ } else if (entries.size() != 4) {
+ throw new AdvancedTypographicTableFormatException ("illegal entries, " + entries.size() + " entries present, but requires 4 entries");
} else {
Object o;
- if ( ( ( o = entries.get(0) ) == null ) || ! ( o instanceof GlyphCoverageTable ) ) {
- throw new AdvancedTypographicTableFormatException ( "illegal entries, first entry must be an GlyphCoverageTable, but is: " + ( ( o != null ) ? o.getClass() : null ) );
+ if (((o = entries.get(0)) == null) || ! (o instanceof GlyphCoverageTable)) {
+ throw new AdvancedTypographicTableFormatException ("illegal entries, first entry must be an GlyphCoverageTable, but is: " + ((o != null) ? o.getClass() : null));
} else {
mct2 = (GlyphCoverageTable) o;
}
- if ( ( ( o = entries.get(1) ) == null ) || ! ( o instanceof Integer ) ) {
- throw new AdvancedTypographicTableFormatException ( "illegal entries, second entry must be an Integer, but is: " + ( ( o != null ) ? o.getClass() : null ) );
+ if (((o = entries.get(1)) == null) || ! (o instanceof Integer)) {
+ throw new AdvancedTypographicTableFormatException ("illegal entries, second entry must be an Integer, but is: " + ((o != null) ? o.getClass() : null));
} else {
nmc = ((Integer)(o)).intValue();
}
- if ( ( ( o = entries.get(2) ) == null ) || ! ( o instanceof MarkAnchor[] ) ) {
- throw new AdvancedTypographicTableFormatException ( "illegal entries, third entry must be a MarkAnchor[], but is: " + ( ( o != null ) ? o.getClass() : null ) );
+ if (((o = entries.get(2)) == null) || ! (o instanceof MarkAnchor[])) {
+ throw new AdvancedTypographicTableFormatException ("illegal entries, third entry must be a MarkAnchor[], but is: " + ((o != null) ? o.getClass() : null));
} else {
maa = (MarkAnchor[]) o;
}
- if ( ( ( o = entries.get(3) ) == null ) || ! ( o instanceof Anchor[][] ) ) {
- throw new AdvancedTypographicTableFormatException ( "illegal entries, fourth entry must be a Anchor[][], but is: " + ( ( o != null ) ? o.getClass() : null ) );
+ if (((o = entries.get(3)) == null) || ! (o instanceof Anchor[][])) {
+ throw new AdvancedTypographicTableFormatException ("illegal entries, fourth entry must be a Anchor[][], but is: " + ((o != null) ? o.getClass() : null));
} else {
mam = (Anchor[][]) o;
}
@@ -1150,27 +1150,27 @@ public class GlyphPositioningTable exten
}
private abstract static class ContextualSubtable extends GlyphPositioningSubtable {
- ContextualSubtable ( String id, int sequence, int flags, int format, GlyphCoverageTable coverage, List entries ) {
- super ( id, sequence, flags, format, coverage );
+ ContextualSubtable (String id, int sequence, int flags, int format, GlyphCoverageTable coverage, List entries) {
+ super (id, sequence, flags, format, coverage);
}
/** {@inheritDoc} */
public int getType() {
return GPOS_LOOKUP_TYPE_CONTEXTUAL;
}
/** {@inheritDoc} */
- public boolean isCompatible ( GlyphSubtable subtable ) {
+ public boolean isCompatible (GlyphSubtable subtable) {
return subtable instanceof ContextualSubtable;
}
/** {@inheritDoc} */
- public boolean position ( GlyphPositioningState ps ) {
+ public boolean position (GlyphPositioningState ps) {
boolean applied = false;
int gi = ps.getGlyph();
int ci;
- if ( ( ci = getCoverageIndex ( gi ) ) >= 0 ) {
+ if ((ci = getCoverageIndex (gi)) >= 0) {
int[] rv = new int[1];
- RuleLookup[] la = getLookups ( ci, gi, ps, rv );
- if ( la != null ) {
- ps.apply ( la, rv[0] );
+ RuleLookup[] la = getLookups (ci, gi, ps, rv);
+ if (la != null) {
+ ps.apply (la, rv[0]);
applied = true;
}
}
@@ -1185,14 +1185,14 @@ public class GlyphPositioningTable exten
* where the first entry is used to return the input sequence length of the matched rule
* @return array of rule lookups or null if none applies
*/
- public abstract RuleLookup[] getLookups ( int ci, int gi, GlyphPositioningState ps, int[] rv );
- static GlyphPositioningSubtable create ( String id, int sequence, int flags, int format, GlyphCoverageTable coverage, List entries ) {
- if ( format == 1 ) {
- return new ContextualSubtableFormat1 ( id, sequence, flags, format, coverage, entries );
- } else if ( format == 2 ) {
- return new ContextualSubtableFormat2 ( id, sequence, flags, format, coverage, entries );
- } else if ( format == 3 ) {
- return new ContextualSubtableFormat3 ( id, sequence, flags, format, coverage, entries );
+ public abstract RuleLookup[] getLookups (int ci, int gi, GlyphPositioningState ps, int[] rv);
+ static GlyphPositioningSubtable create (String id, int sequence, int flags, int format, GlyphCoverageTable coverage, List entries) {
+ if (format == 1) {
+ return new ContextualSubtableFormat1 (id, sequence, flags, format, coverage, entries);
+ } else if (format == 2) {
+ return new ContextualSubtableFormat2 (id, sequence, flags, format, coverage, entries);
+ } else if (format == 3) {
+ return new ContextualSubtableFormat3 (id, sequence, flags, format, coverage, entries);
} else {
throw new UnsupportedOperationException();
}
@@ -1201,39 +1201,39 @@ public class GlyphPositioningTable exten
private static class ContextualSubtableFormat1 extends ContextualSubtable {
private RuleSet[] rsa; // rule set array, ordered by glyph coverage index
- ContextualSubtableFormat1 ( String id, int sequence, int flags, int format, GlyphCoverageTable coverage, List entries ) {
- super ( id, sequence, flags, format, coverage, entries );
- populate ( entries );
+ ContextualSubtableFormat1 (String id, int sequence, int flags, int format, GlyphCoverageTable coverage, List entries) {
+ super (id, sequence, flags, format, coverage, entries);
+ populate (entries);
}
/** {@inheritDoc} */
public List getEntries() {
- if ( rsa != null ) {
- List entries = new ArrayList ( 1 );
- entries.add ( rsa );
+ if (rsa != null) {
+ List entries = new ArrayList (1);
+ entries.add (rsa);
return entries;
} else {
return null;
}
}
/** {@inheritDoc} */
- public void resolveLookupReferences ( Map/*<String,LookupTable>*/ lookupTables ) {
- GlyphTable.resolveLookupReferences ( rsa, lookupTables );
+ public void resolveLookupReferences (Map/*<String,LookupTable>*/ lookupTables) {
+ GlyphTable.resolveLookupReferences (rsa, lookupTables);
}
/** {@inheritDoc} */
- public RuleLookup[] getLookups ( int ci, int gi, GlyphPositioningState ps, int[] rv ) {
+ public RuleLookup[] getLookups (int ci, int gi, GlyphPositioningState ps, int[] rv) {
assert ps != null;
- assert ( rv != null ) && ( rv.length > 0 );
+ assert (rv != null) && (rv.length > 0);
assert rsa != null;
- if ( rsa.length > 0 ) {
+ if (rsa.length > 0) {
RuleSet rs = rsa [ 0 ];
- if ( rs != null ) {
+ if (rs != null) {
Rule[] ra = rs.getRules();
- for ( int i = 0, n = ra.length; i < n; i++ ) {
+ for (int i = 0, n = ra.length; i < n; i++) {
Rule r = ra [ i ];
- if ( ( r != null ) && ( r instanceof ChainedGlyphSequenceRule ) ) {
+ if ((r != null) && (r instanceof ChainedGlyphSequenceRule)) {
ChainedGlyphSequenceRule cr = (ChainedGlyphSequenceRule) r;
- int[] iga = cr.getGlyphs ( gi );
- if ( matches ( ps, iga, 0, rv ) ) {
+ int[] iga = cr.getGlyphs (gi);
+ if (matches (ps, iga, 0, rv)) {
return r.getLookups();
}
}
@@ -1242,40 +1242,40 @@ public class GlyphPositioningTable exten
}
return null;
}
- static boolean matches ( GlyphPositioningState ps, int[] glyphs, int offset, int[] rv ) {
- if ( ( glyphs == null ) || ( glyphs.length == 0 ) ) {
+ static boolean matches (GlyphPositioningState ps, int[] glyphs, int offset, int[] rv) {
+ if ((glyphs == null) || (glyphs.length == 0)) {
return true; // match null or empty glyph sequence
} else {
boolean reverse = offset < 0;
GlyphTester ignores = ps.getIgnoreDefault();
- int[] counts = ps.getGlyphsAvailable ( offset, reverse, ignores );
+ int[] counts = ps.getGlyphsAvailable (offset, reverse, ignores);
int nga = counts[0];
int ngm = glyphs.length;
- if ( nga < ngm ) {
+ if (nga < ngm) {
return false; // insufficient glyphs available to match
} else {
- int[] ga = ps.getGlyphs ( offset, ngm, reverse, ignores, null, counts );
- for ( int k = 0; k < ngm; k++ ) {
- if ( ga [ k ] != glyphs [ k ] ) {
+ int[] ga = ps.getGlyphs (offset, ngm, reverse, ignores, null, counts);
+ for (int k = 0; k < ngm; k++) {
+ if (ga [ k ] != glyphs [ k ]) {
return false; // match fails at ga [ k ]
}
}
- if ( rv != null ) {
+ if (rv != null) {
rv[0] = counts[0] + counts[1];
}
return true; // all glyphs match
}
}
}
- private void populate ( List entries ) {
- if ( entries == null ) {
- throw new AdvancedTypographicTableFormatException ( "illegal entries, must be non-null" );
- } else if ( entries.size() != 1 ) {
- throw new AdvancedTypographicTableFormatException ( "illegal entries, " + entries.size() + " entries present, but requires 1 entry" );
+ private void populate (List entries) {
+ if (entries == null) {
+ throw new AdvancedTypographicTableFormatException ("illegal entries, must be non-null");
+ } else if (entries.size() != 1) {
+ throw new AdvancedTypographicTableFormatException ("illegal entries, " + entries.size() + " entries present, but requires 1 entry");
} else {
Object o;
- if ( ( ( o = entries.get(0) ) == null ) || ! ( o instanceof RuleSet[] ) ) {
- throw new AdvancedTypographicTableFormatException ( "illegal entries, first entry must be an RuleSet[], but is: " + ( ( o != null ) ? o.getClass() : null ) );
+ if (((o = entries.get(0)) == null) || ! (o instanceof RuleSet[])) {
+ throw new AdvancedTypographicTableFormatException ("illegal entries, first entry must be an RuleSet[], but is: " + ((o != null) ? o.getClass() : null));
} else {
rsa = (RuleSet[]) o;
}
@@ -1287,41 +1287,41 @@ public class GlyphPositioningTable exten
private GlyphClassTable cdt; // class def table
private int ngc; // class set count
private RuleSet[] rsa; // rule set array, ordered by class number [0...ngc - 1]
- ContextualSubtableFormat2 ( String id, int sequence, int flags, int format, GlyphCoverageTable coverage, List entries ) {
- super ( id, sequence, flags, format, coverage, entries );
- populate ( entries );
+ ContextualSubtableFormat2 (String id, int sequence, int flags, int format, GlyphCoverageTable coverage, List entries) {
+ super (id, sequence, flags, format, coverage, entries);
+ populate (entries);
}
/** {@inheritDoc} */
public List getEntries() {
- if ( rsa != null ) {
- List entries = new ArrayList ( 3 );
- entries.add ( cdt );
- entries.add ( Integer.valueOf ( ngc ) );
- entries.add ( rsa );
+ if (rsa != null) {
+ List entries = new ArrayList (3);
+ entries.add (cdt);
+ entries.add (Integer.valueOf (ngc));
+ entries.add (rsa);
return entries;
} else {
return null;
}
}
/** {@inheritDoc} */
- public void resolveLookupReferences ( Map/*<String,LookupTable>*/ lookupTables ) {
- GlyphTable.resolveLookupReferences ( rsa, lookupTables );
+ public void resolveLookupReferences (Map/*<String,LookupTable>*/ lookupTables) {
+ GlyphTable.resolveLookupReferences (rsa, lookupTables);
}
/** {@inheritDoc} */
- public RuleLookup[] getLookups ( int ci, int gi, GlyphPositioningState ps, int[] rv ) {
+ public RuleLookup[] getLookups (int ci, int gi, GlyphPositioningState ps, int[] rv) {
assert ps != null;
- assert ( rv != null ) && ( rv.length > 0 );
+ assert (rv != null) && (rv.length > 0);
assert rsa != null;
- if ( rsa.length > 0 ) {
+ if (rsa.length > 0) {
RuleSet rs = rsa [ 0 ];
- if ( rs != null ) {
+ if (rs != null) {
Rule[] ra = rs.getRules();
- for ( int i = 0, n = ra.length; i < n; i++ ) {
+ for (int i = 0, n = ra.length; i < n; i++) {
Rule r = ra [ i ];
- if ( ( r != null ) && ( r instanceof ChainedClassSequenceRule ) ) {
+ if ((r != null) && (r instanceof ChainedClassSequenceRule)) {
ChainedClassSequenceRule cr = (ChainedClassSequenceRule) r;
- int[] ca = cr.getClasses ( cdt.getClassIndex ( gi, ps.getClassMatchSet ( gi ) ) );
- if ( matches ( ps, cdt, ca, 0, rv ) ) {
+ int[] ca = cr.getClasses (cdt.getClassIndex (gi, ps.getClassMatchSet (gi)));
+ if (matches (ps, cdt, ca, 0, rv)) {
return r.getLookups();
}
}
@@ -1330,59 +1330,59 @@ public class GlyphPositioningTable exten
}
return null;
}
- static boolean matches ( GlyphPositioningState ps, GlyphClassTable cdt, int[] classes, int offset, int[] rv ) {
- if ( ( cdt == null ) || ( classes == null ) || ( classes.length == 0 ) ) {
+ static boolean matches (GlyphPositioningState ps, GlyphClassTable cdt, int[] classes, int offset, int[] rv) {
+ if ((cdt == null) || (classes == null) || (classes.length == 0)) {
return true; // match null class definitions, null or empty class sequence
} else {
boolean reverse = offset < 0;
GlyphTester ignores = ps.getIgnoreDefault();
- int[] counts = ps.getGlyphsAvailable ( offset, reverse, ignores );
+ int[] counts = ps.getGlyphsAvailable (offset, reverse, ignores);
int nga = counts[0];
int ngm = classes.length;
- if ( nga < ngm ) {
+ if (nga < ngm) {
return false; // insufficient glyphs available to match
} else {
- int[] ga = ps.getGlyphs ( offset, ngm, reverse, ignores, null, counts );
- for ( int k = 0; k < ngm; k++ ) {
+ int[] ga = ps.getGlyphs (offset, ngm, reverse, ignores, null, counts);
[... 918 lines stripped ...]
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org