xmlgraphics-batik-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vincent Hardy <vincent.ha...@sun.com>
Subject Re: svg font clipping
Date Mon, 17 Jun 2002 17:46:42 GMT
Thomas E Deweese wrote:
> 
> >>>>> "VH" == Vincent Hardy <vincent.hardy@sun.com> writes:
> 
> VH> I do get the bug but I have to zoom in quite a bit to see that the
> VH> bottom line is clipped in the bottom text (half of the stroke
> VH> width is clipped) (it seems like we are using the geometry bounds
> VH> where we should be using the rendering bounds somewhere).
> 
>     Ok, this one is a bit of a mess.  The basic problem is that we
> have two sources of stroking (text element strok-width, and stroking
> specified in SVG fonts), we don't properly account for both of them
> (and it's not enirely clear how we should account for them).
> 
>     In more detail the problem is that the TextPainter assumes that it
> just needs to apply the stroke property from ths ACI to the outline of
> the glyphs to get the correct bounds.  This is true when the glyphs
> are from a 'normal' font or when the SVG font only defines areas to be
> filled.  But it's wrong when the SVG font uses internal stroking.
> 
> My suggestion for fixing this is:
> 
> 1) Push bounds calc down to the level to the GlyphVectors, so
>    AWTGVTGlyphVector can do stroking stuff to AWT glyphs (like
>    Stroking Text painter does currently for all cases) and
>    SVGGVTGlyphVector can just rely on gvt.font.Glyph's bounds calc
>    (which is also currently wrong but is easily fixed).
> 
> This still leaves TextPainter with a bunch of methods that are never
> used and seem more useful then they really are:
> 
>      getShape - has nothing useful to return (in fact it should
>               probably become an alias for getDecoratedShape).  This
>               shape is useless for anything but implementing SVG 'clip'.
> 
>      getBounds, getDecoratedBounds, getPaintedBounds -
>               The only two that are used currently are:
> 
>               getBounds - for GraphicsNode.getGeometryBounds()
>               getDecoratedShape - for GraphicsNode.getBounds()

You meant TextNode.getGeometryBounds() and TextNode.getOutline(), right?

> 
>               (which is rather confusing really).
> 
>      I'm not 100% sure what should be returned for getBounds() should
> it skip stroking specified in internal SVG fonts? (in which case we
> need to add interfaces to GlyphVector) Or should it just not apply
> stroking derived from the text element?
> 
>      I'm guessing the former (skip all stroking anywhere in the text).
>

I am not sure. I'll look into it more. Did you already try what you are 
suggesting? 

Vincent.

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-dev-help@xml.apache.org


Mime
View raw message