GNOME Bugzilla – Bug 708780
<sup>/<sub> should use font-size-relative vertical displacement
Last modified: 2018-05-22 13:10:42 UTC
Created attachment 255717 [details] Example program showing too-small rise with a large font Current pango uses an absolute vertical displacement to implement the <sup> and <sub> tags in pango markup, (such as rise="5000" for <sup). This value is only close to correct for a limited range of font sizes. For very small fonts, the superscript glyphs will be displaced too far, and for large font sizes, the displacement will be far too small. If there were a new attribute available, such as PANGO_ATTR_RELATIVE_RISE, then it would be straightforward to use that for <sup>/<sub>. There seems to be some consensus around using 33% for the displacement in cases like this, though some software uses smaller values: http://en.wikipedia.org/wiki/Subscript_and_superscript#Desktop_publishing Of course, that page also demonstrates that a single relative value is not correct in all cases, (a suffix such as "th" should have a rise that's smaller than a numerical exponent, for example). So allowing for things like rise="25%" would also give the user some good flexibility to control this.
Created attachment 255718 [details] Output from example program This is the output from the pango-sup-bug.c program previously attached. It shows that the result of the <sup> tag looks nothing like a superscript when used with a large font size, (the rise value is extremely small).
*** Bug 519146 has been marked as a duplicate of this bug. ***
Owen, any idea how to address this?
PANGO_ATTR_RELATIVE_RISE in comment #1 was an idea that I suggested to Carl on IRC - I don't think it's possible without a new attribute handled in the Pango core, since the pango-markup doesn't always know the base font size.
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/pango/issues/224.