Fix font inside inset (bugs 1766, 1809)

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9799 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Martin Vermeer 2005-04-10 14:07:33 +00:00
parent 7f1066c339
commit d5d5562e02
7 changed files with 50 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2005-04-10 Martin Vermeer <martin.vermeer@hut.fi>
* rowpainter.C (RowPainter, getFont): fix font inside inset
(bugs 1766, 1809)
2005-04-06 Martin Vermeer <martin.vermeer@hut.fi>
* CutAndPaste.C (eraseSelection): more precise fix for bug 1654,

View File

@ -1,3 +1,10 @@
2005-04-10 Martin Vermeer <martin.vermeer@hut.fi>
* insetcharstyle.C (metrics, draw):
* insetert.C (metrics, draw):
* insetfootlike.[Ch] (metrics, draw): fix font inside inset
(bugs 1766, 1809)
2005-04-05 Martin Vermeer <martin.vermeer@hut.fi>
* insetexternal.C (validate):

View File

@ -102,6 +102,8 @@ void InsetCharStyle::metrics(MetricsInfo & mi, Dimension & dim) const
{
LyXFont tmpfont = mi.base.font;
getDrawFont(mi.base.font);
mi.base.font.reduce(LyXFont(LyXFont::ALL_SANE));
mi.base.font.realize(tmpfont);
mi.base.textwidth -= 2 * TEXT_TO_INSET_OFFSET;
InsetText::metrics(mi, dim);
mi.base.font = tmpfont;
@ -121,6 +123,8 @@ void InsetCharStyle::draw(PainterInfo & pi, int x, int y) const
LyXFont tmpfont = pi.base.font;
getDrawFont(pi.base.font);
// I don't understand why the above .reduce and .realize aren't
//needed, or even wanted, here. It just works. -- MV 10.04.2005
InsetText::draw(pi, x, y);
pi.base.font = tmpfont;

View File

@ -373,6 +373,7 @@ void InsetERT::metrics(MetricsInfo & mi, Dimension & dim) const
{
LyXFont tmpfont = mi.base.font;
getDrawFont(mi.base.font);
mi.base.font.realize(tmpfont);
InsetCollapsable::metrics(mi, dim);
mi.base.font = tmpfont;
dim_ = dim;
@ -383,6 +384,8 @@ void InsetERT::draw(PainterInfo & pi, int x, int y) const
{
LyXFont tmpfont = pi.base.font;
getDrawFont(pi.base.font);
// I don't understand why the above .realize isn't needed, or
// even wanted, here. It just works. -- MV 10.04.2005
InsetCollapsable::draw(pi, x, y);
pi.base.font = tmpfont;
}

View File

@ -42,6 +42,25 @@ InsetFootlike::InsetFootlike(InsetFootlike const & in)
}
void InsetFootlike::metrics(MetricsInfo & mi, Dimension & dim) const
{
LyXFont tmpfont = mi.base.font;
mi.base.font = LyXFont(LyXFont::ALL_SANE);
InsetCollapsable::metrics(mi, dim);
mi.base.font = tmpfont;
dim_ = dim;
}
void InsetFootlike::draw(PainterInfo & pi, int x, int y) const
{
LyXFont tmpfont = pi.base.font;
pi.base.font = LyXFont(LyXFont::ALL_SANE);
InsetCollapsable::draw(pi, x, y);
pi.base.font = tmpfont;
}
void InsetFootlike::write(Buffer const & buf, ostream & os) const
{
os << getInsetName() << "\n";

View File

@ -24,6 +24,10 @@ public:
///
InsetFootlike(InsetFootlike const &);
///
void metrics(MetricsInfo &, Dimension &) const;
///
void draw(PainterInfo & pi, int x, int y) const;
///
void write(Buffer const & buf, std::ostream & os) const;
///
bool insetAllowed(InsetBase::Code) const;

View File

@ -115,6 +115,9 @@ private:
double separator_;
double hfill_;
double label_hfill_;
// Hack to get 1.4cvs working
LyXFont font_;
};
@ -122,7 +125,7 @@ RowPainter::RowPainter(PainterInfo & pi,
LyXText const & text, pit_type pit, Row const & row, int x, int y)
: bv_(*pi.base.bv), pain_(pi.pain), text_(text), pars_(text.paragraphs()),
row_(row), pit_(pit), par_(text.paragraphs()[pit]),
xo_(x), yo_(y), width_(text_.width())
xo_(x), yo_(y), width_(text_.width()), font_(pi.base.font)
{
RowMetrics m = text_.computeRowMetrics(pit, row_);
x_ = m.x + xo_;
@ -142,7 +145,10 @@ RowPainter::RowPainter(PainterInfo & pi,
/// "temporary"
LyXFont const RowPainter::getFont(pos_type pos) const
{
return text_.getFont(par_, pos);
LyXFont lf(font_);
lf.reduce(LyXFont(LyXFont::ALL_SANE));
lf.realize(text_.getFont(par_, pos));
return lf;
}