Browse Source

oops: added further files for rule-style


git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@193856 13f79535-47bb-0310-9956-ffa450edef68
tags/pre-columns
fotis 23 years ago
parent
commit
68d9473ba8
4 changed files with 144 additions and 89 deletions
  1. 4
    2
      STATUS
  2. 1
    0
      docs/bugtests/build.xml
  3. 43
    12
      docs/examples/fo/leader.fo
  4. 96
    75
      src/org/apache/fop/render/pdf/PDFRenderer.java

+ 4
- 2
STATUS View File

@@ -29,6 +29,7 @@ Jon Smirl

Done since 0.15 release
- added: FopImage class that uses JAI [Eric Schaeffer] and JAI compile target [Kelly Campbell]
- added: support for rule-style [Fotis Jannidis]
- updated: svg stuff for the latest java bindings [Keiron Liddle]
- fixed: enhanced error messages for page layout (region names, master) [Norm Walsh]
- fixed: infinite looping bug when TableCell or TableRow is larger than a page [Hani Elabed]
@@ -221,8 +222,9 @@ extended
- colour not continued onto subsequent pages if coloured block goes over page
- keep-next doesn't work and doubles the text lines which should be moved to the next page
- border width in fo:table is added to the start position of the next block or
table (see page 6 in table.fo for a test case)

table (see page 6 in examples/fo/table.fo for a test case)
- if a block, which is positioned with space-before, doesn't fit on the current page,
it gets lost. (see space-before.fo in bugtests/fo for a test case)


SVG

+ 1
- 0
docs/bugtests/build.xml View File

@@ -72,6 +72,7 @@
<fop fofile="${foDir}/word-spacing.fo" pdffile="${testDir}/word-spacing.pdf"/>
<fop fofile="${foDir}/wrap.fo" pdffile="${testDir}/wrap.pdf"/>
<fop fofile="${foDir}/image.fo" pdffile="${testDir}/image.pdf"/>
<fop fofile="${foDir}/space-before.fo" pdffile="${testDir}/space-before.pdf"/>
</target>



+ 43
- 12
docs/examples/fo/leader.fo View File

@@ -375,37 +375,68 @@
space-before.optimum="5pt"
space-after.optimum="3pt"
text-align="start">
Here are 3 fo:leader with the property rule and no text
Here are some fo:leader with the property rule and different rule styles
(solid, dashed, dotted, double, groove, ridge the last one with colored backgrounds
to the effect)
</fo:block>

<!-- Inserts a leader (rule). Because leader is an inline fo you have
to wrap it into a block element -->
<fo:block text-align="start"
<fo:block text-align="center"
space-before.optimum="12pt"
space-after.optimum="12pt">
<fo:leader leader-pattern="rule"
rule-thickness="3.0pt"
rule-thickness="1pt"
leader-length="6cm"/>
</fo:block>

<!-- Inserts a leader (rule). Because leader is an inline fo you have
to wrap it into a block element -->
<fo:block text-align="center"
space-before.optimum="12pt"
space-after.optimum="12pt">

<fo:leader leader-pattern="rule"
rule-thickness="3.0pt"
leader-length="6cm"/>
leader-length="6cm"
rule-thickness="1pt"
rule-style="dashed"/>
</fo:block>

<!-- Inserts a leader (rule). Because leader is an inline fo you have
to wrap it into a block element -->
<fo:block text-align="end"

<fo:block text-align="center"
space-before.optimum="12pt"
space-after.optimum="12pt">
<fo:leader leader-pattern="rule"
rule-thickness="3.0pt"
leader-length="6cm"/>
leader-length="6cm"
rule-style="dotted"
rule-thickness="1pt"/>
</fo:block>

<fo:block text-align="center"
space-before.optimum="12pt"
space-after.optimum="12pt">
<fo:leader leader-pattern="rule"
leader-length="6cm"
rule-thickness="2pt"
rule-style="double"/>
</fo:block>

<fo:block text-align="center" background-color="silver"
space-before.optimum="12pt"
space-after.optimum="12pt">
<fo:leader leader-pattern="rule"
leader-length="6cm"
rule-thickness="1pt"
rule-style="groove"
color="black" />
</fo:block>

