You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Trevor Nicholls <tr...@castingthevoid.com> on 2010/08/30 21:05:15 UTC

edge effects with consecutive colored blocks

Hi

Where my input XML contains "fragment" elements I am generating fo:blocks
with a grey background and black border. Consecutive fragments are coalesced
into what looks like a single block with one outer border (but they need to
be separate fo:blocks so that page breaks occur at a block boundary). 

This is working, but I am getting some edge effects. These are apparent as
faint ghostly lines where the block boundaries occur - these must be due to
some sort of rounding/floating arithmetic as they do not appear consistently
at every boundary nor do they appear consistently on all
screens/resolutions.

I presume I am not the first person to see this kind of artefact, but Google
hasn't helped me find a solution. Can anyone here help me? Do I need to
overlay the blocks somehow (and how does one do that anyway)?

Thanks for any hints
Trevor

===

The relevant xsl-fo templates are these:

  <xsl:attribute-set name="fragment.base.set">
    <xsl:attribute name="font-family">Courier, monospace</xsl:attribute>
    <xsl:attribute name="white-space-treatment">preserve</xsl:attribute>
    <xsl:attribute name="white-space-collapse">false</xsl:attribute>
    <xsl:attribute name="keep-together.within-page">always</xsl:attribute>
    <xsl:attribute name="font-size">9pt</xsl:attribute>
    <xsl:attribute name="background-color">#e0e0e0</xsl:attribute>
    <xsl:attribute name="padding-before">3pt</xsl:attribute>
    <xsl:attribute name="padding-after">3pt</xsl:attribute>
    <xsl:attribute name="padding-start">6pt</xsl:attribute>
    <xsl:attribute name="padding-end">6pt</xsl:attribute>
    <xsl:attribute name="margin">0</xsl:attribute>
    <xsl:attribute name="border-style">solid</xsl:attribute>
    <xsl:attribute name="border-width">0.25mm</xsl:attribute>
  </xsl:attribute-set>
  
  <xsl:attribute-set name="fragment.set"
use-attribute-sets="fragment.base.set">
    <xsl:attribute name="border-color">black</xsl:attribute>
    <xsl:attribute name="space-before.minimum">0.4em</xsl:attribute>
    <xsl:attribute name="space-before.optimum">0.5em</xsl:attribute>
    <xsl:attribute name="space-before.maximum">0.6em</xsl:attribute>
    <xsl:attribute name="space-after.minimum">0.4em</xsl:attribute>
    <xsl:attribute name="space-after.optimum">0.5em</xsl:attribute>
    <xsl:attribute name="space-after.maximum">0.6em</xsl:attribute>
  </xsl:attribute-set>
  
  <xsl:attribute-set name="fragment.top.set"
use-attribute-sets="fragment.base.set">
    <xsl:attribute name="border-top-color">black</xsl:attribute>
    <xsl:attribute name="border-left-color">black</xsl:attribute>
    <xsl:attribute name="border-right-color">black</xsl:attribute>
    <xsl:attribute name="border-bottom-color">#e0e0e0</xsl:attribute>
    <xsl:attribute name="space-before.minimum">0.4em</xsl:attribute>
    <xsl:attribute name="space-before.optimum">0.5em</xsl:attribute>
    <xsl:attribute name="space-before.maximum">0.6em</xsl:attribute>
    <xsl:attribute name="space-after">0em</xsl:attribute>
  </xsl:attribute-set>
  
  <xsl:attribute-set name="fragment.middle.set"
use-attribute-sets="fragment.base.set">
    <xsl:attribute name="border-top-color">#e0e0e0</xsl:attribute>
    <xsl:attribute name="border-left-color">black</xsl:attribute>
    <xsl:attribute name="border-right-color">black</xsl:attribute>
    <xsl:attribute name="border-bottom-color">#e0e0e0</xsl:attribute>
    <xsl:attribute name="space-before">0em</xsl:attribute>
    <xsl:attribute name="space-after">0em</xsl:attribute>
  </xsl:attribute-set>
  
  <xsl:attribute-set name="fragment.bottom.set"
use-attribute-sets="fragment.base.set">
    <xsl:attribute name="border-top-color">#e0e0e0</xsl:attribute>
    <xsl:attribute name="border-left-color">black</xsl:attribute>
    <xsl:attribute name="border-right-color">black</xsl:attribute>
    <xsl:attribute name="border-bottom-color">black</xsl:attribute>
    <xsl:attribute name="space-before">0em</xsl:attribute>
    <xsl:attribute name="space-after.minimum">0.4em</xsl:attribute>
    <xsl:attribute name="space-after.optimum">0.5em</xsl:attribute>
    <xsl:attribute name="space-after.maximum">0.6em</xsl:attribute>
  </xsl:attribute-set>
  
  <xsl:template
