There is nothing like preparing a bug report to make you examine your
assumptions.  My assumptions turned out to be wrong about our -dev svg
results, but that is fine because it means I am making some progress.

I was in the process of preparing a simple test case for a librsvg bug
report (which I fortunately didn't send), when I discovered that -dev svg
had at least two text position bugs.

The first bug I discovered today was the code incorrectly wrote indentation
white space and line end characters (used for human-readability formatting
of the xml file but _not_ part of the text itself) between the <text> and
</text> tags. Some viewers (konqueror, firefox 2) incorrectly ignored those
characters, but others (display and probably firefox 3) correctly rendered
them.  So the result was standard's compliant but still far from what was
intended for the text to be displayed.

I have now (revision 8884) removed those extra human-readability formatting
characters, and I now get much more consistent text-positioning results with
the "display" programme.  However, there is at least one more
text-positioning issue which Andrew pointed out previously, but which I
missed until now.

On 2008-10-07 07:57+0100 Andrew Ross wrote:

> Some testing with hand-editing the source revealed (not surprisingly)
> that it is the text-anchor tag that is not being properly used. Try
> changing "middle" to "start" or "end" and you get some odd results - it
> looks like the length of the text string used to calculate the position
> is far too long. The fact that all editors have a similar bug I find
> disturbing. I wonder if it is related to the transformation matrices?

The problem is that the PLplot string justification parameter (which
continuously ranges from 0. to 1.) is being interpreted by svg.c as either
"start" (for args->just < 0.33), "end" (for args->just > 0.66), or "middle"
(for the the remaining args->just values). From the variety of anchor-tags
in results it appears that args->just is used a lot with a variety of
different values internally in PLplot for text positioning. However,
according to the SVG standard only those three values are allowed for
text-anchor. Therefore, the current svg.c approach must be considerably
modified to get accurate text positioning corresponding to args->just.

What I propose to do is count the number of unicode characters to be
rendered (ignoring FCI's) multiply by some factor times the character
height, and shift the origin of the string appropriately to account for the
PLplot string justification parameter's difference from 0. This approach
should only work for simple text layout languages, but then any args->just
value other than 0. for CTL languages doesn't make much sense.

In sum, I feel I am making excellent progress on understanding the -dev svg
text positioning problems that so many people here have encountered.  I have
fixed one (bad) text-positioning bug as of revision 8884, and I have a plan
to deal with the remaining one that I have found.  I have some hope that
once that remaining bug is fixed we'll have a complete cure for the text
positioning problems, but we'll see.

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state implementation
for stellar interiors (freeeos.sf.net); PLplot scientific plotting software
package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of
Linux Links project (loll.sf.net); and the Linux Brochure Project
(lbproject.sf.net).
__________________________

Linux-powered Science
__________________________

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel

Reply via email to