You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by bc...@apache.org on 2004/10/19 15:30:54 UTC
cvs commit: xml-fop/src/java/org/apache/fop/fo FOText.java FObjMixed.java
bckfnn 2004/10/19 06:30:53
Modified: src/java/org/apache/fop/fo FOText.java FObjMixed.java
Log:
Second phase of performance improvement.
- Pass in a PropertyList to addCharacters()
PR: 31699
Revision Changes Path
1.31 +13 -15 xml-fop/src/java/org/apache/fop/fo/FOText.java
Index: FOText.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/FOText.java,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- FOText.java 19 Oct 2004 08:53:49 -0000 1.30
+++ FOText.java 19 Oct 2004 13:30:53 -0000 1.31
@@ -83,11 +83,6 @@
// End of property values
/**
- * The TextInfo object attached to the text
- */
- public TextInfo textInfo;
-
- /**
* Keeps track of the last FOText object created within the current
* block. This is used to create pointers between such objects.
* TODO: As soon as the control hierarchy is straightened out, this static
@@ -114,6 +109,7 @@
*/
private Block ancestorBlock = null;
+ public TextInfo textInfo;
private static final int IS_WORD_CHAR_FALSE = 0;
private static final int IS_WORD_CHAR_TRUE = 1;
private static final int IS_WORD_CHAR_MAYBE = 2;
@@ -124,18 +120,16 @@
* be a superset of the text in this object)
* @param start starting index into char[] for the text in this object
* @param end ending index into char[] for the text in this object
- * @param ti TextInfo object for the text in this object
* @param parent FONode that is the parent of this object
*/
- public FOText(char[] chars, int start, int end, TextInfo ti, FONode parent) {
+ public FOText(char[] chars, int start, int end, FObj parent) {
super(parent);
endIndex = end - start;
this.ca = new char[endIndex];
System.arraycopy(chars, start, ca, 0, endIndex);
// System.out.println("->" + new String(ca) + "<-");
- textInfo = ti;
- createBlockPointers();
- textTransform();
+ textInfo = parent.propMgr.getTextLayoutProps(parent.getFOEventHandler().getFontInfo());
+
}
/**
@@ -154,6 +148,11 @@
wrapOption = pList.get(Constants.PR_WRAP_OPTION).getEnum();
}
+ protected void startOfNode() {
+ createBlockPointers();
+ textTransform();
+ }
+
/**
* Check if this text node will create an area.
* This means either there is non-whitespace or it is
@@ -164,7 +163,7 @@
* @return true if this will create an area in the output
*/
public boolean willCreateArea() {
- if (textInfo.whiteSpaceCollapse == Constants.WhiteSpaceCollapse.FALSE
+ if (whiteSpaceCollapse == Constants.WhiteSpaceCollapse.FALSE
&& endIndex - startIndex > 0) {
return true;
}
@@ -227,7 +226,7 @@
* text-transform property.
*/
private void textTransform() {
- if (textInfo.textTransform == Constants.TextTransform.NONE) {
+ if (textTransform == Constants.TextTransform.NONE) {
return;
}
for (int i = 0; i < endIndex; i++) {
@@ -354,7 +353,7 @@
* @return char with transformed value
*/
private char charTransform(int i) {
- switch (textInfo.textTransform) {
+ switch (textTransform) {
/* put NONE first, as this is probably the common case */
case Constants.TextTransform.NONE:
return ca[i];
@@ -375,8 +374,7 @@
return Character.toLowerCase(ca[i]);
}
default:
- getLogger().warn("Invalid text-tranform value: "
- + textInfo.textTransform);
+ getLogger().warn("Invalid text-tranform value: " + textTransform);
return ca[i];
}
}
1.42 +4 -11 xml-fop/src/java/org/apache/fop/fo/FObjMixed.java
Index: FObjMixed.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/FObjMixed.java,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -r1.41 -r1.42
--- FObjMixed.java 13 Oct 2004 00:31:46 -0000 1.41
+++ FObjMixed.java 19 Oct 2004 13:30:53 -0000 1.42
@@ -28,9 +28,6 @@
* (i.e., those that can contain both child FO's and text nodes/PCDATA)
*/
public class FObjMixed extends FObj {
- /** TextInfo for this object */
- protected TextInfo textInfo = null;
-
/**
* @param parent FONode that is the parent of this object
*/
@@ -45,16 +42,12 @@
* @param locator location in fo source file.
*/
protected void addCharacters(char data[], int start, int length,
+ PropertyList pList,
Locator locator) throws SAXParseException {
- if (textInfo == null) {
- // Really only need one of these, but need to get fontInfo
- // stored in propMgr for later use.
- propMgr.setFontInfo(getFOEventHandler().getFontInfo());
- textInfo = propMgr.getTextLayoutProps(getFOEventHandler().getFontInfo());
- }
-
- FOText ft = new FOText(data, start, length, textInfo, this);
+ FOText ft = new FOText(data, start, length, this);
ft.setLocator(locator);
+ ft.bind(pList);
+ ft.startOfNode();
getFOEventHandler().characters(ft.ca, ft.startIndex, ft.endIndex);
addChildNode(ft);
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-cvs-help@xml.apache.org