Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/complexscripts/fonts/GlyphMappingTable.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/complexscripts/fonts/GlyphMappingTable.java?rev=1466146&r1=1466145&r2=1466146&view=diff ============================================================================== --- xmlgraphics/fop/trunk/src/java/org/apache/fop/complexscripts/fonts/GlyphMappingTable.java (original) +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/complexscripts/fonts/GlyphMappingTable.java Tue Apr 9 17:31:41 2013 @@ -76,7 +76,7 @@ public class GlyphMappingTable { * @param gid glyph identifier (code) * @return non-negative glyph mapping index or -1 if glyph identifiers is not mapped by table */ - public int getMappedIndex ( int gid ) { + public int getMappedIndex (int gid) { return -1; } @@ -86,13 +86,13 @@ public class GlyphMappingTable { * Construct empty mapping table. */ public EmptyMappingTable() { - this ( (List) null ); + this ((List) null); } /** * Construct empty mapping table with entries (ignored). * @param entries list of entries (ignored) */ - public EmptyMappingTable ( List entries ) { + public EmptyMappingTable (List entries) { } /** {@inheritDoc} */ public int getType() { @@ -107,7 +107,7 @@ public class GlyphMappingTable { return 0; } /** {@inheritDoc} */ - public int getMappedIndex ( int gid ) { + public int getMappedIndex (int gid) { return -1; } } @@ -135,8 +135,8 @@ public class GlyphMappingTable { * Construct range mapping table. * @param entries of mapping ranges */ - public RangeMappingTable ( List entries ) { - populate ( entries ); + public RangeMappingTable (List entries) { + populate (entries); } /** {@inheritDoc} */ public int getType() { @@ -145,9 +145,9 @@ public class GlyphMappingTable { /** {@inheritDoc} */ public List getEntries() { List entries = new java.util.ArrayList(); - if ( sa != null ) { - for ( int i = 0, n = sa.length; i < n; i++ ) { - entries.add ( new MappingRange ( sa [ i ], ea [ i ], ma [ i ] ) ); + if (sa != null) { + for (int i = 0, n = sa.length; i < n; i++) { + entries.add (new MappingRange (sa [ i ], ea [ i ], ma [ i ])); } } return entries; @@ -157,17 +157,17 @@ public class GlyphMappingTable { return miMax + 1; } /** {@inheritDoc} */ - public int getMappedIndex ( int gid ) { + public int getMappedIndex (int gid) { int i; int mi; - if ( ( i = Arrays.binarySearch ( sa, gid ) ) >= 0 ) { - mi = getMappedIndex ( gid, sa [ i ], ma [ i ] ); // matches start of (some) range - } else if ( ( i = - ( i + 1 ) ) == 0 ) { + if ((i = Arrays.binarySearch (sa, gid)) >= 0) { + mi = getMappedIndex (gid, sa [ i ], ma [ i ]); // matches start of (some) range + } else if ((i = - (i + 1)) == 0) { mi = -1; // precedes first range - } else if ( gid > ea [ --i ] ) { + } else if (gid > ea [ --i ]) { mi = -1; // follows preceding (or last) range } else { - mi = getMappedIndex ( gid, sa [ i ], ma [ i ] ); // intersects (some) range + mi = getMappedIndex (gid, sa [ i ], ma [ i ]); // intersects (some) range } return mi; } @@ -179,8 +179,8 @@ public class GlyphMappingTable { * @param m mapping value * @return non-negative glyph mapping index or -1 if glyph identifiers is not mapped by table */ - public abstract int getMappedIndex ( int gid, int s, int m ); - private void populate ( List entries ) { + public abstract int getMappedIndex (int gid, int s, int m); + private void populate (List entries) { int i = 0; int n = entries.size(); int gidMax = -1; @@ -188,35 +188,35 @@ public class GlyphMappingTable { int[] sa = new int [ n ]; int[] ea = new int [ n ]; int[] ma = new int [ n ]; - for ( Iterator it = entries.iterator(); it.hasNext();) { + for (Iterator it = entries.iterator(); it.hasNext();) { Object o = it.next(); - if ( o instanceof MappingRange ) { + if (o instanceof MappingRange) { MappingRange r = (MappingRange) o; int gs = r.getStart(); int ge = r.getEnd(); int mi = r.getIndex(); - if ( ( gs < 0 ) || ( gs > 65535 ) ) { - throw new AdvancedTypographicTableFormatException ( "illegal glyph range: [" + gs + "," + ge + "]: bad start index" ); - } else if ( ( ge < 0 ) || ( ge > 65535 ) ) { - throw new AdvancedTypographicTableFormatException ( "illegal glyph range: [" + gs + "," + ge + "]: bad end index" ); - } else if ( gs > ge ) { - throw new AdvancedTypographicTableFormatException ( "illegal glyph range: [" + gs + "," + ge + "]: start index exceeds end index" ); - } else if ( gs < gidMax ) { - throw new AdvancedTypographicTableFormatException ( "out of order glyph range: [" + gs + "," + ge + "]" ); - } else if ( mi < 0 ) { - throw new AdvancedTypographicTableFormatException ( "illegal mapping index: " + mi ); + if ((gs < 0) || (gs > 65535)) { + throw new AdvancedTypographicTableFormatException ("illegal glyph range: [" + gs + "," + ge + "]: bad start index"); + } else if ((ge < 0) || (ge > 65535)) { + throw new AdvancedTypographicTableFormatException ("illegal glyph range: [" + gs + "," + ge + "]: bad end index"); + } else if (gs > ge) { + throw new AdvancedTypographicTableFormatException ("illegal glyph range: [" + gs + "," + ge + "]: start index exceeds end index"); + } else if (gs < gidMax) { + throw new AdvancedTypographicTableFormatException ("out of order glyph range: [" + gs + "," + ge + "]"); + } else if (mi < 0) { + throw new AdvancedTypographicTableFormatException ("illegal mapping index: " + mi); } else { int miLast; sa [ i ] = gs; ea [ i ] = gidMax = ge; ma [ i ] = mi; - if ( ( miLast = mi + ( ge - gs ) ) > miMax ) { + if ((miLast = mi + (ge - gs)) > miMax) { miMax = miLast; } i++; } } else { - throw new AdvancedTypographicTableFormatException ( "illegal mapping entry, must be Integer: " + o ); + throw new AdvancedTypographicTableFormatException ("illegal mapping entry, must be Integer: " + o); } } assert i == n; @@ -232,15 +232,15 @@ public class GlyphMappingTable { public String toString() { StringBuffer sb = new StringBuffer(); sb.append('{'); - for ( int i = 0, n = sa.length; i < n; i++ ) { - if ( i > 0 ) { + for (int i = 0, n = sa.length; i < n; i++) { + if (i > 0) { sb.append(','); } - sb.append ( '[' ); - sb.append ( Integer.toString ( sa [ i ] ) ); - sb.append ( Integer.toString ( ea [ i ] ) ); - sb.append ( "]:" ); - sb.append ( Integer.toString ( ma [ i ] ) ); + sb.append ('['); + sb.append (Integer.toString (sa [ i ])); + sb.append (Integer.toString (ea [ i ])); + sb.append ("]:"); + sb.append (Integer.toString (ma [ i ])); } sb.append('}'); return sb.toString(); @@ -261,7 +261,7 @@ public class GlyphMappingTable { * Instantiate a mapping range. */ public MappingRange() { - this ( 0, 0, 0 ); + this (0, 0, 0); } /** @@ -270,10 +270,10 @@ public class GlyphMappingTable { * @param gidEnd end of range * @param index mapping index */ - public MappingRange ( int gidStart, int gidEnd, int index ) { - if ( ( gidStart < 0 ) || ( gidEnd < 0 ) || ( index < 0 ) ) { + public MappingRange (int gidStart, int gidEnd, int index) { + if ((gidStart < 0) || (gidEnd < 0) || (index < 0)) { throw new AdvancedTypographicTableFormatException(); - } else if ( gidStart > gidEnd ) { + } else if (gidStart > gidEnd) { throw new AdvancedTypographicTableFormatException(); } else { this.gidStart = gidStart; @@ -307,8 +307,8 @@ public class GlyphMappingTable { * @param interval an array of length two or greater or null * @return interval as a pair of integers, filled into specified array */ - public int[] getInterval ( int[] interval ) { - if ( ( interval == null ) || ( interval.length != 2 ) ) { + public int[] getInterval (int[] interval) { + if ((interval == null) || (interval.length != 2)) { throw new IllegalArgumentException(); } else { interval[0] = gidStart;
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/complexscripts/fonts/GlyphPositioning.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/complexscripts/fonts/GlyphPositioning.java?rev=1466146&r1=1466145&r2=1466146&view=diff ============================================================================== --- xmlgraphics/fop/trunk/src/java/org/apache/fop/complexscripts/fonts/GlyphPositioning.java (original) +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/complexscripts/fonts/GlyphPositioning.java Tue Apr 9 17:31:41 2013 @@ -39,6 +39,6 @@ public interface GlyphPositioning { * adjustment occurred; it only means that no further glyph subtables for the current lookup table * should be applied. */ - boolean position ( GlyphPositioningState ps ); + boolean position (GlyphPositioningState ps); } Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/complexscripts/fonts/GlyphPositioningState.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/complexscripts/fonts/GlyphPositioningState.java?rev=1466146&r1=1466145&r2=1466146&view=diff ============================================================================== --- xmlgraphics/fop/trunk/src/java/org/apache/fop/complexscripts/fonts/GlyphPositioningState.java (original) +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/complexscripts/fonts/GlyphPositioningState.java Tue Apr 9 17:31:41 2013 @@ -60,8 +60,8 @@ public class GlyphPositioningState exten * @param adjustments positioning adjustments to which positioning is applied * @param sct script context tester (or null) */ - public GlyphPositioningState ( GlyphSequence gs, String script, String language, String feature, int fontSize, int[] widths, int[][] adjustments, ScriptContextTester sct ) { - super ( gs, script, language, feature, sct ); + public GlyphPositioningState (GlyphSequence gs, String script, String language, String feature, int fontSize, int[] widths, int[][] adjustments, ScriptContextTester sct) { + super (gs, script, language, feature, sct); this.fontSize = fontSize; this.widths = widths; this.adjustments = adjustments; @@ -72,8 +72,8 @@ public class GlyphPositioningState exten * except as follows: input glyph sequence is copied deep except for its characters array. * @param ps existing positioning state to copy from */ - public GlyphPositioningState ( GlyphPositioningState ps ) { - super ( ps ); + public GlyphPositioningState (GlyphPositioningState ps) { + super (ps); this.fontSize = ps.fontSize; this.widths = ps.widths; this.adjustments = ps.adjustments; @@ -90,8 +90,8 @@ public class GlyphPositioningState exten * @param adjustments positioning adjustments to which positioning is applied * @param sct script context tester (or null) */ - public GlyphPositioningState reset ( GlyphSequence gs, String script, String language, String feature, int fontSize, int[] widths, int[][] adjustments, ScriptContextTester sct ) { - super.reset ( gs, script, language, feature, sct ); + public GlyphPositioningState reset (GlyphSequence gs, String script, String language, String feature, int fontSize, int[] widths, int[][] adjustments, ScriptContextTester sct) { + super.reset (gs, script, language, feature, sct); this.fontSize = fontSize; this.widths = widths; this.adjustments = adjustments; @@ -104,8 +104,8 @@ public class GlyphPositioningState exten * @param gi glyph index * @return design advancement, or zero if glyph index is not present */ - public int getWidth ( int gi ) { - if ( ( widths != null ) && ( gi < widths.length ) ) { + public int getWidth (int gi) { + if ((widths != null) && (gi < widths.length)) { return widths [ gi ]; } else { return 0; @@ -117,8 +117,8 @@ public class GlyphPositioningState exten * @param v value containing adjustments * @return true if a non-zero adjustment was made */ - public boolean adjust ( GlyphPositioningTable.Value v ) { - return adjust ( v, 0 ); + public boolean adjust (GlyphPositioningTable.Value v) { + return adjust (v, 0); } /** @@ -127,10 +127,10 @@ public class GlyphPositioningState exten * @param offset from current position index * @return true if a non-zero adjustment was made */ - public boolean adjust ( GlyphPositioningTable.Value v, int offset ) { + public boolean adjust (GlyphPositioningTable.Value v, int offset) { assert v != null; - if ( ( index + offset ) < indexLast ) { - return v.adjust ( adjustments [ index + offset ], fontSize ); + if ((index + offset) < indexLast) { + return v.adjust (adjustments [ index + offset ], fontSize); } else { throw new IndexOutOfBoundsException(); } @@ -141,7 +141,7 @@ public class GlyphPositioningState exten * @return array of adjustments (int[4]) at current position */ public int[] getAdjustment() { - return getAdjustment ( 0 ); + return getAdjustment (0); } /** @@ -150,8 +150,8 @@ public class GlyphPositioningState exten * @return array of adjustments (int[4]) at specified offset * @throws IndexOutOfBoundsException if offset is invalid */ - public int[] getAdjustment ( int offset ) throws IndexOutOfBoundsException { - if ( ( index + offset ) < indexLast ) { + public int[] getAdjustment (int offset) throws IndexOutOfBoundsException { + if ((index + offset) < indexLast) { return adjustments [ index + offset ]; } else { throw new IndexOutOfBoundsException(); @@ -165,10 +165,10 @@ public class GlyphPositioningState exten * @return true if subtable applied, or false if it did not (e.g., its * input coverage table did not match current input context) */ - public boolean apply ( GlyphPositioningSubtable st ) { + public boolean apply (GlyphPositioningSubtable st) { assert st != null; - updateSubtableState ( st ); - boolean applied = st.position ( this ); + updateSubtableState (st); + boolean applied = st.position (this); return applied; } @@ -182,24 +182,24 @@ public class GlyphPositioningState exten * the lookups are to apply, and to be consumed once the application has finished * @return true if lookups are non-null and non-empty; otherwise, false */ - public boolean apply ( GlyphTable.RuleLookup[] lookups, int nig ) { - if ( ( lookups != null ) && ( lookups.length > 0 ) ) { + public boolean apply (GlyphTable.RuleLookup[] lookups, int nig) { + if ((lookups != null) && (lookups.length > 0)) { // apply each rule lookup to extracted input glyph array - for ( int i = 0, n = lookups.length; i < n; i++ ) { + for (int i = 0, n = lookups.length; i < n; i++) { GlyphTable.RuleLookup l = lookups [ i ]; - if ( l != null ) { + if (l != null) { GlyphTable.LookupTable lt = l.getLookup(); - if ( lt != null ) { + if (lt != null) { // perform positioning on a copy of previous state - GlyphPositioningState ps = new GlyphPositioningState ( this ); + GlyphPositioningState ps = new GlyphPositioningState (this); // apply lookup table positioning - if ( lt.position ( ps, l.getSequenceIndex() ) ) { - setAdjusted ( true ); + if (lt.position (ps, l.getSequenceIndex())) { + setAdjusted (true); } } } } - consume ( nig ); + consume (nig); return true; } else { return false; @@ -218,7 +218,7 @@ public class GlyphPositioningState exten * @param adjusted true if to set adjusted state, otherwise false to * clear adjusted state */ - public void setAdjusted ( boolean adjusted ) { + public void setAdjusted (boolean adjusted) { this.adjusted = adjusted; } Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/complexscripts/fonts/GlyphPositioningSubtable.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/complexscripts/fonts/GlyphPositioningSubtable.java?rev=1466146&r1=1466145&r2=1466146&view=diff ============================================================================== --- xmlgraphics/fop/trunk/src/java/org/apache/fop/complexscripts/fonts/GlyphPositioningSubtable.java (original) +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/complexscripts/fonts/GlyphPositioningSubtable.java Tue Apr 9 17:31:41 2013 @@ -44,8 +44,8 @@ public abstract class GlyphPositioningSu * @param format subtable format * @param coverage subtable coverage table */ - protected GlyphPositioningSubtable ( String id, int sequence, int flags, int format, GlyphCoverageTable coverage ) { - super ( id, sequence, flags, format, coverage ); + protected GlyphPositioningSubtable (String id, int sequence, int flags, int format, GlyphCoverageTable coverage) { + super (id, sequence, flags, format, coverage); } /** {@inheritDoc} */ @@ -55,11 +55,11 @@ public abstract class GlyphPositioningSu /** {@inheritDoc} */ public String getTypeName() { - return GlyphPositioningTable.getLookupTypeName ( getType() ); + return GlyphPositioningTable.getLookupTypeName (getType()); } /** {@inheritDoc} */ - public boolean isCompatible ( GlyphSubtable subtable ) { + public boolean isCompatible (GlyphSubtable subtable) { return subtable instanceof GlyphPositioningSubtable; } @@ -69,7 +69,7 @@ public abstract class GlyphPositioningSu } /** {@inheritDoc} */ - public boolean position ( GlyphPositioningState ps ) { + public boolean position (GlyphPositioningState ps) { return false; } @@ -85,24 +85,24 @@ public abstract class GlyphPositioningSu * @param sequenceIndex if non negative, then apply subtables only at specified sequence index * @return true if a non-zero adjustment occurred */ - public static final boolean position ( GlyphPositioningState ps, GlyphPositioningSubtable[] sta, int sequenceIndex ) { + public static final boolean position (GlyphPositioningState ps, GlyphPositioningSubtable[] sta, int sequenceIndex) { int sequenceStart = ps.getPosition(); boolean appliedOneShot = false; - while ( ps.hasNext() ) { + while (ps.hasNext()) { boolean applied = false; - if ( ! appliedOneShot && ps.maybeApplicable() ) { - for ( int i = 0, n = sta.length; ! applied && ( i < n ); i++ ) { - if ( sequenceIndex < 0 ) { - applied = ps.apply ( sta [ i ] ); - } else if ( ps.getPosition() == ( sequenceStart + sequenceIndex ) ) { - applied = ps.apply ( sta [ i ] ); - if ( applied ) { + if (! appliedOneShot && ps.maybeApplicable()) { + for (int i = 0, n = sta.length; ! applied && (i < n); i++) { + if (sequenceIndex < 0) { + applied = ps.apply (sta [ i ]); + } else if (ps.getPosition() == (sequenceStart + sequenceIndex)) { + applied = ps.apply (sta [ i ]); + if (applied) { appliedOneShot = true; } } } } - if ( ! applied || ! ps.didConsume() ) { + if (! applied || ! ps.didConsume()) { ps.applyDefault(); } ps.next(); @@ -123,9 +123,9 @@ public abstract class GlyphPositioningSu * @param sct script context tester * @return true if a non-zero adjustment occurred */ - public static final boolean position ( GlyphSequence gs, String script, String language, String feature, int fontSize, GlyphPositioningSubtable[] sta, int[] widths, int[][] adjustments, ScriptContextTester sct ) { - synchronized ( state ) { - return position ( state.reset ( gs, script, language, feature, fontSize, widths, adjustments, sct ), sta, -1 ); + public static final boolean position (GlyphSequence gs, String script, String language, String feature, int fontSize, GlyphPositioningSubtable[] sta, int[] widths, int[][] adjustments, ScriptContextTester sct) { + synchronized (state) { + return position (state.reset (gs, script, language, feature, fontSize, widths, adjustments, sct), sta, -1); } } --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
