-FontSetChanger::FontSetChanger(MetricsBase & mb, docstring const & name,
- bool really_change_font)
- : Changer<MetricsBase>(mb), change_(really_change_font)
-{
- if (change_) {
- save_ = mb;
- FontSize oldsize = save_.font.size();
- ColorCode oldcolor = save_.font.color();
- docstring const oldname = from_ascii(save_.fontname);
- mb.fontname = to_utf8(name);
- mb.font = sane_font;
- augmentFont(mb.font, name);
- mb.font.setSize(oldsize);
- if (name != "lyxtex"
- && ((isTextFont(oldname) && oldcolor != Color_foreground)
- || (isMathFont(oldname) && oldcolor != Color_math)))
- mb.font.setColor(oldcolor);
- }
-}
-
-
-FontSetChanger::~FontSetChanger()
-{
- if (change_)
- orig_ = save_;
-}
-
-
-/////////////////////////////////////////////////////////////////////////
-//
-// WidthChanger
-//
-/////////////////////////////////////////////////////////////////////////
-
-WidthChanger::WidthChanger(MetricsBase & mb, int w)
- : Changer<MetricsBase>(mb)
-{
- save_ = mb;
- mb.textwidth = w;
-}
-
-
-WidthChanger::~WidthChanger()
-{
- orig_ = save_;
-}
-
-
-/////////////////////////////////////////////////////////////////////////
-//
-// ColorChanger
-//
-/////////////////////////////////////////////////////////////////////////
-
-ColorChanger::ColorChanger(FontInfo & font, docstring const & color,
- bool really_change_color)
- : Changer<FontInfo, ColorCode>(font), change_(really_change_color)