match="fragment[not(preceding-sibling::*[1][self::fragment])]">
    <xsl:apply-templates select="." mode="inlist" />
  </xsl:template>

  <xsl:template match="fragment" mode="inlist">
    <xsl:choose>
      <xsl:when test="not(preceding-sibling::*[1][self::fragment])">
        <xsl:choose>
          <xsl:when test="not(following-sibling::*[1][self::fragment])">
            <!-- sole fragment -->
            <fo:block xsl:use-attribute-sets="fragment.set" >
              <xsl:apply-templates />
            </fo:block>
          </xsl:when>
          <xsl:otherwise>
            <!-- first fragment -->
            <fo:block xsl:use-attribute-sets="fragment.top.set" >
              <xsl:apply-templates />
            </fo:block>
          </xsl:otherwise>
        </xsl:choose>
      </xsl:when>
      <xsl:otherwise>
        <xsl:choose>
          <xsl:when test="not(following-sibling::*[1][self::fragment])">
            <!-- last fragment -->
            <fo:block xsl:use-attribute-sets="fragment.bottom.set" >
              <xsl:apply-templates />
            </fo:block>
          </xsl:when>
          <xsl:otherwise>
            <!-- middle fragment -->
            <fo:block xsl:use-attribute-sets="fragment.middle.set" >
              <xsl:apply-templates />
            </fo:block>
          </xsl:otherwise>
        </xsl:choose>
      </xsl:otherwise>
    </xsl:choose>
    <xsl:apply-templates select="following-sibling::*[1][self::fragment]"
mode="inlist" />
  </xsl:template>





---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: edge effects with consecutive colored blocks

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
Hi Trevor

There's currently no way to avoid this. FOP paints each border segment
separately. To avoid artifacts like that we'd have to add functionality
that tries to combine border segments as much as possible but that's
very difficult, especially since we've started to support all border
styles for most output formats. I'm afraid I don't foresee a change here
in the near future.

Interesting about the "Smooth Line Art" checkbox. I can see that now in
the latest version, too. Older versions of Acrobat allowed to disable
the feature.

