109 lines
4.0 KiB
Diff
109 lines
4.0 KiB
Diff
--- fop-2.1/src/java/org/apache/fop/fo/FOText.java 2016-01-07 15:13:29.000000000 +0100
|
|
+++ fop-2.1/src/java/org/apache/fop/fo/FOText.java 2018-04-05 12:06:45.984476031 +0200
|
|
@@ -20,6 +20,7 @@
|
|
package org.apache.fop.fo;
|
|
|
|
import java.awt.Color;
|
|
+import java.nio.Buffer;
|
|
import java.nio.CharBuffer;
|
|
import java.text.CharacterIterator;
|
|
import java.text.StringCharacterIterator;
|
|
@@ -120,7 +121,7 @@
|
|
charBuffer = CharBuffer.allocate(newLength);
|
|
} else {
|
|
// allocate a larger buffer, and transfer contents
|
|
- int requires = charBuffer.position() + length;
|
|
+ int requires = ((Buffer)charBuffer).position() + length;
|
|
int capacity = charBuffer.capacity();
|
|
if (requires > capacity) {
|
|
int newCapacity = capacity * 2;
|
|
@@ -134,11 +135,11 @@
|
|
}
|
|
}
|
|
// extend limit to capacity
|
|
- charBuffer.limit(charBuffer.capacity());
|
|
+ ((Buffer)charBuffer).limit(charBuffer.capacity());
|
|
// append characters
|
|
charBuffer.put(data, start, length);
|
|
// shrink limit to position
|
|
- charBuffer.limit(charBuffer.position());
|
|
+ ((Buffer)charBuffer).limit(((Buffer)charBuffer).position());
|
|
}
|
|
|
|
/**
|
|
@@ -162,7 +163,7 @@
|
|
// not really removing, just make sure the char buffer
|
|
// pointed to is really a different one
|
|
if (charBuffer != null) {
|
|
- ft.charBuffer = CharBuffer.allocate(charBuffer.limit());
|
|
+ ft.charBuffer = CharBuffer.allocate(((Buffer)charBuffer).limit());
|
|
charBuffer.rewind();
|
|
ft.charBuffer.put(charBuffer);
|
|
ft.charBuffer.rewind();
|
|
@@ -219,7 +220,7 @@
|
|
*/
|
|
public boolean willCreateArea() {
|
|
if (whiteSpaceCollapse == Constants.EN_FALSE
|
|
- && charBuffer.limit() > 0) {
|
|
+ && ((Buffer)charBuffer).limit() > 0) {
|
|
return true;
|
|
}
|
|
|
|
@@ -278,7 +279,7 @@
|
|
charBuffer.rewind();
|
|
CharBuffer tmp = charBuffer.slice();
|
|
char c;
|
|
- int lim = charBuffer.limit();
|
|
+ int lim = ((Buffer)charBuffer).limit();
|
|
int pos = -1;
|
|
while (++pos < lim) {
|
|
c = charBuffer.get();
|
|
@@ -522,13 +523,13 @@
|
|
|
|
/** {@inheritDoc} */
|
|
public boolean hasNext() {
|
|
- return (this.currentPosition < charBuffer.limit());
|
|
+ return (this.currentPosition < ((Buffer)charBuffer).limit());
|
|
}
|
|
|
|
/** {@inheritDoc} */
|
|
public char nextChar() {
|
|
|
|
- if (this.currentPosition < charBuffer.limit()) {
|
|
+ if (this.currentPosition < ((Buffer)charBuffer).limit()) {
|
|
this.canRemove = true;
|
|
this.canReplace = true;
|
|
return charBuffer.get(currentPosition++);
|
|
@@ -542,11 +543,11 @@
|
|
public void remove() {
|
|
|
|
if (this.canRemove) {
|
|
- charBuffer.position(currentPosition);
|
|
+ ((Buffer)charBuffer).position(currentPosition);
|
|
// Slice the buffer at the current position
|
|
CharBuffer tmp = charBuffer.slice();
|
|
// Reset position to before current character
|
|
- charBuffer.position(--currentPosition);
|
|
+ ((Buffer)charBuffer).position(--currentPosition);
|
|
if (tmp.hasRemaining()) {
|
|
// Transfer any remaining characters
|
|
charBuffer.mark();
|
|
@@ -554,7 +555,7 @@
|
|
charBuffer.reset();
|
|
}
|
|
// Decrease limit
|
|
- charBuffer.limit(charBuffer.limit() - 1);
|
|
+ ((Buffer)charBuffer).limit(((Buffer)charBuffer).limit() - 1);
|
|
// Make sure following calls fail, unless nextChar() was called
|
|
this.canRemove = false;
|
|
} else {
|
|
@@ -729,7 +730,7 @@
|
|
|
|
/** {@inheritDoc} */
|
|
public int length() {
|
|
- return charBuffer.limit();
|
|
+ return ((Buffer)charBuffer).limit();
|
|
}
|
|
|
|
/**
|