mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 01:59:02 +00:00
QFontMetrics::xHeight() is not always the ascent of 'x'
Use the real ascent of glyph 'x' as LyX 2.3.x did. It can make a difference at least on Windows with many fonts. Fixes bug #13100.
This commit is contained in:
parent
edf56d644d
commit
194b53ef9d
@ -114,7 +114,7 @@ inline QChar const ucs4_to_qchar(char_type const ucs4)
|
|||||||
|
|
||||||
|
|
||||||
GuiFontMetrics::GuiFontMetrics(QFont const & font)
|
GuiFontMetrics::GuiFontMetrics(QFont const & font)
|
||||||
: font_(font), metrics_(font, 0), xheight_(metrics_.xHeight()),
|
: font_(font), metrics_(font, 0), xheight_(-metrics_.boundingRect('x').top()),
|
||||||
strwidth_cache_(strwidth_cache_max_cost),
|
strwidth_cache_(strwidth_cache_max_cost),
|
||||||
breakstr_cache_(breakstr_cache_max_cost),
|
breakstr_cache_(breakstr_cache_max_cost),
|
||||||
qtextlayout_cache_(qtextlayout_cache_max_size)
|
qtextlayout_cache_(qtextlayout_cache_max_size)
|
||||||
@ -163,6 +163,7 @@ int GuiFontMetrics::em() const
|
|||||||
|
|
||||||
int GuiFontMetrics::xHeight() const
|
int GuiFontMetrics::xHeight() const
|
||||||
{
|
{
|
||||||
|
// This is not alays true on Windows (see #13100).
|
||||||
// LATTEST(metrics_.xHeight() == ascent('x'));
|
// LATTEST(metrics_.xHeight() == ascent('x'));
|
||||||
return xheight_;
|
return xheight_;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user