From 1dd894724289c2387985e892e6a25a94f7e8d5ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20Gullik=20Bj=C3=B8nnes?= Date: Tue, 15 Apr 2003 00:49:11 +0000 Subject: [PATCH] parlist-12-a.diff git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6809 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/ChangeLog | 19 ++++++++++++++++--- src/paragraph.C | 20 ++++++++++++-------- src/paragraph.h | 6 ++++-- src/paragraph_funcs.C | 5 ++++- src/paragraph_pimpl.C | 28 +++------------------------- src/paragraph_pimpl.h | 7 +++---- 6 files changed, 42 insertions(+), 43 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 1202a9e63b..42c3ecc597 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,8 +1,21 @@ +2003-04-15 Lars Gullik Bjønnes + + * paragraph_pimpl.C (simpleTeXSpecialChars): take a outerfont arg, + adjust + + * paragraph_funcs.C (TeXOnePar): adjust + + * paragraph.C (getLabelFont): add outerfont arg, adjust + (getLayoutFont): ditto + (simpleTeXOnePar): adjust + + * paragraph_pimpl.C (realizeFont): delete func + 2003-04-14 Alfredo Braunstein - * text2.C (beforeFullRowInset): added a bad getchar check, removed - row argument, constify cur argument. - + * text2.C (beforeFullRowInset): added a bad getchar check, removed + row argument, constify cur argument. + 2003-04-15 Lars Gullik Bjønnes * text2.C (getFont): adjust diff --git a/src/paragraph.C b/src/paragraph.C index 4ecbf5f9db..6477b1ad03 100644 --- a/src/paragraph.C +++ b/src/paragraph.C @@ -457,25 +457,29 @@ LyXFont const Paragraph::getFont(BufferParams const & bparams, pos_type pos, } -LyXFont const Paragraph::getLabelFont(BufferParams const & bparams) const +LyXFont const Paragraph::getLabelFont(BufferParams const & bparams, + LyXFont const & outerfont) const { LyXLayout_ptr const & lout = layout(); LyXFont tmpfont = lout->labelfont; tmpfont.setLanguage(getParLanguage(bparams)); + tmpfont.realize(outerfont); - return pimpl_->realizeFont(tmpfont, bparams); + return realizeFont(tmpfont, bparams, 0, false); } -LyXFont const Paragraph::getLayoutFont(BufferParams const & bparams) const +LyXFont const Paragraph::getLayoutFont(BufferParams const & bparams, + LyXFont const & outerfont) const { LyXLayout_ptr const & lout = layout(); LyXFont tmpfont = lout->font; tmpfont.setLanguage(getParLanguage(bparams)); + tmpfont.realize(outerfont); - return pimpl_->realizeFont(tmpfont, bparams); + return realizeFont(tmpfont, bparams, 0, false); } @@ -961,9 +965,9 @@ bool Paragraph::simpleTeXOnePar(Buffer const * buf, if (body_pos > 0) { os << '['; ++column; - basefont = getLabelFont(bparams); + basefont = getLabelFont(bparams, outerfont); } else { - basefont = getLayoutFont(bparams); + basefont = getLayoutFont(bparams, outerfont); } moving_arg |= style->needprotect; @@ -997,7 +1001,7 @@ bool Paragraph::simpleTeXOnePar(Buffer const * buf, column += running_font.latexWriteEndChanges(os, basefont, basefont); open_font = false; } - basefont = getLayoutFont(bparams); + basefont = getLayoutFont(bparams, outerfont); running_font = basefont; os << ']'; ++column; @@ -1070,7 +1074,7 @@ bool Paragraph::simpleTeXOnePar(Buffer const * buf, pimpl_->simpleTeXSpecialChars(buf, bparams, os, texrow, moving_arg, font, running_font, - basefont, open_font, + basefont, outerfont, open_font, running_change, *style, i, column, c); } diff --git a/src/paragraph.h b/src/paragraph.h index 9cb5543eb9..d8c521b12a 100644 --- a/src/paragraph.h +++ b/src/paragraph.h @@ -242,8 +242,10 @@ public: */ LyXFont const getFont(BufferParams const &, lyx::pos_type pos, LyXFont const & outerfont) const; - LyXFont const getLayoutFont(BufferParams const &) const; - LyXFont const getLabelFont(BufferParams const &) const; + LyXFont const getLayoutFont(BufferParams const &, + LyXFont const & outerfont) const; + LyXFont const getLabelFont(BufferParams const &, + LyXFont const & outerfont) const; /// value_type getChar(lyx::pos_type pos) const; /// diff --git a/src/paragraph_funcs.C b/src/paragraph_funcs.C index 056724b924..cb3f557cd5 100644 --- a/src/paragraph_funcs.C +++ b/src/paragraph_funcs.C @@ -562,9 +562,12 @@ TeXOnePar(Buffer const * buf, // Is this really needed ? (Dekel) // We do not need to use to change the font for the last paragraph // or for a command. + LyXFont const outerfont(outerFont(pit)); + LyXFont const font = (pit->empty() - ? pit->getLayoutFont(bparams) : pit->getFont(bparams, pit->size() - 1, outerFont(pit))); + ? pit->getLayoutFont(bparams, outerfont) + : pit->getFont(bparams, pit->size() - 1, outerfont)); bool is_command = style->isCommand(); diff --git a/src/paragraph_pimpl.C b/src/paragraph_pimpl.C index 927a8242b6..16a57fee5d 100644 --- a/src/paragraph_pimpl.C +++ b/src/paragraph_pimpl.C @@ -498,6 +498,7 @@ void Paragraph::Pimpl::simpleTeXSpecialChars(Buffer const * buf, LyXFont & font, LyXFont & running_font, LyXFont & basefont, + LyXFont const & outerfont, bool & open_font, Change::Type & running_change, LyXLayout const & style, @@ -538,7 +539,7 @@ void Paragraph::Pimpl::simpleTeXSpecialChars(Buffer const * buf, column += running_font.latexWriteEndChanges(os, basefont, basefont); open_font = false; } - basefont = owner_->getLayoutFont(bparams); + basefont = owner_->getLayoutFont(bparams, outerfont); running_font = basefont; if (font.family() == LyXFont::TYPEWRITER_FAMILY) @@ -585,7 +586,7 @@ void Paragraph::Pimpl::simpleTeXSpecialChars(Buffer const * buf, basefont, basefont); open_font = false; - basefont = owner_->getLayoutFont(bparams); + basefont = owner_->getLayoutFont(bparams, outerfont); running_font = basefont; } @@ -852,26 +853,3 @@ void Paragraph::Pimpl::validate(LaTeXFeatures & features, } } } - - -LyXFont const Paragraph::Pimpl::realizeFont(LyXFont const & font, - BufferParams const & bparams) const -{ - LyXFont tmpfont(font); - - // check for environment font information - depth_type par_depth = owner_->getDepth(); - Paragraph * par = owner_; - LyXTextClass const & tclass = bparams.getLyXTextClass(); - - while (par && par->getDepth() && !tmpfont.resolved()) { - par = outerHook(par); - if (par) { - tmpfont.realize(par->layout()->font); - par_depth = par->getDepth(); - } - } - - tmpfont.realize(tclass.defaultfont()); - return tmpfont; -} diff --git a/src/paragraph_pimpl.h b/src/paragraph_pimpl.h index db782737b6..0031c56635 100644 --- a/src/paragraph_pimpl.h +++ b/src/paragraph_pimpl.h @@ -84,9 +84,6 @@ struct Paragraph::Pimpl { /// erase the given range bool erase(lyx::pos_type start, lyx::pos_type end); /// - LyXFont const realizeFont(LyXFont const & font, - BufferParams const & bparams) const; - /// Inset * inset_owner; /** A font entry covers a range of positions. Notice that the @@ -158,7 +155,9 @@ struct Paragraph::Pimpl { std::ostream &, TexRow & texrow, bool moving_arg, LyXFont & font, LyXFont & running_font, - LyXFont & basefont, bool & open_font, + LyXFont & basefont, + LyXFont const & outerfont, + bool & open_font, Change::Type & running_change, LyXLayout const & style, lyx::pos_type & i,