diff options
author | Glenn Adams <gadams@apache.org> | 2014-08-23 03:50:42 +0000 |
---|---|---|
committer | Glenn Adams <gadams@apache.org> | 2014-08-23 03:50:42 +0000 |
commit | 65d3a38fcb19d7658f55ba181ee4ec7c7145f18f (patch) | |
tree | 321e322ed2276bbb8cde47d64e020e3198fd044e /src/java/org/apache/fop/fonts | |
parent | f92ab8b081fab203a70b573282188951ec015dcc (diff) | |
download | xmlgraphics-fop-65d3a38fcb19d7658f55ba181ee4ec7c7145f18f.tar.gz xmlgraphics-fop-65d3a38fcb19d7658f55ba181ee4ec7c7145f18f.zip |
FOP-2391: enable bidi processing of SVG text chunks
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1619960 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/fonts')
-rw-r--r-- | src/java/org/apache/fop/fonts/GlyphMapping.java | 25 | ||||
-rw-r--r-- | src/java/org/apache/fop/fonts/TextFragment.java | 42 |
2 files changed, 41 insertions, 26 deletions
diff --git a/src/java/org/apache/fop/fonts/GlyphMapping.java b/src/java/org/apache/fop/fonts/GlyphMapping.java index f0fadaad4..8c80eeb7c 100644 --- a/src/java/org/apache/fop/fonts/GlyphMapping.java +++ b/src/java/org/apache/fop/fonts/GlyphMapping.java @@ -19,7 +19,6 @@ package org.apache.fop.fonts; -import java.util.Collections; import java.util.List; import org.apache.commons.logging.Log; @@ -320,30 +319,6 @@ public class GlyphMapping { areaIPD = areaIPD.plus(idp); } - public void reverse() { - if (mapping == null) { - return; - } - if (mapping.length() > 0) { - mapping = new StringBuffer(mapping).reverse().toString(); - } - if (associations != null) { - Collections.reverse(associations); - } - if (gposAdjustments != null) { - reverse(gposAdjustments); - } - } - - private static void reverse(int[][] aa) { - for (int i = 0, n = aa.length, m = n / 2; i < m; i++) { - int k = n - i - 1; - int[] t = aa [ k ]; - aa [ k ] = aa [ i ]; - aa [ i ] = t; - } - } - public String toString() { return super.toString() + "{" + "interval = [" + startIndex + "," + endIndex + "]" diff --git a/src/java/org/apache/fop/fonts/TextFragment.java b/src/java/org/apache/fop/fonts/TextFragment.java index ad72db8e0..8722ecf2e 100644 --- a/src/java/org/apache/fop/fonts/TextFragment.java +++ b/src/java/org/apache/fop/fonts/TextFragment.java @@ -19,13 +19,53 @@ package org.apache.fop.fonts; +import java.text.CharacterIterator; + +/** + * Encapsulates a sub-sequence (fragement) of a text iterator (or other text source), + * where begin index and end index are indices into larger text iterator that denote + * [begin,end) of sub-sequence range. Additionally associated with a designated script + * (or "auto"), a designated language (or "none"), and a (single) bidi level (or -1 + * if not known). + */ public interface TextFragment { + /** + * Obtain reference to underlying iterator. + */ + CharacterIterator getIterator(); + + /** + * Obtain beginning index (inclusive) of sub-sequence of fragment in overall text source. + */ + int getBeginIndex(); + + /** + * Obtain ending index (exclusive) of sub-sequence of fragment in overall text source. + */ + int getEndIndex(); + + /** + * Obtain associated script (if designated) or "auto" if not. + */ String getScript(); + /** + * Obtain associated language (if designated) or "none" if not. + */ String getLanguage(); - char charAt(int index); + /** + * Obtain associated bidi level (if known) or -1 if not. + */ + int getBidiLevel(); + + /** + * Obtain character at specified index within this fragment's sub-sequence, + * where index 0 corresponds to beginning index in overal text source, and + * subSequenceIndex must be less than ending index - beginning index. + */ + char charAt(int subSequenceIndex); CharSequence subSequence(int startIndex, int endIndex); } |