git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1633759 13f79535-47bb-0310-9956-ffa450edef68pull/28/head
public void addWord( | public void addWord( | ||||
String word, int ipd, int[] letterAdjust, int[] levels, | String word, int ipd, int[] letterAdjust, int[] levels, | ||||
int[][] gposAdjustments, int blockProgressionOffset) { | int[][] gposAdjustments, int blockProgressionOffset) { | ||||
int minWordLevel = findMinLevel(levels); | |||||
int minWordLevel = findMinLevel(levels, getBidiLevel()); | |||||
WordArea wordArea = new WordArea( | WordArea wordArea = new WordArea( | ||||
blockProgressionOffset, minWordLevel, word, letterAdjust, levels, gposAdjustments); | blockProgressionOffset, minWordLevel, word, letterAdjust, levels, gposAdjustments); | ||||
wordArea.setIPD(ipd); | wordArea.setIPD(ipd); | ||||
return sb.toString(); | return sb.toString(); | ||||
} | } | ||||
private void updateLevel(int newLevel) { | |||||
public void updateLevel(int newLevel) { | |||||
if (newLevel >= 0) { | if (newLevel >= 0) { | ||||
int curLevel = getBidiLevel(); | int curLevel = getBidiLevel(); | ||||
if (curLevel >= 0) { | if (curLevel >= 0) { | ||||
} | } | ||||
} | } | ||||
private static int findMinLevel(int[] levels) { | |||||
private static int findMinLevel(int[] levels, int defaultLevel) { | |||||
if (levels != null) { | if (levels != null) { | ||||
int lMin = Integer.MAX_VALUE; | int lMin = Integer.MAX_VALUE; | ||||
for (int i = 0, n = levels.length; i < n; i++) { | for (int i = 0, n = levels.length; i < n; i++) { | ||||
return lMin; | return lMin; | ||||
} | } | ||||
} else { | } else { | ||||
return -1; | |||||
return defaultLevel; | |||||
} | } | ||||
} | } | ||||
public List collectInlineRuns(List runs) { | public List collectInlineRuns(List runs) { | ||||
assert runs != null; | assert runs != null; | ||||
InlineRun r; | 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 { | } else { | ||||
r = new InlineRun(this, -1, word.length()); | |||||
r = new InlineRun(this, getBidiLevel(), word.length()); | |||||
} | } | ||||
runs.add(r); | runs.add(r); | ||||
return runs; | return runs; |
return lb.toString(); | return lb.toString(); | ||||
} | } | ||||
private static int[] makeLevels(int level, int count) { | 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); | Arrays.fill(levels, level); | ||||
return levels; | return levels; | ||||
} | } |
int wordCharLength = 0; | int wordCharLength = 0; | ||||
for (int wordIndex = firstIndex; wordIndex <= lastIndex; wordIndex++) { | for (int wordIndex = firstIndex; wordIndex <= lastIndex; wordIndex++) { | ||||
mapping = getGlyphMapping(wordIndex); | mapping = getGlyphMapping(wordIndex); | ||||
textArea.updateLevel(mapping.level); | |||||
if (mapping.isSpace) { | if (mapping.isSpace) { | ||||
addSpaces(); | addSpaces(); | ||||
} else { | } else { |