On Sun, Mar 18, 2007 at 04:41:53PM +0100, Enrico Forestieri wrote:
> Committed. When I find some more time I will address a remaining issue.
> Currently, the character widths used in mathed are the same as those
> used in normal text, i.e., they are logical and not actual widths as
> explained here http://doc.trolltech.com/4.1/qfontmetrics.html#width .
> As a result, when a character extends beyond its logical width, it may
> clash with a superscript (as in $f^2_1$, for example).
Indeed.
> There are two possible ways to proceed. The first one would be caching
> the actual widths as reported by boundingRect(), as hinted here
>
> void GuiFontMetrics::fillMetricsCache(char_type c) const
> {
> QRect const & r = metrics_.boundingRect(ucs4_to_qchar(c));
> AscendDescend ad = { -r.top(), r.bottom() + 1};
> // We could as well compute the width but this is not really
> // needed for now as it is done directly in width() below.
> metrics_cache_.insert(c, ad);
> }
>
> in src/frontends/qt4/GuiFontMetrics.C (the "width() below" is the one
> reporting the logical widths, btw). The second one would be caching
> the right bearings (in the Qt meaning, not the one documented in
> src/frontends/FontMetrics.h) such that when the right bearing is
> negative, its absolute value gets added to the width reported by the
> InsetMathScript::dx0 method.
>
> I would prefer this second solution as in this way the subscript will
> be more nicely aligned. Any thoughts?
I am afraid I don't care too much in this particular case.
Andre'