Bläddra i källkod

FOP-2420: ensure word area's bidi level is initialized when word is mapped to empty string, e.g., when controls are elided

git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1633759 13f79535-47bb-0310-9956-ffa450edef68
pull/28/head
Glenn Adams 9 år sedan
förälder
incheckning
aa26b092ad

+ 4
- 4
src/java/org/apache/fop/area/inline/TextArea.java Visa fil

@@ -91,7 +91,7 @@ public class TextArea extends AbstractTextArea {
public void addWord(
String word, int ipd, int[] letterAdjust, int[] levels,
int[][] gposAdjustments, int blockProgressionOffset) {
int minWordLevel = findMinLevel(levels);
int minWordLevel = findMinLevel(levels, getBidiLevel());
WordArea wordArea = new WordArea(
blockProgressionOffset, minWordLevel, word, letterAdjust, levels, gposAdjustments);
wordArea.setIPD(ipd);
@@ -167,7 +167,7 @@ public class TextArea extends AbstractTextArea {
return sb.toString();
}

private void updateLevel(int newLevel) {
public void updateLevel(int newLevel) {
if (newLevel >= 0) {
int curLevel = getBidiLevel();
if (curLevel >= 0) {
@@ -180,7 +180,7 @@ public class TextArea extends AbstractTextArea {
}
}

private static int findMinLevel(int[] levels) {
private static int findMinLevel(int[] levels, int defaultLevel) {
if (levels != null) {
int lMin = Integer.MAX_VALUE;
for (int i = 0, n = levels.length; i < n; i++) {
@@ -195,7 +195,7 @@ public class TextArea extends AbstractTextArea {
return lMin;
}
} else {
return -1;
return defaultLevel;
}
}


+ 4
- 3
src/java/org/apache/fop/area/inline/WordArea.java Visa fil

@@ -155,10 +155,11 @@ public class WordArea extends InlineArea {
public List collectInlineRuns(List runs) {
assert runs != null;
InlineRun r;
if (getBidiLevels() != null) {
r = new InlineRun(this, getBidiLevels());
int[] levels = getBidiLevels();
if ((levels != null) && (levels.length > 0)) {
r = new InlineRun(this, levels);
} else {
r = new InlineRun(this, -1, word.length());
r = new InlineRun(this, getBidiLevel(), word.length());
}
runs.add(r);
return runs;

+ 1
- 1
src/java/org/apache/fop/complexscripts/bidi/InlineRun.java Visa fil

@@ -293,7 +293,7 @@ public class InlineRun {
return lb.toString();
}
private static int[] makeLevels(int level, int count) {
int[] levels = new int [ count ];
int[] levels = new int [ count > 0 ? count : 1 ];
Arrays.fill(levels, level);
return levels;
}

+ 1
- 0
src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java Visa fil

@@ -443,6 +443,7 @@ public class TextLayoutManager extends LeafNodeLayoutManager {
int wordCharLength = 0;
for (int wordIndex = firstIndex; wordIndex <= lastIndex; wordIndex++) {
mapping = getGlyphMapping(wordIndex);
textArea.updateLevel(mapping.level);
if (mapping.isSpace) {
addSpaces();
} else {

Laddar…
Avbryt
Spara