On 30.08.2010 22:02:36 Trevor Nicholls wrote:
> Hi Jeremias
> 
> I am using Adobe Reader 9.3.4 and I can see the "Smooth Line Art" option in
> the preferences, but it is always greyed out (and checked!). It seems to be
> a forced setting regardless of the "Smooth text" setting: none, monitor, or
> laptop/LCD. None of these alternatives seem to make any difference to what
> is displayed. Itried playing with the other settings on that page but they
> didn't help either.
> 
> You are correct that when I send the document to the printer the grey
> regions do not have gaps, hooray! But I noticed another problem (less
> apparent on the screen), which is that there is a tiny grey dot in the side
> border at each block boundary. Presumably a black border-left and a grey
> border-top are competing, and the top border is winning the corner. Is there
> a technique for making the side border take precedence to avoid this?
> 
> Cheers
> T
> 
> -----Original Message-----
> From: Jeremias Maerki [mailto:dev@jeremias-maerki.ch] 
> Sent: Tuesday, 31 August 2010 7:29 a.m.
> To: fop-users@xmlgraphics.apache.org
> Subject: Re: edge effects with consecutive colored blocks
> 
> Trevor, try turning off "Smooth Line Art" in Acrobat Reader (Preferences,
> Page Display). If the effects go away, you'll know that it's
> anti-aliasing that causes this. I'll bet it's that but we can't do much
> about it. Won't happen in print. HTH
> 
> On 30.08.2010 21:05:15 Trevor Nicholls wrote:
> > Hi
> > 
> > Where my input XML contains "fragment" elements I am generating fo:blocks
> > with a grey background and black border. Consecutive fragments are
> coalesced
> > into what looks like a single block with one outer border (but they need
> to
> > be separate fo:blocks so that page breaks occur at a block boundary). 
> > 
> > This is working, but I am getting some edge effects. These are apparent as
> > faint ghostly lines where the block boundaries occur - these must be due
> to
> > some sort of rounding/floating arithmetic as they do not appear
> consistently
> > at every boundary nor do they appear consistently on all
> > screens/resolutions.
> > 
> > I presume I am not the first person to see this kind of artefact, but
> Google
> > hasn't helped me find a solution. Can anyone here help me? Do I need to
> > overlay the blocks somehow (and how does one do that anyway)?
> > 
> > Thanks for any hints
> > Trevor
> > 
> > ===
> > 
> > The relevant xsl-fo templates are these:
> > 
> >   <xsl:attribute-set name="fragment.base.set">
> >     <xsl:attribute name="font-family">Courier, monospace</xsl:attribute>
> >     <xsl:attribute name="white-space-treatment">preserve</xsl:attribute>
> >     <xsl:attribute name="white-space-collapse">false</xsl:attribute>
> >     <xsl:attribute name="keep-together.within-page">always</xsl:attribute>
> >     <xsl:attribute name="font-size">9pt</xsl:attribute>
> >     <xsl:attribute name="background-color">#e0e0e0</xsl:attribute>
> >     <xsl:attribute name="padding-before">3pt</xsl:attribute>
> >     <xsl:attribute name="padding-after">3pt</xsl:attribute>
> >     <xsl:attribute name="padding-start">6pt</xsl:attribute>
> >     <xsl:attribute name="padding-end">6pt</xsl:attribute>
> >     <xsl:attribute name="margin">0</xsl:attribute>
> >     <xsl:attribute name="border-style">solid</xsl:attribute>
> >     <xsl:attribute name="border-width">0.25mm</xsl:attribute>
> >   </xsl:attribute-set>
> >   
> >   <xsl:attribute-set name="fragment.set"
> > use-attribute-sets="fragment.base.set">
> >     <xsl:attribute name="border-color">black</xsl:attribute>
> >     <xsl:attribute name="space-before.minimum">0.4em</xsl:attribute>
> >     <xsl:attribute name="space-before.optimum">0.5em</xsl:attribute>
> >     <xsl:attribute name="space-before.maximum">0.6em</xsl:attribute>
> >     <xsl:attribute name="space-after.minimum">0.4em</xsl:attribute>
> >     <xsl:attribute name="space-after.optimum">0.5em</xsl:attribute>
> >     <xsl:attribute name="space-after.maximum">0.6em</xsl:attribute>
> >   </xsl:attribute-set>
> >   
> >   <xsl:attribute-set name="fragment.top.set"
> > use-attribute-sets="fragment.base.set">
> >     <xsl:attribute name="border-top-color">black</xsl:attribute>
> >     <xsl:attribute name="border-left-color">black</xsl:attribute>
> >     <xsl:attribute name="border-right-color">black</xsl:attribute>
> >     <xsl:attribute name="border-bottom-color">#e0e0e0</xsl:attribute>
> >     <xsl:attribute name="space-before.minimum">0.4em</xsl:attribute>
> >     <xsl:attribute name="space-before.optimum">0.5em</xsl:attribute>
> >     <xsl:attribute name="space-before.maximum">0.6em</xsl:attribute>
> >     <xsl:attribute name="space-after">0em</xsl:attribute>
> >   </xsl:attribute-set>
> >   
> >   <xsl:attribute-set name="fragment.middle.set"
> > use-attribute-sets="fragment.base.set">
> >     <xsl:attribute name="border-top-color">#e0e0e0</xsl:attribute>
> >     <xsl:attribute name="border-left-color">black</xsl:attribute>
> >     <xsl:attribute name="border-right-color">black</xsl:attribute>
> >     <xsl:attribute name="border-bottom-color">#e0e0e0</xsl:attribute>
> >     <xsl:attribute name="space-before">0em</xsl:attribute>
> >     <xsl:attribute name="space-after">0em</xsl:attribute>
> >   </xsl:attribute-set>
> >   
> >   <xsl:attribute-set name="fragment.bottom.set"
> > use-attribute-sets="fragment.base.set">
> >     <xsl:attribute name="border-top-color">#e0e0e0</xsl:attribute>
> >     <xsl:attribute name="border-left-color">black</xsl:attribute>
> >     <xsl:attribute name="border-right-color">black</xsl:attribute>
> >     <xsl:attribute name="border-bottom-color">black</xsl:attribute>
> >     <xsl:attribute name="space-before">0em</xsl:attribute>
> >     <xsl:attribute name="space-after.minimum">0.4em</xsl:attribute>
> >     <xsl:attribute name="space-after.optimum">0.5em</xsl:attribute>
> >     <xsl:attribute name="space-after.maximum">0.6em</xsl:attribute>
> >   </xsl:attribute-set>
> >   
> >   <xsl:template
> > match="fragment[not(preceding-sibling::*[1][self::fragment])]">
> >     <xsl:apply-templates select="." mode="inlist" />
> >   </xsl:template>
> > 
> >   <xsl:template match="fragment" mode="inlist">
> >     <xsl:choose>
> >       <xsl:when test="not(preceding-sibling::*[1][self::fragment])">
> >         <xsl:choose>
> >           <xsl:when test="not(following-sibling::*[1][self::fragment])">
> >             <!-- sole fragment -->
> >             <fo:block xsl:use-attribute-sets="fragment.set" >
> >               <xsl:apply-templates />
> >             </fo:block>
> >           </xsl:when>
> >           <xsl:otherwise>
> >             <!-- first fragment -->
> >             <fo:block xsl:use-attribute-sets="fragment.top.set" >
> >               <xsl:apply-templates />
> >             </fo:block>
> >           </xsl:otherwise>
> >         </xsl:choose>
> >       </xsl:when>
> >       <xsl:otherwise>
> >         <xsl:choose>
> >           <xsl:when test="not(following-sibling::*[1][self::fragment])">
> >             <!-- last fragment -->
> >             <fo:block xsl:use-attribute-sets="fragment.bottom.set" >
> >               <xsl:apply-templates />
> >             </fo:block>
> >           </xsl:when>
> >           <xsl:otherwise>
> >             <!-- middle fragment -->
> >             <fo:block xsl:use-attribute-sets="fragment.middle.set" >
> >               <xsl:apply-templates />
> >             </fo:block>
> >           </xsl:otherwise>
> >         </xsl:choose>
> >       </xsl:otherwise>
> >     </xsl:choose>
> >     <xsl:apply-templates select="following-sibling::*[1][self::fragment]"
> > mode="inlist" />
> >   </xsl:template>
> > 
> > 
> 
> 
> 
> Jeremias Maerki
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org




Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


