Hi,

Below is a patch to prevent AWTRender from drawing an invisible
border when the value for border-width is too small.  The patch
basically says that no matter how small the border-width is, it will
always render at least 1 pixel on the target graphics context.

I leave it to others to rule on the correctness of this approach
(makes sense to me) and thereby commit the patch or not.

Note however that for the sample fo attached,
(border-width is 0.1pt) both -awt and -print
fail to render a border, while -pdf does.

[Separate problem that the borders are in the wrong place
for all renderers..]

The attached sample fo was submitted to this list earlier by
[EMAIL PROTECTED]


        ' Best,
        -Ralph LaChance


----------------------  patch --------------------------------
     /**
      * draw a filled rectangle in the current color.
      * Force 1 pixel wide area if the size rounds to zero.
      *
      * @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 drawAsOutline true for draw, false for fill
      */

     // helper function by aml/rlc to correct integer roundoff problems
     //
     protected void addRect(int x, int y, int w, int h,
                            boolean drawAsOutline) {
         int startx = (x + 500) / 1000;
         int starty = pageHeight - ((y + 500) / 1000);
         int endx = (x + w + 500) / 1000;
         int endy = pageHeight - ((y + h + 500) / 1000);
         if (drawAsOutline)
             graphics.drawRect(startx, starty, endx - startx, endy - starty);
         else
         {
           //don't round down to zero
           if (w != 0 && endx == startx) endx++;
           if (h != 0 && endy == starty) endy++;
           graphics.fillRect(startx, starty, endx - startx, endy - starty);
         }
     }

---------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<fo:root 
xmlns:fo="http://www.w3.org/1999/XSL/Format";><fo:layout-master-set><fo:simple-page-master
 margin-right="1cm" margin-left="1cm" margin-bottom="1cm" margin-top="1cm" 
master-name="cover-page"><fo:region-body 
display-align="center"/></fo:simple-page-master><fo:simple-page-master 
margin-right="1cm" margin-left="1cm" margin-bottom="1cm" margin-top="1cm" 
master-name="plain-page"><fo:region-body margin-right="1.5cm" margin-left="1.5cm" 
margin-top="14pt"/><fo:region-before extent="1.5cm"/><fo:region-after 
extent="1.5cm"/></fo:simple-page-master><fo:page-sequence-master 
master-name="cover"><fo:single-page-master-reference 
master-name="cover-page"/></fo:page-sequence-master><fo:page-sequence-master 
master-name="toc"><fo:single-page-master-reference 
master-name="plain-page"/></fo:page-sequence-master><fo:page-sequence-master 
master-name="body"><fo:single-page-master-reference 
master-name="plain-page"/></fo:page-sequence-master></fo:layout-master-set><fo:page-sequence
 master-name="cover"><fo:flow flow-name="xsl-region-body"><fo:block 
text-align="center">Document Title</fo:block><fo:block text-align="center"/><fo:block 
text-align="center"/><fo:block 
text-align="center">Alcatel</fo:block></fo:flow></fo:page-sequence><fo:page-sequence 
master-name="toc"><fo:flow flow-name="xsl-region-body"><fo:block>Table of 
Contents:</fo:block><fo:block>1 part title<fo:leader 
leader-pattern="dots"/><fo:page-number-citation ref-id="N11"/><fo:block>1.1 Part 
Title<fo:leader leader-pattern="dots"/><fo:page-number-citation 
ref-id="N19"/><fo:block>1.1.1 Part Title<fo:leader 
leader-pattern="dots"/><fo:page-number-citation 
ref-id="N3F"/></fo:block></fo:block><fo:block>1.2 Part Title<fo:leader 
leader-pattern="dots"/><fo:page-number-citation 
ref-id="N88"/></fo:block></fo:block><fo:block>2 part title<fo:leader 
leader-pattern="dots"/><fo:page-number-citation 
ref-id="N92"/></fo:block></fo:flow></fo:page-sequence><fo:page-sequence 
master-name="body"><fo:static-content flow-name="xsl-region-after"><fo:block 
text-align="center">
                                                p. <fo:page-number/> / 
