Forum Bugs

Superscript affecting markers

Ben
This is in Prince5 beta3. If I have a block element that contains superscript, and the block element is set to something with a marker, for example, display:list-item, then the marker itself will be slightly superscripted. Take the following xml and css as an example:

XML:
<ol>
<li>Normal item</li>
<li>Convert mol MnO<sub>4</sub><sup>-</sup> to mol Fe<sup>2+</sup></li>
</ol>


CSS:
sub{vertical-align:sub;font-size:8pt;}
sup{vertical-align:super;font-size:8pt;}
li{display:list-item;counter-increment:numbering;}
li::marker{content:counter(numbering, decimal) ". ";}
ol{counter-reset:numbering;display:block;}


Running this through Prince will produce the bug. A simple workaround is setting the li element to display:block and changing the li::marker selector to li::before.
Ben
Lynx
Strange, I can't reproduce your bug. Morover I actually observed the opposite, when vertical alignment does not influence line box at all. See test case at
http://geocities.com/csssite/prince/bug16.xhtml

Following CSS2.1 specs, Mozilla and Opera take into account su(b|per)scripts when calculating height of line box.
Ben
Hmm, I can't imagine why, that is the XML and CSS I use to reproduce the bug. The number marker isn't superscripted completely, but is noticeably higher than the rest of the line. I am using Prince5beta3 (I even re-installed to make sure I was using the latest version). You can view the output at
http://www.benrotz.com/viewer/Bug.pdf
(file size is about 400k, sorry about that).
Ben
mikeday
Ah, I think I see the issue: Ben is processing the file as XML and Lynx is processing the file as XHTML. The default XHTML style sheet contains the following declaration for the sub and sup elements:

sub, sup { line-height: none }

This means that if you process the file as XHTML, the subscript and superscript will not contribute to the line-height at all.

However, if you process the file as XML without applying the default XHTML style sheet, the subscript and superscript elements will contribute to the line height, and because list item markers are currently top aligned rather than baseline aligned they will appear to move up (actually, the line is moving down).

There are a number of workarounds: use list-style-position: inside, to put the marker on the same line as the list item content, or make the list item a block and use li::before, or just use line-height: none on the sub and superscript elements. In the future we will probably add baseline alignment to list item markers, which will also solve the problem :)
Lynx
You are right, I missed line-height:none; in default style sheet.