RE: edge effects with consecutive colored blocks

Posted by Trevor Nicholls <tr...@castingthevoid.com>.
Hi Jeremias

I am using Adobe Reader 9.3.4 and I can see the "Smooth Line Art" option in
the preferences, but it is always greyed out (and checked!). It seems to be
a forced setting regardless of the "Smooth text" setting: none, monitor, or
laptop/LCD. None of these alternatives seem to make any difference to what
is displayed. Itried playing with the other settings on that page but they
didn't help either.

You are correct that when I send the document to the printer the grey
regions do not have gaps, hooray! But I noticed another problem (less
apparent on the screen), which is that there is a tiny grey dot in the side
border at each block boundary. Presumably a black border-left and a grey
border-top are competing, and the top border is winning the corner. Is there
a technique for making the side border take precedence to avoid this?

Cheers
T

-----Original Message-----
From: Jeremias Maerki [mailto:dev@jeremias-maerki.ch] 
Sent: Tuesday, 31 August 2010 7:29 a.m.
To: fop-users@xmlgraphics.apache.org
Subject: Re: edge effects with consecutive colored blocks

Trevor, try turning off "Smooth Line Art" in Acrobat Reader (Preferences,
Page Display). If the effects go away, you'll know that it's
anti-aliasing that causes this. I'll bet it's that but we can't do much
about it. Won't happen in print. HTH

