- setCurrentFont(cur);
-}
-
-
-void Text::setCurrentFont(Cursor & cur)
-{
- BOOST_ASSERT(this == cur.text());
- pos_type pos = cur.pos();
- Paragraph & par = cur.paragraph();
-
- // are we behind previous char in fact? -> go to that char
- if (pos > 0 && cur.boundary())
- --pos;
-
- // find position to take the font from
- if (pos != 0) {
- // paragraph end? -> font of last char
- if (pos == cur.lastpos())
- --pos;
- // on space? -> look at the words in front of space
- else if (pos > 0 && par.isSeparator(pos)) {
- // abc| def -> font of c
- // abc |[WERBEH], i.e. boundary==true -> font of c
- // abc [WERBEH]| def, font of the space
- if (!isRTLBoundary(cur.buffer(), par, pos))
- --pos;
- }
- }
-
- // get font
- BufferParams const & bufparams = cur.buffer().params();
- current_font = par.getFontSettings(bufparams, pos);
- real_current_font = getFont(cur.buffer(), par, pos);
-
- // special case for paragraph end
- if (cur.pos() == cur.lastpos()
- && isRTLBoundary(cur.buffer(), par, cur.pos())
- && !cur.boundary()) {
- Language const * lang = par.getParLanguage(bufparams);
- current_font.setLanguage(lang);
- current_font.setNumber(Font::OFF);
- real_current_font.setLanguage(lang);
- real_current_font.setNumber(Font::OFF);
- }