<fo:page-number-citation ref-id="terminator"/></fo:block></fo:static-content><fo:flow 
flow-name="xsl-region-body"><fo:block id="N11"/>
                <fo:block space-after.optimum="8pt" space-before.optimum="8pt" 
color="white" background-color="black" end-indent="0cm" padding-bottom="0pt" 
padding-top="2pt" text-align="center" font-size="16pt" start-indent="0cm">1 part 
title</fo:block>
                <fo:block space-after.optimum="6pt" space-before.optimum="6pt" 
text-align="justify">A paragraph.</fo:block>
                <fo:block id="N19" margin-left="1cm&#10;                               
         ">
                        <fo:block space-after.optimum="8pt" space-before.optimum="8pt" 
color="white" background-color="black" end-indent="0cm" padding-bottom="0pt" 
padding-top="2pt" text-align="center" font-size="16pt" start-indent="1cm">1.1 Part 
Title</fo:block>
                        <fo:block space-after.optimum="6pt" space-before.optimum="6pt" 
text-align="justify">This is paragraph.</fo:block>
                        <fo:block text-align="center"><fo:external-graphic 
src="alcatel_logo.jpg"/><fo:block space-after.optimum="3pt" space-before.optimum="3pt">
                                caption: picture ripped from the 
net</fo:block></fo:block>
                        <fo:list-block space-after.optimum="6pt" 
space-before.optimum="6pt" provisional-distance-between-starts="18pt" 
provisional-label-separation="3pt">
                                <fo:list-item space-after.minimum="3pt" 
space-before.minimum="3pt"><fo:list-item-label end-indent="label-end()"><fo:block 
text-align="start">1.</fo:block></fo:list-item-label><fo:list-item-body 
start-indent="body-start()"><fo:block>an 
item</fo:block></fo:list-item-body></fo:list-item>
                                <fo:list-item space-after.minimum="3pt" 
space-before.minimum="3pt"><fo:list-item-label end-indent="label-end()"><fo:block 
text-align="start">2.</fo:block></fo:list-item-label><fo:list-item-body 
start-indent="body-start()"><fo:block>an item<fo:block/>with a 
break</fo:block></fo:list-item-body></fo:list-item>
                                <fo:list-item space-after.minimum="3pt" 
space-before.minimum="3pt"><fo:list-item-label end-indent="label-end()"><fo:block 
text-align="start">3.</fo:block></fo:list-item-label><fo:list-item-body 
start-indent="body-start()"><fo:block>
                                        this item contains another list:
                                        <fo:list-block space-after.optimum="6pt" 
space-before.optimum="6pt" provisional-distance-between-starts="18pt" 
provisional-label-separation="3pt">
                                                <fo:list-item 
space-after.minimum="3pt" space-before.minimum="3pt"><fo:list-item-label 
end-indent="label-end()"><fo:block 
text-align="start">a.</fo:block></fo:list-item-label><fo:list-item-body 
start-indent="body-start()"><fo:block>an 
item</fo:block></fo:list-item-body></fo:list-item>
                                                <fo:list-item 
space-after.minimum="3pt" space-before.minimum="3pt"><fo:list-item-label 
end-indent="label-end()"><fo:block 
text-align="start">b.</fo:block></fo:list-item-label><fo:list-item-body 
start-indent="body-start()"><fo:block>an 
item</fo:block></fo:list-item-body></fo:list-item>
                                        </fo:list-block>
                                        this was the list.
                                </fo:block></fo:list-item-body></fo:list-item>
                        </fo:list-block>
                        <fo:block id="N3F" margin-left="2cm&#10;                       
                 ">
                                <fo:block space-after.optimum="8pt" 
space-before.optimum="8pt" color="white" background-color="black" end-indent="0cm" 
padding-bottom="0pt" padding-top="2pt" text-align="center" font-size="16pt" 
start-indent="2cm">1.1.1 Part Title</fo:block>
                                <fo:block space-after.optimum="6pt" 