On 30.08.2010 21:05:15 Trevor Nicholls wrote:
> Hi
> 
> Where my input XML contains "fragment" elements I am generating fo:blocks
> with a grey background and black border. Consecutive fragments are
coalesced
> into what looks like a single block with one outer border (but they need
to
> be separate fo:blocks so that page breaks occur at a block boundary). 
> 
> This is working, but I am getting some edge effects. These are apparent as
> faint ghostly lines where the block boundaries occur - these must be due
to
> some sort of rounding/floating arithmetic as they do not appear
consistently
> at every boundary nor do they appear consistently on all
> screens/resolutions.
> 
> I presume I am not the first person to see this kind of artefact, but
Google
> hasn't helped me find a solution. Can anyone here help me? Do I need to
> overlay the blocks somehow (and how does one do that anyway)?
> 
> Thanks for any hints
> Trevor
> 
> ===
> 
> The relevant xsl-fo templates are these:
> 
>   <xsl:attribute-set name="fragment.base.set">
>     <xsl:attribute name="font-family">Courier, monospace</xsl:attribute>
>     <xsl:attribute name="white-space-treatment">preserve</xsl:attribute>
>     <xsl:attribute name="white-space-collapse">false</xsl:attribute>
>     <xsl:attribute name="keep-together.within-page">always</xsl:attribute>
>     <xsl:attribute name="font-size">9pt</xsl:attribute>
>     <xsl:attribute name="background-color">#e0e0e0</xsl:attribute>
>     <xsl:attribute name="padding-before">3pt</xsl:attribute>
>     <xsl:attribute name="padding-after">3pt</xsl:attribute>
>     <xsl:attribute name="padding-start">6pt</xsl:attribute>
>     <xsl:attribute name="padding-end">6pt</xsl:attribute>
>     <xsl:attribute name="margin">0</xsl:attribute>
>     <xsl:attribute name="border-style">solid</xsl:attribute>
>     <xsl:attribute name="border-width">0.25mm</xsl:attribute>
>   </xsl:attribute-set>
>   
>   <xsl:attribute-set name="fragment.set"
> use-attribute-sets="fragment.base.set">
>     <xsl:attribute name="border-color">black</xsl:attribute>
>     <xsl:attribute name="space-before.minimum">0.4em</xsl:attribute>
>     <xsl:attribute name="space-before.optimum">0.5em</xsl:attribute>
>     <xsl:attribute name="space-before.maximum">0.6em</xsl:attribute>
>     <xsl:attribute name="space-after.minimum">0.4em</xsl:attribute>
>     <xsl:attribute name="space-after.optimum">0.5em</xsl:attribute>
>     <xsl:attribute name="space-after.maximum">0.6em</xsl:attribute>
>   </xsl:attribute-set>
>   
>   <xsl:attribute-set name="fragment.top.set"
> use-attribute-sets="fragment.base.set">
>     <xsl:attribute name="border-top-color">black</xsl:attribute>
>     <xsl:attribute name="border-left-color">black</xsl:attribute>
>     <xsl:attribute name="border-right-color">black</xsl:attribute>
>     <xsl:attribute name="border-bottom-color">#e0e0e0</xsl:attribute>
>     <xsl:attribute name="space-before.minimum">0.4em</xsl:attribute>
>     <xsl:attribute name="space-before.optimum">0.5em</xsl:attribute>
>     <xsl:attribute name="space-before.maximum">0.6em</xsl:attribute>
>     <xsl:attribute name="space-after">0em</xsl:attribute>
>   </xsl:attribute-set>
>   
>   <xsl:attribute-set name="fragment.middle.set"
> use-attribute-sets="fragment.base.set">
>     <xsl:attribute name="border-top-color">#e0e0e0</xsl:attribute>
>     <xsl:attribute name="border-left-color">black</xsl:attribute>
>     <xsl:attribute name="border-right-color">black</xsl:attribute>
>     <xsl:attribute name="border-bottom-color">#e0e0e0</xsl:attribute>
>     <xsl:attribute name="space-before">0em</xsl:attribute>
>     <xsl:attribute name="space-after">0em</xsl:attribute>
>   </xsl:attribute-set>
>   
>   <xsl:attribute-set name="fragment.bottom.set"
> use-attribute-sets="fragment.base.set">
>     <xsl:attribute name="border-top-color">#e0e0e0</xsl:attribute>
>     <xsl:attribute name="border-left-color">black</xsl:attribute>
>     <xsl:attribute name="border-right-color">black</xsl:attribute>
>     <xsl:attribute name="border-bottom-color">black</xsl:attribute>
>     <xsl:attribute name="space-before">0em</xsl:attribute>
>     <xsl:attribute name="space-after.minimum">0.4em</xsl:attribute>
>     <xsl:attribute name="space-after.optimum">0.5em</xsl:attribute>
>     <xsl:attribute name="space-after.maximum">0.6em</xsl:attribute>
>   </xsl:attribute-set>
>   
>   <xsl:template
> match="fragment[not(preceding-sibling::*[1][self::fragment])]">
>     <xsl:apply-templates select="." mode="inlist" />
>   </xsl:template>
> 
>   <xsl:template match="fragment" mode="inlist">
>     <xsl:choose>
>       <xsl:when test="not(preceding-sibling::*[1][self::fragment])">
>         <xsl:choose>
>           <xsl:when test="not(following-sibling::*[1][self::fragment])">
>             <!-- sole fragment -->
>             <fo:block xsl:use-attribute-sets="fragment.set" >
>               <xsl:apply-templates />
>             </fo:block>
>           </xsl:when>
>           <xsl:otherwise>
>             <!-- first fragment -->
>             <fo:block xsl:use-attribute-sets="fragment.top.set" >
>               <xsl:apply-templates />
>             </fo:block>
>           </xsl:otherwise>
>         </xsl:choose>
>       </xsl:when>
>       <xsl:otherwise>
>         <xsl:choose>
>           <xsl:when test="not(following-sibling::*[1][self::fragment])">
>             <!-- last fragment -->
>             <fo:block xsl:use-attribute-sets="fragment.bottom.set" >
>               <xsl:apply-templates />
>             </fo:block>
>           </xsl:when>
>           <xsl:otherwise>
>             <!-- middle fragment -->
>             <fo:block xsl:use-attribute-sets="fragment.middle.set" >
>               <xsl:apply-templates />
>             </fo:block>
>           </xsl:otherwise>
>         </xsl:choose>
>       </xsl:otherwise>
>     </xsl:choose>
>     <xsl:apply-templates select="following-sibling::*[1][self::fragment]"
> mode="inlist" />
>   </xsl:template>
> 
> 



Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: edge effects with consecutive colored blocks

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
Trevor, try turning off "Smooth Line Art" in Acrobat Reader (Preferences,
Page Display). If the effects go away, you'll know that it's
anti-aliasing that causes this. I'll bet it's that but we can't do much
about it. Won't happen in print. HTH

