int LyXText::singleWidth(BufferView * bview, Paragraph * par,
- Paragraph::size_type pos, char c) const
+ Paragraph::size_type pos, char c) const
{
LyXFont const font = getFont(bview->buffer(), par, pos);
++vpos;
if (lyxrc.mark_foreign_language &&
- font.language() != ignore_language &&
+ font.language() != latex_language &&
font.language() != bview->buffer()->params.language) {
int const y = offset + row->height() - 1;
pain.line(int(tmpx), y, int(x), y, LColor::language);
x += lyxfont::width(textstring, font);
}
+#ifdef INHERIT_LANGUAGE
#ifdef WITH_WARNINGS
if ((font.language() == inherit_language) ||
(font.language() == ignore_language))
lyxerr << "No this shouldn't happen!\n";
+#endif
#endif
if (lyxrc.mark_foreign_language &&
+ font.language() != latex_language &&
font.language() != bview->buffer()->params.language) {
int const y = offset + row->height() - 1;
pain.line(int(tmpx), y, int(x), y,
int LyXText::fill(BufferView * bview, Row * row, int paper_width) const
{
if (paper_width < 0)
- return 20;
+ return 0;
int w;
// get the pure distance
// returns true, if a expansion is needed.
// Rules are given by LaTeX
bool LyXText::hfillExpansion(Buffer const * buf, Row const * row_ptr,
- Paragraph::size_type pos) const
+ Paragraph::size_type pos) const
{
// by the way, is it a hfill?
if (!row_ptr->par()->isHfill(pos))
void LyXText::prepareToPrint(BufferView * bview,
- Row * row, float & x,
- float & fill_separator,
- float & fill_hfill,
- float & fill_label_hfill,
- bool bidi) const
+ Row * row, float & x,
+ float & fill_separator,
+ float & fill_hfill,
+ float & fill_label_hfill,
+ bool bidi) const
{
float nlh;
float ns;
// are there any hfills in the row?
float const nh = numberOfHfills(bview->buffer(), row);
- if (nh)
- fill_hfill = w / nh;
- else {
+ if (nh) {
+ if (w > 0)
+ fill_hfill = w / nh;
+ } else {
// is it block, flushleft or flushright?
// set x how you need it
- int align;
- if (row->par()->params().align() == LYX_ALIGN_LAYOUT)
- align = textclasslist.Style(bview->buffer()->params.textclass, row->par()->getLayout()).align;
- else
- align = row->par()->params().align();
-
- // center displayed insets
- Inset * inset;
- if (row->par()->getChar(row->pos()) == Paragraph::META_INSET
- && (inset=row->par()->getInset(row->pos()))
- && (inset->display())) // || (inset->scroll() < 0)))
- align = (inset->lyxCode() == Inset::MATHMACRO_CODE)
- ? LYX_ALIGN_BLOCK : LYX_ALIGN_CENTER;
-
- switch (align) {
+ int align;
+ if (row->par()->params().align() == LYX_ALIGN_LAYOUT) {
+ align = textclasslist.Style(bview->buffer()->params.textclass, row->par()->getLayout()).align;
+ } else {
+ align = row->par()->params().align();
+ }
+
+ // center displayed insets
+ Inset * inset;
+ if (row->par()->getChar(row->pos()) == Paragraph::META_INSET
+ && (inset=row->par()->getInset(row->pos()))
+ && (inset->display())) // || (inset->scroll() < 0)))
+ align = (inset->lyxCode() == Inset::MATHMACRO_CODE)
+ ? LYX_ALIGN_BLOCK : LYX_ALIGN_CENTER;
+
+ switch (align) {
case LYX_ALIGN_BLOCK:
- ns = numberOfSeparators(bview->buffer(), row);
- if (ns && row->next() && row->next()->par() == row->par() &&
- !(row->next()->par()->isNewline(row->next()->pos() - 1))
- && !(row->next()->par()->getChar(row->next()->pos()) == Paragraph::META_INSET
- && row->next()->par()->getInset(row->next()->pos())
- && row->next()->par()->getInset(row->next()->pos())->display())
- )
- fill_separator = w / ns;
- else if (is_rtl)
- x += w;
- break;
+ ns = numberOfSeparators(bview->buffer(), row);
+ if (ns && row->next() && row->next()->par() == row->par() &&
+ !(row->next()->par()->isNewline(row->next()->pos() - 1))
+ && !(row->next()->par()->getChar(row->next()->pos()) == Paragraph::META_INSET
+ && row->next()->par()->getInset(row->next()->pos())
+ && row->next()->par()->getInset(row->next()->pos())->display())
+ )
+ {
+ fill_separator = w / ns;
+ } else if (is_rtl) {
+ x += w;
+ }
+ break;
case LYX_ALIGN_RIGHT:
- x += w;
- break;
+ x += w;
+ break;
case LYX_ALIGN_CENTER:
- x += w / 2;
- break;
- }
+ x += w / 2;
+ break;
+ }
}
if (!bidi)
return;
// This function is only used by the spellchecker for NextWord().
// It doesn't handle LYX_ACCENTs and probably never will.
string const LyXText::selectNextWord(BufferView * bview,
- float & value) const
+ float & value) const
{
if (the_locking_inset) {
string str = the_locking_inset->selectNextWord(bview, value);