}
-Color_color Text::backgroundColor() const
-{
- return Color_color(Color::color(background_color_));
-}
-
-
void Text::breakParagraph(Cursor & cur, bool keep_layout)
{
BOOST_ASSERT(this == cur.text());
recordUndo(cur, Undo::INSERT);
+ TextMetrics const & tm = cur.bv().textMetrics(this);
Buffer const & buffer = cur.buffer();
Paragraph & par = cur.paragraph();
// try to remove this
!(contains(number_seperators, c) &&
cur.pos() != 0 &&
cur.pos() != cur.lastpos() &&
- getFont(buffer, par, cur.pos()).number() == Font::ON &&
- getFont(buffer, par, cur.pos() - 1).number() == Font::ON)
+ tm.getDisplayFont(pit, cur.pos()).number() == Font::ON &&
+ tm.getDisplayFont(pit, cur.pos() - 1).number() == Font::ON)
)
number(cur); // Set current_font.number to OFF
} else if (isDigit(c) &&
|| par.isSeparator(cur.pos() - 2)
|| par.isNewline(cur.pos() - 2))
) {
- setCharFont(buffer, pit, cur.pos() - 1, cur.current_font);
+ setCharFont(buffer, pit, cur.pos() - 1, cur.current_font,
+ tm.font_);
} else if (contains(number_seperators, c)
&& cur.pos() >= 2
- && getFont(buffer, par, cur.pos() - 2).number() == Font::ON) {
- setCharFont(buffer, pit, cur.pos() - 1, cur.current_font);
+ && tm.getDisplayFont(pit, cur.pos() - 2).number() == Font::ON) {
+ setCharFont(buffer, pit, cur.pos() - 1, cur.current_font,
+ tm.font_);
}
}
}
if ((cur.pos() >= 2) && (par.isLineSeparator(cur.pos() - 1))) {
// get font in front and behind the space in question. But do NOT
// use getFont(cur.pos()) because the character c is not inserted yet
- Font const & pre_space_font = getFont(buffer, par, cur.pos() - 2);
+ Font const & pre_space_font = tm.getDisplayFont(cur.pit(), cur.pos() - 2);
Font const & post_space_font = cur.real_current_font;
bool pre_space_rtl = pre_space_font.isVisibleRightToLeft();
bool post_space_rtl = post_space_font.isVisibleRightToLeft();
// adjacent character whose direction is the paragraph's
// direction; don't touch other properties of the font
Language const * lang =
- (pre_space_rtl == par.isRightToLeftPar(buffer.params())) ?
+ (pre_space_rtl == par.isRTL(buffer.params())) ?
pre_space_font.language() : post_space_font.language();
- Font space_font = getFont(buffer, par, cur.pos() - 1);
+ Font space_font = tm.getDisplayFont(cur.pit(), cur.pos() - 1);
space_font.setLanguage(lang);
par.setFont(cur.pos() - 1, space_font);
}
b.getLanguage());
}
- pasteParagraphList(cur, plist, b.params().getTextClass_ptr(),
+ pasteParagraphList(cur, plist, b.params().getTextClassPtr(),
b.errorList("Paste"));
// restore position
cur.pit() = std::min(cur.lastpit(), spit);