Daniel Phillips wrote:

In order to precisely position text characters in SVG, it's often necessary to set kerning='0' on text elements to ensure that unwanted tweaks aren't made to character positions during display or printing. However, Batik handles the 'kerning' attribute incorrectly. It treats a kerning value as an absolute glyph-spacing value rather than as an *adjustment* to glyph spacing.

[...]

The spec supports this interpretation: It goes on to say, "The most common scenario, other than auto, is to set 'kerning' to a value of 0 so that auto-kerning is disabled." The intent here is that you set 'kerning' to 0 to disable kerning. That implies that the kerning value is an adjustment rather than an absolute value. Remember that kerning is a subtle adjustment to glyph spacing to make text look nicer. Kerned and un-kerned text should look much the same in gross terms. Un-kerned text certainly shouldn't look like it's had all of its spacing removed. (Adobe's viewer implementation supports these assertions).


Agree with this interpretation of the specification as it is clearly in line with standard industry practice
(although the specification is a little unclear)


The method responsible for applying the 'kerning' value is org.apache.batik.gvt.text.GlyphLayout.doSpacing. I've reworked it and provided a patch[5]. An additional problem with the original code is that it attempts to remove any auto-kerning values from the GlyphVector before applying the explicit 'kerning' value. In doing so, it also loses explicit x-coords (e.g. in <text x="10,20,30">). However, since neither Java nor Batik currently actually do any kerning, it made sense to remove this code.


We do currently do kerning from font elements. So I rewrote your patch to properly remove font
kerning and use the kern value when present.





--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to