]> git.lyx.org Git - lyx.git/commitdiff
Fix font inside inset (bugs 1766, 1809)
authorMartin Vermeer <martin.vermeer@hut.fi>
Sun, 10 Apr 2005 14:07:33 +0000 (14:07 +0000)
committerMartin Vermeer <martin.vermeer@hut.fi>
Sun, 10 Apr 2005 14:07:33 +0000 (14:07 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9799 a592a061-630c-0410-9148-cb99ea01b6c8

src/ChangeLog
src/insets/ChangeLog
src/insets/insetcharstyle.C
src/insets/insetert.C
src/insets/insetfootlike.C
src/insets/insetfootlike.h
src/rowpainter.C

index 9930e770a922cb57c80fc500fbae20a78d621d52..7f3c5915d93c9ca4b5099222861e63eef8e06117 100644 (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,
index 65335430836ea5c8397da9de68770b8d69153cdd..c6aa3b772d9f89fdbf7a420914449d747c8e4357 100644 (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):
index c9d8ecf515ec73779455b4575a78785488e3a198..f904390fe11e16d697d0ea2bddb0584690320f9a 100644 (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;
 
index b15c22b51180ee480edcab76454cebb132d39a18..72ac3ef684cb602b440736753d78c61868342dca 100644 (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;
 }
index 19cea629046af8d9679b9c7f1ace94cb5dda9baa..6e33522aedb1b157b66584ec6ebf707dcf0491a8 100644 (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";
index 0a7fd2c02569223f3dbe6ecf7a45f2eda5534930..09752a8d493c0904d80811d69c3f1df3fddf5062 100644 (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;
index 36c354a55c54291b4ac1b979d0214da62237b399..438c5125e8601c22d1646d93b12e5d93fb9db010 100644 (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;
 }