optimization: save some font copying

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20016 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Alfredo Braunstein 2007-09-02 23:37:11 +00:00
parent 2ea432bab1
commit 15dc381ce9

View File

@ -225,15 +225,11 @@ Font TextMetrics::getDisplayFont(pit_type pit, pos_type pos) const
Font f = par.getFontSettings(params, pos); Font f = par.getFontSettings(params, pos);
if (!text_->isMainText(buffer)) if (!text_->isMainText(buffer))
applyOuterFont(f); applyOuterFont(f);
Font lf; bool lab = layout->labeltype == LABEL_MANUAL && pos < body_pos;
Font rlf;
if (layout->labeltype == LABEL_MANUAL && pos < body_pos) { Font const & lf = lab ? layout->labelfont : layout->font;
lf = layout->labelfont; Font rlf = lab ? layout->reslabelfont : layout->resfont;
rlf = layout->reslabelfont;
} else {
lf = layout->font;
rlf = layout->resfont;
}
// In case the default family has been customized // In case the default family has been customized
if (lf.family() == Font::INHERIT_FAMILY) if (lf.family() == Font::INHERIT_FAMILY)
rlf.setFamily(params.getFont().family()); rlf.setFamily(params.getFont().family());
@ -241,11 +237,8 @@ Font TextMetrics::getDisplayFont(pit_type pit, pos_type pos) const
} }
// The uncommon case need not be optimized as much // The uncommon case need not be optimized as much
Font layoutfont; Font const & layoutfont = pos < body_pos ?
if (pos < body_pos) layout->labelfont : layout->font;
layoutfont = layout->labelfont;
else
layoutfont = layout->font;
Font font = par.getFontSettings(params, pos); Font font = par.getFontSettings(params, pos);
font.realize(layoutfont); font.realize(layoutfont);