You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by vh...@apache.org on 2013/05/07 18:23:17 UTC
svn commit: r1479969 [10/16] - in /xmlgraphics/fop/trunk: ./
src/codegen/unicode/java/org/apache/fop/complexscripts/bidi/
src/codegen/unicode/java/org/apache/fop/hyphenation/
src/java/org/apache/fop/afp/ src/java/org/apache/fop/afp/modca/
src/java/org/...
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/complexscripts/scripts/ScriptProcessor.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/complexscripts/scripts/ScriptProcessor.java?rev=1479969&r1=1479968&r2=1479969&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/complexscripts/scripts/ScriptProcessor.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/complexscripts/scripts/ScriptProcessor.java Tue May 7 16:23:13 2013
@@ -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;
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/complexscripts/util/CharMirror.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/complexscripts/util/CharMirror.java?rev=1479969&r1=1479968&r2=1479969&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/complexscripts/util/CharMirror.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/complexscripts/util/CharMirror.java Tue May 7 16:23:13 2013
@@ -36,10 +36,10 @@ public final class CharMirror {
* @param s a string whose characters are to be mirrored
* @return the resulting string
*/
- public static String mirror (String s) {
- StringBuffer sb = new StringBuffer (s);
+ public static String mirror(String s) {
+ StringBuffer sb = new StringBuffer(s);
for (int i = 0, n = sb.length(); i < n; i++) {
- sb.setCharAt (i, (char) mirror (sb.charAt (i)));
+ sb.setCharAt(i, (char) mirror(sb.charAt(i)));
}
return sb.toString();
}
@@ -704,8 +704,8 @@ public final class CharMirror {
0xFF62
};
- private static int mirror (int c) {
- int i = Arrays.binarySearch (mirroredCharacters, c);
+ private static int mirror(int c) {
+ int i = Arrays.binarySearch(mirroredCharacters, c);
if (i < 0) {
return c;
} else {
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/complexscripts/util/CharScript.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/complexscripts/util/CharScript.java?rev=1479969&r1=1479968&r2=1479969&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/complexscripts/util/CharScript.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/complexscripts/util/CharScript.java Tue May 7 16:23:13 2013
@@ -143,7 +143,7 @@ public final class CharScript {
* @param c a character represented as a unicode scalar value
* @return true if character is punctuation
*/
- public static boolean isPunctuation (int c) {
+ public static boolean isPunctuation(int c) {
if ((c >= 0x0021) && (c <= 0x002F)) { // basic latin punctuation
return true;
} else if ((c >= 0x003A) && (c <= 0x0040)) { // basic latin punctuation
@@ -172,7 +172,7 @@ public final class CharScript {
* @param c a character represented as a unicode scalar value
* @return true if character is a digit
*/
- public static boolean isDigit (int c) {
+ public static boolean isDigit(int c) {
if ((c >= 0x0030) && (c <= 0x0039)) { // basic latin digits
return true;
} else { // [TBD] - not complete
@@ -185,7 +185,7 @@ public final class CharScript {
* @param c a character represented as a unicode scalar value
* @return true if character belongs to hebrew script
*/
- public static boolean isHebrew (int c) {
+ public static boolean isHebrew(int c) {
if ((c >= 0x0590) && (c <= 0x05FF)) { // hebrew block
return true;
} else if ((c >= 0xFB00) && (c <= 0xFB4F)) { // hebrew presentation forms block
@@ -200,7 +200,7 @@ public final class CharScript {
* @param c a character represented as a unicode scalar value
* @return true if character belongs to mongolian script
*/
- public static boolean isMongolian (int c) {
+ public static boolean isMongolian(int c) {
if ((c >= 0x1800) && (c <= 0x18AF)) { // mongolian block
return true;
} else {
@@ -213,7 +213,7 @@ public final class CharScript {
* @param c a character represented as a unicode scalar value
* @return true if character belongs to arabic script
*/
- public static boolean isArabic (int c) {
+ public static boolean isArabic(int c) {
if ((c >= 0x0600) && (c <= 0x06FF)) { // arabic block
return true;
} else if ((c >= 0x0750) && (c <= 0x077F)) { // arabic supplement block
@@ -232,7 +232,7 @@ public final class CharScript {
* @param c a character represented as a unicode scalar value
* @return true if character belongs to greek script
*/
- public static boolean isGreek (int c) {
+ public static boolean isGreek(int c) {
if ((c >= 0x0370) && (c <= 0x03FF)) { // greek (and coptic) block
return true;
} else if ((c >= 0x1F00) && (c <= 0x1FFF)) { // greek extended block
@@ -247,7 +247,7 @@ public final class CharScript {
* @param c a character represented as a unicode scalar value
* @return true if character belongs to latin script
*/
- public static boolean isLatin (int c) {
+ public static boolean isLatin(int c) {
if ((c >= 0x0041) && (c <= 0x005A)) { // basic latin upper case
return true;
} else if ((c >= 0x0061) && (c <= 0x007A)) { // basic latin lower case
@@ -282,7 +282,7 @@ public final class CharScript {
* @param c a character represented as a unicode scalar value
* @return true if character belongs to cyrillic script
*/
- public static boolean isCyrillic (int c) {
+ public static boolean isCyrillic(int c) {
if ((c >= 0x0400) && (c <= 0x04FF)) { // cyrillic block
return true;
} else if ((c >= 0x0500) && (c <= 0x052F)) { // cyrillic supplement block
@@ -301,7 +301,7 @@ public final class CharScript {
* @param c a character represented as a unicode scalar value
* @return true if character belongs to georgian script
*/
- public static boolean isGeorgian (int c) {
+ public static boolean isGeorgian(int c) {
if ((c >= 0x10A0) && (c <= 0x10FF)) { // georgian block
return true;
} else if ((c >= 0x2D00) && (c <= 0x2D2F)) { // georgian supplement block
@@ -316,7 +316,7 @@ public final class CharScript {
* @param c a character represented as a unicode scalar value
* @return true if character belongs to hangul script
*/
- public static boolean isHangul (int c) {
+ public static boolean isHangul(int c) {
if ((c >= 0x1100) && (c <= 0x11FF)) { // hangul jamo
return true;
} else if ((c >= 0x3130) && (c <= 0x318F)) { // hangul compatibility jamo
@@ -337,7 +337,7 @@ public final class CharScript {
* @param c a character represented as a unicode scalar value
* @return true if character belongs to gurmukhi script
*/
- public static boolean isGurmukhi (int c) {
+ public static boolean isGurmukhi(int c) {
if ((c >= 0x0A00) && (c <= 0x0A7F)) { // gurmukhi block
return true;
} else {
@@ -350,7 +350,7 @@ public final class CharScript {
* @param c a character represented as a unicode scalar value
* @return true if character belongs to devanagari script
*/
- public static boolean isDevanagari (int c) {
+ public static boolean isDevanagari(int c) {
if ((c >= 0x0900) && (c <= 0x097F)) { // devangari block
return true;
} else if ((c >= 0xA8E0) && (c <= 0xA8FF)) { // devangari extended block
@@ -365,7 +365,7 @@ public final class CharScript {
* @param c a character represented as a unicode scalar value
* @return true if character belongs to gujarati script
*/
- public static boolean isGujarati (int c) {
+ public static boolean isGujarati(int c) {
if ((c >= 0x0A80) && (c <= 0x0AFF)) { // gujarati block
return true;
} else {
@@ -378,7 +378,7 @@ public final class CharScript {
* @param c a character represented as a unicode scalar value
* @return true if character belongs to bengali script
*/
- public static boolean isBengali (int c) {
+ public static boolean isBengali(int c) {
if ((c >= 0x0980) && (c <= 0x09FF)) { // bengali block
return true;
} else {
@@ -391,7 +391,7 @@ public final class CharScript {
* @param c a character represented as a unicode scalar value
* @return true if character belongs to oriya script
*/
- public static boolean isOriya (int c) {
+ public static boolean isOriya(int c) {
if ((c >= 0x0B00) && (c <= 0x0B7F)) { // oriya block
return true;
} else {
@@ -404,7 +404,7 @@ public final class CharScript {
* @param c a character represented as a unicode scalar value
* @return true if character belongs to tibetan script
*/
- public static boolean isTibetan (int c) {
+ public static boolean isTibetan(int c) {
if ((c >= 0x0F00) && (c <= 0x0FFF)) { // tibetan block
return true;
} else {
@@ -417,7 +417,7 @@ public final class CharScript {
* @param c a character represented as a unicode scalar value
* @return true if character belongs to telugu script
*/
- public static boolean isTelugu (int c) {
+ public static boolean isTelugu(int c) {
if ((c >= 0x0C00) && (c <= 0x0C7F)) { // telugu block
return true;
} else {
@@ -430,7 +430,7 @@ public final class CharScript {
* @param c a character represented as a unicode scalar value
* @return true if character belongs to kannada script
*/
- public static boolean isKannada (int c) {
+ public static boolean isKannada(int c) {
if ((c >= 0x0C00) && (c <= 0x0C7F)) { // kannada block
return true;
} else {
@@ -443,7 +443,7 @@ public final class CharScript {
* @param c a character represented as a unicode scalar value
* @return true if character belongs to tamil script
*/
- public static boolean isTamil (int c) {
+ public static boolean isTamil(int c) {
if ((c >= 0x0B80) && (c <= 0x0BFF)) { // tamil block
return true;
} else {
@@ -456,7 +456,7 @@ public final class CharScript {
* @param c a character represented as a unicode scalar value
* @return true if character belongs to malayalam script
*/
- public static boolean isMalayalam (int c) {
+ public static boolean isMalayalam(int c) {
if ((c >= 0x0D00) && (c <= 0x0D7F)) { // malayalam block
return true;
} else {
@@ -469,7 +469,7 @@ public final class CharScript {
* @param c a character represented as a unicode scalar value
* @return true if character belongs to sinhalese script
*/
- public static boolean isSinhalese (int c) {
+ public static boolean isSinhalese(int c) {
if ((c >= 0x0D80) && (c <= 0x0DFF)) { // sinhala block
return true;
} else {
@@ -482,7 +482,7 @@ public final class CharScript {
* @param c a character represented as a unicode scalar value
* @return true if character belongs to burmese script
*/
- public static boolean isBurmese (int c) {
+ public static boolean isBurmese(int c) {
if ((c >= 0x1000) && (c <= 0x109F)) { // burmese (myanmar) block
return true;
} else if ((c >= 0xAA60) && (c <= 0xAA7F)) { // burmese (myanmar) extended block
@@ -497,7 +497,7 @@ public final class CharScript {
* @param c a character represented as a unicode scalar value
* @return true if character belongs to thai script
*/
- public static boolean isThai (int c) {
+ public static boolean isThai(int c) {
if ((c >= 0x0E00) && (c <= 0x0E7F)) { // thai block
return true;
} else {
@@ -510,7 +510,7 @@ public final class CharScript {
* @param c a character represented as a unicode scalar value
* @return true if character belongs to khmer script
*/
- public static boolean isKhmer (int c) {
+ public static boolean isKhmer(int c) {
if ((c >= 0x1780) && (c <= 0x17FF)) { // khmer block
return true;
} else if ((c >= 0x19E0) && (c <= 0x19FF)) { // khmer symbols block
@@ -525,7 +525,7 @@ public final class CharScript {
* @param c a character represented as a unicode scalar value
* @return true if character belongs to lao script
*/
- public static boolean isLao (int c) {
+ public static boolean isLao(int c) {
if ((c >= 0x0E80) && (c <= 0x0EFF)) { // lao block
return true;
} else {
@@ -538,7 +538,7 @@ public final class CharScript {
* @param c a character represented as a unicode scalar value
* @return true if character belongs to ethiopic (amharic) script
*/
- public static boolean isEthiopic (int c) {
+ public static boolean isEthiopic(int c) {
if ((c >= 0x1200) && (c <= 0x137F)) { // ethiopic block
return true;
} else if ((c >= 0x1380) && (c <= 0x139F)) { // ethoipic supplement block
@@ -557,7 +557,7 @@ public final class CharScript {
* @param c a character represented as a unicode scalar value
* @return true if character belongs to han (unified cjk) script
*/
- public static boolean isHan (int c) {
+ public static boolean isHan(int c) {
if ((c >= 0x3400) && (c <= 0x4DBF)) {
return true; // cjk unified ideographs extension a
} else if ((c >= 0x4E00) && (c <= 0x9FFF)) {
@@ -580,7 +580,7 @@ public final class CharScript {
* @param c a character represented as a unicode scalar value
* @return true if character belongs to bopomofo script
*/
- public static boolean isBopomofo (int c) {
+ public static boolean isBopomofo(int c) {
if ((c >= 0x3100) && (c <= 0x312F)) {
return true;
} else {
@@ -593,7 +593,7 @@ public final class CharScript {
* @param c a character represented as a unicode scalar value
* @return true if character belongs to hiragana script
*/
- public static boolean isHiragana (int c) {
+ public static boolean isHiragana(int c) {
if ((c >= 0x3040) && (c <= 0x309F)) {
return true;
} else {
@@ -606,7 +606,7 @@ public final class CharScript {
* @param c a character represented as a unicode scalar value
* @return true if character belongs to katakana script
*/
- public static boolean isKatakana (int c) {
+ public static boolean isKatakana(int c) {
if ((c >= 0x30A0) && (c <= 0x30FF)) {
return true;
} else if ((c >= 0x31F0) && (c <= 0x31FF)) {
@@ -622,68 +622,68 @@ public final class CharScript {
* @param c the character to obtain script
* @return an ISO15924 script code
*/
- public static int scriptOf (int c) { // [TBD] - needs optimization!!!
- if (CharUtilities.isAnySpace (c)) {
+ public static int scriptOf(int c) { // [TBD] - needs optimization!!!
+ if (CharUtilities.isAnySpace(c)) {
return SCRIPT_UNDETERMINED;
- } else if (isPunctuation (c)) {
+ } else if (isPunctuation(c)) {
return SCRIPT_UNDETERMINED;
- } else if (isDigit (c)) {
+ } else if (isDigit(c)) {
return SCRIPT_UNDETERMINED;
- } else if (isLatin (c)) {
+ } else if (isLatin(c)) {
return SCRIPT_LATIN;
- } else if (isCyrillic (c)) {
+ } else if (isCyrillic(c)) {
return SCRIPT_CYRILLIC;
- } else if (isGreek (c)) {
+ } else if (isGreek(c)) {
return SCRIPT_GREEK;
- } else if (isHan (c)) {
+ } else if (isHan(c)) {
return SCRIPT_HAN;
- } else if (isBopomofo (c)) {
+ } else if (isBopomofo(c)) {
return SCRIPT_BOPOMOFO;
- } else if (isKatakana (c)) {
+ } else if (isKatakana(c)) {
return SCRIPT_KATAKANA;
- } else if (isHiragana (c)) {
+ } else if (isHiragana(c)) {
return SCRIPT_HIRAGANA;
- } else if (isHangul (c)) {
+ } else if (isHangul(c)) {
return SCRIPT_HANGUL;
- } else if (isArabic (c)) {
+ } else if (isArabic(c)) {
return SCRIPT_ARABIC;
- } else if (isHebrew (c)) {
+ } else if (isHebrew(c)) {
return SCRIPT_HEBREW;
- } else if (isMongolian (c)) {
+ } else if (isMongolian(c)) {
return SCRIPT_MONGOLIAN;
- } else if (isGeorgian (c)) {
+ } else if (isGeorgian(c)) {
return SCRIPT_GEORGIAN;
- } else if (isGurmukhi (c)) {
- return useV2IndicRules (SCRIPT_GURMUKHI);
- } else if (isDevanagari (c)) {
- return useV2IndicRules (SCRIPT_DEVANAGARI);
- } else if (isGujarati (c)) {
- return useV2IndicRules (SCRIPT_GUJARATI);
- } else if (isBengali (c)) {
- return useV2IndicRules (SCRIPT_BENGALI);
- } else if (isOriya (c)) {
- return useV2IndicRules (SCRIPT_ORIYA);
- } else if (isTibetan (c)) {
+ } else if (isGurmukhi(c)) {
+ return useV2IndicRules(SCRIPT_GURMUKHI);
+ } else if (isDevanagari(c)) {
+ return useV2IndicRules(SCRIPT_DEVANAGARI);
+ } else if (isGujarati(c)) {
+ return useV2IndicRules(SCRIPT_GUJARATI);
+ } else if (isBengali(c)) {
+ return useV2IndicRules(SCRIPT_BENGALI);
+ } else if (isOriya(c)) {
+ return useV2IndicRules(SCRIPT_ORIYA);
+ } else if (isTibetan(c)) {
return SCRIPT_TIBETAN;
- } else if (isTelugu (c)) {
- return useV2IndicRules (SCRIPT_TELUGU);
- } else if (isKannada (c)) {
- return useV2IndicRules (SCRIPT_KANNADA);
- } else if (isTamil (c)) {
- return useV2IndicRules (SCRIPT_TAMIL);
- } else if (isMalayalam (c)) {
- return useV2IndicRules (SCRIPT_MALAYALAM);
- } else if (isSinhalese (c)) {
+ } else if (isTelugu(c)) {
+ return useV2IndicRules(SCRIPT_TELUGU);
+ } else if (isKannada(c)) {
+ return useV2IndicRules(SCRIPT_KANNADA);
+ } else if (isTamil(c)) {
+ return useV2IndicRules(SCRIPT_TAMIL);
+ } else if (isMalayalam(c)) {
+ return useV2IndicRules(SCRIPT_MALAYALAM);
+ } else if (isSinhalese(c)) {
return SCRIPT_SINHALESE;
- } else if (isBurmese (c)) {
+ } else if (isBurmese(c)) {
return SCRIPT_BURMESE;
- } else if (isThai (c)) {
+ } else if (isThai(c)) {
return SCRIPT_THAI;
- } else if (isKhmer (c)) {
+ } else if (isKhmer(c)) {
return SCRIPT_KHMER;
- } else if (isLao (c)) {
+ } else if (isLao(c)) {
return SCRIPT_LAO;
- } else if (isEthiopic (c)) {
+ } else if (isEthiopic(c)) {
return SCRIPT_ETHIOPIC;
} else {
return SCRIPT_UNDETERMINED;
@@ -696,7 +696,7 @@ public final class CharScript {
* @param sc a V1 indic script code
* @return either SC or the V2 flavor of SC if V2 indic rules apply
*/
- public static int useV2IndicRules (int sc) {
+ public static int useV2IndicRules(int sc) {
if (useV2Indic) {
return (sc < 1000) ? (sc + 1000) : sc;
} else {
@@ -711,17 +711,17 @@ public final class CharScript {
* @param cs the character sequence
* @return a (possibly empty) array of script codes
*/
- public static int[] scriptsOf (CharSequence cs) {
+ public static int[] scriptsOf(CharSequence cs) {
Set s = new HashSet();
for (int i = 0, n = cs.length(); i < n; i++) {
- s.add (Integer.valueOf (scriptOf (cs.charAt (i))));
+ s.add(Integer.valueOf(scriptOf(cs.charAt(i))));
}
int[] sa = new int [ s.size() ];
int ns = 0;
for (Iterator it = s.iterator(); it.hasNext();) {
sa [ ns++ ] = ((Integer) it.next()) .intValue();
}
- Arrays.sort (sa);
+ Arrays.sort(sa);
return sa;
}
@@ -730,17 +730,17 @@ public final class CharScript {
* @param cs the character sequence
* @return the dominant script or SCRIPT_UNDETERMINED
*/
- public static int dominantScript (CharSequence cs) {
+ public static int dominantScript(CharSequence cs) {
Map m = new HashMap();
for (int i = 0, n = cs.length(); i < n; i++) {
- int c = cs.charAt (i);
- int s = scriptOf (c);
- Integer k = Integer.valueOf (s);
- Integer v = (Integer) m.get (k);
+ int c = cs.charAt(i);
+ int s = scriptOf(c);
+ Integer k = Integer.valueOf(s);
+ Integer v = (Integer) m.get(k);
if (v != null) {
- m.put (k, Integer.valueOf (v.intValue() + 1));
+ m.put(k, Integer.valueOf(v.intValue() + 1));
} else {
- m.put (k, Integer.valueOf (0));
+ m.put(k, Integer.valueOf(0));
}
}
int sMax = -1;
@@ -779,8 +779,8 @@ public final class CharScript {
* @param script a script tag
* @return true if script tag is a designated 'Indic' script
*/
- public static boolean isIndicScript (String script) {
- return isIndicScript (scriptCodeFromTag (script));
+ public static boolean isIndicScript(String script) {
+ return isIndicScript(scriptCodeFromTag(script));
}
/**
@@ -790,7 +790,7 @@ public final class CharScript {
* @param script a script code
* @return true if script code is a designated 'Indic' script
*/
- public static boolean isIndicScript (int script) {
+ public static boolean isIndicScript(int script) {
switch (script) {
case SCRIPT_BENGALI:
case SCRIPT_BENGALI_2:
@@ -822,11 +822,11 @@ public final class CharScript {
* @param code the script code
* @return a script tag
*/
- public static String scriptTagFromCode (int code) {
+ public static String scriptTagFromCode(int code) {
Map<Integer,String> m = getScriptTagsMap();
if (m != null) {
String tag;
- if ((tag = m.get (Integer.valueOf (code))) != null) {
+ if ((tag = m.get(Integer.valueOf(code))) != null) {
return tag;
} else {
return "";
@@ -841,11 +841,11 @@ public final class CharScript {
* @param tag the script tag
* @return a script code
*/
- public static int scriptCodeFromTag (String tag) {
+ public static int scriptCodeFromTag(String tag) {
Map<String,Integer> m = getScriptCodeMap();
if (m != null) {
Integer c;
- if ((c = m.get (tag)) != null) {
+ if ((c = m.get(tag)) != null) {
return (int) c;
} else {
return SCRIPT_UNDETERMINED;
@@ -858,59 +858,59 @@ public final class CharScript {
private static Map<Integer,String> scriptTagsMap = null;
private static Map<String,Integer> scriptCodeMap = null;
- private static void putScriptTag (Map tm, Map cm, int code, String tag) {
+ private static void putScriptTag(Map tm, Map cm, int code, String tag) {
assert tag != null;
assert tag.length() != 0;
assert code >= 0;
assert code < 2000;
- tm.put (Integer.valueOf (code), tag);
- cm.put (tag, Integer.valueOf (code));
+ tm.put(Integer.valueOf(code), tag);
+ cm.put(tag, Integer.valueOf(code));
}
private static void makeScriptMaps() {
HashMap<Integer,String> tm = new HashMap<Integer,String>();
HashMap<String,Integer> cm = new HashMap<String,Integer>();
- putScriptTag (tm, cm, SCRIPT_HEBREW, "hebr");
- putScriptTag (tm, cm, SCRIPT_MONGOLIAN, "mong");
- putScriptTag (tm, cm, SCRIPT_ARABIC, "arab");
- putScriptTag (tm, cm, SCRIPT_GREEK, "grek");
- putScriptTag (tm, cm, SCRIPT_LATIN, "latn");
- putScriptTag (tm, cm, SCRIPT_CYRILLIC, "cyrl");
- putScriptTag (tm, cm, SCRIPT_GEORGIAN, "geor");
- putScriptTag (tm, cm, SCRIPT_BOPOMOFO, "bopo");
- putScriptTag (tm, cm, SCRIPT_HANGUL, "hang");
- putScriptTag (tm, cm, SCRIPT_GURMUKHI, "guru");
- putScriptTag (tm, cm, SCRIPT_GURMUKHI_2, "gur2");
- putScriptTag (tm, cm, SCRIPT_DEVANAGARI, "deva");
- putScriptTag (tm, cm, SCRIPT_DEVANAGARI_2, "dev2");
- putScriptTag (tm, cm, SCRIPT_GUJARATI, "gujr");
- putScriptTag (tm, cm, SCRIPT_GUJARATI_2, "gjr2");
- putScriptTag (tm, cm, SCRIPT_BENGALI, "beng");
- putScriptTag (tm, cm, SCRIPT_BENGALI_2, "bng2");
- putScriptTag (tm, cm, SCRIPT_ORIYA, "orya");
- putScriptTag (tm, cm, SCRIPT_ORIYA_2, "ory2");
- putScriptTag (tm, cm, SCRIPT_TIBETAN, "tibt");
- putScriptTag (tm, cm, SCRIPT_TELUGU, "telu");
- putScriptTag (tm, cm, SCRIPT_TELUGU_2, "tel2");
- putScriptTag (tm, cm, SCRIPT_KANNADA, "knda");
- putScriptTag (tm, cm, SCRIPT_KANNADA_2, "knd2");
- putScriptTag (tm, cm, SCRIPT_TAMIL, "taml");
- putScriptTag (tm, cm, SCRIPT_TAMIL_2, "tml2");
- putScriptTag (tm, cm, SCRIPT_MALAYALAM, "mlym");
- putScriptTag (tm, cm, SCRIPT_MALAYALAM_2, "mlm2");
- putScriptTag (tm, cm, SCRIPT_SINHALESE, "sinh");
- putScriptTag (tm, cm, SCRIPT_BURMESE, "mymr");
- putScriptTag (tm, cm, SCRIPT_THAI, "thai");
- putScriptTag (tm, cm, SCRIPT_KHMER, "khmr");
- putScriptTag (tm, cm, SCRIPT_LAO, "laoo");
- putScriptTag (tm, cm, SCRIPT_HIRAGANA, "hira");
- putScriptTag (tm, cm, SCRIPT_ETHIOPIC, "ethi");
- putScriptTag (tm, cm, SCRIPT_HAN, "hani");
- putScriptTag (tm, cm, SCRIPT_KATAKANA, "kana");
- putScriptTag (tm, cm, SCRIPT_MATH, "zmth");
- putScriptTag (tm, cm, SCRIPT_SYMBOL, "zsym");
- putScriptTag (tm, cm, SCRIPT_UNDETERMINED, "zyyy");
- putScriptTag (tm, cm, SCRIPT_UNCODED, "zzzz");
+ putScriptTag(tm, cm, SCRIPT_HEBREW, "hebr");
+ putScriptTag(tm, cm, SCRIPT_MONGOLIAN, "mong");
+ putScriptTag(tm, cm, SCRIPT_ARABIC, "arab");
+ putScriptTag(tm, cm, SCRIPT_GREEK, "grek");
+ putScriptTag(tm, cm, SCRIPT_LATIN, "latn");
+ putScriptTag(tm, cm, SCRIPT_CYRILLIC, "cyrl");
+ putScriptTag(tm, cm, SCRIPT_GEORGIAN, "geor");
+ putScriptTag(tm, cm, SCRIPT_BOPOMOFO, "bopo");
+ putScriptTag(tm, cm, SCRIPT_HANGUL, "hang");
+ putScriptTag(tm, cm, SCRIPT_GURMUKHI, "guru");
+ putScriptTag(tm, cm, SCRIPT_GURMUKHI_2, "gur2");
+ putScriptTag(tm, cm, SCRIPT_DEVANAGARI, "deva");
+ putScriptTag(tm, cm, SCRIPT_DEVANAGARI_2, "dev2");
+ putScriptTag(tm, cm, SCRIPT_GUJARATI, "gujr");
+ putScriptTag(tm, cm, SCRIPT_GUJARATI_2, "gjr2");
+ putScriptTag(tm, cm, SCRIPT_BENGALI, "beng");
+ putScriptTag(tm, cm, SCRIPT_BENGALI_2, "bng2");
+ putScriptTag(tm, cm, SCRIPT_ORIYA, "orya");
+ putScriptTag(tm, cm, SCRIPT_ORIYA_2, "ory2");
+ putScriptTag(tm, cm, SCRIPT_TIBETAN, "tibt");
+ putScriptTag(tm, cm, SCRIPT_TELUGU, "telu");
+ putScriptTag(tm, cm, SCRIPT_TELUGU_2, "tel2");
+ putScriptTag(tm, cm, SCRIPT_KANNADA, "knda");
+ putScriptTag(tm, cm, SCRIPT_KANNADA_2, "knd2");
+ putScriptTag(tm, cm, SCRIPT_TAMIL, "taml");
+ putScriptTag(tm, cm, SCRIPT_TAMIL_2, "tml2");
+ putScriptTag(tm, cm, SCRIPT_MALAYALAM, "mlym");
+ putScriptTag(tm, cm, SCRIPT_MALAYALAM_2, "mlm2");
+ putScriptTag(tm, cm, SCRIPT_SINHALESE, "sinh");
+ putScriptTag(tm, cm, SCRIPT_BURMESE, "mymr");
+ putScriptTag(tm, cm, SCRIPT_THAI, "thai");
+ putScriptTag(tm, cm, SCRIPT_KHMER, "khmr");
+ putScriptTag(tm, cm, SCRIPT_LAO, "laoo");
+ putScriptTag(tm, cm, SCRIPT_HIRAGANA, "hira");
+ putScriptTag(tm, cm, SCRIPT_ETHIOPIC, "ethi");
+ putScriptTag(tm, cm, SCRIPT_HAN, "hani");
+ putScriptTag(tm, cm, SCRIPT_KATAKANA, "kana");
+ putScriptTag(tm, cm, SCRIPT_MATH, "zmth");
+ putScriptTag(tm, cm, SCRIPT_SYMBOL, "zsym");
+ putScriptTag(tm, cm, SCRIPT_UNDETERMINED, "zyyy");
+ putScriptTag(tm, cm, SCRIPT_UNCODED, "zzzz");
scriptTagsMap = tm;
scriptCodeMap = cm;
}
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/complexscripts/util/GlyphContextTester.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/complexscripts/util/GlyphContextTester.java?rev=1479969&r1=1479968&r2=1479969&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/complexscripts/util/GlyphContextTester.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/complexscripts/util/GlyphContextTester.java Tue May 7 16:23:13 2013
@@ -38,6 +38,6 @@ public interface GlyphContextTester {
* @param flags that apply to lookup in scope
* @return true if test is satisfied
*/
- boolean test (String script, String language, String feature, GlyphSequence gs, int index, int flags);
+ boolean test(String script, String language, String feature, GlyphSequence gs, int index, int flags);
}
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/complexscripts/util/GlyphSequence.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/complexscripts/util/GlyphSequence.java?rev=1479969&r1=1479968&r2=1479969&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/complexscripts/util/GlyphSequence.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/complexscripts/util/GlyphSequence.java Tue May 7 16:23:13 2013
@@ -65,15 +65,15 @@ public class GlyphSequence implements Cl
* @param associations a (possibly null) array of glyph to character associations
* @param predications true if predications are enabled
*/
- public GlyphSequence (IntBuffer characters, IntBuffer glyphs, List associations, boolean predications) {
+ public GlyphSequence(IntBuffer characters, IntBuffer glyphs, List associations, boolean predications) {
if (characters == null) {
- characters = IntBuffer.allocate (DEFAULT_CHARS_CAPACITY);
+ characters = IntBuffer.allocate(DEFAULT_CHARS_CAPACITY);
}
if (glyphs == null) {
- glyphs = IntBuffer.allocate (characters.capacity());
+ glyphs = IntBuffer.allocate(characters.capacity());
}
if (associations == null) {
- associations = makeIdentityAssociations (characters.limit(), glyphs.limit());
+ associations = makeIdentityAssociations(characters.limit(), glyphs.limit());
}
this.characters = characters;
this.glyphs = glyphs;
@@ -91,7 +91,7 @@ public class GlyphSequence implements Cl
* @param glyphs a (possibly null) buffer of glyphs
* @param associations a (possibly null) array of glyph to character associations
*/
- public GlyphSequence (IntBuffer characters, IntBuffer glyphs, List associations) {
+ public GlyphSequence(IntBuffer characters, IntBuffer glyphs, List associations) {
this (characters, glyphs, associations, false);
}
@@ -101,8 +101,8 @@ public class GlyphSequence implements Cl
* of glyphs buffer and association list.
* @param gs an existing glyph sequence
*/
- public GlyphSequence (GlyphSequence gs) {
- this (gs.characters.duplicate(), copyBuffer (gs.glyphs), copyAssociations (gs.associations), gs.predications);
+ public GlyphSequence(GlyphSequence gs) {
+ this (gs.characters.duplicate(), copyBuffer(gs.glyphs), copyAssociations(gs.associations), gs.predications);
}
/**
@@ -119,8 +119,8 @@ public class GlyphSequence implements Cl
* @param ial input association list
* @param lal lookahead association list
*/
- public GlyphSequence (GlyphSequence gs, int[] bga, int[] iga, int[] lga, CharAssociation[] bal, CharAssociation[] ial, CharAssociation[] lal) {
- this (gs.characters.duplicate(), concatGlyphs (bga, iga, lga), concatAssociations (bal, ial, lal), gs.predications);
+ public GlyphSequence(GlyphSequence gs, int[] bga, int[] iga, int[] lga, CharAssociation[] bal, CharAssociation[] ial, CharAssociation[] lal) {
+ this (gs.characters.duplicate(), concatGlyphs(bga, iga, lga), concatAssociations(bal, ial, lal), gs.predications);
}
/**
@@ -141,9 +141,9 @@ public class GlyphSequence implements Cl
* @param copy true if to return a newly instantiated array of characters
* @return array of characters
*/
- public int[] getCharacterArray (boolean copy) {
+ public int[] getCharacterArray(boolean copy) {
if (copy) {
- return toArray (characters);
+ return toArray(characters);
} else {
return characters.array();
}
@@ -165,8 +165,8 @@ public class GlyphSequence implements Cl
* @throws IndexOutOfBoundsException if index is less than zero
* or exceeds last valid position
*/
- public int getGlyph (int index) throws IndexOutOfBoundsException {
- return glyphs.get (index);
+ public int getGlyph(int index) throws IndexOutOfBoundsException {
+ return glyphs.get(index);
}
/**
@@ -176,11 +176,11 @@ public class GlyphSequence implements Cl
* @throws IndexOutOfBoundsException if index is greater or equal to
* the limit of the underlying glyph buffer
*/
- public void setGlyph (int index, int gi) throws IndexOutOfBoundsException {
+ public void setGlyph(int index, int gi) throws IndexOutOfBoundsException {
if (gi > 65535) {
gi = 65535;
}
- glyphs.put (index, gi);
+ glyphs.put(index, gi);
}
/**
@@ -200,7 +200,7 @@ public class GlyphSequence implements Cl
* indicating all avaialble glyphs starting at offset
* @return glyph array
*/
- public int[] getGlyphs (int offset, int count) {
+ public int[] getGlyphs(int offset, int count) {
int ng = getGlyphCount();
if (offset < 0) {
offset = 0;
@@ -213,7 +213,7 @@ public class GlyphSequence implements Cl
int[] ga = new int [ count ];
for (int i = offset, n = offset + count, k = 0; i < n; i++) {
if (k < ga.length) {
- ga [ k++ ] = glyphs.get (i);
+ ga [ k++ ] = glyphs.get(i);
}
}
return ga;
@@ -229,9 +229,9 @@ public class GlyphSequence implements Cl
* @param copy true if to return a newly instantiated array of glyphs
* @return array of glyphs
*/
- public int[] getGlyphArray (boolean copy) {
+ public int[] getGlyphArray(boolean copy) {
if (copy) {
- return toArray (glyphs);
+ return toArray(glyphs);
} else {
return glyphs.array();
}
@@ -253,8 +253,8 @@ public class GlyphSequence implements Cl
* @throws IndexOutOfBoundsException if index is less than zero
* or exceeds last valid position
*/
- public CharAssociation getAssociation (int index) throws IndexOutOfBoundsException {
- return (CharAssociation) associations.get (index);
+ public CharAssociation getAssociation(int index) throws IndexOutOfBoundsException {
+ return (CharAssociation) associations.get(index);
}
/**
@@ -272,7 +272,7 @@ public class GlyphSequence implements Cl
* indicating all avaialble associations starting at offset
* @return associations
*/
- public CharAssociation[] getAssociations (int offset, int count) {
+ public CharAssociation[] getAssociations(int offset, int count) {
int ng = getGlyphCount();
if (offset < 0) {
offset = 0;
@@ -285,7 +285,7 @@ public class GlyphSequence implements Cl
CharAssociation[] aa = new CharAssociation [ count ];
for (int i = offset, n = offset + count, k = 0; i < n; i++) {
if (k < aa.length) {
- aa [ k++ ] = (CharAssociation) associations.get (i);
+ aa [ k++ ] = (CharAssociation) associations.get(i);
}
}
return aa;
@@ -295,7 +295,7 @@ public class GlyphSequence implements Cl
* Enable or disable predications.
* @param enable true if predications are to be enabled; otherwise false to disable
*/
- public void setPredications (boolean enable) {
+ public void setPredications(boolean enable) {
this.predications = enable;
}
@@ -313,11 +313,11 @@ public class GlyphSequence implements Cl
* @param key predication key
* @param value predication value
*/
- public void setPredication (int offset, String key, Object value) {
+ public void setPredication(int offset, String key, Object value) {
if (predications) {
- CharAssociation[] aa = getAssociations (offset, 1);
+ CharAssociation[] aa = getAssociations(offset, 1);
CharAssociation ca = aa[0];
- ca.setPredication (key, value);
+ ca.setPredication(key, value);
}
}
@@ -327,11 +327,11 @@ public class GlyphSequence implements Cl
* @param key predication key
* @return predication KEY at OFFSET or null if none exists
*/
- public Object getPredication (int offset, String key) {
+ public Object getPredication(int offset, String key) {
if (predications) {
- CharAssociation[] aa = getAssociations (offset, 1);
+ CharAssociation[] aa = getAssociations(offset, 1);
CharAssociation ca = aa[0];
- return ca.getPredication (key);
+ return ca.getPredication(key);
} else {
return null;
}
@@ -343,12 +343,12 @@ public class GlyphSequence implements Cl
* @return zero if glyphs are the same, otherwise returns 1 or -1 according to whether this glyph sequence's
* glyphs are lexicographically greater or lesser than the glyphs in the specified string buffer
*/
- public int compareGlyphs (IntBuffer gb) {
+ public int compareGlyphs(IntBuffer gb) {
int ng = getGlyphCount();
for (int i = 0, n = gb.limit(); i < n; i++) {
if (i < ng) {
- int g1 = glyphs.get (i);
- int g2 = gb.get (i);
+ int g1 = glyphs.get(i);
+ int g2 = gb.get(i);
if (g1 > g2) {
return 1;
} else if (g1 < g2) {
@@ -365,9 +365,9 @@ public class GlyphSequence implements Cl
public Object clone() {
try {
GlyphSequence gs = (GlyphSequence) super.clone();
- gs.characters = copyBuffer (characters);
- gs.glyphs = copyBuffer (glyphs);
- gs.associations = copyAssociations (associations);
+ gs.characters = copyBuffer(characters);
+ gs.glyphs = copyBuffer(glyphs);
+ gs.associations = copyAssociations(associations);
return gs;
} catch (CloneNotSupportedException e) {
return null;
@@ -377,15 +377,15 @@ public class GlyphSequence implements Cl
/** {@inheritDoc} */
public String toString() {
StringBuffer sb = new StringBuffer();
- sb.append ('{');
- sb.append ("chars = [");
- sb.append (characters);
- sb.append ("], glyphs = [");
- sb.append (glyphs);
- sb.append ("], associations = [");
- sb.append (associations);
- sb.append ("]");
- sb.append ('}');
+ sb.append('{');
+ sb.append("chars = [");
+ sb.append(characters);
+ sb.append("], glyphs = [");
+ sb.append(glyphs);
+ sb.append("], associations = [");
+ sb.append(associations);
+ sb.append("]");
+ sb.append('}');
return sb.toString();
}
@@ -395,7 +395,7 @@ public class GlyphSequence implements Cl
* @param ga2 second glyph array
* @return true if arrays are botth null or both non-null and have identical elements
*/
- public static boolean sameGlyphs (int[] ga1, int[] ga2) {
+ public static boolean sameGlyphs(int[] ga1, int[] ga2) {
if (ga1 == ga2) {
return true;
} else if ((ga1 == null) || (ga2 == null)) {
@@ -419,7 +419,7 @@ public class GlyphSequence implements Cl
* @param lga lookahead glyph array
* @return new integer buffer containing concatenated glyphs
*/
- public static IntBuffer concatGlyphs (int[] bga, int[] iga, int[] lga) {
+ public static IntBuffer concatGlyphs(int[] bga, int[] iga, int[] lga) {
int ng = 0;
if (bga != null) {
ng += bga.length;
@@ -430,15 +430,15 @@ public class GlyphSequence implements Cl
if (lga != null) {
ng += lga.length;
}
- IntBuffer gb = IntBuffer.allocate (ng);
+ IntBuffer gb = IntBuffer.allocate(ng);
if (bga != null) {
- gb.put (bga);
+ gb.put(bga);
}
if (iga != null) {
- gb.put (iga);
+ gb.put(iga);
}
if (lga != null) {
- gb.put (lga);
+ gb.put(lga);
}
gb.flip();
return gb;
@@ -451,7 +451,7 @@ public class GlyphSequence implements Cl
* @param laa lookahead association array
* @return new list containing concatenated associations
*/
- public static List concatAssociations (CharAssociation[] baa, CharAssociation[] iaa, CharAssociation[] laa) {
+ public static List concatAssociations(CharAssociation[] baa, CharAssociation[] iaa, CharAssociation[] laa) {
int na = 0;
if (baa != null) {
na += baa.length;
@@ -463,20 +463,20 @@ public class GlyphSequence implements Cl
na += laa.length;
}
if (na > 0) {
- List gl = new ArrayList (na);
+ List gl = new ArrayList(na);
if (baa != null) {
for (int i = 0; i < baa.length; i++) {
- gl.add (baa[i]);
+ gl.add(baa[i]);
}
}
if (iaa != null) {
for (int i = 0; i < iaa.length; i++) {
- gl.add (iaa[i]);
+ gl.add(iaa[i]);
}
}
if (laa != null) {
for (int i = 0; i < laa.length; i++) {
- gl.add (laa[i]);
+ gl.add(laa[i]);
}
}
return gl;
@@ -491,7 +491,7 @@ public class GlyphSequence implements Cl
* @param sa array of glyph sequences, whose glyph arrays and association lists are to be concatenated
* @return new glyph sequence referring to character array of GS and concatenated glyphs and associations of SA
*/
- public static GlyphSequence join (GlyphSequence gs, GlyphSequence[] sa) {
+ public static GlyphSequence join(GlyphSequence gs, GlyphSequence[] sa) {
assert sa != null;
int tg = 0;
int ta = 0;
@@ -507,14 +507,14 @@ public class GlyphSequence implements Cl
tg += ng;
ta += na;
}
- IntBuffer uga = IntBuffer.allocate (tg);
- ArrayList ual = new ArrayList (ta);
+ IntBuffer uga = IntBuffer.allocate(tg);
+ ArrayList ual = new ArrayList(ta);
for (int i = 0, n = sa.length; i < n; i++) {
GlyphSequence s = sa [ i ];
- uga.put (s.getGlyphs());
- ual.addAll (s.getAssociations());
+ uga.put(s.getGlyphs());
+ ual.addAll(s.getAssociations());
}
- return new GlyphSequence (gs.getCharacters(), uga, ual, gs.getPredications());
+ return new GlyphSequence(gs.getCharacters(), uga, ual, gs.getPredications());
}
/**
@@ -525,12 +525,12 @@ public class GlyphSequence implements Cl
* @param target index to which source sub-sequence is to be moved
* @return reordered sequence (or original if no reordering performed)
*/
- public static GlyphSequence reorder (GlyphSequence gs, int source, int count, int target) {
+ public static GlyphSequence reorder(GlyphSequence gs, int source, int count, int target) {
if (source != target) {
int ng = gs.getGlyphCount();
- int[] ga = gs.getGlyphArray (false);
+ int[] ga = gs.getGlyphArray(false);
int[] nga = new int [ ng ];
- GlyphSequence.CharAssociation[] aa = gs.getAssociations (0, ng);
+ GlyphSequence.CharAssociation[] aa = gs.getAssociations(0, ng);
GlyphSequence.CharAssociation[] naa = new GlyphSequence.CharAssociation [ ng ];
if (source < target) {
int t = 0;
@@ -569,49 +569,49 @@ public class GlyphSequence implements Cl
naa[t] = aa[s];
}
}
- return new GlyphSequence (gs, null, nga, null, null, naa, null);
+ return new GlyphSequence(gs, null, nga, null, null, naa, null);
} else {
return gs;
}
}
- private static int[] toArray (IntBuffer ib) {
+ private static int[] toArray(IntBuffer ib) {
if (ib != null) {
int n = ib.limit();
int[] ia = new int[n];
- ib.get (ia, 0, n);
+ ib.get(ia, 0, n);
return ia;
} else {
return new int[0];
}
}
- private static List makeIdentityAssociations (int numChars, int numGlyphs) {
+ private static List makeIdentityAssociations(int numChars, int numGlyphs) {
int nc = numChars;
int ng = numGlyphs;
- List av = new ArrayList (ng);
+ List av = new ArrayList(ng);
for (int i = 0, n = ng; i < n; i++) {
int k = (i > nc) ? nc : i;
- av.add (new CharAssociation (i, (k == nc) ? 0 : 1));
+ av.add(new CharAssociation(i, (k == nc) ? 0 : 1));
}
return av;
}
- private static IntBuffer copyBuffer (IntBuffer ib) {
+ private static IntBuffer copyBuffer(IntBuffer ib) {
if (ib != null) {
int[] ia = new int [ ib.capacity() ];
int p = ib.position();
int l = ib.limit();
- System.arraycopy (ib.array(), 0, ia, 0, ia.length);
- return IntBuffer.wrap (ia, p, l - p);
+ System.arraycopy(ib.array(), 0, ia, 0, ia.length);
+ return IntBuffer.wrap(ia, p, l - p);
} else {
return null;
}
}
- private static List copyAssociations (List ca) {
+ private static List copyAssociations(List ca) {
if (ca != null) {
- return new ArrayList (ca);
+ return new ArrayList(ca);
} else {
return ca;
}
@@ -645,7 +645,7 @@ public class GlyphSequence implements Cl
private static volatile Map<String,PredicationMerger> predicationMergers;
interface PredicationMerger {
- Object merge (String key, Object v1, Object v2);
+ Object merge(String key, Object v1, Object v2);
}
/**
@@ -656,7 +656,7 @@ public class GlyphSequence implements Cl
* members of array are sub-interval starts, and odd members are sub-interval
* ends (exclusive)
*/
- public CharAssociation (int offset, int count, int[] subIntervals) {
+ public CharAssociation(int offset, int count, int[] subIntervals) {
this.offset = offset;
this.count = count;
this.subIntervals = ((subIntervals != null) && (subIntervals.length > 2)) ? subIntervals : null;
@@ -667,7 +667,7 @@ public class GlyphSequence implements Cl
* @param offset into array of UTF-16 code elements (in associated CharSequence)
* @param count of UTF-16 character code elements (in associated CharSequence)
*/
- public CharAssociation (int offset, int count) {
+ public CharAssociation(int offset, int count) {
this (offset, count, null);
}
@@ -677,8 +677,8 @@ public class GlyphSequence implements Cl
* members of array are sub-interval starts, and odd members are sub-interval
* ends (exclusive)
*/
- public CharAssociation (int[] subIntervals) {
- this (getSubIntervalsStart (subIntervals), getSubIntervalsLength (subIntervals), subIntervals);
+ public CharAssociation(int[] subIntervals) {
+ this (getSubIntervalsStart(subIntervals), getSubIntervalsLength(subIntervals), subIntervals);
}
/** @return offset (start of association interval) */
@@ -721,7 +721,7 @@ public class GlyphSequence implements Cl
* @param count length of interval
* @return true if this association is contained within [offset,offset+count)
*/
- public boolean contained (int offset, int count) {
+ public boolean contained(int offset, int count) {
int s = offset;
int e = offset + count;
if (! isDisjoint()) {
@@ -746,12 +746,12 @@ public class GlyphSequence implements Cl
* @param key predication key
* @param value predication value
*/
- public void setPredication (String key, Object value) {
+ public void setPredication(String key, Object value) {
if (predications == null) {
predications = new HashMap<String,Object>();
}
if (predications != null) {
- predications.put (key, value);
+ predications.put(key, value);
}
}
@@ -760,9 +760,9 @@ public class GlyphSequence implements Cl
* @param key predication key
* @return predication KEY at OFFSET or null if none exists
*/
- public Object getPredication (String key) {
+ public Object getPredication(String key) {
if (predications != null) {
- return predications.get (key);
+ return predications.get(key);
} else {
return null;
}
@@ -773,17 +773,17 @@ public class GlyphSequence implements Cl
* @param key predication key
* @param value predication value
*/
- public void mergePredication (String key, Object value) {
+ public void mergePredication(String key, Object value) {
if (predications == null) {
predications = new HashMap<String,Object>();
}
if (predications != null) {
- if (predications.containsKey (key)) {
- Object v1 = predications.get (key);
+ if (predications.containsKey(key)) {
+ Object v1 = predications.get(key);
Object v2 = value;
- predications.put (key, mergePredicationValues (key, v1, v2));
+ predications.put(key, mergePredicationValues(key, v1, v2));
} else {
- predications.put (key, value);
+ predications.put(key, value);
}
}
}
@@ -796,10 +796,10 @@ public class GlyphSequence implements Cl
* @param v2 second (to be merged) predication value
* @return merged value
*/
- public static Object mergePredicationValues (String key, Object v1, Object v2) {
- PredicationMerger pm = getPredicationMerger (key);
+ public static Object mergePredicationValues(String key, Object v1, Object v2) {
+ PredicationMerger pm = getPredicationMerger(key);
if (pm != null) {
- return pm.merge (key, v1, v2);
+ return pm.merge(key, v1, v2);
} else if (v2 != null) {
return v2;
} else {
@@ -811,10 +811,10 @@ public class GlyphSequence implements Cl
* Merge predications from another CA.
* @param ca from which to merge
*/
- public void mergePredications (CharAssociation ca) {
+ public void mergePredications(CharAssociation ca) {
if (ca.predications != null) {
for (Map.Entry<String,Object> e : ca.predications.entrySet()) {
- mergePredication (e.getKey(), e.getValue());
+ mergePredication(e.getKey(), e.getValue());
}
}
}
@@ -824,7 +824,7 @@ public class GlyphSequence implements Cl
try {
CharAssociation ca = (CharAssociation) super.clone();
if (predications != null) {
- ca.predications = new HashMap<String,Object> (predications);
+ ca.predications = new HashMap<String,Object>(predications);
}
return ca;
} catch (CloneNotSupportedException e) {
@@ -837,12 +837,12 @@ public class GlyphSequence implements Cl
* @param key for predication merger
* @param pm predication merger
*/
- public static void setPredicationMerger (String key, PredicationMerger pm) {
+ public static void setPredicationMerger(String key, PredicationMerger pm) {
if (predicationMergers == null) {
predicationMergers = new HashMap<String,PredicationMerger>();
}
if (predicationMergers != null) {
- predicationMergers.put (key, pm);
+ predicationMergers.put(key, pm);
}
}
@@ -851,9 +851,9 @@ public class GlyphSequence implements Cl
* @param key for predication merger
* @return predication merger or null if none exists
*/
- public static PredicationMerger getPredicationMerger (String key) {
+ public static PredicationMerger getPredicationMerger(String key) {
if (predicationMergers != null) {
- return predicationMergers.get (key);
+ return predicationMergers.get(key);
} else {
return null;
}
@@ -865,7 +865,7 @@ public class GlyphSequence implements Cl
* @param repeat count
* @return array of replicated associations
*/
- public static CharAssociation[] replicate (CharAssociation a, int repeat) {
+ public static CharAssociation[] replicate(CharAssociation a, int repeat) {
CharAssociation[] aa = new CharAssociation [ repeat ];
for (int i = 0, n = aa.length; i < n; i++) {
aa [ i ] = (CharAssociation) a.clone();
@@ -879,30 +879,30 @@ public class GlyphSequence implements Cl
* @param aa array of associations to join
* @return (possibly disjoint) association containing joined associations
*/
- public static CharAssociation join (CharAssociation[] aa) {
+ public static CharAssociation join(CharAssociation[] aa) {
CharAssociation ca;
// extract sorted intervals
- int[] ia = extractIntervals (aa);
+ int[] ia = extractIntervals(aa);
if ((ia == null) || (ia.length == 0)) {
- ca = new CharAssociation (0, 0);
+ ca = new CharAssociation(0, 0);
} else if (ia.length == 2) {
int s = ia[0];
int e = ia[1];
- ca = new CharAssociation (s, e - s);
+ ca = new CharAssociation(s, e - s);
} else {
- ca = new CharAssociation (mergeIntervals (ia));
+ ca = new CharAssociation(mergeIntervals(ia));
}
- return mergePredicates (ca, aa);
+ return mergePredicates(ca, aa);
}
- private static CharAssociation mergePredicates (CharAssociation ca, CharAssociation[] aa) {
+ private static CharAssociation mergePredicates(CharAssociation ca, CharAssociation[] aa) {
for (CharAssociation a : aa) {
- ca.mergePredications (a);
+ ca.mergePredications(a);
}
return ca;
}
- private static int getSubIntervalsStart (int[] ia) {
+ private static int getSubIntervalsStart(int[] ia) {
int us = Integer.MAX_VALUE;
int ue = Integer.MIN_VALUE;
if (ia != null) {
@@ -926,7 +926,7 @@ public class GlyphSequence implements Cl
return us;
}
- private static int getSubIntervalsLength (int[] ia) {
+ private static int getSubIntervalsLength(int[] ia) {
int us = Integer.MAX_VALUE;
int ue = Integer.MIN_VALUE;
if (ia != null) {
@@ -953,7 +953,7 @@ public class GlyphSequence implements Cl
/**
* Extract sorted sub-intervals.
*/
- private static int[] extractIntervals (CharAssociation[] aa) {
+ private static int[] extractIntervals(CharAssociation[] aa) {
int ni = 0;
for (int i = 0, n = aa.length; i < n; i++) {
CharAssociation a = aa [ i ];
@@ -980,7 +980,7 @@ public class GlyphSequence implements Cl
k++;
}
}
- return sortIntervals (sa, ea);
+ return sortIntervals(sa, ea);
}
private static final int[] sortIncrements16 // CSOK: ConstantNameCheck
@@ -992,7 +992,7 @@ public class GlyphSequence implements Cl
/**
* Sort sub-intervals using modified Shell Sort.
*/
- private static int[] sortIntervals (int[] sa, int[] ea) {
+ private static int[] sortIntervals(int[] sa, int[] ea) {
assert sa != null;
assert ea != null;
assert sa.length == ea.length;
@@ -1030,7 +1030,7 @@ public class GlyphSequence implements Cl
/**
* Merge overlapping and abutting sub-intervals.
*/
- private static int[] mergeIntervals (int[] ia) {
+ private static int[] mergeIntervals(int[] ia) {
int ni = ia.length;
int i;
int n;
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/complexscripts/util/GlyphTester.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/complexscripts/util/GlyphTester.java?rev=1479969&r1=1479968&r2=1479969&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/complexscripts/util/GlyphTester.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/complexscripts/util/GlyphTester.java Tue May 7 16:23:13 2013
@@ -32,6 +32,6 @@ public interface GlyphTester {
* @param flags that apply to lookup in scope
* @return true if test is satisfied
*/
- boolean test (int gi, int flags);
+ boolean test(int gi, int flags);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org