Open mdeff opened 2 years ago
English ordinals are not normally expected to be written using modifier letter superscripts, which are encoded in Unicode as elements of various phonetic transcription systems and alphabets. The STIX Two Text fonts contain a full set of a–zlowercase superscript variant glyphs mapped to their regular lowercase characters via the OpenType Layout sups
feature, and that is the recommended method to display them for ordinals.
Since the full set of a–z lowercase superscript glyphs are available, it would be relatively easy to duplicate those of them that are not yet encoded in the font as modifier letters, and to assign them the codepoints from the Phonetic Extension block. Filling out the remainder of that block would be considerably more work, and is something that STI Pub would need to consider.
PS. Ideally, the layout engine would apply the sups
feature automatically when superscripting the letters, rather than scaling and positioning according to its own algorithm or font fallback data.
PS. Ideally, the layout engine would apply the
sups
feature automatically when superscripting the letters, rather than scaling and positioning according to its own algorithm or font fallback data.
@mdeff There's a LaTeX package that accesses the sups
feature that @tiroj is referring to: realscripts
(either accessed directly or through the package xltxtra
). After you load the package, use the \textsuperscript{}
and \textsubscript{}
commands (or the \realsuperscript{}
and \realsubscript{}
commands) to access the OpenType features.
By the way, the manual for fontspec
actually documents how it implements OpenType features fairly well. I found out about realscripts
from the fontspec
manual.
PS. Ideally, the layout engine would apply the
sups
feature automatically when superscripting the letters, rather than scaling and positioning according to its own algorithm or font fallback data.
P.S. @mdeff's second piece of code is putting regular text inside a math superscript in an inline math equation (the $
s) to force the superscript effect, so not only are the correct glyphs not being used, the spacing is determined using math cut-in kerning rules rather than text font kerning rules.
P.P.S. As it turns out, MS Word does not seem to support the sups
and subs
features at all (i.e. Word emulates the superscripts and subscripts even if the font actually has the right glyphs). It seems that the only way for MS Word users to access the right glyphs is if the glyphs are replicated in the various Unicode blocks.
Sigh. We never managed to persuade the Office text layout folk to implement OpenType Layout sups
(and subs
). Their argument was always that users might apply superscript styling to characters that are not supported by the font layout features, and then there would be an ugly mix of superscript characters at different heights and weights, so it was better to synthesise all superscripts. So users don’t get the actual useful things like superscript letters and numbers that they might reasonably use in conventional typography, in case other users might style random characters as superscript.
The text and math fonts miss the following superscript letters to write ordinals:
Unlike the superscript s, r, n, and h that are included, those are in the phonetic extension. I guess the rest of it should be considered for inclusion as well.
Code to reproduce:
Result:
An alternative is to have the engine superscript the standard letters:
Though that doesn't look as good (positioning and weight):