]> git.lyx.org Git - features.git/commitdiff
fix bug 2146
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Tue, 6 Dec 2005 14:54:23 +0000 (14:54 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Tue, 6 Dec 2005 14:54:23 +0000 (14:54 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10645 a592a061-630c-0410-9148-cb99ea01b6c8

src/ChangeLog
src/lyxtext.h
src/text.C
src/text2.C

index 03a11a005f329f850ae1eefbd0c9548788cabe97..02e64525c4a123531c93dacbcdb6eec5a8a4089d 100644 (file)
@@ -1,3 +1,14 @@
+2005-12-02  Jean-Marc Lasgouttes  <lasgouttes@lyx.org>
+
+       * text2.C (makeFontEntriesLayoutSpecific): remove.
+       (setLayout): adapt.
+
+       * text.C (insertChar): remove bogus caching of fonts (did not do
+       anything). 
+
+       * text2.C (LyXText): initialize current_font to ALL_INHERIT (was
+       ALL_SANE). (bug 2146)
+
 2005-12-01  Jean-Marc Lasgouttes  <lasgouttes@lyx.org>
 
        * rowpainter.C (paintFirst): fix centering of
index f3567c2cc72095689f99dabc2127d32877d4d3a8..48036984376e9c508dc33fc78368fcc9d1b722ed 100644 (file)
@@ -342,6 +342,8 @@ public:
        /// the current font
        LyXFont real_current_font;
        /// our buffer's default layout font. This is textclass specific
+       /* This is actually never initialized! Should be replaced by a
+        * defaultfont() method that looks at the textclass (easy). [JMarc]*/
        LyXFont defaultfont_;
        ///
        int background_color_;
@@ -365,9 +367,6 @@ private:
        /// change on pit
        pit_type undoSpan(pit_type pit);
 
-       /// used in setlayout
-       void makeFontEntriesLayoutSpecific(BufferParams const &, Paragraph & par);
-
        /// Calculate and set the height of the row
        void setHeightOfRow(pit_type, Row & row);
 
index 5c54cc342bd0b1f5611f04566b6d72d180835172..dcdf3b92ea1109bbb3695e179818657419e0d2db 100644 (file)
@@ -1154,16 +1154,6 @@ void LyXText::insertChar(LCursor & cur, char c)
        // difference are the special checks when calculating the row.fill
        // (blank does not count at the end of a row) and the check here
 
-       // The bug is triggered when we type in a description environment:
-       // The current_font is not changed when we go from label to main text
-       // and it should (along with realtmpfont) when we type the space.
-       // CHECK There is a bug here! (Asger)
-
-       // store the current font.  This is because of the use of cursor
-       // movements. The moving cursor would refresh the current font
-       LyXFont realtmpfont = real_current_font;
-       LyXFont rawtmpfont = current_font;
-
        // When the free-spacing option is set for the current layout,
        // disable the double-space checking
        if (!freeSpacing && IsLineSeparatorChar(c)) {
@@ -1190,10 +1180,7 @@ void LyXText::insertChar(LCursor & cur, char c)
                }
        }
 
-       par.insertChar(cur.pos(), c, rawtmpfont);
-
-       current_font = rawtmpfont;
-       real_current_font = realtmpfont;
+       par.insertChar(cur.pos(), c, current_font);
        setCursor(cur, cur.pit(), cur.pos() + 1, false, cur.boundary());
        charInserted();
 }
index b56898bf20b6efd0ac99dc414dc5eca707a272a9..0032efbfb372b2010b72edb60d45da0d4b800c44 100644 (file)
@@ -68,6 +68,7 @@ using std::min;
 
 LyXText::LyXText(BufferView * bv)
        : maxwidth_(bv ? bv->workWidth() : 100),
+         current_font(LyXFont::ALL_INHERIT),
          background_color_(LColor::background),
          bv_owner(bv),
          autoBreakRows_(false)
@@ -277,28 +278,6 @@ void LyXText::setCharFont(pit_type pit, pos_type pos, LyXFont const & fnt)
 }
 
 
-// used in setLayout
-// Asger is not sure we want to do this...
-void LyXText::makeFontEntriesLayoutSpecific(BufferParams const & params,
-                                           Paragraph & par)
-{
-       LyXLayout_ptr const & layout = par.layout();
-       pos_type const psize = par.size();
-
-       LyXFont layoutfont;
-       for (pos_type pos = 0; pos < psize; ++pos) {
-               if (pos < par.beginOfBody())
-                       layoutfont = layout->labelfont;
-               else
-                       layoutfont = layout->font;
-
-               LyXFont tmpfont = par.getFontSettings(params, pos);
-               tmpfont.reduce(layoutfont);
-               par.setFont(pos, tmpfont);
-       }
-}
-
-
 // return past-the-last paragraph influenced by a layout change on pit
 pit_type LyXText::undoSpan(pit_type pit)
 {
@@ -327,7 +306,6 @@ void LyXText::setLayout(pit_type start, pit_type end, string const & layout)
 
        for (pit_type pit = start; pit != end; ++pit) {
                pars_[pit].applyLayout(lyxlayout);
-               makeFontEntriesLayoutSpecific(bufparams, pars_[pit]);
                if (lyxlayout->margintype == MARGIN_MANUAL)
                        pars_[pit].setLabelWidthString(lyxlayout->labelstring());
        }