Using "super" / "sub" in property vertical-align will place the characters too high / too low. This is due to a minor mistake in class LineArea. In method verticalAlign() the offset of the super/subscript is computed by taking 2/3 of ascender for the choosen font. The value which should be used must be 1/3 because you want to get a 2/3 overlap with the text before/after. /** * Balance (vertically) the inline areas within this line. */ public void verticalAlign() { int superHeight = -this.placementOffset; int maxHeight = this.allocationHeight; Enumeration e = children.elements(); while (e.hasMoreElements()) { Box b = (Box)e.nextElement(); if (b instanceof InlineArea) { InlineArea ia = (InlineArea)b; if (ia instanceof WordArea) { ia.setYOffset(placementOffset); } if (ia.getHeight() > maxHeight) { maxHeight = ia.getHeight(); } int vert = ia.getVerticalAlign(); if (vert == VerticalAlign.SUPER) { int fh = fontState.getAscender(); // was: ia.setYOffset((int)(placementOffset - (2.0 * fh / 3.0))); ia.setYOffset((int)(placementOffset - (fh / 3.0))); } else if (vert == VerticalAlign.SUB) { int fh = fontState.getAscender(); // was: ia.setYOffset((int)(placementOffset + (2.0 * fh / 3.0))); ia.setYOffset((int)(placementOffset + (fh / 3.0))); }
Created attachment 4488 [details] diff file which corrects this bug
Thanks for your contribution but I would rather not apply it to the maintenance branch because there are quite a few stylesheets out there which use vertical-align and this patch would probably make the documents look wrong (even if it corrects vertical-align) Of course we will consider this for the redesign.
Bug fixed in latest Trunk (rev 584703), and probably in FOP 0.94 and earlier 0.9x versions (see previous comment).
batch transition pre-FOP1.0 resolved+fixed bugs to closed+fixed