Hi,

if you use a SVG toolkit like Batik you can use "onload" scripts and use the 
DOM to adjust 
the boxes according to the bounding boxes of the text. the batik-rasterizer can 
output 
jpeg, png, tiff and pdf.

I use this succesfully for generating maps where I use a ECMAScript based label 
placement 
algorithm.

Andreas

--- In [email protected], Johan Persson <[EMAIL PROTECTED]> wrote:
>
> Thanks for the tips.
> 
> This is basically the workaround I have but unfortunately it's simply not 
> good 
> enough. The library I was contemplating an SVG backend for is JpGraph which 
> is a PHP (an unholy mix of C/C++ and Java) server side graph generating 
> library that I written. It has quite a lot of advanced text formatting (like 
> tables, columns etc) which adjusts itself to the user selected TTF font and 
> the actual text strings.
> 
> Without drastically reducing the functionality I need to be able to give the 
> end user of the library his/her choice of TTF fonts. At the moment the 
> library generates raster images encoded as either jpeg, gif or png with user 
> selectable TTF fonts.
> 
> The only approximate solution I can think of is to build in some heuristics 
> that given a certain text string and font I try to guesstimate the bounding 
> box. With the way the libary works now the end user never has to think about 
> adjusting things like margins, column widths, etc. it's all taken care of 
> automagically and I like to keep it that way. But of course, this requires 
> the library to be able to calculate bbox:es.
> 
> The "perfectionist" in me has a problem with this approach since it can never 
> be guaranteed to work 100% and will either have to much "safety margin" or 
> things will start overwrite each other. More problematic is the fact that the 
> raster image and the SVG image will possible have quite different 
> proportions.
> 
> The library will generate SVG output directly without the use of any external 
> library (just some utility SVG classes to keep track of things like grouping, 
> viewboxes etc.)
> 
> The only guaranteed solution seems to be to add some automatically generated 
> DOM script that will "backpatch" (possible every coordinate in the scene) 
> depending on the actual strings and fonts the user have selected. I will have 
> to do some experimental coding to even validate that this is in fact possible 
> at all.
> 
> It might just turn out that I have to resort to add a PS backend which will 
> definitely not be easier but PS has the "stringwidth" operator which makes 
> life for me easier.
> 






------------------------ Yahoo! Groups Sponsor --------------------~--> 
Everything you need is one click away.  Make Yahoo! your home page now.
http://us.click.yahoo.com/AHchtC/4FxNAA/yQLSAA/1U_rlB/TM
--------------------------------------------------------------------~-> 

-----
To unsubscribe send a message to: [EMAIL PROTECTED]
-or-
visit http://groups.yahoo.com/group/svg-developers and click "edit my 
membership"
---- 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/svg-developers/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to