<fo:block text-align="center" background-color="silver"
space-before.optimum="12pt"
space-after.optimum="12pt">
<fo:leader leader-pattern="rule"
leader-length="6cm"
rule-thickness="1pt"
rule-style="ridge"
color="black" />
</fo:block>

<!-- Normal text -->

+ 96
- 75
src/org/apache/fop/render/pdf/PDFRenderer.java View File

@@ -148,20 +148,20 @@ public class PDFRenderer implements Renderer {
}

/**
* set the PDF document's producer
*
* @param producer string indicating application producing PDF
*/
* set the PDF document's producer
*
* @param producer string indicating application producing PDF
*/
public void setProducer(String producer) {
this.pdfDoc.setProducer(producer);
}

/**
* render the areas into PDF
*
* @param areaTree the laid-out area tree
* @param writer the PrintWriter to write the PDF with
*/
* render the areas into PDF
*
* @param areaTree the laid-out area tree
* @param writer the PrintWriter to write the PDF with
*/
public void render(AreaTree areaTree,
PrintWriter writer) throws IOException, FOPException {
MessageHandler.logln("rendering areas to PDF");
@@ -184,6 +184,26 @@ public class PDFRenderer implements Renderer {
this.pdfDoc.output(writer);
}

/**
* add a line to the current stream
*
* @param x1 the start x location in millipoints
* @param y1 the start y location in millipoints
* @param x2 the end x location in millipoints
* @param y2 the end y location in millipoints
* @param th the thickness in millipoints
* @param r the red component
* @param g the green component
* @param b the blue component
*/
protected void addLine(int x1, int y1, int x2, int y2, int th,
PDFPathPaint stroke) {
currentStream.add("ET\nq\n" + stroke.getColorSpaceOut(false) +
(x1 / 1000f) + " "+ (y1 / 1000f) + " m " +
(x2 / 1000f) + " "+ (y2 / 1000f) + " l " +
(th / 1000f) + " w S\n" + "Q\nBT\n");
}

/**
* add a line to the current stream
*
@@ -192,27 +212,28 @@ public class PDFRenderer implements Renderer {
* @param x2 the end x location in millipoints
* @param y2 the end y location in millipoints
* @param th the thickness in millipoints
* @param rs the rule style as String containing dashArray + dashPhase
* @param r the red component
* @param g the green component
* @param b the blue component
*/
protected void addLine(int x1, int y1, int x2, int y2, int th,
PDFPathPaint stroke) {
String rs, PDFPathPaint stroke) {
currentStream.add("ET\nq\n" + stroke.getColorSpaceOut(false) +
(x1 / 1000f) + " "+ (y1 / 1000f) + " m " +
rs + (x1 / 1000f) + " "+ (y1 / 1000f) + " m " +
(x2 / 1000f) + " "+ (y2 / 1000f) + " l " +
(th / 1000f) + " w S\n" + "Q\nBT\n");
}

/**
* add a rectangle to the current stream
*
* @param x the x position of left edge in millipoints
* @param y the y position of top edge in millipoints
* @param w the width in millipoints
* @param h the height in millipoints
* @param stroke the stroke color/gradient
*/
* add a rectangle to the current stream
*
* @param x the x position of left edge in millipoints
* @param y the y position of top edge in millipoints
* @param w the width in millipoints
* @param h the height in millipoints
* @param stroke the stroke color/gradient
*/
protected void addRect(int x, int y, int w, int h,
PDFPathPaint stroke) {
currentStream.add("ET\nq\n" + stroke.getColorSpaceOut(false) +
@@ -221,15 +242,15 @@ public class PDFRenderer implements Renderer {
}

/**
* add a filled rectangle to the current stream
*
* @param x the x position of left edge in millipoints
* @param y the y position of top edge in millipoints
* @param w the width in millipoints
* @param h the height in millipoints
* @param fill the fill color/gradient
* @param stroke the stroke color/gradient
*/
* add a filled rectangle to the current stream
*
* @param x the x position of left edge in millipoints
* @param y the y position of top edge in millipoints
* @param w the width in millipoints
* @param h the height in millipoints
* @param fill the fill color/gradient
* @param stroke the stroke color/gradient
*/
protected void addRect(int x, int y, int w, int h,
PDFPathPaint stroke, PDFPathPaint fill) {
currentStream.add("ET\nq\n" + fill.getColorSpaceOut(true) +
@@ -239,10 +260,10 @@ public class PDFRenderer implements Renderer {
}

/**
* render area container to PDF
*
* @param area the area container to render
*/
* render area container to PDF
*
* @param area the area container to render
*/
public void renderAreaContainer(AreaContainer area) {

int saveY = this.currentYPosition;
@@ -322,10 +343,10 @@ public class PDFRenderer implements Renderer {


/**
* render block area to PDF
*
* @param area the block area to render
*/
* render block area to PDF
*
* @param area the block area to render
*/
public void renderBlockArea(BlockArea area) {
doFrame(area);
Enumeration e = area.getChildren().elements();
@@ -336,20 +357,20 @@ public class PDFRenderer implements Renderer {
}

/**
* render display space to PDF
*
* @param space the display space to render
*/
* render display space to PDF
*
* @param space the display space to render
*/
public void renderDisplaySpace(DisplaySpace space) {
int d = space.getSize();
this.currentYPosition -= d;
}

/**
* render image area to PDF
*
* @param area the image area to render
*/
* render image area to PDF
*
* @param area the image area to render
*/
public void renderImageArea(ImageArea area) {
// adapted from contribution by BoBoGi
int x = this.currentAreaContainerXPosition + area.getXOffset();
@@ -444,10 +465,10 @@ public class PDFRenderer implements Renderer {
}

/**
* render SVG area to PDF
*
* @param area the SVG area to render
*/
* render SVG area to PDF
*
* @param area the SVG area to render
*/
public void renderSVGArea(SVGArea area) {
int x = this.currentXPosition;
int y = this.currentYPosition;
@@ -486,10 +507,10 @@ public class PDFRenderer implements Renderer {
}

/**
* render inline area to PDF
*
* @param area inline area to render
*/
* render inline area to PDF
*
* @param area inline area to render
*/
public void renderInlineArea(InlineArea area) {
char ch;
StringBuffer pdf = new StringBuffer();
@@ -566,19 +587,19 @@ public class PDFRenderer implements Renderer {
}

/**
* render inline space to PDF
*
* @param space space to render
*/
* render inline space to PDF
*
* @param space space to render
*/
public void renderInlineSpace(InlineSpace space) {
this.currentXPosition += space.getSize();
}

/**
* render line area to PDF
*
* @param area area to render
*/
* render line area to PDF
*
* @param area area to render
*/
public void renderLineArea(LineArea area) {
int rx = this.currentAreaContainerXPosition + area.getStartIndent();
int ry = this.currentYPosition;
@@ -602,10 +623,10 @@ public class PDFRenderer implements Renderer {
}

/**
* render page into PDF
*
* @param page page to render
*/
* render page into PDF
*
* @param page page to render
*/
public void renderPage(Page page) {
AreaContainer body, before, after;

@@ -661,10 +682,10 @@ public class PDFRenderer implements Renderer {
}

/**
* render leader area into PDF
*
* @param area area to render
*/
* render leader area into PDF
*
* @param area area to render
*/
public void renderLeaderArea(LeaderArea area) {
int rx = this.currentXPosition;
;
@@ -674,7 +695,7 @@ public class PDFRenderer implements Renderer {
int th = area.getRuleThickness();
int st = area.getRuleStyle();
String rs = setRuleStylePattern(st);
//checks whether thickness is = 0, because of bug in pdf (or where?),
//checks whether thickness is = 0, because of bug in pdf (or where?),
//a line with thickness 0 is still displayed
if (th != 0) {
switch (st) {
@@ -713,18 +734,18 @@ public class PDFRenderer implements Renderer {
}

/**
* set up the font info
*
* @param fontInfo font info to set up
*/
* set up the font info
*
* @param fontInfo font info to set up
*/
public void setupFontInfo(FontInfo fontInfo) {
FontSetup.setup(fontInfo);
FontSetup.addToResources(this.pdfDoc, fontInfo);
}

/**
* defines a string containing dashArray and dashPhase for the rule style
*/
* defines a string containing dashArray and dashPhase for the rule style
*/
private String setRuleStylePattern (int style) {
String rs = "";
switch (style) {

Loading…
Cancel
Save