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 sp...@apache.org on 2010/08/19 21:46:45 UTC
svn commit: r987282 [9/9] - in
/xmlgraphics/fop/branches/Temp_ComplexScripts: ./
src/codegen/unicode/java/org/apache/fop/hyphenation/
src/codegen/unicode/java/org/apache/fop/text/bidi/
src/java/org/apache/fop/area/ src/java/org/apache/fop/area/inline/ ...
Added: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/traits/Direction.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/traits/Direction.java?rev=987282&view=auto
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/traits/Direction.java (added)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/traits/Direction.java Thu Aug 19 19:46:41 2010
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id$ */
+
+package org.apache.fop.traits;
+
+import java.io.ObjectStreamException;
+
+import org.apache.fop.fo.Constants;
+
+/**
+ * Enumeration class for direction traits, namely {inline,block}-progression-direction
+ * and shift-direction.
+ */
+public final class Direction extends TraitEnum {
+
+ private static final long serialVersionUID = 1L;
+
+ private static final String[] DIRECTION_NAMES = new String[]
+ {"lr", "rl", "tb", "bt"};
+
+ private static final int[] DIRECTION_VALUES = new int[]
+ {Constants.EN_LR, Constants.EN_RL, Constants.EN_TB, Constants.EN_BT};
+
+ /** direction: left-to-right */
+ public static final Direction LR = new Direction(0);
+ /** direction: right-to-left */
+ public static final Direction RL = new Direction(1);
+ /** direction: top-to-bottom */
+ public static final Direction TB = new Direction(2);
+ /** direction: bottom-to-top */
+ public static final Direction BT = new Direction(3);
+
+ private static final Direction[] DIRECTIONS = new Direction[] {LR, RL, TB, BT};
+
+ private Direction(int index) {
+ super(DIRECTION_NAMES[index], DIRECTION_VALUES[index]);
+ }
+
+ /**
+ * Returns the enumeration/singleton object based on its name.
+ * @param name the name of the enumeration value
+ * @return the enumeration object
+ */
+ public static Direction valueOf(String name) {
+ for (int i = 0; i < DIRECTIONS.length; i++) {
+ if (DIRECTIONS[i].getName().equalsIgnoreCase(name)) {
+ return DIRECTIONS[i];
+ }
+ }
+ throw new IllegalArgumentException("Illegal direction: " + name);
+ }
+
+ /**
+ * Returns the enumeration/singleton object based on its name.
+ * @param enumValue the enumeration value
+ * @return the enumeration object
+ */
+ public static Direction valueOf(int enumValue) {
+ for (int i = 0; i < DIRECTIONS.length; i++) {
+ if (DIRECTIONS[i].getEnumValue() == enumValue) {
+ return DIRECTIONS[i];
+ }
+ }
+ throw new IllegalArgumentException("Illegal direction: " + enumValue);
+ }
+
+ private Object readResolve() throws ObjectStreamException {
+ return valueOf(getName());
+ }
+
+ /** {@inheritDoc} */
+ public String toString() {
+ return getName();
+ }
+
+}
Propchange: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/traits/Direction.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/traits/Direction.java
------------------------------------------------------------------------------
svn:keywords = Id
Added: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/traits/WritingMode.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/traits/WritingMode.java?rev=987282&view=auto
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/traits/WritingMode.java (added)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/traits/WritingMode.java Thu Aug 19 19:46:41 2010
@@ -0,0 +1,140 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id$ */
+
+package org.apache.fop.traits;
+
+import java.io.ObjectStreamException;
+
+import org.apache.fop.fo.Constants;
+
+/** Enumeration class for writing mode trait. */
+public final class WritingMode extends TraitEnum {
+
+ private static final long serialVersionUID = 1L;
+
+ private static final String[] WRITING_MODE_NAMES = new String[]
+ {"lr-tb", "rl-tb", "tb-lr", "tb-rl"};
+
+ private static final int[] WRITING_MODE_VALUES = new int[]
+ {Constants.EN_LR_TB, Constants.EN_RL_TB, Constants.EN_TB_LR, Constants.EN_TB_RL};
+
+ /** writing mode: lr-tb */
+ public static final WritingMode LR_TB = new WritingMode(0);
+ /** writing mode: rl-tb */
+ public static final WritingMode RL_TB = new WritingMode(1);
+ /** writing mode: tb-lr */
+ public static final WritingMode TB_LR = new WritingMode(2);
+ /** writing mode: tb-rl */
+ public static final WritingMode TB_RL = new WritingMode(3);
+
+ private static final WritingMode[] WRITING_MODES
+ = new WritingMode[] {LR_TB, RL_TB, TB_LR, TB_RL};
+
+ private WritingMode(int index) {
+ super(WRITING_MODE_NAMES[index], WRITING_MODE_VALUES[index]);
+ }
+
+ /**
+ * Assign writing mode traits from this trait to the specified
+ * writing mode traits setter.
+ * @param wms a writing mode traits setter
+ */
+ public void assignWritingModeTraits ( WritingModeTraitsSetter wms ) {
+ Direction inlineProgressionDirection;
+ Direction blockProgressionDirection;
+ Direction columnProgressionDirection;
+ Direction rowProgressionDirection;
+ Direction shiftDirection;
+ switch ( getEnumValue() ) {
+ default:
+ case Constants.EN_LR_TB:
+ inlineProgressionDirection = Direction.LR;
+ blockProgressionDirection = Direction.TB;
+ columnProgressionDirection = Direction.LR;
+ rowProgressionDirection = Direction.TB;
+ shiftDirection = Direction.BT;
+ break;
+ case Constants.EN_RL_TB:
+ inlineProgressionDirection = Direction.RL;
+ blockProgressionDirection = Direction.TB;
+ columnProgressionDirection = Direction.RL;
+ rowProgressionDirection = Direction.TB;
+ shiftDirection = Direction.BT;
+ break;
+ case Constants.EN_TB_LR:
+ inlineProgressionDirection = Direction.TB;
+ blockProgressionDirection = Direction.LR;
+ columnProgressionDirection = Direction.TB;
+ rowProgressionDirection = Direction.LR;
+ shiftDirection = Direction.RL;
+ break;
+ case Constants.EN_TB_RL:
+ inlineProgressionDirection = Direction.TB;
+ blockProgressionDirection = Direction.RL;
+ columnProgressionDirection = Direction.TB;
+ rowProgressionDirection = Direction.RL;
+ shiftDirection = Direction.LR;
+ break;
+ }
+ wms.setInlineProgressionDirection ( inlineProgressionDirection );
+ wms.setBlockProgressionDirection ( blockProgressionDirection );
+ wms.setColumnProgressionDirection ( columnProgressionDirection );
+ wms.setRowProgressionDirection ( rowProgressionDirection );
+ wms.setShiftDirection ( shiftDirection );
+ wms.setWritingMode ( this );
+ }
+
+ /**
+ * Returns the enumeration/singleton object based on its name.
+ * @param name the name of the enumeration value
+ * @return the enumeration object
+ */
+ public static WritingMode valueOf(String name) {
+ for (int i = 0; i < WRITING_MODES.length; i++) {
+ if (WRITING_MODES[i].getName().equalsIgnoreCase(name)) {
+ return WRITING_MODES[i];
+ }
+ }
+ throw new IllegalArgumentException("Illegal writing mode: " + name);
+ }
+
+ /**
+ * Returns the enumeration/singleton object based on its name.
+ * @param enumValue the enumeration value
+ * @return the enumeration object
+ */
+ public static WritingMode valueOf(int enumValue) {
+ for (int i = 0; i < WRITING_MODES.length; i++) {
+ if (WRITING_MODES[i].getEnumValue() == enumValue) {
+ return WRITING_MODES[i];
+ }
+ }
+ throw new IllegalArgumentException("Illegal writing mode: " + enumValue);
+ }
+
+ private Object readResolve() throws ObjectStreamException {
+ return valueOf(getName());
+ }
+
+ /** {@inheritDoc} */
+ public String toString() {
+ return getName();
+ }
+
+}
Propchange: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/traits/WritingMode.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/traits/WritingMode.java
------------------------------------------------------------------------------
svn:keywords = Id
Added: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/traits/WritingModeTraits.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/traits/WritingModeTraits.java?rev=987282&view=auto
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/traits/WritingModeTraits.java (added)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/traits/WritingModeTraits.java Thu Aug 19 19:46:41 2010
@@ -0,0 +1,141 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id$ */
+
+package org.apache.fop.traits;
+
+/**
+ * This class provides a reusable implementation of the WritingModeTraitsSetter
+ * interface.
+ */
+public class WritingModeTraits implements WritingModeTraitsSetter {
+
+ private Direction inlineProgressionDirection;
+ private Direction blockProgressionDirection;
+ private Direction columnProgressionDirection;
+ private Direction rowProgressionDirection;
+ private Direction shiftDirection;
+ private WritingMode writingMode;
+
+ /**
+ * Default writing mode traits constructor.
+ */
+ public WritingModeTraits() {
+ this ( WritingMode.LR_TB );
+ }
+
+ /**
+ * Construct writing mode traits using the specified writing mode.
+ * @param writingMode a writing mode traits object
+ */
+ public WritingModeTraits ( WritingMode writingMode ) {
+ assignWritingModeTraits ( writingMode );
+ }
+
+ /**
+ * @return the "inline-progression-direction" trait.
+ */
+ public Direction getInlineProgressionDirection() {
+ return inlineProgressionDirection;
+ }
+
+ /**
+ * @param direction the "inline-progression-direction" trait.
+ */
+ public void setInlineProgressionDirection ( Direction direction ) {
+ this.inlineProgressionDirection = direction;
+ }
+
+ /**
+ * @return the "block-progression-direction" trait.
+ */
+ public Direction getBlockProgressionDirection() {
+ return blockProgressionDirection;
+ }
+
+ /**
+ * @param direction the "block-progression-direction" trait.
+ */
+ public void setBlockProgressionDirection ( Direction direction ) {
+ this.blockProgressionDirection = direction;
+ }
+
+ /**
+ * @return the "column-progression-direction" trait.
+ */
+ public Direction getColumnProgressionDirection() {
+ return columnProgressionDirection;
+ }
+
+ /**
+ * @param direction the "column-progression-direction" trait.
+ */
+ public void setColumnProgressionDirection ( Direction direction ) {
+ this.columnProgressionDirection = direction;
+ }
+
+ /**
+ * @return the "row-progression-direction" trait.
+ */
+ public Direction getRowProgressionDirection() {
+ return rowProgressionDirection;
+ }
+
+ /**
+ * @param direction the "row-progression-direction" trait.
+ */
+ public void setRowProgressionDirection ( Direction direction ) {
+ this.rowProgressionDirection = direction;
+ }
+
+ /**
+ * @return the "shift-direction" trait.
+ */
+ public Direction getShiftDirection() {
+ return shiftDirection;
+ }
+
+ /**
+ * @param direction the "shift-direction" trait.
+ */
+ public void setShiftDirection ( Direction direction ) {
+ this.shiftDirection = direction;
+ }
+
+ /**
+ * @return the "writing-mode" trait.
+ */
+ public WritingMode getWritingMode() {
+ return writingMode;
+ }
+
+ /**
+ * @param writingMode the "writing-mode" trait.
+ */
+ public void setWritingMode ( WritingMode writingMode ) {
+ this.writingMode = writingMode;
+ }
+
+ /**
+ * @param writingMode the "writing-mode" trait.
+ */
+ public void assignWritingModeTraits ( WritingMode writingMode ) {
+ writingMode.assignWritingModeTraits ( this );
+ }
+
+}
Propchange: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/traits/WritingModeTraits.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/traits/WritingModeTraits.java
------------------------------------------------------------------------------
svn:keywords = Id
Added: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/traits/WritingModeTraitsGetter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/traits/WritingModeTraitsGetter.java?rev=987282&view=auto
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/traits/WritingModeTraitsGetter.java (added)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/traits/WritingModeTraitsGetter.java Thu Aug 19 19:46:41 2010
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id$ */
+
+package org.apache.fop.traits;
+
+/**
+ * This interface provides read access to FO traits related to writing mode.
+ */
+public interface WritingModeTraitsGetter {
+
+ /**
+ * @return the "inline-progression-direction" trait
+ */
+ Direction getInlineProgressionDirection();
+
+ /**
+ * @return the "block-progression-direction" trait
+ */
+ Direction getBlockProgressionDirection();
+
+ /**
+ * @return the "column-progression-direction" trait
+ */
+ Direction getColumnProgressionDirection();
+
+ /**
+ * @return the "row-progression-direction" trait
+ */
+
+ Direction getRowProgressionDirection();
+
+ /**
+ * @return the "shift-direction" trait
+ */
+ Direction getShiftDirection();
+
+ /**
+ * @return the "writing-mode" trait
+ */
+ WritingMode getWritingMode();
+
+}
Propchange: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/traits/WritingModeTraitsGetter.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/traits/WritingModeTraitsGetter.java
------------------------------------------------------------------------------
svn:keywords = Id
Added: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/traits/WritingModeTraitsSetter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/traits/WritingModeTraitsSetter.java?rev=987282&view=auto
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/traits/WritingModeTraitsSetter.java (added)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/traits/WritingModeTraitsSetter.java Thu Aug 19 19:46:41 2010
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id$ */
+
+package org.apache.fop.traits;
+
+/**
+ * This interface provides read and assignment access to FO traits related to writing mode.
+ */
+public interface WritingModeTraitsSetter extends WritingModeTraitsGetter {
+
+ /**
+ * Set value of inline-progression-direction trait.
+ * @param direction the "inline-progression-direction" trait
+ */
+ void setInlineProgressionDirection ( Direction direction );
+
+ /**
+ * Set value of block-progression-direction trait.
+ * @param direction the "block-progression-direction" trait
+ */
+ void setBlockProgressionDirection ( Direction direction );
+
+ /**
+ * Set value of column-progression-direction trait.
+ * @param direction the "column-progression-direction" trait
+ */
+ void setColumnProgressionDirection ( Direction direction );
+
+ /**
+ * Set value of row-progression-direction trait.
+ * @param direction the "row-progression-direction" trait
+ */
+ void setRowProgressionDirection ( Direction direction );
+
+ /**
+ * Set value of shift-direction trait.
+ * @param direction the "shift-direction" trait
+ */
+ void setShiftDirection ( Direction direction );
+
+ /**
+ * Set value of writing-mode trait.
+ * @param writingMode the "writing-mode" trait
+ */
+ void setWritingMode ( WritingMode writingMode );
+
+ /**
+ * Collectivelly assign values to all writing mode traits based upon a specific
+ * writing mode.
+ * @param writingMode the "writing-mode" trait
+ */
+ void assignWritingModeTraits ( WritingMode writingMode );
+
+}
Propchange: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/traits/WritingModeTraitsSetter.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/traits/WritingModeTraitsSetter.java
------------------------------------------------------------------------------
svn:keywords = Id
Added: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/util/BidiConstants.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/util/BidiConstants.java?rev=987282&view=auto
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/util/BidiConstants.java (added)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/util/BidiConstants.java Thu Aug 19 19:46:41 2010
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id$ */
+
+package org.apache.fop.util;
+
+
+/**
+ * Constants used for bidirectional processing.
+ * @author Glenn Adams
+ */
+public interface BidiConstants {
+
+ // bidi character class
+
+ // strong category
+ /** left-to-right class */
+ int L = 1;
+ /** left-to-right embedding class */
+ int LRE = 2;
+ /** left-to-right override class */
+ int LRO = 3;
+ /** right-to-left class */
+ int R = 4;
+ /** right-to-left arabic class */
+ int AL = 5;
+ /** right-to-left embedding class */
+ int RLE = 6;
+ /** right-to-left override class */
+ int RLO = 7;
+
+ // weak category
+ /** pop directional formatting class */
+ int PDF = 8;
+ /** european number class */
+ int EN = 9;
+ /** european number separator class */
+ int ES = 10;
+ /** european number terminator class */
+ int ET = 11;
+ /** arabic number class */
+ int AN = 12;
+ /** common number separator class */
+ int CS = 13;
+ /** non-spacing mark class */
+ int NSM = 14;
+ /** boundary neutral class */
+ int BN = 15;
+
+ // neutral category
+ /** paragraph separator class */
+ int B = 16;
+ /** segment separator class */
+ int S = 17;
+ /** whitespace class */
+ int WS = 18;
+ /** other neutrals class */
+ int ON = 19;
+
+ // implementation specific categories
+ /** placeholder for low surrogate */
+ int SURROGATE = 20;
+
+ // other constants
+ /** maximum bidirectional levels */
+ int MAX_LEVELS = 61;
+ /** override flag */
+ int OVERRIDE = 128;
+}
Propchange: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/util/BidiConstants.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/util/BidiConstants.java
------------------------------------------------------------------------------
svn:keywords = Id
Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/util/CharUtilities.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/util/CharUtilities.java?rev=987282&r1=987281&r2=987282&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/util/CharUtilities.java (original)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/util/CharUtilities.java Thu Aug 19 19:46:41 2010
@@ -19,6 +19,17 @@
package org.apache.fop.util;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+// CSOFF: AvoidNestedBlocksCheck
+// CSOFF: InnerAssignmentCheck
+// CSOFF: SimplifyBooleanReturnCheck
+
/**
* This class provides utilities to distinguish various kinds of Unicode
* whitespace and to get character widths in a given FontState.
@@ -74,6 +85,20 @@ public class CharUtilities {
public static final char WORD_JOINER = '\u2060';
/** zero-width joiner */
public static final char ZERO_WIDTH_JOINER = '\u200D';
+ /** left-to-right mark */
+ public static final char LRM = '\u200E';
+ /** right-to-left mark */
+ public static final char RLM = '\u202F';
+ /** left-to-right embedding */
+ public static final char LRE = '\u202A';
+ /** right-to-left embedding */
+ public static final char RLE = '\u202B';
+ /** pop directional formatting */
+ public static final char PDF = '\u202C';
+ /** left-to-right override */
+ public static final char LRO = '\u202D';
+ /** right-to-left override */
+ public static final char RLO = '\u202E';
/** zero-width no-break space (= byte order mark) */
public static final char ZERO_WIDTH_NOBREAK_SPACE = '\uFEFF';
/** soft hyphen */
@@ -103,7 +128,7 @@ public class CharUtilities {
* @param c character to inspect
* @return the determined character class
*/
- public static int classOf(char c) {
+ public static int classOf ( int c ) {
switch (c) {
case CODE_EOT:
return EOT;
@@ -126,7 +151,7 @@ public class CharUtilities {
* @param c character to inspect
* @return True if the character is a normal space
*/
- public static boolean isBreakableSpace(char c) {
+ public static boolean isBreakableSpace ( int c ) {
return (c == SPACE || isFixedWidthSpace(c));
}
@@ -135,7 +160,7 @@ public class CharUtilities {
* @param c the character to check
* @return true if the character is a zero-width space
*/
- public static boolean isZeroWidthSpace(char c) {
+ public static boolean isZeroWidthSpace ( int c ) {
return c == ZERO_WIDTH_SPACE // 200Bh
|| c == WORD_JOINER // 2060h
|| c == ZERO_WIDTH_NOBREAK_SPACE; // FEFFh (also used as BOM)
@@ -146,7 +171,7 @@ public class CharUtilities {
* @param c the character to check
* @return true if the character has a fixed-width
*/
- public static boolean isFixedWidthSpace(char c) {
+ public static boolean isFixedWidthSpace ( int c ) {
return (c >= '\u2000' && c <= '\u200B')
|| c == '\u3000';
// c == '\u2000' // en quad
@@ -170,7 +195,7 @@ public class CharUtilities {
* @param c character to check
* @return True if the character is a nbsp
*/
- public static boolean isNonBreakableSpace(char c) {
+ public static boolean isNonBreakableSpace ( int c ) {
return
(c == NBSPACE // no-break space
|| c == '\u202F' // narrow no-break space
@@ -185,7 +210,7 @@ public class CharUtilities {
* @param c character to check
* @return True if the character is adjustable
*/
- public static boolean isAdjustableSpace(char c) {
+ public static boolean isAdjustableSpace ( int c ) {
//TODO: are there other kinds of adjustable spaces?
return
(c == '\u0020' // normal space
@@ -197,19 +222,19 @@ public class CharUtilities {
* @param c character to check
* @return True if the character represents any kind of space
*/
- public static boolean isAnySpace(char c) {
+ public static boolean isAnySpace ( int c ) {
return (isBreakableSpace(c) || isNonBreakableSpace(c));
}
/**
* Indicates whether a character is classified as "Alphabetic" by the Unicode standard.
- * @param ch the character
+ * @param c the character
* @return true if the character is "Alphabetic"
*/
- public static boolean isAlphabetic(char ch) {
+ public static boolean isAlphabetic ( int c ) {
//http://www.unicode.org/Public/UNIDATA/UCD.html#Alphabetic
//Generated from: Other_Alphabetic + Lu + Ll + Lt + Lm + Lo + Nl
- int generalCategory = Character.getType(ch);
+ int generalCategory = Character.getType((char)c);
switch (generalCategory) {
case Character.UPPERCASE_LETTER: //Lu
case Character.LOWERCASE_LETTER: //Ll
@@ -227,15 +252,1362 @@ public class CharUtilities {
/**
* Indicates whether the given character is an explicit break-character
- * @param ch the character to check
+ * @param c the character to check
* @return true if the character represents an explicit break
*/
- public static boolean isExplicitBreak(char ch) {
- return (ch == LINEFEED_CHAR
- || ch == CARRIAGE_RETURN
- || ch == NEXT_LINE
- || ch == LINE_SEPARATOR
- || ch == PARAGRAPH_SEPARATOR);
+ public static boolean isExplicitBreak ( int c ) {
+ return (c == LINEFEED_CHAR
+ || c == CARRIAGE_RETURN
+ || c == NEXT_LINE
+ || c == LINE_SEPARATOR
+ || c == PARAGRAPH_SEPARATOR);
+ }
+
+
+ /** hebrew script constant */
+ public static final int SCRIPT_HEBREW = 125; // 'hebr'
+ /** mongolian script constant */
+ public static final int SCRIPT_MONGOLIAN = 145; // 'mong'
+ /** arabic script constant */
+ public static final int SCRIPT_ARABIC = 160; // 'arab'
+ /** greek script constant */
+ public static final int SCRIPT_GREEK = 200; // 'grek'
+ /** latin script constant */
+ public static final int SCRIPT_LATIN = 215; // 'latn'
+ /** cyrillic script constant */
+ public static final int SCRIPT_CYRILLIC = 220; // 'cyrl'
+ /** georgian script constant */
+ public static final int SCRIPT_GEORGIAN = 240; // 'geor'
+ /** bopomofo script constant */
+ public static final int SCRIPT_BOPOMOFO = 285; // 'bopo'
+ /** hangul script constant */
+ public static final int SCRIPT_HANGUL = 286; // 'hang'
+ /** gurmukhi script constant */
+ public static final int SCRIPT_GURMUKHI = 310; // 'guru'
+ /** devanagari script constant */
+ public static final int SCRIPT_DEVANAGARI = 315; // 'deva'
+ /** gujarati script constant */
+ public static final int SCRIPT_GUJARATI = 320; // 'gujr'
+ /** bengali script constant */
+ public static final int SCRIPT_BENGALI = 326; // 'beng'
+ /** oriya script constant */
+ public static final int SCRIPT_ORIYA = 327; // 'orya'
+ /** tibetan script constant */
+ public static final int SCRIPT_TIBETAN = 330; // 'tibt'
+ /** telugu script constant */
+ public static final int SCRIPT_TELUGU = 340; // 'telu'
+ /** tamil script constant */
+ public static final int SCRIPT_TAMIL = 346; // 'taml'
+ /** malayalam script constant */
+ public static final int SCRIPT_MALAYALAM = 347; // 'mlym'
+ /** sinhalese script constant */
+ public static final int SCRIPT_SINHALESE = 348; // 'sinh'
+ /** burmese script constant */
+ public static final int SCRIPT_BURMESE = 350; // 'mymr'
+ /** thai script constant */
+ public static final int SCRIPT_THAI = 352; // 'thai'
+ /** khmer script constant */
+ public static final int SCRIPT_KHMER = 355; // 'khmr'
+ /** lao script constant */
+ public static final int SCRIPT_LAO = 356; // 'laoo'
+ /** hiragana script constant */
+ public static final int SCRIPT_HIRAGANA = 410; // 'hira'
+ /** ethiopic script constant */
+ public static final int SCRIPT_ETHIOPIC = 430; // 'ethi'
+ /** han script constant */
+ public static final int SCRIPT_HAN = 500; // 'hani'
+ /** katakana script constant */
+ public static final int SCRIPT_KATAKANA = 410; // 'kana'
+ /** math script constant */
+ public static final int SCRIPT_MATH = 995; // 'zmth'
+ /** symbol script constant */
+ public static final int SCRIPT_SYMBOL = 996; // 'zsym'
+ /** undetermined script constant */
+ public static final int SCRIPT_UNDETERMINED = 998; // 'zyyy'
+ /** uncoded script constant */
+ public static final int SCRIPT_UNCODED = 999; // 'zzzz'
+
+ /**
+ * Determine if character c is punctuation.
+ * @param c a character represented as a unicode scalar value
+ * @return true if character is punctuation
+ */
+ 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
+ return true;
+ } else if ( ( c >= 0x005F ) && ( c <= 0x0060 ) ) { // basic latin punctuation
+ return true;
+ } else if ( ( c >= 0x007E ) && ( c <= 0x007E ) ) { // basic latin punctuation
+ return true;
+ } else if ( ( c >= 0x007E ) && ( c <= 0x007E ) ) { // basic latin punctuation
+ return true;
+ } else if ( ( c >= 0x00A1 ) && ( c <= 0x00BF ) ) { // latin supplement punctuation
+ return true;
+ } else if ( ( c >= 0x00D7 ) && ( c <= 0x00D7 ) ) { // latin supplement punctuation
+ return true;
+ } else if ( ( c >= 0x00F7 ) && ( c <= 0x00F7 ) ) { // latin supplement punctuation
+ return true;
+ } else if ( ( c >= 0x2000 ) && ( c <= 0x206F ) ) { // general punctuation
+ return true;
+ } else { // [TBD] - not complete
+ return false;
+ }
+ }
+
+ /**
+ * Determine if character c is a digit.
+ * @param c a character represented as a unicode scalar value
+ * @return true if character is a digit
+ */
+ public static boolean isDigit ( int c ) {
+ if ( ( c >= 0x0030 ) && ( c <= 0x0039 ) ) { // basic latin digits
+ return true;
+ } else { // [TBD] - not complete
+ return false;
+ }
+ }
+
+ /**
+ * Determine if character c belong to the hebrew script.
+ * @param c a character represented as a unicode scalar value
+ * @return true if character belongs to hebrew script
+ */
+ public static boolean isHebrew ( int c ) {
+ return false; // [TBD] - implement me
+ }
+
+ /**
+ * Determine if character c belong to the mongolian script.
+ * @param c a character represented as a unicode scalar value
+ * @return true if character belongs to mongolian script
+ */
+ public static boolean isMongolian ( int c ) {
+ return false; // [TBD] - implement me
}
-}
+ /**
+ * Determine if character c belong to the arabic script.
+ * @param c a character represented as a unicode scalar value
+ * @return true if character belongs to arabic script
+ */
+ public static boolean isArabic ( int c ) {
+ if ( ( c >= 0x0600 ) && ( c <= 0x06FF ) ) { // arabic block
+ return true;
+ } else if ( ( c >= 0x0750 ) && ( c <= 0x077F ) ) { // arabic supplement block
+ return true;
+ } else if ( ( c >= 0xFB50 ) && ( c <= 0xFDFF ) ) { // arabic presentation forms a block
+ return true;
+ } else if ( ( c >= 0xFE70 ) && ( c <= 0xFEFF ) ) { // arabic presentation forms b block
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Determine if character c belong to the greek script.
+ * @param c a character represented as a unicode scalar value
+ * @return true if character belongs to greek script
+ */
+ public static boolean isGreek ( int c ) {
+ return false; // [TBD] - implement me
+ }
+
+ /**
+ * Determine if character c belong to the latin script.
+ * @param c a character represented as a unicode scalar value
+ * @return true if character belongs to latin script
+ */
+ 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
+ return true;
+ } else if ( ( c >= 0x00C0 ) && ( c <= 0x00D6 ) ) { // latin supplement upper case
+ return true;
+ } else if ( ( c >= 0x00D8 ) && ( c <= 0x00DF ) ) { // latin supplement upper case
+ return true;
+ } else if ( ( c >= 0x00E0 ) && ( c <= 0x00F6 ) ) { // latin supplement lower case
+ return true;
+ } else if ( ( c >= 0x00F8 ) && ( c <= 0x00FF ) ) { // latin supplement lower case
+ return true;
+ } else if ( ( c >= 0x0100 ) && ( c <= 0x017F ) ) { // latin extended a
+ return true;
+ } else if ( ( c >= 0x0180 ) && ( c <= 0x024F ) ) { // latin extended b
+ return true;
+ } else if ( ( c >= 0x1E00 ) && ( c <= 0x1EFF ) ) { // latin extended additional
+ return true;
+ } else if ( ( c >= 0x2C60 ) && ( c <= 0x2C7F ) ) { // latin extended c
+ return true;
+ } else if ( ( c >= 0xA720 ) && ( c <= 0xA7FF ) ) { // latin extended d
+ return true;
+ } else if ( ( c >= 0xFB00 ) && ( c <= 0xFB0F ) ) { // latin ligatures
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Determine if character c belong to the cyrillic script.
+ * @param c a character represented as a unicode scalar value
+ * @return true if character belongs to cyrillic script
+ */
+ public static boolean isCyrillic ( int c ) {
+ return false; // [TBD] - implement me
+ }
+
+ /**
+ * Determine if character c belong to the georgian script.
+ * @param c a character represented as a unicode scalar value
+ * @return true if character belongs to georgian script
+ */
+ public static boolean isGeorgian ( int c ) {
+ return false; // [TBD] - implement me
+ }
+
+ /**
+ * Determine if character c belong to the hangul script.
+ * @param c a character represented as a unicode scalar value
+ * @return true if character belongs to hangul script
+ */
+ public static boolean isHangul ( int c ) {
+ if ( ( c >= 0x1100 ) && ( c <= 0x11FF ) ) { // hangul jamo
+ return true;
+ } else if ( ( c >= 0x3130 ) && ( c <= 0x318F ) ) { // hangul compatibility jamo
+ return true;
+ } else if ( ( c >= 0xA960 ) && ( c <= 0xA97F ) ) { // hangul jamo extended a
+ return true;
+ } else if ( ( c >= 0xAC00 ) && ( c <= 0xD7A3 ) ) { // hangul syllables
+ return true;
+ } else if ( ( c >= 0xD7B0 ) && ( c <= 0xD7FF ) ) { // hangul jamo extended a
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Determine if character c belong to the gurmukhi script.
+ * @param c a character represented as a unicode scalar value
+ * @return true if character belongs to gurmukhi script
+ */
+ public static boolean isGurmukhi ( int c ) {
+ return false; // [TBD] - implement me
+ }
+
+ /**
+ * Determine if character c belong to the devanagari script.
+ * @param c a character represented as a unicode scalar value
+ * @return true if character belongs to devanagari script
+ */
+ public static boolean isDevanagari ( int c ) {
+ return false; // [TBD] - implement me
+ }
+
+ /**
+ * Determine if character c belong to the gujarati script.
+ * @param c a character represented as a unicode scalar value
+ * @return true if character belongs to gujarati script
+ */
+ public static boolean isGujarati ( int c ) {
+ return false; // [TBD] - implement me
+ }
+
+ /**
+ * Determine if character c belong to the bengali script.
+ * @param c a character represented as a unicode scalar value
+ * @return true if character belongs to bengali script
+ */
+ public static boolean isBengali ( int c ) {
+ return false; // [TBD] - implement me
+ }
+
+ /**
+ * Determine if character c belong to the oriya script.
+ * @param c a character represented as a unicode scalar value
+ * @return true if character belongs to oriya script
+ */
+ public static boolean isOriya ( int c ) {
+ return false; // [TBD] - implement me
+ }
+
+ /**
+ * Determine if character c belong to the tibetan script.
+ * @param c a character represented as a unicode scalar value
+ * @return true if character belongs to tibetan script
+ */
+ public static boolean isTibetan ( int c ) {
+ return false; // [TBD] - implement me
+ }
+
+ /**
+ * Determine if character c belong to the telugu script.
+ * @param c a character represented as a unicode scalar value
+ * @return true if character belongs to telugu script
+ */
+ public static boolean isTelugu ( int c ) {
+ return false; // [TBD] - implement me
+ }
+
+ /**
+ * Determine if character c belong to the tamil script.
+ * @param c a character represented as a unicode scalar value
+ * @return true if character belongs to tamil script
+ */
+ public static boolean isTamil ( int c ) {
+ return false; // [TBD] - implement me
+ }
+
+ /**
+ * Determine if character c belong to the malayalam script.
+ * @param c a character represented as a unicode scalar value
+ * @return true if character belongs to malayalam script
+ */
+ public static boolean isMalayalam ( int c ) {
+ return false; // [TBD] - implement me
+ }
+
+ /**
+ * Determine if character c belong to the sinhalese script.
+ * @param c a character represented as a unicode scalar value
+ * @return true if character belongs to sinhalese script
+ */
+ public static boolean isSinhalese ( int c ) {
+ return false; // [TBD] - implement me
+ }
+
+ /**
+ * Determine if character c belong to the burmese script.
+ * @param c a character represented as a unicode scalar value
+ * @return true if character belongs to burmese script
+ */
+ public static boolean isBurmese ( int c ) {
+ return false; // [TBD] - implement me
+ }
+
+ /**
+ * Determine if character c belong to the thai script.
+ * @param c a character represented as a unicode scalar value
+ * @return true if character belongs to thai script
+ */
+ public static boolean isThai ( int c ) {
+ return false; // [TBD] - implement me
+ }
+
+ /**
+ * Determine if character c belong to the khmer script.
+ * @param c a character represented as a unicode scalar value
+ * @return true if character belongs to khmer script
+ */
+ public static boolean isKhmer ( int c ) {
+ return false; // [TBD] - implement me
+ }
+
+ /**
+ * Determine if character c belong to the lao script.
+ * @param c a character represented as a unicode scalar value
+ * @return true if character belongs to lao script
+ */
+ public static boolean isLao ( int c ) {
+ return false; // [TBD] - implement me
+ }
+
+ /**
+ * Determine if character c belong to the ethiopic (amharic) script.
+ * @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 ) {
+ return false; // [TBD] - implement me
+ }
+
+ /**
+ * Determine if character c belong to the han (unified cjk) script.
+ * @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 ) {
+ if ( ( c >= 0x3400 ) && ( c <= 0x4DBF ) ) {
+ return true; // cjk unified ideographs extension a
+ } else if ( ( c >= 0x4E00 ) && ( c <= 0x9FFF ) ) {
+ return true; // cjk unified ideographs
+ } else if ( ( c >= 0xF900 ) && ( c <= 0xFAFF ) ) {
+ return true; // cjk compatibility ideographs
+ } else if ( ( c >= 0x20000 ) && ( c <= 0x2A6DF ) ) {
+ return true; // cjk unified ideographs extension b
+ } else if ( ( c >= 0x2A700 ) && ( c <= 0x2B73F ) ) {
+ return true; // cjk unified ideographs extension c
+ } else if ( ( c >= 0x2F800 ) && ( c <= 0x2FA1F ) ) {
+ return true; // cjk compatibility ideographs supplement
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Determine if character c belong to the bopomofo script.
+ * @param c a character represented as a unicode scalar value
+ * @return true if character belongs to bopomofo script
+ */
+ public static boolean isBopomofo ( int c ) {
+ if ( ( c >= 0x3100 ) && ( c <= 0x312F ) ) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Determine if character c belong to the hiragana script.
+ * @param c a character represented as a unicode scalar value
+ * @return true if character belongs to hiragana script
+ */
+ public static boolean isHiragana ( int c ) {
+ if ( ( c >= 0x3040 ) && ( c <= 0x309F ) ) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Determine if character c belong to the katakana script.
+ * @param c a character represented as a unicode scalar value
+ * @return true if character belongs to katakana script
+ */
+ public static boolean isKatakana ( int c ) {
+ if ( ( c >= 0x30A0 ) && ( c <= 0x30FF ) ) {
+ return true;
+ } else if ( ( c >= 0x31F0 ) && ( c <= 0x31FF ) ) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Obtain ISO15924 numeric script code of character. If script is not or cannot be determined,
+ * then the script code 998 ('zyyy') is returned.
+ * @param c the character to obtain script
+ * @return an ISO15924 script code
+ */
+ public static int scriptOf ( int c ) { // [TBD] - needs optimization!!!
+ if ( isAnySpace ( c ) ) {
+ return SCRIPT_UNDETERMINED;
+ } else if ( isPunctuation ( c ) ) {
+ return SCRIPT_UNDETERMINED;
+ } else if ( isDigit ( c ) ) {
+ return SCRIPT_UNDETERMINED;
+ } else if ( isLatin ( c ) ) {
+ return SCRIPT_LATIN;
+ } else if ( isCyrillic ( c ) ) {
+ return SCRIPT_CYRILLIC;
+ } else if ( isGreek ( c ) ) {
+ return SCRIPT_GREEK;
+ } else if ( isHan ( c ) ) {
+ return SCRIPT_HAN;
+ } else if ( isBopomofo ( c ) ) {
+ return SCRIPT_BOPOMOFO;
+ } else if ( isKatakana ( c ) ) {
+ return SCRIPT_KATAKANA;
+ } else if ( isHiragana ( c ) ) {
+ return SCRIPT_HIRAGANA;
+ } else if ( isHangul ( c ) ) {
+ return SCRIPT_HANGUL;
+ } else if ( isArabic ( c ) ) {
+ return SCRIPT_ARABIC;
+ } else if ( isHebrew ( c ) ) {
+ return SCRIPT_HEBREW;
+ } else if ( isMongolian ( c ) ) {
+ return SCRIPT_MONGOLIAN;
+ } else if ( isGeorgian ( c ) ) {
+ return SCRIPT_GEORGIAN;
+ } else if ( isGurmukhi ( c ) ) {
+ return SCRIPT_GURMUKHI;
+ } else if ( isDevanagari ( c ) ) {
+ return SCRIPT_DEVANAGARI;
+ } else if ( isGujarati ( c ) ) {
+ return SCRIPT_GUJARATI;
+ } else if ( isBengali ( c ) ) {
+ return SCRIPT_BENGALI;
+ } else if ( isOriya ( c ) ) {
+ return SCRIPT_ORIYA;
+ } else if ( isTibetan ( c ) ) {
+ return SCRIPT_TIBETAN;
+ } else if ( isTelugu ( c ) ) {
+ return SCRIPT_TELUGU;
+ } else if ( isTamil ( c ) ) {
+ return SCRIPT_TAMIL;
+ } else if ( isMalayalam ( c ) ) {
+ return SCRIPT_MALAYALAM;
+ } else if ( isSinhalese ( c ) ) {
+ return SCRIPT_SINHALESE;
+ } else if ( isBurmese ( c ) ) {
+ return SCRIPT_BURMESE;
+ } else if ( isThai ( c ) ) {
+ return SCRIPT_THAI;
+ } else if ( isKhmer ( c ) ) {
+ return SCRIPT_KHMER;
+ } else if ( isLao ( c ) ) {
+ return SCRIPT_LAO;
+ } else if ( isEthiopic ( c ) ) {
+ return SCRIPT_ETHIOPIC;
+ } else {
+ return SCRIPT_UNDETERMINED;
+ }
+ }
+
+ /**
+ * Obtain the script codes of each character in a character sequence. If script
+ * is not or cannot be determined for some character, then the script code 998
+ * ('zyyy') is returned.
+ * @param cs the character sequence
+ * @return a (possibly empty) array of script codes
+ */
+ 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 ) ) ) );
+ }
+ 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 );
+ return sa;
+ }
+
+ /**
+ * Determine the dominant script of a character sequence.
+ * @param cs the character sequence
+ * @return the dominant script or SCRIPT_UNDETERMINED
+ */
+ 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 );
+ if ( v != null ) {
+ m.put ( k, Integer.valueOf ( v.intValue() + 1 ) );
+ } else {
+ m.put ( k, Integer.valueOf ( 0 ) );
+ }
+ }
+ int sMax = -1;
+ int cMax = -1;
+ for ( Iterator it = m.entrySet().iterator(); it.hasNext();) {
+ Map.Entry e = (Map.Entry) it.next();
+ Integer k = (Integer) e.getKey();
+ int s = k.intValue();
+ switch ( s ) {
+ case SCRIPT_UNDETERMINED:
+ case SCRIPT_UNCODED:
+ break;
+ default:
+ {
+ Integer v = (Integer) e.getValue();
+ assert v != null;
+ int c = v.intValue();
+ if ( c > cMax ) {
+ cMax = c; sMax = s;
+ }
+ break;
+ }
+ }
+ }
+ if ( sMax < 0 ) {
+ sMax = SCRIPT_UNDETERMINED;
+ }
+ return sMax;
+ }
+
+ /**
+ * Determine the ISO script tag associated with an internal
+ * script code.
+ * @param code the script code
+ * @return an ISO script tag
+ */
+ public static String scriptTagFromCode ( int code ) {
+ String tag;
+ if ( scriptTagsMap == null ) {
+ scriptTagsMap = makeScriptTagsMap();
+ }
+ if ( ( tag = (String) scriptTagsMap.get ( Integer.valueOf ( code ) ) ) == null ) {
+ tag = scriptTagFromCode ( SCRIPT_UNDETERMINED );
+ }
+ return tag;
+ }
+
+ /**
+ * Convert a single unicode scalar value to an XML numeric character
+ * reference. If in the BMP, four digits are used, otherwise 6 digits are used.
+ * @param c a unicode scalar value
+ * @return a string representing a numeric character reference
+ */
+ public static String charToNCRef ( int c ) {
+ StringBuffer sb = new StringBuffer();
+ for ( int i = 0, nDigits = ( c > 0xFFFF ) ? 6 : 4; i < nDigits; i++, c >>= 4 ) {
+ int d = c & 0xF;
+ char hd;
+ if ( d < 10 ) {
+ hd = (char) ( (int) '0' + d );
+ } else {
+ hd = (char) ( (int) 'A' + ( d - 10 ) );
+ }
+ sb.append ( hd );
+ }
+ return "&#x" + sb.reverse() + ";";
+ }
+
+ /**
+ * Convert a string to a sequence of ASCII or XML numeric character references.
+ * @param s a java string (encoded in UTF-16)
+ * @return a string representing a sequence of numeric character reference or
+ * ASCII characters
+ */
+ public static String toNCRefs ( String s ) {
+ StringBuffer sb = new StringBuffer();
+ if ( s != null ) {
+ for ( int i = 0; i < s.length(); i++ ) {
+ char c = s.charAt(i);
+ if ( ( c >= 32 ) && ( c < 127 ) ) {
+ sb.append ( c );
+ } else {
+ sb.append ( charToNCRef ( c ) );
+ }
+ }
+ }
+ return sb.toString();
+ }
+
+ private static Map scriptTagsMap = null;
+
+ private static void putScriptTag ( Map m, int code, String tag ) {
+ m.put ( Integer.valueOf ( code ), tag );
+ }
+
+ private static Map makeScriptTagsMap() {
+ HashMap m = new HashMap();
+ putScriptTag ( m, SCRIPT_HEBREW, "hebr" );
+ putScriptTag ( m, SCRIPT_MONGOLIAN, "mong" );
+ putScriptTag ( m, SCRIPT_ARABIC, "arab" );
+ putScriptTag ( m, SCRIPT_GREEK, "grek" );
+ putScriptTag ( m, SCRIPT_LATIN, "latn" );
+ putScriptTag ( m, SCRIPT_CYRILLIC, "cyrl" );
+ putScriptTag ( m, SCRIPT_GEORGIAN, "geor" );
+ putScriptTag ( m, SCRIPT_BOPOMOFO, "bopo" );
+ putScriptTag ( m, SCRIPT_HANGUL, "hang" );
+ putScriptTag ( m, SCRIPT_GURMUKHI, "guru" );
+ putScriptTag ( m, SCRIPT_DEVANAGARI, "deva" );
+ putScriptTag ( m, SCRIPT_GUJARATI, "gujr" );
+ putScriptTag ( m, SCRIPT_BENGALI, "beng" );
+ putScriptTag ( m, SCRIPT_ORIYA, "orya" );
+ putScriptTag ( m, SCRIPT_TIBETAN, "tibt" );
+ putScriptTag ( m, SCRIPT_TELUGU, "telu" );
+ putScriptTag ( m, SCRIPT_TAMIL, "taml" );
+ putScriptTag ( m, SCRIPT_MALAYALAM, "mlym" );
+ putScriptTag ( m, SCRIPT_SINHALESE, "sinh" );
+ putScriptTag ( m, SCRIPT_BURMESE, "mymr" );
+ putScriptTag ( m, SCRIPT_THAI, "thai" );
+ putScriptTag ( m, SCRIPT_KHMER, "khmr" );
+ putScriptTag ( m, SCRIPT_LAO, "laoo" );
+ putScriptTag ( m, SCRIPT_HIRAGANA, "hira" );
+ putScriptTag ( m, SCRIPT_ETHIOPIC, "ethi" );
+ putScriptTag ( m, SCRIPT_HAN, "hani" );
+ putScriptTag ( m, SCRIPT_KATAKANA, "kana" );
+ putScriptTag ( m, SCRIPT_MATH, "zmth" );
+ putScriptTag ( m, SCRIPT_SYMBOL, "zsym" );
+ putScriptTag ( m, SCRIPT_UNDETERMINED, "zyyy" );
+ putScriptTag ( m, SCRIPT_UNCODED, "zzzz" );
+ return m;
+ }
+
+ /**
+ * Mirror characters that are designated as having the bidi mirrorred property.
+ * @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 );
+ for ( int i = 0, n = sb.length(); i < n; i++ ) {
+ sb.setCharAt ( i, (char) mirror ( sb.charAt ( i ) ) );
+ }
+ return sb.toString();
+ }
+
+ private static int[] mirroredCharacters = {
+ 0x0028,
+ 0x0029,
+ 0x003C,
+ 0x003E,
+ 0x005B,
+ 0x005D,
+ 0x007B,
+ 0x007D,
+ 0x00AB,
+ 0x00BB,
+ 0x0F3A,
+ 0x0F3B,
+ 0x0F3C,
+ 0x0F3D,
+ 0x169B,
+ 0x169C,
+ 0x2039,
+ 0x203A,
+ 0x2045,
+ 0x2046,
+ 0x207D,
+ 0x207E,
+ 0x208D,
+ 0x208E,
+ 0x2208,
+ 0x2209,
+ 0x220A,
+ 0x220B,
+ 0x220C,
+ 0x220D,
+ 0x2215,
+ 0x223C,
+ 0x223D,
+ 0x2243,
+ 0x2252,
+ 0x2253,
+ 0x2254,
+ 0x2255,
+ 0x2264,
+ 0x2265,
+ 0x2266,
+ 0x2267,
+ 0x2268,
+ 0x2269,
+ 0x226A,
+ 0x226B,
+ 0x226E,
+ 0x226F,
+ 0x2270,
+ 0x2271,
+ 0x2272,
+ 0x2273,
+ 0x2274,
+ 0x2275,
+ 0x2276,
+ 0x2277,
+ 0x2278,
+ 0x2279,
+ 0x227A,
+ 0x227B,
+ 0x227C,
+ 0x227D,
+ 0x227E,
+ 0x227F,
+ 0x2280,
+ 0x2281,
+ 0x2282,
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,
+ 0x2AA7,
+ 0x2AA6,
+ 0x2AA9,
+ 0x2AA8,
+ 0x2AAB,
+ 0x2AAA,
+ 0x2AAD,
+ 0x2AAC,
+ 0x2AB0,
+ 0x2AAF,
+ 0x2AB4,
+ 0x2AB3,
+ 0x2AC4,
+ 0x2AC3,
+ 0x2AC6,
+ 0x2AC5,
+ 0x2ACE,
+ 0x2ACD,
+ 0x2AD0,
+ 0x2ACF,
+ 0x2AD2,
+ 0x2AD1,
+ 0x2AD4,
+ 0x2AD3,
+ 0x2AD6,
+ 0x2AD5,
+ 0x22A6,
+ 0x22A9,
+ 0x2E03,
+ 0x2E02,
+ 0x2E05,
+ 0x2E04,
+ 0x2E0A,
+ 0x2E09,
+ 0x2E0D,
+ 0x2E0C,
+ 0x2E1D,
+ 0x2E1C,
+ 0x2E21,
+ 0x2E20,
+ 0x2E23,
+ 0x2E22,
+ 0x2E25,
+ 0x2E24,
+ 0x2E27,
+ 0x300F,
+ 0x300E,
+ 0x3011,
+ 0x3010,
+ 0x3015,
+ 0x3014,
+ 0x3017,
+ 0x3016,
+ 0x3019,
+ 0x3018,
+ 0x301B,
+ 0x301A,
+ 0xFE5A,
+ 0xFE59,
+ 0xFF3D,
+ 0xFF3B,
+ 0xFF5D,
+ 0xFF5B,
+ 0xFF60,
+ 0xFF5F,
+ 0xFF63,
+ 0xFF62
+ };
+
+ private static int mirror ( int c ) {
+ int i = Arrays.binarySearch ( mirroredCharacters, c );
+ if ( i < 0 ) {
+ return c;
+ } else {
+ return mirroredCharactersMapping [ i ];
+ }
+ }
+
+}
Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/test/java/org/apache/fop/fonts/TrueTypeAnsiTestCase.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/test/java/org/apache/fop/fonts/TrueTypeAnsiTestCase.java?rev=987282&r1=987281&r2=987282&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/test/java/org/apache/fop/fonts/TrueTypeAnsiTestCase.java (original)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/test/java/org/apache/fop/fonts/TrueTypeAnsiTestCase.java Thu Aug 19 19:46:41 2010
@@ -77,7 +77,7 @@ public class TrueTypeAnsiTestCase extend
triplets.add(new FontTriplet(fontFamily, "normal", Font.WEIGHT_NORMAL));
EmbedFontInfo font = new EmbedFontInfo(
metricsFile.toURI().toASCIIString(),
- true, triplets,
+ true, true, triplets,
ttfFile.toURI().toASCIIString(), null);
fontList.add(font);
renderer.addFontList(fontList);
Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/test/layoutengine/disabled-testcases.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/test/layoutengine/disabled-testcases.xml?rev=987282&r1=987281&r2=987282&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/test/layoutengine/disabled-testcases.xml (original)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/test/layoutengine/disabled-testcases.xml Thu Aug 19 19:46:41 2010
@@ -222,4 +222,10 @@
<description>The block should cause overflow in the
last column on the page, rather than be broken.</description>
</testcase>
+ <testcase>
+ <name>Writing mode problems</name>
+ <file>simple-page-master_writing-mode_rl_region-body_writing-mode-lr.xml</file>
+ <description>Test erroneously depends upon incorrect implementation of writing-mode trait
+ derivation on fo:region-*.</description>
+ </testcase>
</disabled-testcases>
Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/test/layoutengine/standard-testcases/block_basic_2.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/test/layoutengine/standard-testcases/block_basic_2.xml?rev=987282&r1=987281&r2=987282&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/test/layoutengine/standard-testcases/block_basic_2.xml (original)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/test/layoutengine/standard-testcases/block_basic_2.xml Thu Aug 19 19:46:41 2010
@@ -75,7 +75,7 @@
<eval expected="0" xpath="//flow/block[5]/lineArea/inlineparent/@offset"/>
<eval expected="8616" xpath="//flow/block[5]/lineArea/inlineparent/text/@baseline"/>
<eval expected="0" xpath="//flow/block[6]/lineArea/text/@offset"/>
- <eval expected="0" xpath="//flow/block[6]/lineArea/text/word/@offset"/>
+ <true xpath="not(boolean(//flow/block[6]/lineArea/text/word/@offset))"/>
<eval expected="8616" xpath="//flow/block[6]/lineArea/text/@baseline"/>
</checks>
</testcase>
Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/test/layoutengine/standard-testcases/kerning_1_off.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/test/layoutengine/standard-testcases/kerning_1_off.xml?rev=987282&r1=987281&r2=987282&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/test/layoutengine/standard-testcases/kerning_1_off.xml (original)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/test/layoutengine/standard-testcases/kerning_1_off.xml Thu Aug 19 19:46:41 2010
@@ -47,12 +47,12 @@
<checks>
<eval expected="40020" xpath="//flow/block[1]/block[1]/lineArea/inlineparent/@ipd"/>
<true xpath="not(boolean(//flow/block[1]/block[1]/lineArea/inlineparent/text/@tlsadjust))"/>
- <eval expected="0" xpath="//flow/block[1]/block[1]/lineArea/inlineparent/text/word/@offset"/>
+ <true xpath="not(boolean(//flow/block[1]/block[1]/lineArea/inlineparent/text/word/@offset))"/>
<true xpath="not(boolean(//flow/block[1]/block[1]/lineArea/inlineparent/text/word/@letter-adjust))"/>
<eval expected="44020" xpath="//flow/block[2]/block[1]/lineArea/inlineparent/@ipd"/>
<eval expected="1000" xpath="//flow/block[2]/block[1]/lineArea/inlineparent/text/@tlsadjust"/>
- <eval expected="0" xpath="//flow/block[2]/block[1]/lineArea/inlineparent/text/word/@offset"/>
+ <true xpath="not(boolean(//flow/block[2]/block[1]/lineArea/inlineparent/text/word/@offset))"/>
<true xpath="not(boolean(//flow/block[2]/block[1]/lineArea/inlineparent/text/word/@letter-adjust))"/>
</checks>
</testcase>
Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/test/layoutengine/standard-testcases/kerning_1_on.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/test/layoutengine/standard-testcases/kerning_1_on.xml?rev=987282&r1=987281&r2=987282&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/test/layoutengine/standard-testcases/kerning_1_on.xml (original)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/test/layoutengine/standard-testcases/kerning_1_on.xml Thu Aug 19 19:46:41 2010
@@ -52,12 +52,12 @@
</fo>
<checks>
<eval expected="36420" xpath="//flow/block[1]/block[1]/lineArea/inlineparent/@ipd"/>
- <eval expected="0" xpath="//flow/block[1]/block[1]/lineArea/inlineparent/text/word/@offset"/>
+ <true xpath="not(boolean(//flow/block[1]/block[1]/lineArea/inlineparent/text/word/@offset))"/>
<eval expected="0 -960 -840 -960 -840" xpath="//flow/block[1]/block[1]/lineArea/inlineparent/text/word/@letter-adjust"/>
<eval expected="40420" xpath="//flow/block[2]/block[1]/lineArea/inlineparent/@ipd"/>
<eval expected="1000" xpath="//flow/block[2]/block[1]/lineArea/inlineparent/text/@tlsadjust"/>
- <eval expected="0" xpath="//flow/block[2]/block[1]/lineArea/inlineparent/text/word/@offset"/>
+ <true xpath="not(boolean(//flow/block[2]/block[1]/lineArea/inlineparent/text/word/@offset))"/>
<eval expected="0 -960 -840 -960 -840" xpath="//flow/block[2]/block[1]/lineArea/inlineparent/text/word/@letter-adjust"/>
</checks>
<if-checks xmlns:if="http://xmlgraphics.apache.org/fop/intermediate">
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org