On 30.08.2010 21:05:15 Trevor Nicholls wrote:
> Hi
> 
> Where my input XML contains "fragment" elements I am generating fo:blocks
> with a grey background and black border. Consecutive fragments are coalesced
> into what looks like a single block with one outer border (but they need to
> be separate fo:blocks so that page breaks occur at a block boundary). 
> 
> This is working, but I am getting some edge effects. These are apparent as
> faint ghostly lines where the block boundaries occur - these must be due to
> some sort of rounding/floating arithmetic as they do not appear consistently
> at every boundary nor do they appear consistently on all
> screens/resolutions.
> 
> I presume I am not the first person to see this kind of artefact, but Google
> hasn't helped me find a solution. Can anyone here help me? Do I need to
> overlay the blocks somehow (and how does one do that anyway)?
> 
> Thanks for any hints
> Trevor
> 
> ===
> 
> The relevant xsl-fo templates are these:
> 
>   <xsl:attribute-set name="fragment.base.set">
>     <xsl:attribute name="font-family">Courier, monospace</xsl:attribute>
>     <xsl:attribute name="white-space-treatment">preserve</xsl:attribute>
>     <xsl:attribute name="white-space-collapse">false</xsl:attribute>
>     <xsl:attribute name="keep-together.within-page">always</xsl:attribute>
>     <xsl:attribute name="font-size">9pt</xsl:attribute>
>     <xsl:attribute name="background-color">#e0e0e0</xsl:attribute>
>     <xsl:attribute name="padding-before">3pt</xsl:attribute>
>     <xsl:attribute name="padding-after">3pt</xsl:attribute>
>     <xsl:attribute name="padding-start">6pt</xsl:attribute>
>     <xsl:attribute name="padding-end">6pt</xsl:attribute>
>     <xsl:attribute name="margin">0</xsl:attribute>
>     <xsl:attribute name="border-style">solid</xsl:attribute>
>     <xsl:attribute name="border-width">0.25mm</xsl:attribute>
>   </xsl:attribute-set>
>   
>   <xsl:attribute-set name="fragment.set"
> use-attribute-sets="fragment.base.set">
>     <xsl:attribute name="border-color">black</xsl:attribute>
>     <xsl:attribute name="space-before.minimum">0.4em</xsl:attribute>
>     <xsl:attribute name="space-before.optimum">0.5em</xsl:attribute>
>     <xsl:attribute name="space-before.maximum">0.6em</xsl:attribute>
>     <xsl:attribute name="space-after.minimum">0.4em</xsl:attribute>
>     <xsl:attribute name="space-after.optimum">0.5em</xsl:attribute>
>     <xsl:attribute name="space-after.maximum">0.6em</xsl:attribute>
>   </xsl:attribute-set>
>   
>   <xsl:attribute-set name="fragment.top.set"
> use-attribute-sets="fragment.base.set">
>     <xsl:attribute name="border-top-color">black</xsl:attribute>
>     <xsl:attribute name="border-left-color">black</xsl:attribute>
>     <xsl:attribute name="border-right-color">black</xsl:attribute>
>     <xsl:attribute name="border-bottom-color">#e0e0e0</xsl:attribute>
>     <xsl:attribute name="space-before.minimum">0.4em</xsl:attribute>
>     <xsl:attribute name="space-before.optimum">0.5em</xsl:attribute>
>     <xsl:attribute name="space-before.maximum">0.6em</xsl:attribute>
>     <xsl:attribute name="space-after">0em</xsl:attribute>
>   </xsl:attribute-set>
>   
>   <xsl:attribute-set name="fragment.middle.set"
> use-attribute-sets="fragment.base.set">
>     <xsl:attribute name="border-top-color">#e0e0e0</xsl:attribute>
>     <xsl:attribute name="border-left-color">black</xsl:attribute>
>     <xsl:attribute name="border-right-color">black</xsl:attribute>
>     <xsl:attribute name="border-bottom-color">#e0e0e0</xsl:attribute>
>     <xsl:attribute name="space-before">0em</xsl:attribute>
>     <xsl:attribute name="space-after">0em</xsl:attribute>
>   </xsl:attribute-set>
>   
>   <xsl:attribute-set name="fragment.bottom.set"
> use-attribute-sets="fragment.base.set">
>     <xsl:attribute name="border-top-color">#e0e0e0</xsl:attribute>
>     <xsl:attribute name="border-left-color">black</xsl:attribute>
>     <xsl:attribute name="border-right-color">black</xsl:attribute>
>     <xsl:attribute name="border-bottom-color">black</xsl:attribute>
>     <xsl:attribute name="space-before">0em</xsl:attribute>
>     <xsl:attribute name="space-after.minimum">0.4em</xsl:attribute>
>     <xsl:attribute name="space-after.optimum">0.5em</xsl:attribute>
>     <xsl:attribute name="space-after.maximum">0.6em</xsl:attribute>
>   </xsl:attribute-set>
>   
>   <xsl:template
> match="fragment[not(preceding-sibling::*[1][self::fragment])]">
>     <xsl:apply-templates select="." mode="inlist" />
>   </xsl:template>
> 
>   <xsl:template match="fragment" mode="inlist">
>     <xsl:choose>
>       <xsl:when test="not(preceding-sibling::*[1][self::fragment])">
>         <xsl:choose>
>           <xsl:when test="not(following-sibling::*[1][self::fragment])">
>             <!-- sole fragment -->
>             <fo:block xsl:use-attribute-sets="fragment.set" >
>               <xsl:apply-templates />
>             </fo:block>
>           </xsl:when>
>           <xsl:otherwise>
>             <!-- first fragment -->
>             <fo:block xsl:use-attribute-sets="fragment.top.set" >
>               <xsl:apply-templates />
>             </fo:block>
>           </xsl:otherwise>
>         </xsl:choose>
>       </xsl:when>
>       <xsl:otherwise>
>         <xsl:choose>
>           <xsl:when test="not(following-sibling::*[1][self::fragment])">
>             <!-- last fragment -->
>             <fo:block xsl:use-attribute-sets="fragment.bottom.set" >
>               <xsl:apply-templates />
>             </fo:block>
>           </xsl:when>
>           <xsl:otherwise>
>             <!-- middle fragment -->
>             <fo:block xsl:use-attribute-sets="fragment.middle.set" >
>               <xsl:apply-templates />
>             </fo:block>
>           </xsl:otherwise>
>         </xsl:choose>
>       </xsl:otherwise>
>     </xsl:choose>
>     <xsl:apply-templates select="following-sibling::*[1][self::fragment]"
> mode="inlist" />
>   </xsl:template>
> 
> 



Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


