2020-06-03 17:44:10 +02:00
|
|
|
--- fop-2.5/fop-core/src/main/java/org/apache/fop/afp/fonts/CharactersetEncoder.java 2020-05-05 11:42:04.000000000 +0200
|
|
|
|
+++ fop-2.5/fop-core/src/main/java/org/apache/fop/afp/fonts/CharactersetEncoder.java 2020-06-03 11:18:04.577537190 +0200
|
2018-12-06 23:28:13 +01:00
|
|
|
@@ -21,6 +21,7 @@
|
|
|
|
|
|
|
|
import java.io.IOException;
|
|
|
|
import java.io.OutputStream;
|
|
|
|
+import java.nio.Buffer;
|
|
|
|
import java.nio.ByteBuffer;
|
|
|
|
import java.nio.CharBuffer;
|
|
|
|
import java.nio.charset.CharacterCodingException;
|
|
|
|
@@ -68,7 +69,7 @@
|
|
|
|
if (bb.hasArray()) {
|
|
|
|
return getEncodedChars(bb.array(), bb.limit());
|
|
|
|
} else {
|
|
|
|
- bb.rewind();
|
|
|
|
+ ((Buffer)bb).rewind();
|
|
|
|
byte[] bytes = new byte[bb.remaining()];
|
|
|
|
bb.get(bytes);
|
|
|
|
return getEncodedChars(bytes, bytes.length);
|
2020-06-03 17:44:10 +02:00
|
|
|
--- fop-2.5/fop-core/src/main/java/org/apache/fop/area/AreaTreeParser.java 2020-05-05 11:42:04.000000000 +0200
|
|
|
|
+++ fop-2.5/fop-core/src/main/java/org/apache/fop/area/AreaTreeParser.java 2020-06-03 11:18:04.581537214 +0200
|
2018-12-06 23:28:13 +01:00
|
|
|
@@ -24,6 +24,7 @@
|
|
|
|
import java.awt.geom.Rectangle2D;
|
|
|
|
import java.io.FileNotFoundException;
|
|
|
|
import java.io.IOException;
|
|
|
|
+import java.nio.Buffer;
|
|
|
|
import java.nio.CharBuffer;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Map;
|
2020-06-03 17:44:10 +02:00
|
|
|
@@ -326,7 +327,7 @@
|
2018-12-06 23:28:13 +01:00
|
|
|
throws SAXException {
|
|
|
|
lastAttributes = new AttributesImpl(attributes);
|
|
|
|
Maker maker = makers.get(localName);
|
|
|
|
- content.clear();
|
|
|
|
+ ((Buffer)content).clear();
|
|
|
|
ignoreCharacters = true;
|
|
|
|
if (maker != null) {
|
|
|
|
ignoreCharacters = maker.ignoreCharacters();
|
2020-06-03 17:44:10 +02:00
|
|
|
@@ -357,7 +358,7 @@
|
2018-12-06 23:28:13 +01:00
|
|
|
Maker maker = makers.get(localName);
|
|
|
|
if (maker != null) {
|
|
|
|
maker.endElement();
|
|
|
|
- content.clear();
|
|
|
|
+ ((Buffer)content).clear();
|
|
|
|
}
|
|
|
|
ignoreCharacters = true;
|
|
|
|
} else {
|
2020-06-03 17:44:10 +02:00
|
|
|
@@ -845,7 +846,7 @@
|
2018-12-06 23:28:13 +01:00
|
|
|
boolean reversed = XMLUtil.getAttributeAsBoolean(lastAttributes, "reversed", false);
|
|
|
|
int[][] gposAdjustments
|
|
|
|
= XMLUtil.getAttributeAsPositionAdjustments(lastAttributes, "position-adjust");
|
|
|
|
- content.flip();
|
|
|
|
+ ((Buffer)content).flip();
|
|
|
|
WordArea word = new WordArea(
|
|
|
|
offset, level, content.toString().trim(), letterAdjust,
|
|
|
|
null, gposAdjustments, reversed);
|
2020-06-03 17:44:10 +02:00
|
|
|
@@ -865,7 +866,7 @@
|
2018-12-06 23:28:13 +01:00
|
|
|
int offset = XMLUtil.getAttributeAsInt(lastAttributes, "offset", 0);
|
|
|
|
//TODO the isAdjustable parameter is currently not used/implemented
|
|
|
|
if (content.position() > 0) {
|
|
|
|
- content.flip();
|
|
|
|
+ ((Buffer)content).flip();
|
|
|
|
boolean adjustable = XMLUtil.getAttributeAsBoolean(lastAttributes, "adj", true);
|
|
|
|
int level = XMLUtil.getAttributeAsInt(lastAttributes, "level", -1);
|
|
|
|
SpaceArea space = new SpaceArea(offset, level, content.charAt(0), adjustable);
|
2020-06-03 17:44:10 +02:00
|
|
|
@@ -1254,17 +1255,17 @@
|
2018-12-06 23:28:13 +01:00
|
|
|
// allocate a larger buffer and transfer content
|
|
|
|
CharBuffer newContent
|
|
|
|
= CharBuffer.allocate(this.content.position() + length);
|
|
|
|
- this.content.flip();
|
|
|
|
+ ((Buffer)(this.content)).flip();
|
|
|
|
newContent.put(this.content);
|
|
|
|
this.content = newContent;
|
|
|
|
}
|
|
|
|
// make sure the full capacity is used
|
|
|
|
- this.content.limit(this.content.capacity());
|
|
|
|
+ ((Buffer)(this.content)).limit(this.content.capacity());
|
|
|
|
// add characters to the buffer
|
|
|
|
this.content.put(ch, start, length);
|
|
|
|
// decrease the limit, if necessary
|
|
|
|
if (this.content.position() < this.content.limit()) {
|
|
|
|
- this.content.limit(this.content.position());
|
|
|
|
+ ((Buffer)(this.content)).limit(this.content.position());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-06-03 17:44:10 +02:00
|
|
|
--- fop-2.5/fop-core/src/main/java/org/apache/fop/fo/FOText.java 2020-05-05 11:42:04.000000000 +0200
|
|
|
|
+++ fop-2.5/fop-core/src/main/java/org/apache/fop/fo/FOText.java 2020-06-03 11:18:04.581537214 +0200
|
2018-04-05 12:14:35 +02:00
|
|
|
@@ -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;
|
2020-06-03 17:44:10 +02:00
|
|
|
@@ -134,17 +135,17 @@
|
2018-12-06 23:28:13 +01:00
|
|
|
newCapacity = requires;
|
|
|
|
}
|
|
|
|
CharBuffer newBuffer = CharBuffer.allocate(newCapacity);
|
|
|
|
- charBuffer.rewind();
|
|
|
|
+ ((Buffer)charBuffer).rewind();
|
|
|
|
newBuffer.put(charBuffer);
|
|
|
|
charBuffer = newBuffer;
|
2018-04-05 12:14:35 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
// 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());
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2020-06-03 17:44:10 +02:00
|
|
|
@@ -156,7 +157,7 @@
|
2018-12-06 23:28:13 +01:00
|
|
|
if (this.charBuffer == null) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
- this.charBuffer.rewind();
|
|
|
|
+ ((Buffer)(this.charBuffer)).rewind();
|
|
|
|
return this.charBuffer.asReadOnlyBuffer().subSequence(0, this.charBuffer.limit());
|
|
|
|
}
|
|
|
|
|
2020-06-03 17:44:10 +02:00
|
|
|
@@ -169,9 +170,9 @@
|
2018-04-05 12:14:35 +02:00
|
|
|
// pointed to is really a different one
|
|
|
|
if (charBuffer != null) {
|
2018-12-06 23:28:13 +01:00
|
|
|
ft.charBuffer = CharBuffer.allocate(charBuffer.limit());
|
|
|
|
- charBuffer.rewind();
|
|
|
|
+ ((Buffer)charBuffer).rewind();
|
2018-04-05 12:14:35 +02:00
|
|
|
ft.charBuffer.put(charBuffer);
|
2018-12-06 23:28:13 +01:00
|
|
|
- ft.charBuffer.rewind();
|
|
|
|
+ ((Buffer)(ft.charBuffer)).rewind();
|
|
|
|
}
|
2018-04-05 12:14:35 +02:00
|
|
|
}
|
2018-12-06 23:28:13 +01:00
|
|
|
ft.prevFOTextThisBlock = null;
|
2020-06-03 17:44:10 +02:00
|
|
|
@@ -203,7 +204,7 @@
|
2018-12-06 23:28:13 +01:00
|
|
|
/** {@inheritDoc} */
|
|
|
|
public void endOfNode() throws FOPException {
|
|
|
|
if (charBuffer != null) {
|
|
|
|
- charBuffer.rewind();
|
|
|
|
+ ((Buffer)charBuffer).rewind();
|
|
|
|
}
|
|
|
|
super.endOfNode();
|
|
|
|
getFOEventHandler().characters(this);
|
2020-06-03 17:44:10 +02:00
|
|
|
@@ -230,7 +231,7 @@
|
2018-04-05 12:14:35 +02:00
|
|
|
}
|
|
|
|
|
2018-12-06 23:28:13 +01:00
|
|
|
char ch;
|
|
|
|
- charBuffer.rewind();
|
|
|
|
+ ((Buffer)charBuffer).rewind();
|
|
|
|
while (charBuffer.hasRemaining()) {
|
|
|
|
ch = charBuffer.get();
|
|
|
|
if (!((ch == CharUtilities.SPACE)
|
2020-06-03 17:44:10 +02:00
|
|
|
@@ -238,7 +239,7 @@
|
2018-12-06 23:28:13 +01:00
|
|
|
|| (ch == CharUtilities.CARRIAGE_RETURN)
|
|
|
|
|| (ch == CharUtilities.TAB))) {
|
|
|
|
// not whitespace
|
|
|
|
- charBuffer.rewind();
|
|
|
|
+ ((Buffer)charBuffer).rewind();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
2020-06-03 17:44:10 +02:00
|
|
|
@@ -281,7 +282,7 @@
|
2018-12-06 23:28:13 +01:00
|
|
|
return;
|
|
|
|
}
|
2018-04-05 12:14:35 +02:00
|
|
|
|
2018-12-06 23:28:13 +01:00
|
|
|
- charBuffer.rewind();
|
|
|
|
+ ((Buffer)charBuffer).rewind();
|
|
|
|
CharBuffer tmp = charBuffer.slice();
|
|
|
|
char c;
|
|
|
|
int lim = charBuffer.limit();
|
2020-06-03 17:44:10 +02:00
|
|
|
@@ -548,19 +549,19 @@
|
2018-04-05 12:14:35 +02:00
|
|
|
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
|
2018-12-06 23:28:13 +01:00
|
|
|
- charBuffer.mark();
|
|
|
|
+ ((Buffer)charBuffer).mark();
|
|
|
|
charBuffer.put(tmp);
|
|
|
|
- charBuffer.reset();
|
|
|
|
+ ((Buffer)charBuffer).reset();
|
2018-04-05 12:14:35 +02:00
|
|
|
}
|
|
|
|
// 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 {
|
2020-06-03 17:44:10 +02:00
|
|
|
@@ -743,7 +744,7 @@
|
2018-12-06 23:28:13 +01:00
|
|
|
*/
|
|
|
|
public void resetBuffer() {
|
|
|
|
if (charBuffer != null) {
|
|
|
|
- charBuffer.rewind();
|
|
|
|
+ ((Buffer)charBuffer).rewind();
|
|
|
|
}
|
|
|
|
}
|
2018-04-05 12:14:35 +02:00
|
|
|
|
2020-06-03 17:44:10 +02:00
|
|
|
--- fop-2.5/fop-core/src/main/java/org/apache/fop/fonts/MultiByteFont.java 2020-05-05 11:42:05.000000000 +0200
|
|
|
|
+++ fop-2.5/fop-core/src/main/java/org/apache/fop/fonts/MultiByteFont.java 2020-06-03 11:19:29.182037444 +0200
|
2018-12-06 23:28:13 +01:00
|
|
|
@@ -21,6 +21,7 @@
|
|
|
|
|
|
|
|
import java.awt.Rectangle;
|
|
|
|
import java.io.InputStream;
|
|
|
|
+import java.nio.Buffer;
|
|
|
|
import java.nio.CharBuffer;
|
|
|
|
import java.nio.IntBuffer;
|
2020-06-03 17:44:10 +02:00
|
|
|
import java.util.ArrayList;
|
|
|
|
@@ -731,7 +732,7 @@
|
|
|
|
cb.put(c);
|
2018-12-06 23:28:13 +01:00
|
|
|
}
|
2020-06-03 17:44:10 +02:00
|
|
|
|
2018-12-06 23:28:13 +01:00
|
|
|
- cb.flip();
|
|
|
|
+ ((Buffer)cb).flip();
|
|
|
|
return cb;
|
2018-04-05 12:14:35 +02:00
|
|
|
}
|
|
|
|
|