aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop/complexscripts/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'src/java/org/apache/fop/complexscripts/scripts')
-rw-r--r--src/java/org/apache/fop/complexscripts/scripts/ArabicScriptProcessor.java252
-rw-r--r--src/java/org/apache/fop/complexscripts/scripts/DefaultScriptProcessor.java42
-rw-r--r--src/java/org/apache/fop/complexscripts/scripts/DevanagariScriptProcessor.java180
-rw-r--r--src/java/org/apache/fop/complexscripts/scripts/GujaratiScriptProcessor.java180
-rw-r--r--src/java/org/apache/fop/complexscripts/scripts/GurmukhiScriptProcessor.java184
-rw-r--r--src/java/org/apache/fop/complexscripts/scripts/IndicScriptProcessor.java244
-rw-r--r--src/java/org/apache/fop/complexscripts/scripts/ScriptProcessor.java82
7 files changed, 582 insertions, 582 deletions
diff --git a/src/java/org/apache/fop/complexscripts/scripts/ArabicScriptProcessor.java b/src/java/org/apache/fop/complexscripts/scripts/ArabicScriptProcessor.java
index ef3c9f43a..740d81335 100644
--- a/src/java/org/apache/fop/complexscripts/scripts/ArabicScriptProcessor.java
+++ b/src/java/org/apache/fop/complexscripts/scripts/ArabicScriptProcessor.java
@@ -75,49 +75,49 @@ public class ArabicScriptProcessor extends DefaultScriptProcessor {
private static class SubstitutionScriptContextTester implements ScriptContextTester {
private static Map/*<String,GlyphContextTester>*/ testerMap = new HashMap/*<String,GlyphContextTester>*/();
static {
- testerMap.put ( "fina", new GlyphContextTester() {
- public boolean test ( String script, String language, String feature, GlyphSequence gs, int index, int flags ) {
- return inFinalContext ( script, language, feature, gs, index, flags );
+ testerMap.put ("fina", new GlyphContextTester() {
+ public boolean test (String script, String language, String feature, GlyphSequence gs, int index, int flags) {
+ return inFinalContext (script, language, feature, gs, index, flags);
}
- } );
- testerMap.put ( "init", new GlyphContextTester() {
- public boolean test ( String script, String language, String feature, GlyphSequence gs, int index, int flags ) {
- return inInitialContext ( script, language, feature, gs, index, flags );
+ });
+ testerMap.put ("init", new GlyphContextTester() {
+ public boolean test (String script, String language, String feature, GlyphSequence gs, int index, int flags) {
+ return inInitialContext (script, language, feature, gs, index, flags);
}
- } );
- testerMap.put ( "isol", new GlyphContextTester() {
- public boolean test ( String script, String language, String feature, GlyphSequence gs, int index, int flags ) {
- return inIsolateContext ( script, language, feature, gs, index, flags );
+ });
+ testerMap.put ("isol", new GlyphContextTester() {
+ public boolean test (String script, String language, String feature, GlyphSequence gs, int index, int flags) {
+ return inIsolateContext (script, language, feature, gs, index, flags);
}
- } );
- testerMap.put ( "liga", new GlyphContextTester() {
- public boolean test ( String script, String language, String feature, GlyphSequence gs, int index, int flags ) {
- return inLigatureContext ( script, language, feature, gs, index, flags );
+ });
+ testerMap.put ("liga", new GlyphContextTester() {
+ public boolean test (String script, String language, String feature, GlyphSequence gs, int index, int flags) {
+ return inLigatureContext (script, language, feature, gs, index, flags);
}
- } );
- testerMap.put ( "medi", new GlyphContextTester() {
- public boolean test ( String script, String language, String feature, GlyphSequence gs, int index, int flags ) {
- return inMedialContext ( script, language, feature, gs, index, flags );
+ });
+ testerMap.put ("medi", new GlyphContextTester() {
+ public boolean test (String script, String language, String feature, GlyphSequence gs, int index, int flags) {
+ return inMedialContext (script, language, feature, gs, index, flags);
}
- } );
+ });
}
- public GlyphContextTester getTester ( String feature ) {
- return (GlyphContextTester) testerMap.get ( feature );
+ public GlyphContextTester getTester (String feature) {
+ return (GlyphContextTester) testerMap.get (feature);
}
}
private static class PositioningScriptContextTester implements ScriptContextTester {
private static Map/*<String,GlyphContextTester>*/ testerMap = new HashMap/*<String,GlyphContextTester>*/();
- public GlyphContextTester getTester ( String feature ) {
- return (GlyphContextTester) testerMap.get ( feature );
+ public GlyphContextTester getTester (String feature) {
+ return (GlyphContextTester) testerMap.get (feature);
}
}
private final ScriptContextTester subContextTester;
private final ScriptContextTester posContextTester;
- ArabicScriptProcessor ( String script ) {
- super ( script );
+ ArabicScriptProcessor (String script) {
+ super (script);
this.subContextTester = new SubstitutionScriptContextTester();
this.posContextTester = new PositioningScriptContextTester();
}
@@ -144,26 +144,26 @@ public class ArabicScriptProcessor extends DefaultScriptProcessor {
/** {@inheritDoc} */
@Override
- public GlyphSequence reorderCombiningMarks ( GlyphDefinitionTable gdef, GlyphSequence gs, int[][] gpa, String script, String language ) {
+ public GlyphSequence reorderCombiningMarks (GlyphDefinitionTable gdef, GlyphSequence gs, int[][] gpa, String script, String language) {
// a side effect of BIDI reordering is to order combining marks before their base, so we need to override the default here to
// prevent double reordering
return gs;
}
- private static boolean inFinalContext ( String script, String language, String feature, GlyphSequence gs, int index, int flags ) {
- GlyphSequence.CharAssociation a = gs.getAssociation ( index );
- int[] ca = gs.getCharacterArray ( false );
+ private static boolean inFinalContext (String script, String language, String feature, GlyphSequence gs, int index, int flags) {
+ GlyphSequence.CharAssociation a = gs.getAssociation (index);
+ int[] ca = gs.getCharacterArray (false);
int nc = gs.getCharacterCount();
- if ( nc == 0 ) {
+ if (nc == 0) {
return false;
} else {
int s = a.getStart();
int e = a.getEnd();
- if ( ! hasFinalPrecedingContext ( ca, nc, s, e ) ) {
+ if (! hasFinalPrecedingContext (ca, nc, s, e)) {
return false;
- } else if ( forcesFinalThisContext ( ca, nc, s, e ) ) {
+ } else if (forcesFinalThisContext (ca, nc, s, e)) {
return true;
- } else if ( ! hasFinalFollowingContext ( ca, nc, s, e ) ) {
+ } else if (! hasFinalFollowingContext (ca, nc, s, e)) {
return false;
} else {
return true;
@@ -171,18 +171,18 @@ public class ArabicScriptProcessor extends DefaultScriptProcessor {
}
}
- private static boolean inInitialContext ( String script, String language, String feature, GlyphSequence gs, int index, int flags ) {
- GlyphSequence.CharAssociation a = gs.getAssociation ( index );
- int[] ca = gs.getCharacterArray ( false );
+ private static boolean inInitialContext (String script, String language, String feature, GlyphSequence gs, int index, int flags) {
+ GlyphSequence.CharAssociation a = gs.getAssociation (index);
+ int[] ca = gs.getCharacterArray (false);
int nc = gs.getCharacterCount();
- if ( nc == 0 ) {
+ if (nc == 0) {
return false;
} else {
int s = a.getStart();
int e = a.getEnd();
- if ( ! hasInitialPrecedingContext ( ca, nc, s, e ) ) {
+ if (! hasInitialPrecedingContext (ca, nc, s, e)) {
return false;
- } else if ( ! hasInitialFollowingContext ( ca, nc, s, e ) ) {
+ } else if (! hasInitialFollowingContext (ca, nc, s, e)) {
return false;
} else {
return true;
@@ -190,30 +190,30 @@ public class ArabicScriptProcessor extends DefaultScriptProcessor {
}
}
- private static boolean inIsolateContext ( String script, String language, String feature, GlyphSequence gs, int index, int flags ) {
- GlyphSequence.CharAssociation a = gs.getAssociation ( index );
+ private static boolean inIsolateContext (String script, String language, String feature, GlyphSequence gs, int index, int flags) {
+ GlyphSequence.CharAssociation a = gs.getAssociation (index);
int nc = gs.getCharacterCount();
- if ( nc == 0 ) {
+ if (nc == 0) {
return false;
- } else if ( ( a.getStart() == 0 ) && ( a.getEnd() == nc ) ) {
+ } else if ((a.getStart() == 0) && (a.getEnd() == nc)) {
return true;
} else {
return false;
}
}
- private static boolean inLigatureContext ( String script, String language, String feature, GlyphSequence gs, int index, int flags ) {
- GlyphSequence.CharAssociation a = gs.getAssociation ( index );
- int[] ca = gs.getCharacterArray ( false );
+ private static boolean inLigatureContext (String script, String language, String feature, GlyphSequence gs, int index, int flags) {
+ GlyphSequence.CharAssociation a = gs.getAssociation (index);
+ int[] ca = gs.getCharacterArray (false);
int nc = gs.getCharacterCount();
- if ( nc == 0 ) {
+ if (nc == 0) {
return false;
} else {
int s = a.getStart();
int e = a.getEnd();
- if ( ! hasLigaturePrecedingContext ( ca, nc, s, e ) ) {
+ if (! hasLigaturePrecedingContext (ca, nc, s, e)) {
return false;
- } else if ( ! hasLigatureFollowingContext ( ca, nc, s, e ) ) {
+ } else if (! hasLigatureFollowingContext (ca, nc, s, e)) {
return false;
} else {
return true;
@@ -221,20 +221,20 @@ public class ArabicScriptProcessor extends DefaultScriptProcessor {
}
}
- private static boolean inMedialContext ( String script, String language, String feature, GlyphSequence gs, int index, int flags ) {
- GlyphSequence.CharAssociation a = gs.getAssociation ( index );
- int[] ca = gs.getCharacterArray ( false );
+ private static boolean inMedialContext (String script, String language, String feature, GlyphSequence gs, int index, int flags) {
+ GlyphSequence.CharAssociation a = gs.getAssociation (index);
+ int[] ca = gs.getCharacterArray (false);
int nc = gs.getCharacterCount();
- if ( nc == 0 ) {
+ if (nc == 0) {
return false;
} else {
int s = a.getStart();
int e = a.getEnd();
- if ( ! hasMedialPrecedingContext ( ca, nc, s, e ) ) {
+ if (! hasMedialPrecedingContext (ca, nc, s, e)) {
return false;
- } else if ( ! hasMedialThisContext ( ca, nc, s, e ) ) {
+ } else if (! hasMedialThisContext (ca, nc, s, e)) {
return false;
- } else if ( ! hasMedialFollowingContext ( ca, nc, s, e ) ) {
+ } else if (! hasMedialFollowingContext (ca, nc, s, e)) {
return false;
} else {
return true;
@@ -242,209 +242,209 @@ public class ArabicScriptProcessor extends DefaultScriptProcessor {
}
}
- private static boolean hasFinalPrecedingContext ( int[] ca, int nc, int s, int e ) {
+ private static boolean hasFinalPrecedingContext (int[] ca, int nc, int s, int e) {
int chp = 0;
int clp = 0;
- for ( int i = s; i > 0; i-- ) {
+ for (int i = s; i > 0; i--) {
int k = i - 1;
- if ( ( k >= 0 ) && ( k < nc ) ) {
+ if ((k >= 0) && (k < nc)) {
chp = ca [ k ];
- clp = BidiClass.getBidiClass ( chp );
- if ( clp != BidiConstants.NSM ) {
+ clp = BidiClass.getBidiClass (chp);
+ if (clp != BidiConstants.NSM) {
break;
}
}
}
- if ( clp != BidiConstants.AL ) {
+ if (clp != BidiConstants.AL) {
return false;
- } else if ( hasIsolateInitial ( chp ) ) {
+ } else if (hasIsolateInitial (chp)) {
return false;
} else {
return true;
}
}
- private static boolean forcesFinalThisContext ( int[] ca, int nc, int s, int e ) {
+ private static boolean forcesFinalThisContext (int[] ca, int nc, int s, int e) {
int chl = 0;
int cll = 0;
- for ( int i = 0, n = e - s; i < n; i++ ) {
+ for (int i = 0, n = e - s; i < n; i++) {
int k = n - i - 1;
int j = s + k;
- if ( ( j >= 0 ) && ( j < nc ) ) {
+ if ((j >= 0) && (j < nc)) {
chl = ca [ j ];
- cll = BidiClass.getBidiClass ( chl );
- if ( cll != BidiConstants.NSM ) {
+ cll = BidiClass.getBidiClass (chl);
+ if (cll != BidiConstants.NSM) {
break;
}
}
}
- if ( cll != BidiConstants.AL ) {
+ if (cll != BidiConstants.AL) {
return false;
}
- if ( hasIsolateInitial ( chl ) ) {
+ if (hasIsolateInitial (chl)) {
return true;
} else {
return false;
}
}
- private static boolean hasFinalFollowingContext ( int[] ca, int nc, int s, int e ) {
+ private static boolean hasFinalFollowingContext (int[] ca, int nc, int s, int e) {
int chf = 0;
int clf = 0;
- for ( int i = e, n = nc; i < n; i++ ) {
+ for (int i = e, n = nc; i < n; i++) {
chf = ca [ i ];
- clf = BidiClass.getBidiClass ( chf );
- if ( clf != BidiConstants.NSM ) {
+ clf = BidiClass.getBidiClass (chf);
+ if (clf != BidiConstants.NSM) {
break;
}
}
- if ( clf != BidiConstants.AL ) {
+ if (clf != BidiConstants.AL) {
return true;
- } else if ( hasIsolateFinal ( chf ) ) {
+ } else if (hasIsolateFinal (chf)) {
return true;
} else {
return false;
}
}
- private static boolean hasInitialPrecedingContext ( int[] ca, int nc, int s, int e ) {
+ private static boolean hasInitialPrecedingContext (int[] ca, int nc, int s, int e) {
int chp = 0;
int clp = 0;
- for ( int i = s; i > 0; i-- ) {
+ for (int i = s; i > 0; i--) {
int k = i - 1;
- if ( ( k >= 0 ) && ( k < nc ) ) {
+ if ((k >= 0) && (k < nc)) {
chp = ca [ k ];
- clp = BidiClass.getBidiClass ( chp );
- if ( clp != BidiConstants.NSM ) {
+ clp = BidiClass.getBidiClass (chp);
+ if (clp != BidiConstants.NSM) {
break;
}
}
}
- if ( clp != BidiConstants.AL ) {
+ if (clp != BidiConstants.AL) {
return true;
- } else if ( hasIsolateInitial ( chp ) ) {
+ } else if (hasIsolateInitial (chp)) {
return true;
} else {
return false;
}
}
- private static boolean hasInitialFollowingContext ( int[] ca, int nc, int s, int e ) {
+ private static boolean hasInitialFollowingContext (int[] ca, int nc, int s, int e) {
int chf = 0;
int clf = 0;
- for ( int i = e, n = nc; i < n; i++ ) {
+ for (int i = e, n = nc; i < n; i++) {
chf = ca [ i ];
- clf = BidiClass.getBidiClass ( chf );
- if ( clf != BidiConstants.NSM ) {
+ clf = BidiClass.getBidiClass (chf);
+ if (clf != BidiConstants.NSM) {
break;
}
}
- if ( clf != BidiConstants.AL ) {
+ if (clf != BidiConstants.AL) {
return false;
- } else if ( hasIsolateFinal ( chf ) ) {
+ } else if (hasIsolateFinal (chf)) {
return false;
} else {
return true;
}
}
- private static boolean hasMedialPrecedingContext ( int[] ca, int nc, int s, int e ) {
+ private static boolean hasMedialPrecedingContext (int[] ca, int nc, int s, int e) {
int chp = 0;
int clp = 0;
- for ( int i = s; i > 0; i-- ) {
+ for (int i = s; i > 0; i--) {
int k = i - 1;
- if ( ( k >= 0 ) && ( k < nc ) ) {
+ if ((k >= 0) && (k < nc)) {
chp = ca [ k ];
- clp = BidiClass.getBidiClass ( chp );
- if ( clp != BidiConstants.NSM ) {
+ clp = BidiClass.getBidiClass (chp);
+ if (clp != BidiConstants.NSM) {
break;
}
}
}
- if ( clp != BidiConstants.AL ) {
+ if (clp != BidiConstants.AL) {
return false;
- } else if ( hasIsolateInitial ( chp ) ) {
+ } else if (hasIsolateInitial (chp)) {
return false;
} else {
return true;
}
}
- private static boolean hasMedialThisContext ( int[] ca, int nc, int s, int e ) {
+ private static boolean hasMedialThisContext (int[] ca, int nc, int s, int e) {
int chf = 0; // first non-NSM char in [s,e)
int clf = 0;
- for ( int i = 0, n = e - s; i < n; i++ ) {
+ for (int i = 0, n = e - s; i < n; i++) {
int k = s + i;
- if ( ( k >= 0 ) && ( k < nc ) ) {
+ if ((k >= 0) && (k < nc)) {
chf = ca [ s + i ];
- clf = BidiClass.getBidiClass ( chf );
- if ( clf != BidiConstants.NSM ) {
+ clf = BidiClass.getBidiClass (chf);
+ if (clf != BidiConstants.NSM) {
break;
}
}
}
- if ( clf != BidiConstants.AL ) {
+ if (clf != BidiConstants.AL) {
return false;
}
int chl = 0; // last non-NSM char in [s,e)
int cll = 0;
- for ( int i = 0, n = e - s; i < n; i++ ) {
+ for (int i = 0, n = e - s; i < n; i++) {
int k = n - i - 1;
int j = s + k;
- if ( ( j >= 0 ) && ( j < nc ) ) {
+ if ((j >= 0) && (j < nc)) {
chl = ca [ j ];
- cll = BidiClass.getBidiClass ( chl );
- if ( cll != BidiConstants.NSM ) {
+ cll = BidiClass.getBidiClass (chl);
+ if (cll != BidiConstants.NSM) {
break;
}
}
}
- if ( cll != BidiConstants.AL ) {
+ if (cll != BidiConstants.AL) {
return false;
}
- if ( hasIsolateFinal ( chf ) ) {
+ if (hasIsolateFinal (chf)) {
return false;
- } else if ( hasIsolateInitial ( chl ) ) {
+ } else if (hasIsolateInitial (chl)) {
return false;
} else {
return true;
}
}
- private static boolean hasMedialFollowingContext ( int[] ca, int nc, int s, int e ) {
+ private static boolean hasMedialFollowingContext (int[] ca, int nc, int s, int e) {
int chf = 0;
int clf = 0;
- for ( int i = e, n = nc; i < n; i++ ) {
+ for (int i = e, n = nc; i < n; i++) {
chf = ca [ i ];
- clf = BidiClass.getBidiClass ( chf );
- if ( clf != BidiConstants.NSM ) {
+ clf = BidiClass.getBidiClass (chf);
+ if (clf != BidiConstants.NSM) {
break;
}
}
- if ( clf != BidiConstants.AL ) {
+ if (clf != BidiConstants.AL) {
return false;
- } else if ( hasIsolateFinal ( chf ) ) {
+ } else if (hasIsolateFinal (chf)) {
return false;
} else {
return true;
}
}
- private static boolean hasLigaturePrecedingContext ( int[] ca, int nc, int s, int e ) {
+ private static boolean hasLigaturePrecedingContext (int[] ca, int nc, int s, int e) {
return true;
}
- private static boolean hasLigatureFollowingContext ( int[] ca, int nc, int s, int e ) {
+ private static boolean hasLigatureFollowingContext (int[] ca, int nc, int s, int e) {
int chf = 0;
int clf = 0;
- for ( int i = e, n = nc; i < n; i++ ) {
+ for (int i = e, n = nc; i < n; i++) {
chf = ca [ i ];
- clf = BidiClass.getBidiClass ( chf );
- if ( clf != BidiConstants.NSM ) {
+ clf = BidiClass.getBidiClass (chf);
+ if (clf != BidiConstants.NSM) {
break;
}
}
- if ( clf == BidiConstants.AL ) {
+ if (clf == BidiConstants.AL) {
return true;
} else {
return false;
@@ -504,8 +504,8 @@ public class ArabicScriptProcessor extends DefaultScriptProcessor {
0x06EF // REH WITH INVERTED V
};
- private static boolean hasIsolateInitial ( int ch ) {
- return Arrays.binarySearch ( isolatedInitials, ch ) >= 0;
+ private static boolean hasIsolateInitial (int ch) {
+ return Arrays.binarySearch (isolatedInitials, ch) >= 0;
}
/**
@@ -516,8 +516,8 @@ public class ArabicScriptProcessor extends DefaultScriptProcessor {
0x0621 // HAMZA
};
- private static boolean hasIsolateFinal ( int ch ) {
- return Arrays.binarySearch ( isolatedFinals, ch ) >= 0;
+ private static boolean hasIsolateFinal (int ch) {
+ return Arrays.binarySearch (isolatedFinals, ch) >= 0;
}
}
diff --git a/src/java/org/apache/fop/complexscripts/scripts/DefaultScriptProcessor.java b/src/java/org/apache/fop/complexscripts/scripts/DefaultScriptProcessor.java
index 09a71db6a..5f49990ac 100644
--- a/src/java/org/apache/fop/complexscripts/scripts/DefaultScriptProcessor.java
+++ b/src/java/org/apache/fop/complexscripts/scripts/DefaultScriptProcessor.java
@@ -49,8 +49,8 @@ public class DefaultScriptProcessor extends ScriptProcessor {
"mkmk" // mark to mark positioning
};
- DefaultScriptProcessor ( String script ) {
- super ( script );
+ DefaultScriptProcessor (String script) {
+ super (script);
}
@Override
@@ -79,43 +79,43 @@ public class DefaultScriptProcessor extends ScriptProcessor {
@Override
/** {@inheritDoc} */
- public GlyphSequence reorderCombiningMarks ( GlyphDefinitionTable gdef, GlyphSequence gs, int[][] gpa, String script, String language ) {
+ public GlyphSequence reorderCombiningMarks (GlyphDefinitionTable gdef, GlyphSequence gs, int[][] gpa, String script, String language) {
int ng = gs.getGlyphCount();
- int[] ga = gs.getGlyphArray ( false );
+ int[] ga = gs.getGlyphArray (false);
int nm = 0;
// count combining marks
- for ( int i = 0; i < ng; i++ ) {
+ for (int i = 0; i < ng; i++) {
int gid = ga [ i ];
- if ( gdef.isGlyphClass ( gid, GlyphDefinitionTable.GLYPH_CLASS_MARK ) ) {
+ if (gdef.isGlyphClass (gid, GlyphDefinitionTable.GLYPH_CLASS_MARK)) {
nm++;
}
}
// only reorder if there is at least one mark and at least one non-mark glyph
- if ( ( nm > 0 ) && ( ( ng - nm ) > 0 ) ) {
- GlyphSequence.CharAssociation[] aa = gs.getAssociations ( 0, -1 );
+ if ((nm > 0) && ((ng - nm) > 0)) {
+ GlyphSequence.CharAssociation[] aa = gs.getAssociations (0, -1);
int[] nga = new int [ ng ];
- int[][] npa = ( gpa != null ) ? new int [ ng ][] : null;
+ int[][] npa = (gpa != null) ? new int [ ng ][] : null;
GlyphSequence.CharAssociation[] naa = new GlyphSequence.CharAssociation [ ng ];
int k = 0;
GlyphSequence.CharAssociation ba = null;
int bg = -1;
int[] bpa = null;
- for ( int i = 0; i < ng; i++ ) {
+ for (int i = 0; i < ng; i++) {
int gid = ga [ i ];
- int[] pa = ( gpa != null ) ? gpa [ i ] : null;
+ int[] pa = (gpa != null) ? gpa [ i ] : null;
GlyphSequence.CharAssociation ca = aa [ i ];
- if ( gdef.isGlyphClass ( gid, GlyphDefinitionTable.GLYPH_CLASS_MARK ) ) {
+ if (gdef.isGlyphClass (gid, GlyphDefinitionTable.GLYPH_CLASS_MARK)) {
nga [ k ] = gid;
naa [ k ] = ca;
- if ( npa != null ) {
+ if (npa != null) {
npa [ k ] = pa;
}
k++;
} else {
- if ( bg != -1 ) {
+ if (bg != -1) {
nga [ k ] = bg;
naa [ k ] = ba;
- if ( npa != null ) {
+ if (npa != null) {
npa [ k ] = bpa;
}
k++;
@@ -123,26 +123,26 @@ public class DefaultScriptProcessor extends ScriptProcessor {
ba = null;
bpa = null;
}
- if ( bg == -1 ) {
+ if (bg == -1) {
bg = gid;
ba = ca;
bpa = pa;
}
}
}
- if ( bg != -1 ) {
+ if (bg != -1) {
nga [ k ] = bg;
naa [ k ] = ba;
- if ( npa != null ) {
+ if (npa != null) {
npa [ k ] = bpa;
}
k++;
}
assert k == ng;
- if ( npa != null ) {
- System.arraycopy ( npa, 0, gpa, 0, ng );
+ if (npa != null) {
+ System.arraycopy (npa, 0, gpa, 0, ng);
}
- return new GlyphSequence ( gs, null, nga, null, null, naa, null );
+ return new GlyphSequence (gs, null, nga, null, null, naa, null);
} else {
return gs;
}
diff --git a/src/java/org/apache/fop/complexscripts/scripts/DevanagariScriptProcessor.java b/src/java/org/apache/fop/complexscripts/scripts/DevanagariScriptProcessor.java
index be8488baf..171f52d8b 100644
--- a/src/java/org/apache/fop/complexscripts/scripts/DevanagariScriptProcessor.java
+++ b/src/java/org/apache/fop/complexscripts/scripts/DevanagariScriptProcessor.java
@@ -42,8 +42,8 @@ public class DevanagariScriptProcessor extends IndicScriptProcessor {
/** logging instance */
private static final Log log = LogFactory.getLog(DevanagariScriptProcessor.class); // CSOK: ConstantNameCheck
- DevanagariScriptProcessor ( String script ) {
- super ( script );
+ DevanagariScriptProcessor (String script) {
+ super (script);
}
@Override
@@ -53,12 +53,12 @@ public class DevanagariScriptProcessor extends IndicScriptProcessor {
@Override
// find rightmost pre-base matra
- protected int findPreBaseMatra ( GlyphSequence gs ) {
+ protected int findPreBaseMatra (GlyphSequence gs) {
int ng = gs.getGlyphCount();
int lk = -1;
- for ( int i = ng; i > 0; i-- ) {
+ for (int i = ng; i > 0; i--) {
int k = i - 1;
- if ( containsPreBaseMatra ( gs, k ) ) {
+ if (containsPreBaseMatra (gs, k)) {
lk = k;
break;
}
@@ -68,15 +68,15 @@ public class DevanagariScriptProcessor extends IndicScriptProcessor {
@Override
// find leftmost pre-base matra target, starting from source
- protected int findPreBaseMatraTarget ( GlyphSequence gs, int source ) {
+ protected int findPreBaseMatraTarget (GlyphSequence gs, int source) {
int ng = gs.getGlyphCount();
int lk = -1;
- for ( int i = ( source < ng ) ? source : ng; i > 0; i-- ) {
+ for (int i = (source < ng) ? source : ng; i > 0; i--) {
int k = i - 1;
- if ( containsConsonant ( gs, k ) ) {
- if ( containsHalfConsonant ( gs, k ) ) {
+ if (containsConsonant (gs, k)) {
+ if (containsHalfConsonant (gs, k)) {
lk = k;
- } else if ( lk == -1 ) {
+ } else if (lk == -1) {
lk = k;
} else {
break;
@@ -86,39 +86,39 @@ public class DevanagariScriptProcessor extends IndicScriptProcessor {
return lk;
}
- private static boolean containsPreBaseMatra ( GlyphSequence gs, int k ) {
- GlyphSequence.CharAssociation a = gs.getAssociation ( k );
- int[] ca = gs.getCharacterArray ( false );
- for ( int i = a.getStart(), e = a.getEnd(); i < e; i++ ) {
- if ( isPreM ( ca [ i ] ) ) {
+ private static boolean containsPreBaseMatra (GlyphSequence gs, int k) {
+ GlyphSequence.CharAssociation a = gs.getAssociation (k);
+ int[] ca = gs.getCharacterArray (false);
+ for (int i = a.getStart(), e = a.getEnd(); i < e; i++) {
+ if (isPreM (ca [ i ])) {
return true;
}
}
return false;
}
- private static boolean containsConsonant ( GlyphSequence gs, int k ) {
- GlyphSequence.CharAssociation a = gs.getAssociation ( k );
- int[] ca = gs.getCharacterArray ( false );
- for ( int i = a.getStart(), e = a.getEnd(); i < e; i++ ) {
- if ( isC ( ca [ i ] ) ) {
+ private static boolean containsConsonant (GlyphSequence gs, int k) {
+ GlyphSequence.CharAssociation a = gs.getAssociation (k);
+ int[] ca = gs.getCharacterArray (false);
+ for (int i = a.getStart(), e = a.getEnd(); i < e; i++) {
+ if (isC (ca [ i ])) {
return true;
}
}
return false;
}
- private static boolean containsHalfConsonant ( GlyphSequence gs, int k ) {
- Boolean half = (Boolean) gs.getAssociation ( k ) . getPredication ( "half" );
- return ( half != null ) ? half.booleanValue() : false;
+ private static boolean containsHalfConsonant (GlyphSequence gs, int k) {
+ Boolean half = (Boolean) gs.getAssociation (k) . getPredication ("half");
+ return (half != null) ? half.booleanValue() : false;
}
@Override
- protected int findReph ( GlyphSequence gs ) {
+ protected int findReph (GlyphSequence gs) {
int ng = gs.getGlyphCount();
int li = -1;
- for ( int i = 0; i < ng; i++ ) {
- if ( containsReph ( gs, i ) ) {
+ for (int i = 0; i < ng; i++) {
+ if (containsReph (gs, i)) {
li = i;
break;
}
@@ -127,58 +127,58 @@ public class DevanagariScriptProcessor extends IndicScriptProcessor {
}
@Override
- protected int findRephTarget ( GlyphSequence gs, int source ) {
+ protected int findRephTarget (GlyphSequence gs, int source) {
int ng = gs.getGlyphCount();
int c1 = -1;
int c2 = -1;
// first candidate target is after first non-half consonant
- for ( int i = 0; i < ng; i++ ) {
- if ( ( i != source ) && containsConsonant ( gs, i ) ) {
- if ( ! containsHalfConsonant ( gs, i ) ) {
+ for (int i = 0; i < ng; i++) {
+ if ((i != source) && containsConsonant (gs, i)) {
+ if (! containsHalfConsonant (gs, i)) {
c1 = i + 1;
break;
}
}
}
// second candidate target is after last non-prebase matra after first candidate or before first syllable or vedic mark
- for ( int i = ( c1 >= 0 ) ? c1 : 0; i < ng; i++ ) {
- if ( containsMatra ( gs, i ) && ! containsPreBaseMatra ( gs, i ) ) {
+ for (int i = (c1 >= 0) ? c1 : 0; i < ng; i++) {
+ if (containsMatra (gs, i) && ! containsPreBaseMatra (gs, i)) {
c2 = i + 1;
- } else if ( containsOtherMark ( gs, i ) ) {
+ } else if (containsOtherMark (gs, i)) {
c2 = i;
break;
}
}
- if ( c2 >= 0 ) {
+ if (c2 >= 0) {
return c2;
- } else if ( c1 >= 0 ) {
+ } else if (c1 >= 0) {
return c1;
} else {
return source;
}
}
- private static boolean containsReph ( GlyphSequence gs, int k ) {
- Boolean rphf = (Boolean) gs.getAssociation ( k ) . getPredication ( "rphf" );
- return ( rphf != null ) ? rphf.booleanValue() : false;
+ private static boolean containsReph (GlyphSequence gs, int k) {
+ Boolean rphf = (Boolean) gs.getAssociation (k) . getPredication ("rphf");
+ return (rphf != null) ? rphf.booleanValue() : false;
}
- private static boolean containsMatra ( GlyphSequence gs, int k ) {
- GlyphSequence.CharAssociation a = gs.getAssociation ( k );
- int[] ca = gs.getCharacterArray ( false );
- for ( int i = a.getStart(), e = a.getEnd(); i < e; i++ ) {
- if ( isM ( ca [ i ] ) ) {
+ private static boolean containsMatra (GlyphSequence gs, int k) {
+ GlyphSequence.CharAssociation a = gs.getAssociation (k);
+ int[] ca = gs.getCharacterArray (false);
+ for (int i = a.getStart(), e = a.getEnd(); i < e; i++) {
+ if (isM (ca [ i ])) {
return true;
}
}
return false;
}
- private static boolean containsOtherMark ( GlyphSequence gs, int k ) {
- GlyphSequence.CharAssociation a = gs.getAssociation ( k );
- int[] ca = gs.getCharacterArray ( false );
- for ( int i = a.getStart(), e = a.getEnd(); i < e; i++ ) {
- switch ( typeOf ( ca [ i ] ) ) {
+ private static boolean containsOtherMark (GlyphSequence gs, int k) {
+ GlyphSequence.CharAssociation a = gs.getAssociation (k);
+ int[] ca = gs.getCharacterArray (false);
+ for (int i = a.getStart(), e = a.getEnd(); i < e; i++) {
+ switch (typeOf (ca [ i ])) {
case C_T: // tone (e.g., udatta, anudatta)
case C_A: // accent (e.g., acute, grave)
case C_O: // other (e.g., candrabindu, anusvara, visarga, etc)
@@ -191,18 +191,18 @@ public class DevanagariScriptProcessor extends IndicScriptProcessor {
}
private static class DevanagariSyllabizer extends DefaultSyllabizer {
- DevanagariSyllabizer ( String script, String language ) {
- super ( script, language );
+ DevanagariSyllabizer (String script, String language) {
+ super (script, language);
}
@Override
// | C ...
- protected int findStartOfSyllable ( int[] ca, int s, int e ) {
- if ( ( s < 0 ) || ( s >= e ) ) {
+ protected int findStartOfSyllable (int[] ca, int s, int e) {
+ if ((s < 0) || (s >= e)) {
return -1;
} else {
- while ( s < e ) {
+ while (s < e) {
int c = ca [ s ];
- if ( isC ( c ) ) {
+ if (isC (c)) {
break;
} else {
s++;
@@ -213,29 +213,29 @@ public class DevanagariScriptProcessor extends IndicScriptProcessor {
}
@Override
// D* L? | ...
- protected int findEndOfSyllable ( int[] ca, int s, int e ) {
- if ( ( s < 0 ) || ( s >= e ) ) {
+ protected int findEndOfSyllable (int[] ca, int s, int e) {
+ if ((s < 0) || (s >= e)) {
return -1;
} else {
int nd = 0;
int nl = 0;
int i;
// consume dead consonants
- while ( ( i = isDeadConsonant ( ca, s, e ) ) > s ) {
+ while ((i = isDeadConsonant (ca, s, e)) > s) {
s = i;
nd++;
}
// consume zero or one live consonant
- if ( ( i = isLiveConsonant ( ca, s, e ) ) > s ) {
+ if ((i = isLiveConsonant (ca, s, e)) > s) {
s = i;
nl++;
}
- return ( ( nd > 0 ) || ( nl > 0 ) ) ? s : -1;
+ return ((nd > 0) || (nl > 0)) ? s : -1;
}
}
// D := ( C N? H )?
- private int isDeadConsonant ( int[] ca, int s, int e ) {
- if ( s < 0 ) {
+ private int isDeadConsonant (int[] ca, int s, int e) {
+ if (s < 0) {
return -1;
} else {
int c;
@@ -244,9 +244,9 @@ public class DevanagariScriptProcessor extends IndicScriptProcessor {
int nh = 0;
do {
// C
- if ( ( s + i ) < e ) {
+ if ((s + i) < e) {
c = ca [ s + i ];
- if ( isC ( c ) ) {
+ if (isC (c)) {
i++;
nc++;
} else {
@@ -254,29 +254,29 @@ public class DevanagariScriptProcessor extends IndicScriptProcessor {
}
}
// N?
- if ( ( s + i ) < e ) {
+ if ((s + i) < e) {
c = ca [ s + 1 ];
- if ( isN ( c ) ) {
+ if (isN (c)) {
i++;
}
}
// H
- if ( ( s + i ) < e ) {
+ if ((s + i) < e) {
c = ca [ s + i ];
- if ( isH ( c ) ) {
+ if (isH (c)) {
i++;
nh++;
} else {
break;
}
}
- } while ( false );
- return ( nc > 0 ) && ( nh > 0 ) ? s + i : -1;
+ } while (false);
+ return (nc > 0) && (nh > 0) ? s + i : -1;
}
}
// L := ( (C|V) N? X* )?; where X = ( MATRA | ACCENT MARK | TONE MARK | OTHER MARK )
- private int isLiveConsonant ( int[] ca, int s, int e ) {
- if ( s < 0 ) {
+ private int isLiveConsonant (int[] ca, int s, int e) {
+ if (s < 0) {
return -1;
} else {
int c;
@@ -286,12 +286,12 @@ public class DevanagariScriptProcessor extends IndicScriptProcessor {
int nx = 0;
do {
// C
- if ( ( s + i ) < e ) {
+ if ((s + i) < e) {
c = ca [ s + i ];
- if ( isC ( c ) ) {
+ if (isC (c)) {
i++;
nc++;
- } else if ( isV ( c ) ) {
+ } else if (isV (c)) {
i++;
nv++;
} else {
@@ -299,37 +299,37 @@ public class DevanagariScriptProcessor extends IndicScriptProcessor {
}
}
// N?
- if ( ( s + i ) < e ) {
+ if ((s + i) < e) {
c = ca [ s + i ];
- if ( isN ( c ) ) {
+ if (isN (c)) {
i++;
}
}
// X*
- while ( ( s + i ) < e ) {
+ while ((s + i) < e) {
c = ca [ s + i ];
- if ( isX ( c ) ) {
+ if (isX (c)) {
i++;
nx++;
} else {
break;
}
}
- } while ( false );
+ } while (false);
// if no X but has H, then ignore C|I
- if ( nx == 0 ) {
- if ( ( s + i ) < e ) {
+ if (nx == 0) {
+ if ((s + i) < e) {
c = ca [ s + i ];
- if ( isH ( c ) ) {
- if ( nc > 0 ) {
+ if (isH (c)) {
+ if (nc > 0) {
nc--;
- } else if ( nv > 0 ) {
+ } else if (nv > 0) {
nv--;
}
}
}
}
- return ( ( nc > 0 ) || ( nv > 0 ) ) ? s + i : -1;
+ return ((nc > 0) || (nv > 0)) ? s + i : -1;
}
}
}
@@ -486,18 +486,18 @@ public class DevanagariScriptProcessor extends IndicScriptProcessor {
C_C // 0x097F // BBA (SINDHI)
};
static int typeOf(int c) {
- if ( ( c >= ccaStart ) && ( c < ccaEnd ) ) {
+ if ((c >= ccaStart) && (c < ccaEnd)) {
return cca [ c - ccaStart ] & C_M_TYPE;
} else {
return C_U;
}
}
static boolean isType(int c, int t) {
- return typeOf ( c ) == t;
+ return typeOf (c) == t;
}
static boolean hasFlag(int c, int f) {
- if ( ( c >= ccaStart ) && ( c < ccaEnd ) ) {
- return ( cca [ c - ccaStart ] & f ) == f;
+ if ((c >= ccaStart) && (c < ccaEnd)) {
+ return (cca [ c - ccaStart ] & f) == f;
} else {
return false;
}
@@ -524,7 +524,7 @@ public class DevanagariScriptProcessor extends IndicScriptProcessor {
return isType(c,C_M) && hasFlag(c,C_PRE);
}
static boolean isX(int c) {
- switch ( typeOf ( c ) ) {
+ switch (typeOf (c)) {
case C_M: // matra (combining vowel)
case C_A: // accent mark
case C_T: // tone mark
diff --git a/src/java/org/apache/fop/complexscripts/scripts/GujaratiScriptProcessor.java b/src/java/org/apache/fop/complexscripts/scripts/GujaratiScriptProcessor.java
index 480f45f87..937cc2288 100644
--- a/src/java/org/apache/fop/complexscripts/scripts/GujaratiScriptProcessor.java
+++ b/src/java/org/apache/fop/complexscripts/scripts/GujaratiScriptProcessor.java
@@ -42,8 +42,8 @@ public class GujaratiScriptProcessor extends IndicScriptProcessor {
/** logging instance */
private static final Log log = LogFactory.getLog(GujaratiScriptProcessor.class); // CSOK: ConstantNameCheck
- GujaratiScriptProcessor ( String script ) {
- super ( script );
+ GujaratiScriptProcessor (String script) {
+ super (script);
}
@Override
@@ -53,12 +53,12 @@ public class GujaratiScriptProcessor extends IndicScriptProcessor {
@Override
// find rightmost pre-base matra
- protected int findPreBaseMatra ( GlyphSequence gs ) {
+ protected int findPreBaseMatra (GlyphSequence gs) {
int ng = gs.getGlyphCount();
int lk = -1;
- for ( int i = ng; i > 0; i-- ) {
+ for (int i = ng; i > 0; i--) {
int k = i - 1;
- if ( containsPreBaseMatra ( gs, k ) ) {
+ if (containsPreBaseMatra (gs, k)) {
lk = k;
break;
}
@@ -68,15 +68,15 @@ public class GujaratiScriptProcessor extends IndicScriptProcessor {
@Override
// find leftmost pre-base matra target, starting from source
- protected int findPreBaseMatraTarget ( GlyphSequence gs, int source ) {
+ protected int findPreBaseMatraTarget (GlyphSequence gs, int source) {
int ng = gs.getGlyphCount();
int lk = -1;
- for ( int i = ( source < ng ) ? source : ng; i > 0; i-- ) {
+ for (int i = (source < ng) ? source : ng; i > 0; i--) {
int k = i - 1;
- if ( containsConsonant ( gs, k ) ) {
- if ( containsHalfConsonant ( gs, k ) ) {
+ if (containsConsonant (gs, k)) {
+ if (containsHalfConsonant (gs, k)) {
lk = k;
- } else if ( lk == -1 ) {
+ } else if (lk == -1) {
lk = k;
} else {
break;
@@ -86,39 +86,39 @@ public class GujaratiScriptProcessor extends IndicScriptProcessor {
return lk;
}
- private static boolean containsPreBaseMatra ( GlyphSequence gs, int k ) {
- GlyphSequence.CharAssociation a = gs.getAssociation ( k );
- int[] ca = gs.getCharacterArray ( false );
- for ( int i = a.getStart(), e = a.getEnd(); i < e; i++ ) {
- if ( isPreM ( ca [ i ] ) ) {
+ private static boolean containsPreBaseMatra (GlyphSequence gs, int k) {
+ GlyphSequence.CharAssociation a = gs.getAssociation (k);
+ int[] ca = gs.getCharacterArray (false);
+ for (int i = a.getStart(), e = a.getEnd(); i < e; i++) {
+ if (isPreM (ca [ i ])) {
return true;
}
}
return false;
}
- private static boolean containsConsonant ( GlyphSequence gs, int k ) {
- GlyphSequence.CharAssociation a = gs.getAssociation ( k );
- int[] ca = gs.getCharacterArray ( false );
- for ( int i = a.getStart(), e = a.getEnd(); i < e; i++ ) {
- if ( isC ( ca [ i ] ) ) {
+ private static boolean containsConsonant (GlyphSequence gs, int k) {
+ GlyphSequence.CharAssociation a = gs.getAssociation (k);
+ int[] ca = gs.getCharacterArray (false);
+ for (int i = a.getStart(), e = a.getEnd(); i < e; i++) {
+ if (isC (ca [ i ])) {
return true;
}
}
return false;
}
- private static boolean containsHalfConsonant ( GlyphSequence gs, int k ) {
- Boolean half = (Boolean) gs.getAssociation ( k ) . getPredication ( "half" );
- return ( half != null ) ? half.booleanValue() : false;
+ private static boolean containsHalfConsonant (GlyphSequence gs, int k) {
+ Boolean half = (Boolean) gs.getAssociation (k) . getPredication ("half");
+ return (half != null) ? half.booleanValue() : false;
}
@Override
- protected int findReph ( GlyphSequence gs ) {
+ protected int findReph (GlyphSequence gs) {
int ng = gs.getGlyphCount();
int li = -1;
- for ( int i = 0; i < ng; i++ ) {
- if ( containsReph ( gs, i ) ) {
+ for (int i = 0; i < ng; i++) {
+ if (containsReph (gs, i)) {
li = i;
break;
}
@@ -127,58 +127,58 @@ public class GujaratiScriptProcessor extends IndicScriptProcessor {
}
@Override
- protected int findRephTarget ( GlyphSequence gs, int source ) {
+ protected int findRephTarget (GlyphSequence gs, int source) {
int ng = gs.getGlyphCount();
int c1 = -1;
int c2 = -1;
// first candidate target is after first non-half consonant
- for ( int i = 0; i < ng; i++ ) {
- if ( ( i != source ) && containsConsonant ( gs, i ) ) {
- if ( ! containsHalfConsonant ( gs, i ) ) {
+ for (int i = 0; i < ng; i++) {
+ if ((i != source) && containsConsonant (gs, i)) {
+ if (! containsHalfConsonant (gs, i)) {
c1 = i + 1;
break;
}
}
}
// second candidate target is after last non-prebase matra after first candidate or before first syllable or vedic mark
- for ( int i = ( c1 >= 0 ) ? c1 : 0; i < ng; i++ ) {
- if ( containsMatra ( gs, i ) && ! containsPreBaseMatra ( gs, i ) ) {
+ for (int i = (c1 >= 0) ? c1 : 0; i < ng; i++) {
+ if (containsMatra (gs, i) && ! containsPreBaseMatra (gs, i)) {
c2 = i + 1;
- } else if ( containsOtherMark ( gs, i ) ) {
+ } else if (containsOtherMark (gs, i)) {
c2 = i;
break;
}
}
- if ( c2 >= 0 ) {
+ if (c2 >= 0) {
return c2;
- } else if ( c1 >= 0 ) {
+ } else if (c1 >= 0) {
return c1;
} else {
return source;
}
}
- private static boolean containsReph ( GlyphSequence gs, int k ) {
- Boolean rphf = (Boolean) gs.getAssociation ( k ) . getPredication ( "rphf" );
- return ( rphf != null ) ? rphf.booleanValue() : false;
+ private static boolean containsReph (GlyphSequence gs, int k) {
+ Boolean rphf = (Boolean) gs.getAssociation (k) . getPredication ("rphf");
+ return (rphf != null) ? rphf.booleanValue() : false;
}
- private static boolean containsMatra ( GlyphSequence gs, int k ) {
- GlyphSequence.CharAssociation a = gs.getAssociation ( k );
- int[] ca = gs.getCharacterArray ( false );
- for ( int i = a.getStart(), e = a.getEnd(); i < e; i++ ) {
- if ( isM ( ca [ i ] ) ) {
+ private static boolean containsMatra (GlyphSequence gs, int k) {
+ GlyphSequence.CharAssociation a = gs.getAssociation (k);
+ int[] ca = gs.getCharacterArray (false);
+ for (int i = a.getStart(), e = a.getEnd(); i < e; i++) {
+ if (isM (ca [ i ])) {
return true;
}
}
return false;
}
- private static boolean containsOtherMark ( GlyphSequence gs, int k ) {
- GlyphSequence.CharAssociation a = gs.getAssociation ( k );
- int[] ca = gs.getCharacterArray ( false );
- for ( int i = a.getStart(), e = a.getEnd(); i < e; i++ ) {
- switch ( typeOf ( ca [ i ] ) ) {
+ private static boolean containsOtherMark (GlyphSequence gs, int k) {
+ GlyphSequence.CharAssociation a = gs.getAssociation (k);
+ int[] ca = gs.getCharacterArray (false);
+ for (int i = a.getStart(), e = a.getEnd(); i < e; i++) {
+ switch (typeOf (ca [ i ])) {
case C_T: // tone (e.g., udatta, anudatta)
case C_A: // accent (e.g., acute, grave)
case C_O: // other (e.g., candrabindu, anusvara, visarga, etc)
@@ -191,18 +191,18 @@ public class GujaratiScriptProcessor extends IndicScriptProcessor {
}
private static class GujaratiSyllabizer extends DefaultSyllabizer {
- GujaratiSyllabizer ( String script, String language ) {
- super ( script, language );
+ GujaratiSyllabizer (String script, String language) {
+ super (script, language);
}
@Override
// | C ...
- protected int findStartOfSyllable ( int[] ca, int s, int e ) {
- if ( ( s < 0 ) || ( s >= e ) ) {
+ protected int findStartOfSyllable (int[] ca, int s, int e) {
+ if ((s < 0) || (s >= e)) {
return -1;
} else {
- while ( s < e ) {
+ while (s < e) {
int c = ca [ s ];
- if ( isC ( c ) ) {
+ if (isC (c)) {
break;
} else {
s++;
@@ -213,29 +213,29 @@ public class GujaratiScriptProcessor extends IndicScriptProcessor {
}
@Override
// D* L? | ...
- protected int findEndOfSyllable ( int[] ca, int s, int e ) {
- if ( ( s < 0 ) || ( s >= e ) ) {
+ protected int findEndOfSyllable (int[] ca, int s, int e) {
+ if ((s < 0) || (s >= e)) {
return -1;
} else {
int nd = 0;
int nl = 0;
int i;
// consume dead consonants
- while ( ( i = isDeadConsonant ( ca, s, e ) ) > s ) {
+ while ((i = isDeadConsonant (ca, s, e)) > s) {
s = i;
nd++;
}
// consume zero or one live consonant
- if ( ( i = isLiveConsonant ( ca, s, e ) ) > s ) {
+ if ((i = isLiveConsonant (ca, s, e)) > s) {
s = i;
nl++;
}
- return ( ( nd > 0 ) || ( nl > 0 ) ) ? s : -1;
+ return ((nd > 0) || (nl > 0)) ? s : -1;
}
}
// D := ( C N? H )?
- private int isDeadConsonant ( int[] ca, int s, int e ) {
- if ( s < 0 ) {
+ private int isDeadConsonant (int[] ca, int s, int e) {
+ if (s < 0) {
return -1;
} else {
int c;
@@ -244,9 +244,9 @@ public class GujaratiScriptProcessor extends IndicScriptProcessor {
int nh = 0;
do {
// C
- if ( ( s + i ) < e ) {
+ if ((s + i) < e) {
c = ca [ s + i ];
- if ( isC ( c ) ) {
+ if (isC (c)) {
i++;
nc++;
} else {
@@ -254,29 +254,29 @@ public class GujaratiScriptProcessor extends IndicScriptProcessor {
}
}
// N?
- if ( ( s + i ) < e ) {
+ if ((s + i) < e) {
c = ca [ s + 1 ];
- if ( isN ( c ) ) {
+ if (isN (c)) {
i++;
}
}
// H
- if ( ( s + i ) < e ) {
+ if ((s + i) < e) {
c = ca [ s + i ];
- if ( isH ( c ) ) {
+ if (isH (c)) {
i++;
nh++;
} else {
break;
}
}
- } while ( false );
- return ( nc > 0 ) && ( nh > 0 ) ? s + i : -1;
+ } while (false);
+ return (nc > 0) && (nh > 0) ? s + i : -1;
}
}
// L := ( (C|V) N? X* )?; where X = ( MATRA | ACCENT MARK | TONE MARK | OTHER MARK )
- private int isLiveConsonant ( int[] ca, int s, int e ) {
- if ( s < 0 ) {
+ private int isLiveConsonant (int[] ca, int s, int e) {
+ if (s < 0) {
return -1;
} else {
int c;
@@ -286,12 +286,12 @@ public class GujaratiScriptProcessor extends IndicScriptProcessor {
int nx = 0;
do {
// C
- if ( ( s + i ) < e ) {
+ if ((s + i) < e) {
c = ca [ s + i ];
- if ( isC ( c ) ) {
+ if (isC (c)) {
i++;
nc++;
- } else if ( isV ( c ) ) {
+ } else if (isV (c)) {
i++;
nv++;
} else {
@@ -299,37 +299,37 @@ public class GujaratiScriptProcessor extends IndicScriptProcessor {
}
}
// N?
- if ( ( s + i ) < e ) {
+ if ((s + i) < e) {
c = ca [ s + i ];
- if ( isN ( c ) ) {
+ if (isN (c)) {
i++;
}
}
// X*
- while ( ( s + i ) < e ) {
+ while ((s + i) < e) {
c = ca [ s + i ];
- if ( isX ( c ) ) {
+ if (isX (c)) {
i++;
nx++;
} else {
break;
}
}
- } while ( false );
+ } while (false);
// if no X but has H, then ignore C|I
- if ( nx == 0 ) {
- if ( ( s + i ) < e ) {
+ if (nx == 0) {
+ if ((s + i) < e) {
c = ca [ s + i ];
- if ( isH ( c ) ) {
- if ( nc > 0 ) {
+ if (isH (c)) {
+ if (nc > 0) {
nc--;
- } else if ( nv > 0 ) {
+ } else if (nv > 0) {
nv--;
}
}
}
}
- return ( ( nc > 0 ) || ( nv > 0 ) ) ? s + i : -1;
+ return ((nc > 0) || (nv > 0)) ? s + i : -1;
}
}
}
@@ -486,18 +486,18 @@ public class GujaratiScriptProcessor extends IndicScriptProcessor {
C_U // 0x0AFF // UNASSIGNED
};
static int typeOf(int c) {
- if ( ( c >= ccaStart ) && ( c < ccaEnd ) ) {
+ if ((c >= ccaStart) && (c < ccaEnd)) {
return cca [ c - ccaStart ] & C_M_TYPE;
} else {
return C_U;
}
}
static boolean isType(int c, int t) {
- return typeOf ( c ) == t;
+ return typeOf (c) == t;
}
static boolean hasFlag(int c, int f) {
- if ( ( c >= ccaStart ) && ( c < ccaEnd ) ) {
- return ( cca [ c - ccaStart ] & f ) == f;
+ if ((c >= ccaStart) && (c < ccaEnd)) {
+ return (cca [ c - ccaStart ] & f) == f;
} else {
return false;
}
@@ -524,7 +524,7 @@ public class GujaratiScriptProcessor extends IndicScriptProcessor {
return isType(c,C_M) && hasFlag(c,C_PRE);
}
static boolean isX(int c) {
- switch ( typeOf ( c ) ) {
+ switch (typeOf (c)) {
case C_M: // matra (combining vowel)
case C_A: // accent mark
case C_T: // tone mark
diff --git a/src/java/org/apache/fop/complexscripts/scripts/GurmukhiScriptProcessor.java b/src/java/org/apache/fop/complexscripts/scripts/GurmukhiScriptProcessor.java
index 5fd84bfce..2da632574 100644
--- a/src/java/org/apache/fop/complexscripts/scripts/GurmukhiScriptProcessor.java
+++ b/src/java/org/apache/fop/complexscripts/scripts/GurmukhiScriptProcessor.java
@@ -43,8 +43,8 @@ public class GurmukhiScriptProcessor extends IndicScriptProcessor {
/** logging instance */
private static final Log log = LogFactory.getLog(GurmukhiScriptProcessor.class); // CSOK: ConstantNameCheck
- GurmukhiScriptProcessor ( String script ) {
- super ( script );
+ GurmukhiScriptProcessor (String script) {
+ super (script);
}
@Override
@@ -54,12 +54,12 @@ public class GurmukhiScriptProcessor extends IndicScriptProcessor {
@Override
// find rightmost pre-base matra
- protected int findPreBaseMatra ( GlyphSequence gs ) {
+ protected int findPreBaseMatra (GlyphSequence gs) {
int ng = gs.getGlyphCount();
int lk = -1;
- for ( int i = ng; i > 0; i-- ) {
+ for (int i = ng; i > 0; i--) {
int k = i - 1;
- if ( containsPreBaseMatra ( gs, k ) ) {
+ if (containsPreBaseMatra (gs, k)) {
lk = k;
break;
}
@@ -69,15 +69,15 @@ public class GurmukhiScriptProcessor extends IndicScriptProcessor {
@Override
// find leftmost pre-base matra target, starting from source
- protected int findPreBaseMatraTarget ( GlyphSequence gs, int source ) {
+ protected int findPreBaseMatraTarget (GlyphSequence gs, int source) {
int ng = gs.getGlyphCount();
int lk = -1;
- for ( int i = ( source < ng ) ? source : ng; i > 0; i-- ) {
+ for (int i = (source < ng) ? source : ng; i > 0; i--) {
int k = i - 1;
- if ( containsConsonant ( gs, k ) ) {
- if ( containsHalfConsonant ( gs, k ) ) {
+ if (containsConsonant (gs, k)) {
+ if (containsHalfConsonant (gs, k)) {
lk = k;
- } else if ( lk == -1 ) {
+ } else if (lk == -1) {
lk = k;
} else {
break;
@@ -87,39 +87,39 @@ public class GurmukhiScriptProcessor extends IndicScriptProcessor {
return lk;
}
- private static boolean containsPreBaseMatra ( GlyphSequence gs, int k ) {
- GlyphSequence.CharAssociation a = gs.getAssociation ( k );
- int[] ca = gs.getCharacterArray ( false );
- for ( int i = a.getStart(), e = a.getEnd(); i < e; i++ ) {
- if ( isPreM ( ca [ i ] ) ) {
+ private static boolean containsPreBaseMatra (GlyphSequence gs, int k) {
+ GlyphSequence.CharAssociation a = gs.getAssociation (k);
+ int[] ca = gs.getCharacterArray (false);
+ for (int i = a.getStart(), e = a.getEnd(); i < e; i++) {
+ if (isPreM (ca [ i ])) {
return true;
}
}
return false;
}
- private static boolean containsConsonant ( GlyphSequence gs, int k ) {
- GlyphSequence.CharAssociation a = gs.getAssociation ( k );
- int[] ca = gs.getCharacterArray ( false );
- for ( int i = a.getStart(), e = a.getEnd(); i < e; i++ ) {
- if ( isC ( ca [ i ] ) ) {
+ private static boolean containsConsonant (GlyphSequence gs, int k) {
+ GlyphSequence.CharAssociation a = gs.getAssociation (k);
+ int[] ca = gs.getCharacterArray (false);
+ for (int i = a.getStart(), e = a.getEnd(); i < e; i++) {
+ if (isC (ca [ i ])) {
return true;
}
}
return false;
}
- private static boolean containsHalfConsonant ( GlyphSequence gs, int k ) {
- Boolean half = (Boolean) gs.getAssociation ( k ) . getPredication ( "half" );
- return ( half != null ) ? half.booleanValue() : false;
+ private static boolean containsHalfConsonant (GlyphSequence gs, int k) {
+ Boolean half = (Boolean) gs.getAssociation (k) . getPredication ("half");
+ return (half != null) ? half.booleanValue() : false;
}
@Override
- protected int findReph ( GlyphSequence gs ) {
+ protected int findReph (GlyphSequence gs) {
int ng = gs.getGlyphCount();
int li = -1;
- for ( int i = 0; i < ng; i++ ) {
- if ( containsReph ( gs, i ) ) {
+ for (int i = 0; i < ng; i++) {
+ if (containsReph (gs, i)) {
li = i;
break;
}
@@ -128,58 +128,58 @@ public class GurmukhiScriptProcessor extends IndicScriptProcessor {
}
@Override
- protected int findRephTarget ( GlyphSequence gs, int source ) {
+ protected int findRephTarget (GlyphSequence gs, int source) {
int ng = gs.getGlyphCount();
int c1 = -1;
int c2 = -1;
// first candidate target is after first non-half consonant
- for ( int i = 0; i < ng; i++ ) {
- if ( ( i != source ) && containsConsonant ( gs, i ) ) {
- if ( ! containsHalfConsonant ( gs, i ) ) {
+ for (int i = 0; i < ng; i++) {
+ if ((i != source) && containsConsonant (gs, i)) {
+ if (! containsHalfConsonant (gs, i)) {
c1 = i + 1;
break;
}
}
}
// second candidate target is after last non-prebase matra after first candidate or before first syllable or vedic mark
- for ( int i = ( c1 >= 0 ) ? c1 : 0; i < ng; i++ ) {
- if ( containsMatra ( gs, i ) && ! containsPreBaseMatra ( gs, i ) ) {
+ for (int i = (c1 >= 0) ? c1 : 0; i < ng; i++) {
+ if (containsMatra (gs, i) && ! containsPreBaseMatra (gs, i)) {
c2 = i + 1;
- } else if ( containsOtherMark ( gs, i ) ) {
+ } else if (containsOtherMark (gs, i)) {
c2 = i;
break;
}
}
- if ( c2 >= 0 ) {
+ if (c2 >= 0) {
return c2;
- } else if ( c1 >= 0 ) {
+ } else if (c1 >= 0) {
return c1;
} else {
return source;
}
}
- private static boolean containsReph ( GlyphSequence gs, int k ) {
- Boolean rphf = (Boolean) gs.getAssociation ( k ) . getPredication ( "rphf" );
- return ( rphf != null ) ? rphf.booleanValue() : false;
+ private static boolean containsReph (GlyphSequence gs, int k) {
+ Boolean rphf = (Boolean) gs.getAssociation (k) . getPredication ("rphf");
+ return (rphf != null) ? rphf.booleanValue() : false;
}
- private static boolean containsMatra ( GlyphSequence gs, int k ) {
- GlyphSequence.CharAssociation a = gs.getAssociation ( k );
- int[] ca = gs.getCharacterArray ( false );
- for ( int i = a.getStart(), e = a.getEnd(); i < e; i++ ) {
- if ( isM ( ca [ i ] ) ) {
+ private static boolean containsMatra (GlyphSequence gs, int k) {
+ GlyphSequence.CharAssociation a = gs.getAssociation (k);
+ int[] ca = gs.getCharacterArray (false);
+ for (int i = a.getStart(), e = a.getEnd(); i < e; i++) {
+ if (isM (ca [ i ])) {
return true;
}
}
return false;
}
- private static boolean containsOtherMark ( GlyphSequence gs, int k ) {
- GlyphSequence.CharAssociation a = gs.getAssociation ( k );
- int[] ca = gs.getCharacterArray ( false );
- for ( int i = a.getStart(), e = a.getEnd(); i < e; i++ ) {
- switch ( typeOf ( ca [ i ] ) ) {
+ private static boolean containsOtherMark (GlyphSequence gs, int k) {
+ GlyphSequence.CharAssociation a = gs.getAssociation (k);
+ int[] ca = gs.getCharacterArray (false);
+ for (int i = a.getStart(), e = a.getEnd(); i < e; i++) {
+ switch (typeOf (ca [ i ])) {
case C_T: // tone (e.g., udatta, anudatta)
case C_A: // accent (e.g., acute, grave)
case C_O: // other (e.g., candrabindu, anusvara, visarga, etc)
@@ -192,18 +192,18 @@ public class GurmukhiScriptProcessor extends IndicScriptProcessor {
}
private static class GurmukhiSyllabizer extends DefaultSyllabizer {
- GurmukhiSyllabizer ( String script, String language ) {
- super ( script, language );
+ GurmukhiSyllabizer (String script, String language) {
+ super (script, language);
}
@Override
// | C ...
- protected int findStartOfSyllable ( int[] ca, int s, int e ) {
- if ( ( s < 0 ) || ( s >= e ) ) {
+ protected int findStartOfSyllable (int[] ca, int s, int e) {
+ if ((s < 0) || (s >= e)) {
return -1;
} else {
- while ( s < e ) {
+ while (s < e) {
int c = ca [ s ];
- if ( isC ( c ) ) {
+ if (isC (c)) {
break;
} else {
s++;
@@ -214,29 +214,29 @@ public class GurmukhiScriptProcessor extends IndicScriptProcessor {
}
@Override
// D* L? | ...
- protected int findEndOfSyllable ( int[] ca, int s, int e ) {
- if ( ( s < 0 ) || ( s >= e ) ) {
+ protected int findEndOfSyllable (int[] ca, int s, int e) {
+ if ((s < 0) || (s >= e)) {
return -1;
} else {
int nd = 0;
int nl = 0;
int i;
// consume dead consonants
- while ( ( i = isDeadConsonant ( ca, s, e ) ) > s ) {
+ while ((i = isDeadConsonant (ca, s, e)) > s) {
s = i;
nd++;
}
// consume zero or one live consonant
- if ( ( i = isLiveConsonant ( ca, s, e ) ) > s ) {
+ if ((i = isLiveConsonant (ca, s, e)) > s) {
s = i;
nl++;
}
- return ( ( nd > 0 ) || ( nl > 0 ) ) ? s : -1;
+ return ((nd > 0) || (nl > 0)) ? s : -1;
}
}
// D := ( C N? H )?
- private int isDeadConsonant ( int[] ca, int s, int e ) {
- if ( s < 0 ) {
+ private int isDeadConsonant (int[] ca, int s, int e) {
+ if (s < 0) {
return -1;
} else {
int c;
@@ -245,9 +245,9 @@ public class GurmukhiScriptProcessor extends IndicScriptProcessor {
int nh = 0;
do {
// C
- if ( ( s + i ) < e ) {
+ if ((s + i) < e) {
c = ca [ s + i ];
- if ( isC ( c ) ) {
+ if (isC (c)) {
i++;
nc++;
} else {
@@ -255,29 +255,29 @@ public class GurmukhiScriptProcessor extends IndicScriptProcessor {
}
}
// N?
- if ( ( s + i ) < e ) {
+ if ((s + i) < e) {
c = ca [ s + 1 ];
- if ( isN ( c ) ) {
+ if (isN (c)) {
i++;
}
}
// H
- if ( ( s + i ) < e ) {
+ if ((s + i) < e) {
c = ca [ s + i ];
- if ( isH ( c ) ) {
+ if (isH (c)) {
i++;
nh++;
} else {
break;
}
}
- } while ( false );
- return ( nc > 0 ) && ( nh > 0 ) ? s + i : -1;
+ } while (false);
+ return (nc > 0) && (nh > 0) ? s + i : -1;
}
}
// L := ( (C|V) N? X* )?; where X = ( MATRA | ACCENT MARK | TONE MARK | OTHER MARK )
- private int isLiveConsonant ( int[] ca, int s, int e ) {
- if ( s < 0 ) {
+ private int isLiveConsonant (int[] ca, int s, int e) {
+ if (s < 0) {
return -1;
} else {
int c;
@@ -287,12 +287,12 @@ public class GurmukhiScriptProcessor extends IndicScriptProcessor {
int nx = 0;
do {
// C
- if ( ( s + i ) < e ) {
+ if ((s + i) < e) {
c = ca [ s + i ];
- if ( isC ( c ) ) {
+ if (isC (c)) {
i++;
nc++;
- } else if ( isV ( c ) ) {
+ } else if (isV (c)) {
i++;
nv++;
} else {
@@ -300,37 +300,37 @@ public class GurmukhiScriptProcessor extends IndicScriptProcessor {
}
}
// N?
- if ( ( s + i ) < e ) {
+ if ((s + i) < e) {
c = ca [ s + i ];
- if ( isN ( c ) ) {
+ if (isN (c)) {
i++;
}
}
// X*
- while ( ( s + i ) < e ) {
+ while ((s + i) < e) {
c = ca [ s + i ];
- if ( isX ( c ) ) {
+ if (isX (c)) {
i++;
nx++;
} else {
break;
}
}
- } while ( false );
+ } while (false);
// if no X but has H, then ignore C|I
- if ( nx == 0 ) {
- if ( ( s + i ) < e ) {
+ if (nx == 0) {
+ if ((s + i) < e) {
c = ca [ s + i ];
- if ( isH ( c ) ) {
- if ( nc > 0 ) {
+ if (isH (c)) {
+ if (nc > 0) {
nc--;
- } else if ( nv > 0 ) {
+ } else if (nv > 0) {
nv--;
}
}
}
}
- return ( ( nc > 0 ) || ( nv > 0 ) ) ? s + i : -1;
+ return ((nc > 0) || (nv > 0)) ? s + i : -1;
}
}
}
@@ -487,18 +487,18 @@ public class GurmukhiScriptProcessor extends IndicScriptProcessor {
C_U // 0x0A7F // UNASSIGNED
};
static int typeOf(int c) {
- if ( ( c >= ccaStart ) && ( c < ccaEnd ) ) {
+ if ((c >= ccaStart) && (c < ccaEnd)) {
return cca [ c - ccaStart ] & C_M_TYPE;
} else {
return C_U;
}
}
static boolean isType(int c, int t) {
- return typeOf ( c ) == t;
+ return typeOf (c) == t;
}
static boolean hasFlag(int c, int f) {
- if ( ( c >= ccaStart ) && ( c < ccaEnd ) ) {
- return ( cca [ c - ccaStart ] & f ) == f;
+ if ((c >= ccaStart) && (c < ccaEnd)) {
+ return (cca [ c - ccaStart ] & f) == f;
} else {
return false;
}
@@ -525,7 +525,7 @@ public class GurmukhiScriptProcessor extends IndicScriptProcessor {
return isType(c,C_M) && hasFlag(c,C_PRE);
}
static boolean isX(int c) {
- switch ( typeOf ( c ) ) {
+ switch (typeOf (c)) {
case C_M: // matra (combining vowel)
case C_A: // accent mark
case C_T: // tone mark
@@ -543,8 +543,8 @@ public class GurmukhiScriptProcessor extends IndicScriptProcessor {
}
@Override
- public GlyphSequence reorderCombiningMarks ( GlyphDefinitionTable gdef, GlyphSequence gs, int[][] gpa, String script, String language ) {
- return super.reorderCombiningMarks ( gdef, gs, gpa, script, language );
+ public GlyphSequence reorderCombiningMarks (GlyphDefinitionTable gdef, GlyphSequence gs, int[][] gpa, String script, String language) {
+ return super.reorderCombiningMarks (gdef, gs, gpa, script, language);
}
}
diff --git a/src/java/org/apache/fop/complexscripts/scripts/IndicScriptProcessor.java b/src/java/org/apache/fop/complexscripts/scripts/IndicScriptProcessor.java
index 26249bc22..3175884cb 100644
--- a/src/java/org/apache/fop/complexscripts/scripts/IndicScriptProcessor.java
+++ b/src/java/org/apache/fop/complexscripts/scripts/IndicScriptProcessor.java
@@ -105,15 +105,15 @@ public class IndicScriptProcessor extends DefaultScriptProcessor {
private static class SubstitutionScriptContextTester implements ScriptContextTester {
private static Map/*<String,GlyphContextTester>*/ testerMap = new HashMap/*<String,GlyphContextTester>*/();
- public GlyphContextTester getTester ( String feature ) {
- return (GlyphContextTester) testerMap.get ( feature );
+ public GlyphContextTester getTester (String feature) {
+ return (GlyphContextTester) testerMap.get (feature);
}
}
private static class PositioningScriptContextTester implements ScriptContextTester {
private static Map/*<String,GlyphContextTester>*/ testerMap = new HashMap/*<String,GlyphContextTester>*/();
- public GlyphContextTester getTester ( String feature ) {
- return (GlyphContextTester) testerMap.get ( feature );
+ public GlyphContextTester getTester (String feature) {
+ return (GlyphContextTester) testerMap.get (feature);
}
}
@@ -122,28 +122,28 @@ public class IndicScriptProcessor extends DefaultScriptProcessor {
* @param script tag
* @return script processor instance
*/
- public static ScriptProcessor makeProcessor ( String script ) {
- switch ( CharScript.scriptCodeFromTag ( script ) ) {
+ public static ScriptProcessor makeProcessor (String script) {
+ switch (CharScript.scriptCodeFromTag (script)) {
case CharScript.SCRIPT_DEVANAGARI:
case CharScript.SCRIPT_DEVANAGARI_2:
- return new DevanagariScriptProcessor ( script );
+ return new DevanagariScriptProcessor (script);
case CharScript.SCRIPT_GUJARATI:
case CharScript.SCRIPT_GUJARATI_2:
- return new GujaratiScriptProcessor ( script );
+ return new GujaratiScriptProcessor (script);
case CharScript.SCRIPT_GURMUKHI:
case CharScript.SCRIPT_GURMUKHI_2:
- return new GurmukhiScriptProcessor ( script );
+ return new GurmukhiScriptProcessor (script);
// [TBD] implement other script processors
default:
- return new IndicScriptProcessor ( script );
+ return new IndicScriptProcessor (script);
}
}
private final ScriptContextTester subContextTester;
private final ScriptContextTester posContextTester;
- IndicScriptProcessor ( String script ) {
- super ( script );
+ IndicScriptProcessor (String script) {
+ super (script);
this.subContextTester = new SubstitutionScriptContextTester();
this.posContextTester = new PositioningScriptContextTester();
}
@@ -180,38 +180,38 @@ public class IndicScriptProcessor extends DefaultScriptProcessor {
/** {@inheritDoc} */
@Override
- public GlyphSequence substitute ( GlyphSequence gs, String script, String language, GlyphTable.UseSpec[] usa, ScriptContextTester sct ) {
+ public GlyphSequence substitute (GlyphSequence gs, String script, String language, GlyphTable.UseSpec[] usa, ScriptContextTester sct) {
assert usa != null;
// 1. syllabize
- GlyphSequence[] sa = syllabize ( gs, script, language );
+ GlyphSequence[] sa = syllabize (gs, script, language);
// 2. process each syllable
- for ( int i = 0, n = sa.length; i < n; i++ ) {
+ for (int i = 0, n = sa.length; i < n; i++) {
GlyphSequence s = sa [ i ];
// apply basic shaping subs
- for ( int j = 0, m = usa.length; j < m; j++ ) {
+ for (int j = 0, m = usa.length; j < m; j++) {
GlyphTable.UseSpec us = usa [ j ];
- if ( isBasicShapingUse ( us ) ) {
- s.setPredications ( true );
- s = us.substitute ( s, script, language, sct );
+ if (isBasicShapingUse (us)) {
+ s.setPredications (true);
+ s = us.substitute (s, script, language, sct);
}
}
// reorder pre-base matra
- s = reorderPreBaseMatra ( s );
+ s = reorderPreBaseMatra (s);
// reorder reph
- s = reorderReph ( s );
+ s = reorderReph (s);
// apply presentation subs
- for ( int j = 0, m = usa.length; j < m; j++ ) {
+ for (int j = 0, m = usa.length; j < m; j++) {
GlyphTable.UseSpec us = usa [ j ];
- if ( isPresentationUse ( us ) ) {
- s.setPredications ( true );
- s = us.substitute ( s, script, language, sct );
+ if (isPresentationUse (us)) {
+ s.setPredications (true);
+ s = us.substitute (s, script, language, sct);
}
}
// record result
sa [ i ] = s;
}
// 3. return reassembled substituted syllables
- return unsyllabize ( gs, sa );
+ return unsyllabize (gs, sa);
}
/**
@@ -222,12 +222,12 @@ public class IndicScriptProcessor extends DefaultScriptProcessor {
return null;
}
- private GlyphSequence[] syllabize ( GlyphSequence gs, String script, String language ) {
- return Syllabizer.getSyllabizer ( script, language, getSyllabizerClass() ) . syllabize ( gs );
+ private GlyphSequence[] syllabize (GlyphSequence gs, String script, String language) {
+ return Syllabizer.getSyllabizer (script, language, getSyllabizerClass()) . syllabize (gs);
}
- private GlyphSequence unsyllabize ( GlyphSequence gs, GlyphSequence[] sa ) {
- return GlyphSequence.join ( gs, sa );
+ private GlyphSequence unsyllabize (GlyphSequence gs, GlyphSequence[] sa) {
+ return GlyphSequence.join (gs, sa);
}
private static Set<String> basicShapingFeatures;
@@ -247,14 +247,14 @@ public class IndicScriptProcessor extends DefaultScriptProcessor {
};
static {
basicShapingFeatures = new HashSet<String>();
- for ( String s : basicShapingFeatureStrings ) {
- basicShapingFeatures.add ( s );
+ for (String s : basicShapingFeatureStrings) {
+ basicShapingFeatures.add (s);
}
}
- private boolean isBasicShapingUse ( GlyphTable.UseSpec us ) {
+ private boolean isBasicShapingUse (GlyphTable.UseSpec us) {
assert us != null;
- if ( basicShapingFeatures != null ) {
- return basicShapingFeatures.contains ( us.getFeature() );
+ if (basicShapingFeatures != null) {
+ return basicShapingFeatures.contains (us.getFeature());
} else {
return false;
}
@@ -271,26 +271,26 @@ public class IndicScriptProcessor extends DefaultScriptProcessor {
};
static {
presentationFeatures = new HashSet<String>();
- for ( String s : presentationFeatureStrings ) {
- presentationFeatures.add ( s );
+ for (String s : presentationFeatureStrings) {
+ presentationFeatures.add (s);
}
}
- private boolean isPresentationUse ( GlyphTable.UseSpec us ) {
+ private boolean isPresentationUse (GlyphTable.UseSpec us) {
assert us != null;
- if ( presentationFeatures != null ) {
- return presentationFeatures.contains ( us.getFeature() );
+ if (presentationFeatures != null) {
+ return presentationFeatures.contains (us.getFeature());
} else {
return false;
}
}
- private GlyphSequence reorderPreBaseMatra ( GlyphSequence gs ) {
+ private GlyphSequence reorderPreBaseMatra (GlyphSequence gs) {
int source;
- if ( ( source = findPreBaseMatra ( gs ) ) >= 0 ) {
+ if ((source = findPreBaseMatra (gs)) >= 0) {
int target;
- if ( ( target = findPreBaseMatraTarget ( gs, source ) ) >= 0 ) {
- if ( target != source ) {
- gs = reorder ( gs, source, target );
+ if ((target = findPreBaseMatraTarget (gs, source)) >= 0) {
+ if (target != source) {
+ gs = reorder (gs, source, target);
}
}
}
@@ -302,7 +302,7 @@ public class IndicScriptProcessor extends DefaultScriptProcessor {
* @param gs input sequence
* @return index of pre-base matra or -1 if not found
*/
- protected int findPreBaseMatra ( GlyphSequence gs ) {
+ protected int findPreBaseMatra (GlyphSequence gs) {
return -1;
}
@@ -312,17 +312,17 @@ public class IndicScriptProcessor extends DefaultScriptProcessor {
* @param source index of pre-base matra
* @return index of pre-base matra target or -1
*/
- protected int findPreBaseMatraTarget ( GlyphSequence gs, int source ) {
+ protected int findPreBaseMatraTarget (GlyphSequence gs, int source) {
return -1;
}
- private GlyphSequence reorderReph ( GlyphSequence gs ) {
+ private GlyphSequence reorderReph (GlyphSequence gs) {
int source;
- if ( ( source = findReph ( gs ) ) >= 0 ) {
+ if ((source = findReph (gs)) >= 0) {
int target;
- if ( ( target = findRephTarget ( gs, source ) ) >= 0 ) {
- if ( target != source ) {
- gs = reorder ( gs, source, target );
+ if ((target = findRephTarget (gs, source)) >= 0) {
+ if (target != source) {
+ gs = reorder (gs, source, target);
}
}
}
@@ -334,7 +334,7 @@ public class IndicScriptProcessor extends DefaultScriptProcessor {
* @param gs input sequence
* @return index of reph or -1 if not found
*/
- protected int findReph ( GlyphSequence gs ) {
+ protected int findReph (GlyphSequence gs) {
return -1;
}
@@ -344,18 +344,18 @@ public class IndicScriptProcessor extends DefaultScriptProcessor {
* @param source index of reph
* @return index of reph target or -1
*/
- protected int findRephTarget ( GlyphSequence gs, int source ) {
+ protected int findRephTarget (GlyphSequence gs, int source) {
return -1;
}
- private GlyphSequence reorder ( GlyphSequence gs, int source, int target ) {
- return GlyphSequence.reorder ( gs, source, 1, target );
+ private GlyphSequence reorder (GlyphSequence gs, int source, int target) {
+ return GlyphSequence.reorder (gs, source, 1, target);
}
/** {@inheritDoc} */
@Override
- public boolean position ( GlyphSequence gs, String script, String language, int fontSize, GlyphTable.UseSpec[] usa, int[] widths, int[][] adjustments, ScriptContextTester sct ) {
- boolean adjusted = super.position ( gs, script, language, fontSize, usa, widths, adjustments, sct );
+ public boolean position (GlyphSequence gs, String script, String language, int fontSize, GlyphTable.UseSpec[] usa, int[] widths, int[][] adjustments, ScriptContextTester sct) {
+ boolean adjusted = super.position (gs, script, language, fontSize, usa, widths, adjustments, sct);
return adjusted;
}
@@ -363,7 +363,7 @@ public class IndicScriptProcessor extends DefaultScriptProcessor {
protected abstract static class Syllabizer implements Comparable {
private String script;
private String language;
- Syllabizer ( String script, String language ) {
+ Syllabizer (String script, String language) {
this.script = script;
this.language = language;
}
@@ -373,21 +373,21 @@ public class IndicScriptProcessor extends DefaultScriptProcessor {
* @param gs input glyph sequence
* @return segmented syllabic glyph sequences
*/
- abstract GlyphSequence[] syllabize ( GlyphSequence gs );
+ abstract GlyphSequence[] syllabize (GlyphSequence gs);
/** {@inheritDoc} */
public int hashCode() {
int hc = 0;
- hc = 7 * hc + ( hc ^ script.hashCode() );
- hc = 11 * hc + ( hc ^ language.hashCode() );
+ hc = 7 * hc + (hc ^ script.hashCode());
+ hc = 11 * hc + (hc ^ language.hashCode());
return hc;
}
/** {@inheritDoc} */
- public boolean equals ( Object o ) {
- if ( o instanceof Syllabizer ) {
+ public boolean equals (Object o) {
+ if (o instanceof Syllabizer) {
Syllabizer s = (Syllabizer) o;
- if ( ! s.script.equals ( script ) ) {
+ if (! s.script.equals (script)) {
return false;
- } else if ( ! s.language.equals ( language ) ) {
+ } else if (! s.language.equals (language)) {
return false;
} else {
return true;
@@ -397,12 +397,12 @@ public class IndicScriptProcessor extends DefaultScriptProcessor {
}
}
/** {@inheritDoc} */
- public int compareTo ( Object o ) {
+ public int compareTo (Object o) {
int d;
- if ( o instanceof Syllabizer ) {
+ if (o instanceof Syllabizer) {
Syllabizer s = (Syllabizer) o;
- if ( ( d = script.compareTo ( s.script ) ) == 0 ) {
- d = language.compareTo ( s.language );
+ if ((d = script.compareTo (s.script)) == 0) {
+ d = language.compareTo (s.language);
}
} else {
d = -1;
@@ -410,32 +410,32 @@ public class IndicScriptProcessor extends DefaultScriptProcessor {
return d;
}
private static Map<String,Syllabizer> syllabizers = new HashMap<String,Syllabizer>();
- static Syllabizer getSyllabizer ( String script, String language, Class<? extends Syllabizer> syllabizerClass ) {
- String sid = makeSyllabizerId ( script, language );
- Syllabizer s = syllabizers.get ( sid );
- if ( s == null ) {
- if ( ( s = makeSyllabizer ( script, language, syllabizerClass ) ) == null ) {
- s = new DefaultSyllabizer ( script, language );
+ static Syllabizer getSyllabizer (String script, String language, Class<? extends Syllabizer> syllabizerClass) {
+ String sid = makeSyllabizerId (script, language);
+ Syllabizer s = syllabizers.get (sid);
+ if (s == null) {
+ if ((s = makeSyllabizer (script, language, syllabizerClass)) == null) {
+ s = new DefaultSyllabizer (script, language);
}
- syllabizers.put ( sid, s );
+ syllabizers.put (sid, s);
}
return s;
}
- static String makeSyllabizerId ( String script, String language ) {
+ static String makeSyllabizerId (String script, String language) {
return script + ":" + language;
}
- static Syllabizer makeSyllabizer ( String script, String language, Class<? extends Syllabizer> syllabizerClass ) {
+ static Syllabizer makeSyllabizer (String script, String language, Class<? extends Syllabizer> syllabizerClass) {
Syllabizer s;
try {
- Constructor<? extends Syllabizer> cf = syllabizerClass.getDeclaredConstructor ( new Class[] { String.class, String.class } );
- s = (Syllabizer) cf.newInstance ( script, language );
- } catch ( NoSuchMethodException e ) {
+ Constructor<? extends Syllabizer> cf = syllabizerClass.getDeclaredConstructor (new Class[] { String.class, String.class });
+ s = (Syllabizer) cf.newInstance (script, language);
+ } catch (NoSuchMethodException e) {
s = null;
- } catch ( InstantiationException e ) {
+ } catch (InstantiationException e) {
s = null;
- } catch ( IllegalAccessException e ) {
+ } catch (IllegalAccessException e) {
s = null;
- } catch ( InvocationTargetException e ) {
+ } catch (InvocationTargetException e) {
s = null;
}
return s;
@@ -444,18 +444,18 @@ public class IndicScriptProcessor extends DefaultScriptProcessor {
/** Default syllabizer. */
protected static class DefaultSyllabizer extends Syllabizer {
- DefaultSyllabizer ( String script, String language ) {
- super ( script, language );
+ DefaultSyllabizer (String script, String language) {
+ super (script, language);
}
/** {@inheritDoc} */
@Override
- GlyphSequence[] syllabize ( GlyphSequence gs ) {
- int[] ca = gs.getCharacterArray ( false );
+ GlyphSequence[] syllabize (GlyphSequence gs) {
+ int[] ca = gs.getCharacterArray (false);
int nc = gs.getCharacterCount();
- if ( nc == 0 ) {
+ if (nc == 0) {
return new GlyphSequence[] { gs };
} else {
- return segmentize ( gs, segmentize ( ca, nc ) );
+ return segmentize (gs, segmentize (ca, nc));
}
}
/**
@@ -464,30 +464,30 @@ public class IndicScriptProcessor extends DefaultScriptProcessor {
* @param nc number of characters in sequence
* @return array of syllable segments
*/
- protected Segment[] segmentize ( int[] ca, int nc ) {
- Vector<Segment> sv = new Vector<Segment> ( nc );
- for ( int s = 0, e = nc; s < e; ) {
+ protected Segment[] segmentize (int[] ca, int nc) {
+ Vector<Segment> sv = new Vector<Segment> (nc);
+ for (int s = 0, e = nc; s < e; ) {
int i;
- if ( ( i = findStartOfSyllable ( ca, s, e ) ) > s ) {
+ if ((i = findStartOfSyllable (ca, s, e)) > s) {
// from s to i is non-syllable segment
- sv.add ( new Segment ( s, i, Segment.OTHER ) );
+ sv.add (new Segment (s, i, Segment.OTHER));
s = i; // move s to start of syllable
- } else if ( i > s ) {
+ } else if (i > s) {
// from s to e is non-syllable segment
- sv.add ( new Segment ( s, e, Segment.OTHER ) );
+ sv.add (new Segment (s, e, Segment.OTHER));
s = e; // move s to end of input sequence
}
- if ( ( i = findEndOfSyllable ( ca, s, e ) ) > s ) {
+ if ((i = findEndOfSyllable (ca, s, e)) > s) {
// from s to i is syllable segment
- sv.add ( new Segment ( s, i, Segment.SYLLABLE ) );
+ sv.add (new Segment (s, i, Segment.SYLLABLE));
s = i; // move s to end of syllable
} else {
// from s to e is non-syllable segment
- sv.add ( new Segment ( s, e, Segment.OTHER ) );
+ sv.add (new Segment (s, e, Segment.OTHER));
s = e; // move s to end of input sequence
}
}
- return sv.toArray ( new Segment [ sv.size() ] );
+ return sv.toArray (new Segment [ sv.size() ]);
}
/**
* Construct array of glyph sequences from original glyph sequence and segment array.
@@ -495,28 +495,28 @@ public class IndicScriptProcessor extends DefaultScriptProcessor {
* @param sa segment array
* @return array of glyph sequences each belonging to an (ordered) segment in SA
*/
- protected GlyphSequence[] segmentize ( GlyphSequence gs, Segment[] sa ) {
+ protected GlyphSequence[] segmentize (GlyphSequence gs, Segment[] sa) {
int ng = gs.getGlyphCount();
- int[] ga = gs.getGlyphArray ( false );
- GlyphSequence.CharAssociation[] aa = gs.getAssociations ( 0, -1 );
+ int[] ga = gs.getGlyphArray (false);
+ GlyphSequence.CharAssociation[] aa = gs.getAssociations (0, -1);
Vector<GlyphSequence> nsv = new Vector<GlyphSequence>();
- for ( int i = 0, ns = sa.length; i < ns; i++ ) {
+ for (int i = 0, ns = sa.length; i < ns; i++) {
Segment s = sa [ i ];
- Vector<Integer> ngv = new Vector<Integer> ( ng );
- Vector<GlyphSequence.CharAssociation> nav = new Vector<GlyphSequence.CharAssociation> ( ng );
- for ( int j = 0; j < ng; j++ ) {
+ Vector<Integer> ngv = new Vector<Integer> (ng);
+ Vector<GlyphSequence.CharAssociation> nav = new Vector<GlyphSequence.CharAssociation> (ng);
+ for (int j = 0; j < ng; j++) {
GlyphSequence.CharAssociation ca = aa [ j ];
- if ( ca.contained ( s.getOffset(), s.getCount() ) ) {
- ngv.add ( ga [ j ] );
- nav.add ( ca );
+ if (ca.contained (s.getOffset(), s.getCount())) {
+ ngv.add (ga [ j ]);
+ nav.add (ca);
}
}
- if ( ngv.size() > 0 ) {
- nsv.add ( new GlyphSequence ( gs, null, toIntArray ( ngv ), null, null, nav.toArray ( new GlyphSequence.CharAssociation [ nav.size() ] ), null ) );
+ if (ngv.size() > 0) {
+ nsv.add (new GlyphSequence (gs, null, toIntArray (ngv), null, null, nav.toArray (new GlyphSequence.CharAssociation [ nav.size() ]), null));
}
}
- if ( nsv.size() > 0 ) {
- return nsv.toArray ( new GlyphSequence [ nsv.size() ] );
+ if (nsv.size() > 0) {
+ return nsv.toArray (new GlyphSequence [ nsv.size() ]);
} else {
return new GlyphSequence[] { gs };
}
@@ -528,7 +528,7 @@ public class IndicScriptProcessor extends DefaultScriptProcessor {
* @param e end index
* @return index of start or E if no start found
*/
- protected int findStartOfSyllable ( int[] ca, int s, int e ) {
+ protected int findStartOfSyllable (int[] ca, int s, int e) {
return e;
}
/**
@@ -538,14 +538,14 @@ public class IndicScriptProcessor extends DefaultScriptProcessor {
* @param e end index
* @return index of start or S if no end found
*/
- protected int findEndOfSyllable ( int[] ca, int s, int e ) {
+ protected int findEndOfSyllable (int[] ca, int s, int e) {
return s;
}
- private static int[] toIntArray ( Vector<Integer> iv ) {
+ private static int[] toIntArray (Vector<Integer> iv) {
int ni = iv.size();
int[] ia = new int [ iv.size() ];
- for ( int i = 0, n = ni; i < n; i++ ) {
- ia [ i ] = (int) iv.get ( i );
+ for (int i = 0, n = ni; i < n; i++) {
+ ia [ i ] = (int) iv.get (i);
}
return ia;
}
@@ -561,7 +561,7 @@ public class IndicScriptProcessor extends DefaultScriptProcessor {
private int end;
private int type;
- Segment ( int start, int end, int type ) {
+ Segment (int start, int end, int type) {
this.start = start;
this.end = end;
this.type = type;
diff --git a/src/java/org/apache/fop/complexscripts/scripts/ScriptProcessor.java b/src/java/org/apache/fop/complexscripts/scripts/ScriptProcessor.java
index d8223bf47..e6529eb2c 100644
--- a/src/java/org/apache/fop/complexscripts/scripts/ScriptProcessor.java
+++ b/src/java/org/apache/fop/complexscripts/scripts/ScriptProcessor.java
@@ -55,9 +55,9 @@ public abstract class ScriptProcessor {
* Instantiate a script processor.
* @param script a script identifier
*/
- protected ScriptProcessor ( String script ) {
- if ( ( script == null ) || ( script.length() == 0 ) ) {
- throw new IllegalArgumentException ( "script must be non-empty string" );
+ protected ScriptProcessor (String script) {
+ if ((script == null) || (script.length() == 0)) {
+ throw new IllegalArgumentException ("script must be non-empty string");
} else {
this.script = script;
this.assembledLookups = new HashMap/*<AssembledLookupsKey,GlyphTable.UseSpec[]>*/();
@@ -98,8 +98,8 @@ public abstract class ScriptProcessor {
* @param lookups a mapping from lookup specifications to glyph subtables to use for substitution processing
* @return the substituted (output) glyph sequence
*/
- public final GlyphSequence substitute ( GlyphSubstitutionTable gsub, GlyphSequence gs, String script, String language, Map/*<LookupSpec,List<LookupTable>>>*/ lookups ) {
- return substitute ( gs, script, language, assembleLookups ( gsub, getSubstitutionFeatures(), lookups ), getSubstitutionContextTester() );
+ public final GlyphSequence substitute (GlyphSubstitutionTable gsub, GlyphSequence gs, String script, String language, Map/*<LookupSpec,List<LookupTable>>>*/ lookups) {
+ return substitute (gs, script, language, assembleLookups (gsub, getSubstitutionFeatures(), lookups), getSubstitutionContextTester());
}
/**
@@ -111,11 +111,11 @@ public abstract class ScriptProcessor {
* @param sct a script specific context tester (or null)
* @return the substituted (output) glyph sequence
*/
- public GlyphSequence substitute ( GlyphSequence gs, String script, String language, GlyphTable.UseSpec[] usa, ScriptContextTester sct ) {
+ public GlyphSequence substitute (GlyphSequence gs, String script, String language, GlyphTable.UseSpec[] usa, ScriptContextTester sct) {
assert usa != null;
- for ( int i = 0, n = usa.length; i < n; i++ ) {
+ for (int i = 0, n = usa.length; i < n; i++) {
GlyphTable.UseSpec us = usa [ i ];
- gs = us.substitute ( gs, script, language, sct );
+ gs = us.substitute (gs, script, language, sct);
}
return gs;
}
@@ -132,7 +132,7 @@ public abstract class ScriptProcessor {
* @param language a language identifier
* @return the reordered (output) glyph sequence
*/
- public GlyphSequence reorderCombiningMarks ( GlyphDefinitionTable gdef, GlyphSequence gs, int[][] gpa, String script, String language ) {
+ public GlyphSequence reorderCombiningMarks (GlyphDefinitionTable gdef, GlyphSequence gs, int[][] gpa, String script, String language) {
return gs;
}
@@ -169,8 +169,8 @@ public abstract class ScriptProcessor {
* with one 4-tuple for each element of glyph sequence
* @return true if some adjustment is not zero; otherwise, false
*/
- public final boolean position ( GlyphPositioningTable gpos, GlyphSequence gs, String script, String language, int fontSize, Map/*<LookupSpec,List<LookupTable>>*/ lookups, int[] widths, int[][] adjustments ) {
- return position ( gs, script, language, fontSize, assembleLookups ( gpos, getPositioningFeatures(), lookups ), widths, adjustments, getPositioningContextTester() );
+ public final boolean position (GlyphPositioningTable gpos, GlyphSequence gs, String script, String language, int fontSize, Map/*<LookupSpec,List<LookupTable>>*/ lookups, int[] widths, int[][] adjustments) {
+ return position (gs, script, language, fontSize, assembleLookups (gpos, getPositioningFeatures(), lookups), widths, adjustments, getPositioningContextTester());
}
/**
@@ -186,12 +186,12 @@ public abstract class ScriptProcessor {
* @param sct a script specific context tester (or null)
* @return true if some adjustment is not zero; otherwise, false
*/
- public boolean position ( GlyphSequence gs, String script, String language, int fontSize, GlyphTable.UseSpec[] usa, int[] widths, int[][] adjustments, ScriptContextTester sct ) {
+ public boolean position (GlyphSequence gs, String script, String language, int fontSize, GlyphTable.UseSpec[] usa, int[] widths, int[][] adjustments, ScriptContextTester sct) {
assert usa != null;
boolean adjusted = false;
- for ( int i = 0, n = usa.length; i < n; i++ ) {
+ for (int i = 0, n = usa.length; i < n; i++) {
GlyphTable.UseSpec us = usa [ i ];
- if ( us.position ( gs, script, language, fontSize, widths, adjustments, sct ) ) {
+ if (us.position (gs, script, language, fontSize, widths, adjustments, sct)) {
adjusted = true;
}
}
@@ -206,22 +206,22 @@ public abstract class ScriptProcessor {
* @param lookups a mapping from lookup specifications to lists of look tables from which to select lookup tables according to the specified features
* @return ordered array of assembled lookup table use specifications
*/
- public final GlyphTable.UseSpec[] assembleLookups ( GlyphTable table, String[] features, Map/*<LookupSpec,List<LookupTable>>*/ lookups ) {
- AssembledLookupsKey key = new AssembledLookupsKey ( table, features, lookups );
+ public final GlyphTable.UseSpec[] assembleLookups (GlyphTable table, String[] features, Map/*<LookupSpec,List<LookupTable>>*/ lookups) {
+ AssembledLookupsKey key = new AssembledLookupsKey (table, features, lookups);
GlyphTable.UseSpec[] usa;
- if ( ( usa = assembledLookupsGet ( key ) ) != null ) {
+ if ((usa = assembledLookupsGet (key)) != null) {
return usa;
} else {
- return assembledLookupsPut ( key, table.assembleLookups ( features, lookups ) );
+ return assembledLookupsPut (key, table.assembleLookups (features, lookups));
}
}
- private GlyphTable.UseSpec[] assembledLookupsGet ( AssembledLookupsKey key ) {
- return (GlyphTable.UseSpec[]) assembledLookups.get ( key );
+ private GlyphTable.UseSpec[] assembledLookupsGet (AssembledLookupsKey key) {
+ return (GlyphTable.UseSpec[]) assembledLookups.get (key);
}
- private GlyphTable.UseSpec[] assembledLookupsPut ( AssembledLookupsKey key, GlyphTable.UseSpec[] usa ) {
- assembledLookups.put ( key, usa );
+ private GlyphTable.UseSpec[] assembledLookupsPut (AssembledLookupsKey key, GlyphTable.UseSpec[] usa) {
+ assembledLookups.put (key, usa);
return usa;
}
@@ -230,25 +230,25 @@ public abstract class ScriptProcessor {
* @param script a script identifier
* @return a script processor instance or null if none found
*/
- public static synchronized ScriptProcessor getInstance ( String script ) {
+ public static synchronized ScriptProcessor getInstance (String script) {
ScriptProcessor sp = null;
assert processors != null;
- if ( ( sp = processors.get ( script ) ) == null ) {
- processors.put ( script, sp = createProcessor ( script ) );
+ if ((sp = processors.get (script)) == null) {
+ processors.put (script, sp = createProcessor (script));
}
return sp;
}
// [TBD] - rework to provide more configurable binding between script name and script processor constructor
- private static ScriptProcessor createProcessor ( String script ) {
+ private static ScriptProcessor createProcessor (String script) {
ScriptProcessor sp = null;
- int sc = CharScript.scriptCodeFromTag ( script );
- if ( sc == CharScript.SCRIPT_ARABIC ) {
- sp = new ArabicScriptProcessor ( script );
- } else if ( CharScript.isIndicScript ( sc ) ) {
- sp = IndicScriptProcessor.makeProcessor ( script );
+ int sc = CharScript.scriptCodeFromTag (script);
+ if (sc == CharScript.SCRIPT_ARABIC) {
+ sp = new ArabicScriptProcessor (script);
+ } else if (CharScript.isIndicScript (sc)) {
+ sp = IndicScriptProcessor.makeProcessor (script);
} else {
- sp = new DefaultScriptProcessor ( script );
+ sp = new DefaultScriptProcessor (script);
}
return sp;
}
@@ -259,7 +259,7 @@ public abstract class ScriptProcessor {
private final String[] features;
private final Map/*<LookupSpec,List<LookupTable>>*/ lookups;
- AssembledLookupsKey ( GlyphTable table, String[] features, Map/*<LookupSpec,List<LookupTable>>*/ lookups ) {
+ AssembledLookupsKey (GlyphTable table, String[] features, Map/*<LookupSpec,List<LookupTable>>*/ lookups) {
this.table = table;
this.features = features;
this.lookups = lookups;
@@ -268,21 +268,21 @@ public abstract class ScriptProcessor {
/** {@inheritDoc} */
public int hashCode() {
int hc = 0;
- hc = 7 * hc + ( hc ^ table.hashCode() );
- hc = 11 * hc + ( hc ^ Arrays.hashCode ( features ) );
- hc = 17 * hc + ( hc ^ lookups.hashCode() );
+ hc = 7 * hc + (hc ^ table.hashCode());
+ hc = 11 * hc + (hc ^ Arrays.hashCode (features));
+ hc = 17 * hc + (hc ^ lookups.hashCode());
return hc;
}
/** {@inheritDoc} */
- public boolean equals ( Object o ) {
- if ( o instanceof AssembledLookupsKey ) {
+ public boolean equals (Object o) {
+ if (o instanceof AssembledLookupsKey) {
AssembledLookupsKey k = (AssembledLookupsKey) o;
- if ( ! table.equals ( k.table ) ) {
+ if (! table.equals (k.table)) {
return false;
- } else if ( ! Arrays.equals ( features, k.features ) ) {
+ } else if (! Arrays.equals (features, k.features)) {
return false;
- } else if ( ! lookups.equals ( k.lookups ) ) {
+ } else if (! lookups.equals (k.lookups)) {
return false;
} else {
return true;