mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 10:00:33 +00:00
Cache the value of FontMetrics::xHeight()
This value is computed for the metrics of *every* Mathdata and hotspot says that it counts for 9% of total on math-heavy "branch-test.lyx" file. I am not sure that real world agrees with that, but profiling shows that Qt itself does not cache the value. Part of reinvestigation of #12297.
This commit is contained in:
parent
d8e509e5eb
commit
386a2ddca1
@ -117,7 +117,7 @@ inline QChar const ucs4_to_qchar(char_type const ucs4)
|
||||
|
||||
|
||||
GuiFontMetrics::GuiFontMetrics(QFont const & font)
|
||||
: font_(font), metrics_(font, 0),
|
||||
: font_(font), metrics_(font, 0), xheight_(metrics_.xHeight()),
|
||||
strwidth_cache_(strwidth_cache_max_cost),
|
||||
breakstr_cache_(breakstr_cache_max_cost),
|
||||
qtextlayout_cache_(qtextlayout_cache_max_size)
|
||||
@ -167,7 +167,7 @@ int GuiFontMetrics::em() const
|
||||
int GuiFontMetrics::xHeight() const
|
||||
{
|
||||
// LATTEST(metrics_.xHeight() == ascent('x'));
|
||||
return metrics_.xHeight();
|
||||
return xheight_;
|
||||
}
|
||||
|
||||
|
||||
|
@ -116,6 +116,9 @@ private:
|
||||
/// Metrics on the font
|
||||
QFontMetrics metrics_;
|
||||
|
||||
/// Height of character "x"
|
||||
int xheight_;
|
||||
|
||||
/// Slope of italic font
|
||||
double slope_;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user