diff options
author | Vincent Hennebert <vhennebert@apache.org> | 2013-05-07 16:23:13 +0000 |
---|---|---|
committer | Vincent Hennebert <vhennebert@apache.org> | 2013-05-07 16:23:13 +0000 |
commit | e8f590803ae0bb67a0d1686c47ccc2fb6d187ae8 (patch) | |
tree | 1d332afdbc04dce657b7480df6f20d4498cd0712 /src/java/org/apache/fop/complexscripts/scripts | |
parent | 4726c4f941c2179152a3c27e0dc7f62147e825f3 (diff) | |
download | xmlgraphics-fop-e8f590803ae0bb67a0d1686c47ccc2fb6d187ae8.tar.gz xmlgraphics-fop-e8f590803ae0bb67a0d1686c47ccc2fb6d187ae8.zip |
Cosmetics only: enabled Checkstyle MethodParamPad rule and fixed corresponding violations
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1479969 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/complexscripts/scripts')
7 files changed, 379 insertions, 379 deletions
diff --git a/src/java/org/apache/fop/complexscripts/scripts/ArabicScriptProcessor.java b/src/java/org/apache/fop/complexscripts/scripts/ArabicScriptProcessor.java index 740d81335..2a1e55df3 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) { 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) { 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,8 +190,8 @@ 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) { return false; @@ -202,18 +202,18 @@ public class ArabicScriptProcessor extends DefaultScriptProcessor { } } - 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) { 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) { 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,14 +242,14 @@ 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--) { int k = i - 1; if ((k >= 0) && (k < nc)) { chp = ca [ k ]; - clp = BidiClass.getBidiClass (chp); + clp = BidiClass.getBidiClass(chp); if (clp != BidiConstants.NSM) { break; } @@ -257,14 +257,14 @@ public class ArabicScriptProcessor extends DefaultScriptProcessor { } 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++) { @@ -272,7 +272,7 @@ public class ArabicScriptProcessor extends DefaultScriptProcessor { int j = s + k; if ((j >= 0) && (j < nc)) { chl = ca [ j ]; - cll = BidiClass.getBidiClass (chl); + cll = BidiClass.getBidiClass(chl); if (cll != BidiConstants.NSM) { break; } @@ -281,40 +281,40 @@ public class ArabicScriptProcessor extends DefaultScriptProcessor { 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++) { chf = ca [ i ]; - clf = BidiClass.getBidiClass (chf); + clf = BidiClass.getBidiClass(chf); if (clf != BidiConstants.NSM) { break; } } 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--) { int k = i - 1; if ((k >= 0) && (k < nc)) { chp = ca [ k ]; - clp = BidiClass.getBidiClass (chp); + clp = BidiClass.getBidiClass(chp); if (clp != BidiConstants.NSM) { break; } @@ -322,40 +322,40 @@ public class ArabicScriptProcessor extends DefaultScriptProcessor { } 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++) { chf = ca [ i ]; - clf = BidiClass.getBidiClass (chf); + clf = BidiClass.getBidiClass(chf); if (clf != BidiConstants.NSM) { break; } } 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--) { int k = i - 1; if ((k >= 0) && (k < nc)) { chp = ca [ k ]; - clp = BidiClass.getBidiClass (chp); + clp = BidiClass.getBidiClass(chp); if (clp != BidiConstants.NSM) { break; } @@ -363,21 +363,21 @@ public class ArabicScriptProcessor extends DefaultScriptProcessor { } 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++) { int k = s + i; if ((k >= 0) && (k < nc)) { chf = ca [ s + i ]; - clf = BidiClass.getBidiClass (chf); + clf = BidiClass.getBidiClass(chf); if (clf != BidiConstants.NSM) { break; } @@ -393,7 +393,7 @@ public class ArabicScriptProcessor extends DefaultScriptProcessor { int j = s + k; if ((j >= 0) && (j < nc)) { chl = ca [ j ]; - cll = BidiClass.getBidiClass (chl); + cll = BidiClass.getBidiClass(chl); if (cll != BidiConstants.NSM) { break; } @@ -402,44 +402,44 @@ public class ArabicScriptProcessor extends DefaultScriptProcessor { 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++) { chf = ca [ i ]; - clf = BidiClass.getBidiClass (chf); + clf = BidiClass.getBidiClass(chf); if (clf != BidiConstants.NSM) { break; } } 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++) { chf = ca [ i ]; - clf = BidiClass.getBidiClass (chf); + clf = BidiClass.getBidiClass(chf); if (clf != BidiConstants.NSM) { break; } @@ -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 5f49990ac..1dff3d8c4 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,20 +79,20 @@ 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++) { 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); + GlyphSequence.CharAssociation[] aa = gs.getAssociations(0, -1); int[] nga = new int [ ng ]; int[][] npa = (gpa != null) ? new int [ ng ][] : null; GlyphSequence.CharAssociation[] naa = new GlyphSequence.CharAssociation [ ng ]; @@ -104,7 +104,7 @@ public class DefaultScriptProcessor extends ScriptProcessor { int gid = ga [ i ]; 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) { @@ -140,9 +140,9 @@ public class DefaultScriptProcessor extends ScriptProcessor { } assert k == ng; if (npa != null) { - System.arraycopy (npa, 0, gpa, 0, ng); + 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 171f52d8b..d39261316 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--) { int k = i - 1; - if (containsPreBaseMatra (gs, k)) { + if (containsPreBaseMatra(gs, k)) { lk = k; break; } @@ -68,13 +68,13 @@ 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--) { 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) { lk = k; @@ -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); + 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 ])) { + 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); + 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 ])) { + if (isC(ca [ i ])) { return true; } } return false; } - private static boolean containsHalfConsonant (GlyphSequence gs, int k) { - Boolean half = (Boolean) gs.getAssociation (k) . getPredication ("half"); + 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)) { + if (containsReph(gs, i)) { li = i; break; } @@ -127,14 +127,14 @@ 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)) { + if ((i != source) && containsConsonant(gs, i)) { + if (! containsHalfConsonant(gs, i)) { c1 = i + 1; break; } @@ -142,9 +142,9 @@ public class DevanagariScriptProcessor extends IndicScriptProcessor { } // 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)) { + if (containsMatra(gs, i) && ! containsPreBaseMatra(gs, i)) { c2 = i + 1; - } else if (containsOtherMark (gs, i)) { + } else if (containsOtherMark(gs, i)) { c2 = i; break; } @@ -158,27 +158,27 @@ public class DevanagariScriptProcessor extends IndicScriptProcessor { } } - private static boolean containsReph (GlyphSequence gs, int k) { - Boolean rphf = (Boolean) gs.getAssociation (k) . getPredication ("rphf"); + 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); + 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 ])) { + 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); + 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 ])) { + 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) { + protected int findStartOfSyllable(int[] ca, int s, int e) { if ((s < 0) || (s >= e)) { return -1; } else { while (s < e) { int c = ca [ s ]; - if (isC (c)) { + if (isC(c)) { break; } else { s++; @@ -213,7 +213,7 @@ public class DevanagariScriptProcessor extends IndicScriptProcessor { } @Override // D* L? | ... - protected int findEndOfSyllable (int[] ca, int s, int e) { + protected int findEndOfSyllable(int[] ca, int s, int e) { if ((s < 0) || (s >= e)) { return -1; } else { @@ -221,12 +221,12 @@ public class DevanagariScriptProcessor extends IndicScriptProcessor { 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++; } @@ -234,7 +234,7 @@ public class DevanagariScriptProcessor extends IndicScriptProcessor { } } // D := ( C N? H )? - private int isDeadConsonant (int[] ca, int s, int e) { + private int isDeadConsonant(int[] ca, int s, int e) { if (s < 0) { return -1; } else { @@ -246,7 +246,7 @@ public class DevanagariScriptProcessor extends IndicScriptProcessor { // C if ((s + i) < e) { c = ca [ s + i ]; - if (isC (c)) { + if (isC(c)) { i++; nc++; } else { @@ -256,14 +256,14 @@ public class DevanagariScriptProcessor extends IndicScriptProcessor { // N? if ((s + i) < e) { c = ca [ s + 1 ]; - if (isN (c)) { + if (isN(c)) { i++; } } // H if ((s + i) < e) { c = ca [ s + i ]; - if (isH (c)) { + if (isH(c)) { i++; nh++; } else { @@ -275,7 +275,7 @@ public class DevanagariScriptProcessor extends IndicScriptProcessor { } } // L := ( (C|V) N? X* )?; where X = ( MATRA | ACCENT MARK | TONE MARK | OTHER MARK ) - private int isLiveConsonant (int[] ca, int s, int e) { + private int isLiveConsonant(int[] ca, int s, int e) { if (s < 0) { return -1; } else { @@ -288,10 +288,10 @@ public class DevanagariScriptProcessor extends IndicScriptProcessor { // C 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 { @@ -301,14 +301,14 @@ public class DevanagariScriptProcessor extends IndicScriptProcessor { // N? if ((s + i) < e) { c = ca [ s + i ]; - if (isN (c)) { + if (isN(c)) { i++; } } // X* while ((s + i) < e) { c = ca [ s + i ]; - if (isX (c)) { + if (isX(c)) { i++; nx++; } else { @@ -320,7 +320,7 @@ public class DevanagariScriptProcessor extends IndicScriptProcessor { if (nx == 0) { if ((s + i) < e) { c = ca [ s + i ]; - if (isH (c)) { + if (isH(c)) { if (nc > 0) { nc--; } else if (nv > 0) { @@ -493,7 +493,7 @@ public class DevanagariScriptProcessor extends IndicScriptProcessor { } } 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)) { @@ -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 937cc2288..aaf0290e8 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--) { int k = i - 1; - if (containsPreBaseMatra (gs, k)) { + if (containsPreBaseMatra(gs, k)) { lk = k; break; } @@ -68,13 +68,13 @@ 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--) { 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) { lk = k; @@ -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); + 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 ])) { + 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); + 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 ])) { + if (isC(ca [ i ])) { return true; } } return false; } - private static boolean containsHalfConsonant (GlyphSequence gs, int k) { - Boolean half = (Boolean) gs.getAssociation (k) . getPredication ("half"); + 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)) { + if (containsReph(gs, i)) { li = i; break; } @@ -127,14 +127,14 @@ 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)) { + if ((i != source) && containsConsonant(gs, i)) { + if (! containsHalfConsonant(gs, i)) { c1 = i + 1; break; } @@ -142,9 +142,9 @@ public class GujaratiScriptProcessor extends IndicScriptProcessor { } // 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)) { + if (containsMatra(gs, i) && ! containsPreBaseMatra(gs, i)) { c2 = i + 1; - } else if (containsOtherMark (gs, i)) { + } else if (containsOtherMark(gs, i)) { c2 = i; break; } @@ -158,27 +158,27 @@ public class GujaratiScriptProcessor extends IndicScriptProcessor { } } - private static boolean containsReph (GlyphSequence gs, int k) { - Boolean rphf = (Boolean) gs.getAssociation (k) . getPredication ("rphf"); + 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); + 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 ])) { + 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); + 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 ])) { + 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) { + protected int findStartOfSyllable(int[] ca, int s, int e) { if ((s < 0) || (s >= e)) { return -1; } else { while (s < e) { int c = ca [ s ]; - if (isC (c)) { + if (isC(c)) { break; } else { s++; @@ -213,7 +213,7 @@ public class GujaratiScriptProcessor extends IndicScriptProcessor { } @Override // D* L? | ... - protected int findEndOfSyllable (int[] ca, int s, int e) { + protected int findEndOfSyllable(int[] ca, int s, int e) { if ((s < 0) || (s >= e)) { return -1; } else { @@ -221,12 +221,12 @@ public class GujaratiScriptProcessor extends IndicScriptProcessor { 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++; } @@ -234,7 +234,7 @@ public class GujaratiScriptProcessor extends IndicScriptProcessor { } } // D := ( C N? H )? - private int isDeadConsonant (int[] ca, int s, int e) { + private int isDeadConsonant(int[] ca, int s, int e) { if (s < 0) { return -1; } else { @@ -246,7 +246,7 @@ public class GujaratiScriptProcessor extends IndicScriptProcessor { // C if ((s + i) < e) { c = ca [ s + i ]; - if (isC (c)) { + if (isC(c)) { i++; nc++; } else { @@ -256,14 +256,14 @@ public class GujaratiScriptProcessor extends IndicScriptProcessor { // N? if ((s + i) < e) { c = ca [ s + 1 ]; - if (isN (c)) { + if (isN(c)) { i++; } } // H if ((s + i) < e) { c = ca [ s + i ]; - if (isH (c)) { + if (isH(c)) { i++; nh++; } else { @@ -275,7 +275,7 @@ public class GujaratiScriptProcessor extends IndicScriptProcessor { } } // L := ( (C|V) N? X* )?; where X = ( MATRA | ACCENT MARK | TONE MARK | OTHER MARK ) - private int isLiveConsonant (int[] ca, int s, int e) { + private int isLiveConsonant(int[] ca, int s, int e) { if (s < 0) { return -1; } else { @@ -288,10 +288,10 @@ public class GujaratiScriptProcessor extends IndicScriptProcessor { // C 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 { @@ -301,14 +301,14 @@ public class GujaratiScriptProcessor extends IndicScriptProcessor { // N? if ((s + i) < e) { c = ca [ s + i ]; - if (isN (c)) { + if (isN(c)) { i++; } } // X* while ((s + i) < e) { c = ca [ s + i ]; - if (isX (c)) { + if (isX(c)) { i++; nx++; } else { @@ -320,7 +320,7 @@ public class GujaratiScriptProcessor extends IndicScriptProcessor { if (nx == 0) { if ((s + i) < e) { c = ca [ s + i ]; - if (isH (c)) { + if (isH(c)) { if (nc > 0) { nc--; } else if (nv > 0) { @@ -493,7 +493,7 @@ public class GujaratiScriptProcessor extends IndicScriptProcessor { } } 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)) { @@ -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 2da632574..5c41951cf 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--) { int k = i - 1; - if (containsPreBaseMatra (gs, k)) { + if (containsPreBaseMatra(gs, k)) { lk = k; break; } @@ -69,13 +69,13 @@ 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--) { 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) { lk = k; @@ -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); + 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 ])) { + 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); + 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 ])) { + if (isC(ca [ i ])) { return true; } } return false; } - private static boolean containsHalfConsonant (GlyphSequence gs, int k) { - Boolean half = (Boolean) gs.getAssociation (k) . getPredication ("half"); + 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)) { + if (containsReph(gs, i)) { li = i; break; } @@ -128,14 +128,14 @@ 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)) { + if ((i != source) && containsConsonant(gs, i)) { + if (! containsHalfConsonant(gs, i)) { c1 = i + 1; break; } @@ -143,9 +143,9 @@ public class GurmukhiScriptProcessor extends IndicScriptProcessor { } // 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)) { + if (containsMatra(gs, i) && ! containsPreBaseMatra(gs, i)) { c2 = i + 1; - } else if (containsOtherMark (gs, i)) { + } else if (containsOtherMark(gs, i)) { c2 = i; break; } @@ -159,27 +159,27 @@ public class GurmukhiScriptProcessor extends IndicScriptProcessor { } } - private static boolean containsReph (GlyphSequence gs, int k) { - Boolean rphf = (Boolean) gs.getAssociation (k) . getPredication ("rphf"); + 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); + 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 ])) { + 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); + 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 ])) { + 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) { + protected int findStartOfSyllable(int[] ca, int s, int e) { if ((s < 0) || (s >= e)) { return -1; } else { while (s < e) { int c = ca [ s ]; - if (isC (c)) { + if (isC(c)) { break; } else { s++; @@ -214,7 +214,7 @@ public class GurmukhiScriptProcessor extends IndicScriptProcessor { } @Override // D* L? | ... - protected int findEndOfSyllable (int[] ca, int s, int e) { + protected int findEndOfSyllable(int[] ca, int s, int e) { if ((s < 0) || (s >= e)) { return -1; } else { @@ -222,12 +222,12 @@ public class GurmukhiScriptProcessor extends IndicScriptProcessor { 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++; } @@ -235,7 +235,7 @@ public class GurmukhiScriptProcessor extends IndicScriptProcessor { } } // D := ( C N? H )? - private int isDeadConsonant (int[] ca, int s, int e) { + private int isDeadConsonant(int[] ca, int s, int e) { if (s < 0) { return -1; } else { @@ -247,7 +247,7 @@ public class GurmukhiScriptProcessor extends IndicScriptProcessor { // C if ((s + i) < e) { c = ca [ s + i ]; - if (isC (c)) { + if (isC(c)) { i++; nc++; } else { @@ -257,14 +257,14 @@ public class GurmukhiScriptProcessor extends IndicScriptProcessor { // N? if ((s + i) < e) { c = ca [ s + 1 ]; - if (isN (c)) { + if (isN(c)) { i++; } } // H if ((s + i) < e) { c = ca [ s + i ]; - if (isH (c)) { + if (isH(c)) { i++; nh++; } else { @@ -276,7 +276,7 @@ public class GurmukhiScriptProcessor extends IndicScriptProcessor { } } // L := ( (C|V) N? X* )?; where X = ( MATRA | ACCENT MARK | TONE MARK | OTHER MARK ) - private int isLiveConsonant (int[] ca, int s, int e) { + private int isLiveConsonant(int[] ca, int s, int e) { if (s < 0) { return -1; } else { @@ -289,10 +289,10 @@ public class GurmukhiScriptProcessor extends IndicScriptProcessor { // C 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 { @@ -302,14 +302,14 @@ public class GurmukhiScriptProcessor extends IndicScriptProcessor { // N? if ((s + i) < e) { c = ca [ s + i ]; - if (isN (c)) { + if (isN(c)) { i++; } } // X* while ((s + i) < e) { c = ca [ s + i ]; - if (isX (c)) { + if (isX(c)) { i++; nx++; } else { @@ -321,7 +321,7 @@ public class GurmukhiScriptProcessor extends IndicScriptProcessor { if (nx == 0) { if ((s + i) < e) { c = ca [ s + i ]; - if (isH (c)) { + if (isH(c)) { if (nc > 0) { nc--; } else if (nv > 0) { @@ -494,7 +494,7 @@ public class GurmukhiScriptProcessor extends IndicScriptProcessor { } } 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)) { @@ -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 3175884cb..1da3fda42 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++) { GlyphSequence s = sa [ i ]; // apply basic shaping subs 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++) { 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; @@ -248,13 +248,13 @@ public class IndicScriptProcessor extends DefaultScriptProcessor { static { basicShapingFeatures = new HashSet<String>(); for (String s : basicShapingFeatureStrings) { - basicShapingFeatures.add (s); + 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()); + return basicShapingFeatures.contains(us.getFeature()); } else { return false; } @@ -272,25 +272,25 @@ public class IndicScriptProcessor extends DefaultScriptProcessor { static { presentationFeatures = new HashSet<String>(); for (String s : presentationFeatureStrings) { - presentationFeatures.add (s); + 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()); + 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 = findPreBaseMatraTarget(gs, source)) >= 0) { if (target != source) { - gs = reorder (gs, source, target); + 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 = findRephTarget(gs, source)) >= 0) { if (target != source) { - gs = reorder (gs, source, target); + 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,7 +373,7 @@ 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; @@ -382,12 +382,12 @@ public class IndicScriptProcessor extends DefaultScriptProcessor { return hc; } /** {@inheritDoc} */ - public boolean equals (Object o) { + 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) { 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,25 +410,25 @@ 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); + 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); + 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); + 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) { @@ -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) { 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); + 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) { // 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++) { Segment s = sa [ i ]; - Vector<Integer> ngv = new Vector<Integer> (ng); - Vector<GlyphSequence.CharAssociation> nav = new Vector<GlyphSequence.CharAssociation> (ng); + 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)); + 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() ]); + 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); + 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 e6529eb2c..72d092b12 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) { + protected ScriptProcessor(String script) { if ((script == null) || (script.length() == 0)) { - throw new IllegalArgumentException ("script must be non-empty string"); + 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++) { 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++) { 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); + int sc = CharScript.scriptCodeFromTag(script); if (sc == CharScript.SCRIPT_ARABIC) { - sp = new ArabicScriptProcessor (script); - } else if (CharScript.isIndicScript (sc)) { - sp = IndicScriptProcessor.makeProcessor (script); + 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; @@ -269,20 +269,20 @@ public abstract class ScriptProcessor { public int hashCode() { int hc = 0; hc = 7 * hc + (hc ^ table.hashCode()); - hc = 11 * hc + (hc ^ Arrays.hashCode (features)); + hc = 11 * hc + (hc ^ Arrays.hashCode(features)); hc = 17 * hc + (hc ^ lookups.hashCode()); return hc; } /** {@inheritDoc} */ - public boolean equals (Object o) { + 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; |