30.9.2016, 18:19, Philippe Verdy wrote:

Note also that many tools generating documentation from source code
allow you to insert HTML comments, so you could as well use <sub></sub>,

Yes, but there’s a serious typographic pitfall with this, as well as with using e.g. subscript or superscript formatting in a word processor. The problem is that the rendering is almost always simplistic: letters (or other characters) of the current font are used in reduced size and in lowered or raised position. The result is that the glyphs have reduced stroke width too, and the position change very often causes line spacing to be uneven.

The typographically correct implementation of such formatting or markup would use subscript or superscript glyphs from the font, designed by the font creator to match the style of the font. This is more difficult than the simplistic approach, and of course it is possible only when using a font that contains such glyphs.

Using HTML, for example, the way to achieve that at present would be to use markup like <span class="sub">...</span> (to avoid the problems caused by the default formatting of <sub> and <sup>) and to use a CSS style sheet that sets font-family suitably and uses OpenType font feature settings to select subscript or superscript glyphs. In practice, you would need to use @font-face to embed a suitable OpenType font. So it’s doable, but not trivial like just slapping <sub> and </sub> around some text.

A practical conclusion is that if you need only e.g. 2 and 3 as superscripts (a rather general situation in general texts, where you just need m² or m³), it is much simpler to use the relevant Unicode superscript characters (instead of e.g. m<sup>2</sup>). This means using typographer-designer superscript glyphs in a simple and reliable way.

Yucca


Reply via email to