RE: edge effects with consecutive colored blocks

Posted by Trevor Nicholls <tr...@castingthevoid.com>.
Sorry, I omitted to say this is with FOP 0.95 on Fedora Linux.

Cheers
T

-----Original Message-----
From: Trevor Nicholls [mailto:trevor@castingthevoid.com] 
Sent: Tuesday, 31 August 2010 7:05 a.m.
To: fop-users@xmlgraphics.apache.org
Subject: edge effects with consecutive colored blocks

Hi

Where my input XML contains "fragment" elements I am generating fo:blocks
with a grey background and black border. Consecutive fragments are coalesced
into what looks like a single block with one outer border (but they need to
be separate fo:blocks so that page breaks occur at a block boundary). 

This is working, but I am getting some edge effects. These are apparent as
faint ghostly lines where the block boundaries occur - these must be due to
some sort of rounding/floating arithmetic as they do not appear consistently
at every boundary nor do they appear consistently on all
screens/resolutions.

I presume I am not the first person to see this kind of artefact, but Google
hasn't helped me find a solution. Can anyone here help me? Do I need to
overlay the blocks somehow (and how does one do that anyway)?

Thanks for any hints
Trevor

===

The relevant xsl-fo templates are these:

  <xsl:attribute-set name="fragment.base.set">
    <xsl:attribute name="font-family">Courier, monospace</xsl:attribute>
    <xsl:attribute name="white-space-treatment">preserve</xsl:attribute>
    <xsl:attribute name="white-space-collapse">false</xsl:attribute>
    <xsl:attribute name="keep-together.within-page">always</xsl:attribute>
    <xsl:attribute name="font-size">9pt</xsl:attribute>
    <xsl:attribute name="background-color">#e0e0e0</xsl:attribute>
    <xsl:attribute name="padding-before">3pt</xsl:attribute>
    <xsl:attribute name="padding-after">3pt</xsl:attribute>
    <xsl:attribute name="padding-start">6pt</xsl:attribute>
    <xsl:attribute name="padding-end">6pt</xsl:attribute>
    <xsl:attribute name="margin">0</xsl:attribute>
    <xsl:attribute name="border-style">solid</xsl:attribute>
    <xsl:attribute name="border-width">0.25mm</xsl:attribute>
  </xsl:attribute-set>
  
  <xsl:attribute-set name="fragment.set"