space-before.optimum="6pt" text-align="justify">This is paragraph. This word is 
<fo:inline font-weight="bold">stressed</fo:inline>.</fo:block>
                                <fo:block space-after.optimum="6pt" 
space-before.optimum="6pt" text-align="justify">
                                        <fo:inline font-family="monospace">this is 
some <fo:inline font-weight="bold">stressed</fo:inline> code</fo:inline>.</fo:block>
                                <fo:block space-after.optimum="6pt" 
space-before.optimum="6pt" text-align="justify">This is a <fo:inline 
font-weight="bold">very <fo:inline font-weight="bold">stressed</fo:inline> 
word</fo:inline>.</fo:block>
                                <fo:block><fo:table><fo:table-column 
column-width="5cm"/><fo:table-column column-width="3cm"/><fo:table-column 
column-width="3cm"/><fo:table-body><fo:table-row>
                                                <fo:table-cell border-style="solid" 
border-width="0.1pt"><fo:block space-after.optimum="3pt" space-before.optimum="3pt" 
text-align="center">collumn</fo:block></fo:table-cell>
                                                <fo:table-cell border-style="solid" 
border-width="0.1pt"><fo:block space-after.optimum="3pt" space-before.optimum="3pt" 
text-align="center">collumn</fo:block></fo:table-cell>
                                                <fo:table-cell border-style="solid" 
border-width="0.1pt"><fo:block space-after.optimum="3pt" space-before.optimum="3pt" 
text-align="center">collumn</fo:block></fo:table-cell>
                                        </fo:table-row><fo:table-row>
                                                <fo:table-cell border-style="solid" 
border-width="0.1pt"><fo:block space-after.optimum="3pt" space-before.optimum="3pt" 
text-align="center">
                                                        <fo:inline 
font-weight="bold">bold</fo:inline> collumn</fo:block></fo:table-cell>
                                                <fo:table-cell border-style="solid" 
border-width="0.1pt"><fo:block space-after.optimum="3pt" space-before.optimum="3pt" 
text-align="center">collumn</fo:block></fo:table-cell>
                                                <fo:table-cell border-style="solid" 
border-width="0.1pt"><fo:block space-after.optimum="3pt" space-before.optimum="3pt" 
text-align="center">collumn</fo:block></fo:table-cell>
                                        
</fo:table-row></fo:table-body></fo:table><fo:block space-after.optimum="3pt" 
space-before.optimum="3pt">
                                caption: a first table</fo:block></fo:block>
                        </fo:block>
                </fo:block>
                <fo:block id="N88" margin-left="1cm&#10;                               
         ">
                        <fo:block space-after.optimum="8pt" space-before.optimum="8pt" 
color="white" background-color="black" end-indent="0cm" padding-bottom="0pt" 
padding-top="2pt" text-align="center" font-size="16pt" start-indent="1cm">1.2 Part 
Title</fo:block>
                        <fo:block space-after.optimum="6pt" space-before.optimum="6pt" 
text-align="justify">this is paragraph.</fo:block>
                </fo:block>
        </fo:flow></fo:page-sequence><fo:page-sequence 
master-name="body"><fo:static-content flow-name="xsl-region-after"><fo:block 
text-align="center">
                                                p. <fo:page-number/> / 
<fo:page-number-citation ref-id="terminator"/></fo:block></fo:static-content><fo:flow 
flow-name="xsl-region-body"><fo:block id="N92"/>
                <fo:block space-after.optimum="8pt" space-before.optimum="8pt" 
color="white" background-color="black" end-indent="0cm" padding-bottom="0pt" 
padding-top="2pt" text-align="center" font-size="16pt" start-indent="0cm">2 part 
title</fo:block>
                <fo:block space-after.optimum="6pt" space-before.optimum="6pt" 
text-align="justify">A very small part.</fo:block>
        <fo:block id="terminator"/></fo:flow></fo:page-sequence></fo:root>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to