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 ge...@locus.apache.org on 2000/10/19 19:00:23 UTC
cvs commit: xml-fop/src/org/apache/fop/render/pdf PDFRenderer.java
gears 00/10/19 10:00:21
Modified: docs/examples build.xml
docs/examples/fo readme.fo
src/codegen properties.xml
src/org/apache/fop/fo FOText.java
StandardPropertyListMapping.java
src/org/apache/fop/fo/flow Inline.java PageNumber.java
PageNumberCitation.java
src/org/apache/fop/layout BlockArea.java InlineArea.java
LineArea.java
src/org/apache/fop/render/pdf PDFRenderer.java
Log:
Apply's Christian Geisert's text decoration (underline) patch.
I updated the readme.fo so it reports the latest released version of fop
as 0.14, rather than 12.0(????). I fixed the build.xml so it will build
reference PDFs for the last two added examples. I added Christian's
textdeko.fo example file as one of the examples.
Revision Changes Path
1.6 +3 -0 xml-fop/docs/examples/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/xml-fop/docs/examples/build.xml,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- build.xml 2000/08/03 14:01:39 1.5
+++ build.xml 2000/10/19 17:00:01 1.6
@@ -52,6 +52,7 @@
<fop fofile="${foDir}/readme.fo" pdffile="${testDir}/readme.pdf"/>
<fop fofile="${foDir}/fonts.fo" pdffile="${testDir}/fonts.pdf"/>
<fop fofile="${foDir}/leader.fo" pdffile="${testDir}/leader.pdf"/>
+ <fop fofile="${foDir}/textdeko.fo" pdffile="${testDir}/textdeko.pdf"/>
</target>
@@ -81,6 +82,8 @@
<fop fofile="${foDir}/images.fo" pdffile="${referenceDir}/images.pdf"/>
<fop fofile="${foDir}/readme.fo" pdffile="${referenceDir}/readme.pdf"/>
<fop fofile="${foDir}/fonts.fo" pdffile="${referenceDir}/fonts.pdf"/>
+ <fop fofile="${foDir}/leader.fo" pdffile="${referenceDir}/leader.pdf"/>
+ <fop fofile="${foDir}/textdeko.fo" pdffile="${referenceDir}/textdeko.pdf"/>
</target>
1.9 +3 -3 xml-fop/docs/examples/fo/readme.fo
Index: readme.fo
===================================================================
RCS file: /home/cvs/xml-fop/docs/examples/fo/readme.fo,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- readme.fo 2000/08/11 17:42:54 1.8
+++ readme.fo 2000/10/19 17:00:02 1.9
@@ -89,8 +89,8 @@
<fo:block id="sec2" font-size="18pt" font-family="serif" line-height="20pt" space-before.optimum="20pt" space-after.optimum="14pt" >B)
Downloading FOP</fo:block>
- <fo:block space-after.optimum="3pt" font-family="serif">The latest release version is <fo:inline font-style="italic" font-family="serif">FOP 12.0</fo:inline>
-<fo:inline font-family="serif">
+ <fo:block space-after.optimum="3pt" font-family="serif">The latest release version is <fo:inline font-style="italic" font-family="serif">FOP
+0.14</fo:inline> <fo:inline font-family="serif">
()
</fo:inline>. </fo:block>
<fo:block space-after.optimum="3pt" font-family="serif">NOTE: you do not have to unjar or unzip this jar file.</fo:block>
@@ -105,7 +105,7 @@
<fo:block space-after.optimum="3pt" font-family="serif">To run FOP from the command line, see Running FOP. If you are interested in
embedding FOP in a Java application of your own, see Embedding FOP.
</fo:block>
- <fo:block space-after.optimum="3pt" font-family="serif">You can also download the <fo:inline font-style="italic" font-family="serif">source code v. 12.0</fo:inline>
+ <fo:block space-after.optimum="3pt" font-family="serif">You can also download the <fo:inline font-style="italic" font-family="serif">source code v. 0.14</fo:inline>
<fo:inline font-family="serif">
()
</fo:inline> as jar file</fo:block>
1.26 +15 -0 xml-fop/src/codegen/properties.xml
Index: properties.xml
===================================================================
RCS file: /home/cvs/xml-fop/src/codegen/properties.xml,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- properties.xml 2000/10/16 04:47:36 1.25
+++ properties.xml 2000/10/19 17:00:03 1.26
@@ -960,6 +960,21 @@
<default>auto</default>
</property>
+ <property>
+ <name>text-decoration</name>
+ <class-name>TextDecoration</class-name>
+ <inherited>false</inherited>
+ <datatype>
+ <enumeration>
+ <value const="NONE">none</value>
+ <value const="UNDERLINE">underline</value>
+ <value const="OVERLINE">overline</value>
+ <value const="LINE_THROUGH">line-through</value>
+ </enumeration>
+ </datatype>
+ <default>none</default>
+ </property>
+
<!-- svg properties, or should these be in another file -->
<property>
<name>requiredFeatures</name>
1.10 +14 -3 xml-fop/src/org/apache/fop/fo/FOText.java
Index: FOText.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/FOText.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- FOText.java 2000/10/06 00:01:50 1.9
+++ FOText.java 2000/10/19 17:00:06 1.10
@@ -1,4 +1,4 @@
-/*-- $Id: FOText.java,v 1.9 2000/10/06 00:01:50 keiron Exp $ --
+/*-- $Id: FOText.java,v 1.10 2000/10/19 17:00:06 gears Exp $ --
============================================================================
The Apache Software License, Version 1.1
@@ -76,7 +76,13 @@
int wrapOption;
int whiteSpaceTreatment;
- protected FOText(char[] chars, int s, int e, FObj parent) {
+ // Textdecoration
+ protected boolean underlined = false;
+ protected boolean overlined = false;
+ protected boolean lineThrough = false;
+
+
+ public FOText(char[] chars, int s, int e, FObj parent) {
super(parent);
this.start = 0;
this.ca = new char[e - s];
@@ -85,6 +91,10 @@
this.length = e - s;
}
+ public void setUnderlined(boolean ul) {
+ this.underlined = ul;
+ }
+
public Status layout(Area area) throws FOPException {
if (!(area instanceof BlockArea)) {
MessageHandler.errorln("WARNING: text outside block area" + new String(ca, start, length));
@@ -121,7 +131,8 @@
wrapOption,
this.getLinkSet(),
whiteSpaceTreatment,
- ca, this.marker, length);
+ ca, this.marker, length,
+ underlined);
if (this.marker == -1) {
this.marker = 0;
return new Status(Status.OK);
1.7 +2 -1 xml-fop/src/org/apache/fop/fo/StandardPropertyListMapping.java
Index: StandardPropertyListMapping.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/StandardPropertyListMapping.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- StandardPropertyListMapping.java 2000/08/29 00:09:41 1.6
+++ StandardPropertyListMapping.java 2000/10/19 17:00:09 1.7
@@ -1,4 +1,4 @@
-/*-- $Id: StandardPropertyListMapping.java,v 1.6 2000/08/29 00:09:41 keiron Exp $ --
+/*-- $Id: StandardPropertyListMapping.java,v 1.7 2000/10/19 17:00:09 gears Exp $ --
============================================================================
The Apache Software License, Version 1.1
@@ -165,6 +165,7 @@
propertyTable.put("scaling",Scaling.maker());
propertyTable.put("vertical-align",VerticalAlign.maker());
propertyTable.put("overflow",Overflow.maker());
+ propertyTable.put("text-decoration",TextDecoration.maker());
builder.addPropertyList(uri, propertyTable);
}
}
1.2 +24 -2 xml-fop/src/org/apache/fop/fo/flow/Inline.java
Index: Inline.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/flow/Inline.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Inline.java 2000/08/11 00:02:55 1.1
+++ Inline.java 2000/10/19 17:00:10 1.2
@@ -1,4 +1,4 @@
-/*-- $Id: Inline.java,v 1.1 2000/08/11 00:02:55 fotis Exp $ --
+/*-- $Id: Inline.java,v 1.2 2000/10/19 17:00:10 gears Exp $ --
============================================================================
The Apache Software License, Version 1.1
@@ -55,6 +55,7 @@
import org.apache.fop.fo.*;
import org.apache.fop.layout.Area;
import org.apache.fop.apps.FOPException;
+import org.apache.fop.fo.properties.*;
// Java
import java.util.Enumeration;
@@ -71,15 +72,36 @@
public static FObj.Maker maker() {
return new Inline.Maker();
}
+
+ // Textdecoration
+ protected boolean underlined = false;
+ protected boolean overlined = false;
+ protected boolean lineThrough = false;
+
public Inline(FObj parent, PropertyList propertyList)
throws FOPException {
super(parent, propertyList);
this.name = "fo:inline";
-
+
+ int textDecoration =
+ this.properties.get("text-decoration").getEnum();
+
+ if (textDecoration == TextDecoration.UNDERLINE) {
+ this.underlined = true;
+ }
+
if (parent.getName().equals("fo:flow")) {
throw new FOPException("fo:inline can't be directly"
+ " under flow");
}
+
}
+
+ protected void addCharacters(char data[], int start, int length) {
+ FOText ft = new FOText(data,start,length, this);
+ ft.setUnderlined(underlined);
+ children.addElement(ft);
+ }
+
}
1.10 +3 -2 xml-fop/src/org/apache/fop/fo/flow/PageNumber.java
Index: PageNumber.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/flow/PageNumber.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- PageNumber.java 2000/06/27 22:13:36 1.9
+++ PageNumber.java 2000/10/19 17:00:10 1.10
@@ -1,4 +1,4 @@
-/*-- $Id: PageNumber.java,v 1.9 2000/06/27 22:13:36 fotis Exp $ --
+/*-- $Id: PageNumber.java,v 1.10 2000/10/19 17:00:10 gears Exp $ --
============================================================================
The Apache Software License, Version 1.1
@@ -122,7 +122,8 @@
null,
whiteSpaceTreatment,
p.toCharArray(), 0,
- p.length());
+ p.length(),
+ false);
return new Status(Status.OK);
}
}
1.8 +2 -2 xml-fop/src/org/apache/fop/fo/flow/PageNumberCitation.java
Index: PageNumberCitation.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/flow/PageNumberCitation.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- PageNumberCitation.java 2000/07/10 19:21:11 1.7
+++ PageNumberCitation.java 2000/10/19 17:00:11 1.8
@@ -1,4 +1,4 @@
-/*-- $Id: PageNumberCitation.java,v 1.7 2000/07/10 19:21:11 jordan Exp $ --
+/*-- $Id: PageNumberCitation.java,v 1.8 2000/10/19 17:00:11 gears Exp $ --
============================================================================
The Apache Software License, Version 1.1
@@ -194,7 +194,7 @@
pageNumber=idReferences.getPageNumber(refId);
if ( pageNumber!=null ) { // if we already know the page number
- this.marker = ((BlockArea) area).addText(fs, red, green, blue, wrapOption, null, whiteSpaceTreatment, pageNumber.toCharArray(), 0, pageNumber.length());
+ this.marker = ((BlockArea) area).addText(fs, red, green, blue, wrapOption, null, whiteSpaceTreatment, pageNumber.toCharArray(), 0, pageNumber.length(), false);
}
else { // add pageNumberCitation to area to be resolved during rendering
this.marker = ((BlockArea) area).addPageNumberCitation(fs, red, green, blue, wrapOption, null, whiteSpaceTreatment, refId);
1.13 +4 -4 xml-fop/src/org/apache/fop/layout/BlockArea.java
Index: BlockArea.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/layout/BlockArea.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- BlockArea.java 2000/07/05 23:13:28 1.12
+++ BlockArea.java 2000/10/19 17:00:12 1.13
@@ -1,4 +1,4 @@
-/*-- $Id: BlockArea.java,v 1.12 2000/07/05 23:13:28 jordan Exp $ --
+/*-- $Id: BlockArea.java,v 1.13 2000/10/19 17:00:12 gears Exp $ --
============================================================================
The Apache Software License, Version 1.1
@@ -139,7 +139,7 @@
public int addText(FontState fontState, float red, float green,
float blue, int wrapOption, LinkSet ls,
int whiteSpaceTreatment, char data[],
- int start, int end) {
+ int start, int end, boolean ul) {
int ts, te;
char[] ca;
@@ -161,7 +161,7 @@
ls.setYOffset(currentHeight);
}
- ts = this.currentLineArea.addText(ca, ts, te, ls);
+ ts = this.currentLineArea.addText(ca, ts, te, ls, ul);
this.hasLines = true;
while (ts != -1) {
@@ -182,7 +182,7 @@
ls.setYOffset(currentHeight);
}
- ts = this.currentLineArea.addText(ca, ts, te, ls);
+ ts = this.currentLineArea.addText(ca, ts, te, ls, ul);
}
return -1;
}
1.7 +16 -1 xml-fop/src/org/apache/fop/layout/InlineArea.java
Index: InlineArea.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/layout/InlineArea.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- InlineArea.java 2000/07/05 23:05:04 1.6
+++ InlineArea.java 2000/10/19 17:00:12 1.7
@@ -1,4 +1,4 @@
-/*-- $Id: InlineArea.java,v 1.6 2000/07/05 23:05:04 jordan Exp $ --
+/*-- $Id: InlineArea.java,v 1.7 2000/10/19 17:00:12 gears Exp $ --
============================================================================
The Apache Software License, Version 1.1
@@ -58,6 +58,12 @@
protected String pageNumberId=null;
private float red, green, blue;
+ // Textdecoration
+ protected boolean underlined = false;
+ protected boolean overlined = false;
+ protected boolean lineThrough = false;
+
+
public InlineArea(FontState fontState, float red, float green, float blue, String text, int width) {
super(fontState);
this.red = red;
@@ -90,4 +96,13 @@
public String getPageNumberID() {
return pageNumberId;
}
+
+ public void setUnderlined(boolean ul) {
+ this.underlined = ul;
+ }
+
+ public boolean getUnderlined() {
+ return this.underlined;
+ }
+
}
1.18 +5 -2 xml-fop/src/org/apache/fop/layout/LineArea.java
Index: LineArea.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/layout/LineArea.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- LineArea.java 2000/07/22 08:00:03 1.17
+++ LineArea.java 2000/10/19 17:00:13 1.18
@@ -1,4 +1,4 @@
-/*-- $Id: LineArea.java,v 1.17 2000/07/22 08:00:03 fotis Exp $ --
+/*-- $Id: LineArea.java,v 1.18 2000/10/19 17:00:13 gears Exp $ --
============================================================================
The Apache Software License, Version 1.1
@@ -175,7 +175,7 @@
}
- public int addText(char odata[], int start, int end, LinkSet ls) {
+ public int addText(char odata[], int start, int end, LinkSet ls, boolean ul) {
boolean overrun = false;
wordStart = start;
@@ -274,6 +274,7 @@
String(data, wordStart,
wordLength),
wordWidth);
+ ia.setUnderlined(ul);
addChild(ia);
if (ls != null) {
Rectangle lr =
@@ -381,6 +382,8 @@
this.green, this.blue, new
String(data, wordStart,
wordLength), wordWidth);
+
+ pia.setUnderlined(ul);
if (ls != null) {
Rectangle lr =
1.34 +6 -1 xml-fop/src/org/apache/fop/render/pdf/PDFRenderer.java
Index: PDFRenderer.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/render/pdf/PDFRenderer.java,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- PDFRenderer.java 2000/09/22 05:31:09 1.33
+++ PDFRenderer.java 2000/10/19 17:00:18 1.34
@@ -1,4 +1,4 @@
-/*-- $Id: PDFRenderer.java,v 1.33 2000/09/22 05:31:09 keiron Exp $ --
+/*-- $Id: PDFRenderer.java,v 1.34 2000/10/19 17:00:18 gears Exp $ --
============================================================================
The Apache Software License, Version 1.1
@@ -540,6 +540,11 @@
}
}
pdf = pdf.append(") Tj\n");
+
+ if (area.getUnderlined()) {
+ addLine(rx, bl - size/10, rx + area.getContentWidth(),
+ bl - size/10, size/14, theAreaColor);
+ }
currentStream.add(pdf.toString());