>>>>> "AP" == Andrew Pietsch <apietsch@xxxxxxxxxxxxxxxx> writes:
AP> I've managed to get the rendering working (for the simple cases of
AP> top, bottom and middle), but I'm a little unsure how to package
AP> the align attribute in SVGFlowTextElementBridge. It seems to me
AP> that the vertical-align attribute should belong to the
AP> <batik:region> element, which is currently converted to a
AP> Rectangle2D.
Unfortunately, I can see arguments on both sides of this
(horizontal alignment would then per-para but vertical alignment would
be on regions), I tend to agree that vertical-align belongs on the
region element (just be aware that in the end this is the sort of
thing the SVG WG is likely to change).
AP> I'm guessing that the list of rectangles produced (by
AP> SVGFlowTextElementBridge.gatherRects) eventually ends up as the
AP> list of flowRects passed to GlyphLayout.textWrapTextChunk() and
AP> that I should be passing a RegionInfo class that holds the
AP> rectangle and the alignment instead.
AP> Sound ok?
Sounds about right, BTW gatherRects is only called from one place
which is where the rectangles are attached to the attributed string.
So a simple change would be to change gatherRects to gatherRegionInfo,
and have it return a list of RegionInfo objects. Similar small
parallel changes on the other side should finish the job!
Thanks, for doing this.
AP> Cheers Andrew
AP> On Wed, 2002-11-13 at 09:29, Andrew Pietsch wrote:
>> Thanks for that, I'll give it a go.. (c:
>>
>> On Tue, 2002-11-12 at 00:33, Thomas E Deweese wrote: > >>>>> "AP"
>> == Andrew Pietsch <apietsch@xxxxxxxxxxxxxxxx> writes:
>> >
>> > AP> I've now decided I need this.. )c:
>> >
>> > AP> I'm presuming the final implementation is still someway off,
>> so is > AP> there any change of adding it (since you feel its easy)
>> or > AP> pointing me in the right direction so I can implement it?
>> >
>> > I'll gadly point you in the right direction ;)
>> >
>> > All of text wrapping is done as a post-processing step in text >
>> layout. That post-processing step has two parts, first it figures
>> out > what needs to be on each line, then it positions all the
>> glyphs.
>> >
>> > All this work is done in the two methods:
>> >
>> > // Does the line break determination >
>> batik.gvt.text.GlyphLayout.textWrapTextChunk(....)
>> >
>> > // Does the glyph positioning >
>> batik.gvt.text.GlyphLayout.layoutChunk(....)
>> >
>> > As textWrapTextChunk does it's work it adde LineInfo object to a
>> > list, one for each line of text.
>> >
>> > What I would suggest is adding a vertical-align offset member to
>> > the LineInfo class. This should be a Point2D.float. Use the
>> same > Point2D.float for all lines in a single flowRect (the list
>> of > flowRects is accessed from the 'flowRectsIter'). When we hit
>> the end > of a flowRect (or of text), you can get the vertical size
>> from 'dy' > (depending on the case you will need to figure in the
>> current line's > size - search for 'bottomEdge') & the flow rect
>> size from cRect.height > from this you can calculate the 'left
>> over' space and put half of it > in the vertical-align Point2D's y
>> value.
>> >
>> > Then in the layoutChunk method just add the vertical-align offset
>> > in when calculating the correct lineLoc for the current line.
>> >
>> > ---
>> >
>> > You will also need to pass this information to the text-wrap
>> stuff > from the source SVG. This is mostly done in the >
>> batik.extension.svg.SVGFlowTextElementBridge class. You might look
>> at > how the margin's are done (search for makeMarginInfo) or how
>> the > FlowRegions are handleded (search for getRegions).
>> >
>> > ---
>> >
>> > Hope this helps, and good luck (if you get into it and have >
>> specific questions feel free to post).
>> >
>> > AP> Thanks Andrew
>> >
>> > AP> On Wed, 2002-10-23 at 22:34, Thomas E Deweese wrote: > >>
>> >>>>> "AP" == Andrew Pietsch <apietsch@xxxxxxxxxxxxxxxx> writes:
>> > >>
>> > AP> Hi,I was wondering if the css vertical-align property is
>> supported > AP> (or planned) when using the flow text extension
>> (i've tried a few > AP> times and browsed the code so I'm guessing
>> no). > >> No, and eventually :)
>> > >>
>> > >> This is on hold pending decisions in the SVG WG. The > >>
>> implementation was done to get experience to feed back to the SVG >
>> >> WG. The WG is tring to sort out the details of how text
>> wrapping > >> will work - what features to support, what algs
>> should be used, > >> etc.
>> > >>
>> > AP> I'm using the cvs version (week or so old). I have a single
>> flow > AP> region and it would be nice (though not critical) to
>> vertically > AP> centre the text. > >> This wouldn't be hard to
>> implement for this case (or actually even > >> for multiple flow
>> regions), but I haven't bothered since everything > >> is about to
>> change anyway.
|