#include "lyxtext.h"
#include "undo_funcs.h"
#include "changes.h"
+#include "paragraph_funcs.h"
#include "frontends/Alert.h"
#include "frontends/Dialogs.h"
if (!t)
return 0;
- LyXCursor const & c= t->cursor;
- LyXFont const font = c.par()->getFont(buffer()->params, c.pos());
+ LyXCursor const & c = t->cursor;
+ LyXFont const font = c.par()->getFont(buffer()->params, c.pos(),
+ outerFont(c.par()));
return font.language()->encoding();
}
+2003-04-15 Lars Gullik Bjønnes <larsbj@gullik.net>
+
+ * text2.C (getFont): adjust
+ (getLayoutFont): adjust
+ (getLabelFont): adjust
+
+ * paragraph_funcs.C (TeXOnePar): adjust
+ (outerFont): new func...
+ (realizeFont): ...moved out from here, changed this to facilitate
+ transition
+
+ * paragraph.C (getFont): take outerfont as arg, adjust
+ (simpleTeXOnePar): add outerfont arg, adjust
+
+ * buffer.C (simpleLinuxDocOnePar): adjust
+ (simpleDocBookOnePar): adjust
+
+ * CutAndPaste.C (pasteSelection): adjust
+
+ * BufferView.C (getEncoding): adjust
+
2003-04-14 Lars Gullik Bjønnes <larsbj@gullik.net>
* text2.C (setCharFont): adjust
tmpbuf->erase(i--);
}
} else {
- LyXFont f1 = tmpbuf->getFont(current_view->buffer()->params,i);
+ LyXFont f1 = tmpbuf->getFont(current_view->buffer()->params, i, outerFont(tmpbuf));
LyXFont f2 = f1;
if (!(*par)->checkInsertChar(f1)) {
tmpbuf->erase(i--);
PAR_TAG tag_close = NONE;
list < PAR_TAG > tag_open;
- LyXFont const font = par->getFont(params, i);
+ LyXFont const font = par->getFont(params, i, outerFont(par));
if (font_old.family() != font.family()) {
switch (family_type) {
// parsing main loop
for (pos_type i = 0; i < par->size(); ++i) {
- LyXFont font = par->getFont(params, i);
+ LyXFont font = par->getFont(params, i, outerFont(par));
// handle <emphasis> tag
if (font_old.emph() != font.emph()) {
+2003-04-15 Lars Gullik Bjønnes <larsbj@gullik.net>
+
+ * insetquotes.C (latex): comment some code and add warnings.
+
2003-04-14 Alfredo Braunstein <abraunst@libero.it>
* insetexternal.C (localDispatch): added a missing DISPATCHED
// How do we get the local language here??
lyx::pos_type curr_pos = parOwner()->getPositionOfInset(this);
lyx::Assert(curr_pos != -1);
+
+#warning FIXME. We _must_ find another way to get the language. (Lgb)
+#if 0
+ // This cannot be used. (Lgb)
string const curr_lang =
parOwner()->getFont(buf->params,
curr_pos).language()->babel();
-
+#else
+ // And this is not the way... (Lgb)
+ string const curr_lang = buf->params.language->lang();
+#endif
const int quoteind = quote_index[side_][language_];
string qstr;
// The difference is that this one is used for generating the LaTeX file,
// and thus cosmetic "improvements" are disallowed: This has to deliver
// the true picture of the buffer. (Asger)
-LyXFont const Paragraph::getFont(BufferParams const & bparams,
- pos_type pos) const
+LyXFont const Paragraph::getFont(BufferParams const & bparams, pos_type pos,
+ LyXFont const & outerfont) const
{
lyx::Assert(pos >= 0);
LyXFont tmpfont = getFontSettings(bparams, pos);
tmpfont.realize(layoutfont);
+ tmpfont.realize(outerfont);
- return pimpl_->realizeFont(tmpfont, bparams);
+ return realizeFont(tmpfont, bparams, 0, false);
}
// This one spits out the text of the paragraph
bool Paragraph::simpleTeXOnePar(Buffer const * buf,
BufferParams const & bparams,
+ LyXFont const & outerfont,
ostream & os, TexRow & texrow,
bool moving_arg)
{
value_type c = getChar(i);
// Fully instantiated font
- LyXFont font = getFont(bparams, i);
+ LyXFont font = getFont(bparams, i, outerfont);
LyXFont const last_font = running_font;
// outside font change, i.e. we write "\textXX{text} "
// rather than "\textXX{text }". (Asger)
if (open_font && c == ' ' && i <= size() - 2) {
- LyXFont const & next_font = getFont(bparams, i + 1);
+ LyXFont const & next_font = getFont(bparams, i + 1, outerfont);
if (next_font != running_font
&& next_font != font) {
font = next_font;
running_font
.latexWriteEndChanges(os, basefont,
next_->getFont(bparams,
- 0));
+ 0, outerfont));
} else {
running_font.latexWriteEndChanges(os, basefont,
basefont);
void Paragraph::changeLanguage(BufferParams const & bparams,
- Language const * from, Language const * to)
+ Language const * from, Language const * to)
{
for (pos_type i = 0; i < size(); ++i) {
LyXFont font = getFontSettings(bparams, i);
///
bool simpleTeXOnePar(Buffer const *, BufferParams const &,
- std::ostream &, TexRow & texrow, bool moving_arg);
+ LyXFont const & outerfont, std::ostream &,
+ TexRow & texrow, bool moving_arg);
///
bool hasSameLayout(Paragraph const * par) const;
attributes with values LyXFont::INHERIT, LyXFont::IGNORE or
LyXFont::TOGGLE.
*/
- LyXFont const getFont(BufferParams const &, lyx::pos_type pos) const;
+ 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;
///
}
if (pit->params().lineTop()) {
- os << "\\lyxline{\\" << pit->getFont(bparams, 0).latexSize() << '}'
+ os << "\\lyxline{\\" << pit->getFont(bparams, 0, outerFont(pit)).latexSize() << '}'
<< "\\vspace{-1\\parskip}";
further_blank_line = true;
}
break;
}
- bool need_par = pit->simpleTeXOnePar(buf, bparams, os, texrow, moving_arg);
+ bool need_par = pit->simpleTeXOnePar(buf, bparams, outerFont(pit),
+ os, texrow, moving_arg);
// Make sure that \\par is done with the font of the last
// character if this has another size as the default.
// or for a command.
LyXFont const font =
(pit->empty()
- ? pit->getLayoutFont(bparams) : pit->getFont(bparams, pit->size() - 1));
+ ? pit->getLayoutFont(bparams) : pit->getFont(bparams, pit->size() - 1, outerFont(pit)));
bool is_command = style->isCommand();
}
-LyXFont const realizeFont(LyXFont const & font,
- Buffer const * buf,
- ParagraphList & /*plist*/,
- ParagraphList::iterator pit)
+LyXFont const outerFont(ParagraphList::iterator pit)
{
- LyXTextClass const & tclass = buf->params.getLyXTextClass();
- LyXFont tmpfont(font);
Paragraph::depth_type par_depth = pit->getDepth();
-
- Paragraph * par = &*pit;
+ LyXFont tmpfont(LyXFont::ALL_INHERIT);
// Resolve against environment font information
+ Paragraph * par = &*pit;
while (par && par_depth && !tmpfont.resolved()) {
par = outerHook(par);
if (par) {
}
}
+ return tmpfont;
+}
+
+
+LyXFont const realizeFont(LyXFont const & font,
+ BufferParams const & params,
+ ParagraphList::iterator pit,
+ bool outerhook)
+{
+ LyXTextClass const & tclass = params.getLyXTextClass();
+ LyXFont tmpfont(font);
+
+ if (outerhook) {
+ LyXFont of = outerFont(pit);
+ tmpfont.realize(of);
+ }
+
tmpfont.realize(tclass.defaultfont());
return tmpfont;
int readParagraph(Buffer & buf, Paragraph & par, LyXLex & lex);
LyXFont const realizeFont(LyXFont const & font,
- Buffer const * buf,
- ParagraphList & /*plist*/,
- ParagraphList::iterator pit);
+ BufferParams const & params,
+ ParagraphList::iterator pit,
+ bool outerhook = true);
+
+LyXFont const outerFont(ParagraphList::iterator pit);
#endif // PARAGRAPH_FUNCS_H
if (pit->inInset())
pit->inInset()->getDrawFont(tmpfont);
- return realizeFont(tmpfont, buf, ownerParagraphs(), pit);
+ // Realize with the fonts of lesser depth.
+ tmpfont.realize(outerFont(pit));
+
+ return realizeFont(tmpfont, buf->params, pit, false);
}
return layout->resfont;
}
- return realizeFont(layout->font, buf, ownerParagraphs(), pit);
+ LyXFont font(layout->font);
+ // Realize with the fonts of lesser depth.
+ font.realize(outerFont(pit));
+
+ return realizeFont(font, buf->params, pit, false);
}
return layout->reslabelfont;
}
- return realizeFont(layout->labelfont, buf, ownerParagraphs(), pit);
+ LyXFont font(layout->labelfont);
+ // Realize with the fonts of lesser depth.
+ font.realize(outerFont(pit));
+
+ return realizeFont(layout->labelfont, buf->params, pit, false);
}