use-attribute-sets="fragment.base.set">
    <xsl:attribute name="border-color">black</xsl:attribute>
    <xsl:attribute name="space-before.minimum">0.4em</xsl:attribute>
    <xsl:attribute name="space-before.optimum">0.5em</xsl:attribute>
    <xsl:attribute name="space-before.maximum">0.6em</xsl:attribute>
    <xsl:attribute name="space-after.minimum">0.4em</xsl:attribute>
    <xsl:attribute name="space-after.optimum">0.5em</xsl:attribute>
    <xsl:attribute name="space-after.maximum">0.6em</xsl:attribute>
  </xsl:attribute-set>
  
  <xsl:attribute-set name="fragment.top.set"
use-attribute-sets="fragment.base.set">
    <xsl:attribute name="border-top-color">black</xsl:attribute>
    <xsl:attribute name="border-left-color">black</xsl:attribute>
    <xsl:attribute name="border-right-color">black</xsl:attribute>
    <xsl:attribute name="border-bottom-color">#e0e0e0</xsl:attribute>
    <xsl:attribute name="space-before.minimum">0.4em</xsl:attribute>
    <xsl:attribute name="space-before.optimum">0.5em</xsl:attribute>
    <xsl:attribute name="space-before.maximum">0.6em</xsl:attribute>
    <xsl:attribute name="space-after">0em</xsl:attribute>
  </xsl:attribute-set>
  
  <xsl:attribute-set name="fragment.middle.set"
use-attribute-sets="fragment.base.set">
    <xsl:attribute name="border-top-color">#e0e0e0</xsl:attribute>
    <xsl:attribute name="border-left-color">black</xsl:attribute>
    <xsl:attribute name="border-right-color">black</xsl:attribute>
    <xsl:attribute name="border-bottom-color">#e0e0e0</xsl:attribute>
    <xsl:attribute name="space-before">0em</xsl:attribute>
    <xsl:attribute name="space-after">0em</xsl:attribute>
  </xsl:attribute-set>
  
  <xsl:attribute-set name="fragment.bottom.set"
use-attribute-sets="fragment.base.set">
    <xsl:attribute name="border-top-color">#e0e0e0</xsl:attribute>
    <xsl:attribute name="border-left-color">black</xsl:attribute>
    <xsl:attribute name="border-right-color">black</xsl:attribute>
    <xsl:attribute name="border-bottom-color">black</xsl:attribute>
    <xsl:attribute name="space-before">0em</xsl:attribute>
    <xsl:attribute name="space-after.minimum">0.4em</xsl:attribute>
    <xsl:attribute name="space-after.optimum">0.5em</xsl:attribute>
    <xsl:attribute name="space-after.maximum">0.6em</xsl:attribute>
  </xsl:attribute-set>
  
  <xsl:template
match="fragment[not(preceding-sibling::*[1][self::fragment])]">
    <xsl:apply-templates select="." mode="inlist" />
  </xsl:template>

  <xsl:template match="fragment" mode="inlist">
    <xsl:choose>
      <xsl:when test="not(preceding-sibling::*[1][self::fragment])">
        <xsl:choose>
          <xsl:when test="not(following-sibling::*[1][self::fragment])">
            <!-- sole fragment -->
            <fo:block xsl:use-attribute-sets="fragment.set" >
              <xsl:apply-templates />
            </fo:block>
          </xsl:when>
          <xsl:otherwise>
            <!-- first fragment -->
            <fo:block xsl:use-attribute-sets="fragment.top.set" >
              <xsl:apply-templates />
            </fo:block>
          </xsl:otherwise>
        </xsl:choose>
      </xsl:when>
      <xsl:otherwise>
        <xsl:choose>
          <xsl:when test="not(following-sibling::*[1][self::fragment])">
            <!-- last fragment -->
            <fo:block xsl:use-attribute-sets="fragment.bottom.set" >
              <xsl:apply-templates />
            </fo:block>
          </xsl:when>
          <xsl:otherwise>
            <!-- middle fragment -->
            <fo:block xsl:use-attribute-sets="fragment.middle.set" >
              <xsl:apply-templates />
            </fo:block>
          </xsl:otherwise>
        </xsl:choose>
      </xsl:otherwise>
    </xsl:choose>
    <xsl:apply-templates select="following-sibling::*[1][self::fragment]"
mode="inlist" />
  </xsl:template>





---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org