2001-07-31 Juergen Vigna <jug@sad.it>
+ * text.C (setHeightOfRow): fixed setting of ascent/descent based on
+ the font (wrong since using of Paragraph::highestFontInRange).
+
+ * paragraph.C (highestFontInRange): added a default_size parameter.
+
* text.C (getVisibleRow): minor clear row changes (still not perfect).
(setHeightOfRow): reformat
/// Returns the height of the highest font in range
LyXFont::FONT_SIZE
Paragraph::highestFontInRange(Paragraph::size_type startpos,
- Paragraph::size_type endpos) const
+ Paragraph::size_type endpos,
+ LyXFont::FONT_SIZE const def_size) const
{
- LyXFont::FONT_SIZE maxsize = LyXFont::SIZE_TINY;
if (pimpl_->fontlist.empty())
- return maxsize;
+ return def_size;
+ LyXFont::FONT_SIZE maxsize = LyXFont::SIZE_TINY;
Pimpl::FontTable end_search(endpos, LyXFont());
Pimpl::FontList::const_iterator end_it =
lower_bound(pimpl_->fontlist.begin(),
cit != end_it; ++cit)
{
LyXFont::FONT_SIZE size = cit->font().size();
+ if (size == LyXFont::INHERIT_SIZE)
+ size = def_size;
if (size > maxsize && size <= LyXFont::SIZE_HUGER)
maxsize = size;
}
void setFont(size_type pos, LyXFont const & font);
/// Returns the height of the highest font in range
LyXFont::FONT_SIZE highestFontInRange(size_type startpos,
- size_type endpos) const;
+ size_type endpos,
+ LyXFont::FONT_SIZE const def_size) const;
///
void insertChar(size_type pos, value_type c);
///
LyXLayout const & layout = textclasslist.Style(bview->buffer()->params.textclass,
firstpar->getLayout());
- LyXFont font = getFont(bview->buffer(), par, par->size() - 1);
- LyXFont::FONT_SIZE const size = font.size();
+ // as max get the first character of this row then it can increes but not
+ // decrees the height. Just some point to start with so we don't have to
+ // do the assignment below too often.
+ LyXFont font = getFont(bview->buffer(), par, row_ptr->pos());
+ LyXFont::FONT_SIZE const tmpsize = font.size();
font = getFont(bview->buffer(), par, -1);
- font.setSize(size);
+ LyXFont::FONT_SIZE const size = font.size();
+ font.setSize(tmpsize);
LyXFont labelfont = getFont(bview->buffer(), par, -2);
// Check if any custom fonts are larger (Asger)
// This is not completely correct, but we can live with the small,
// cosmetic error for now.
- LyXFont::FONT_SIZE const maxsize =
- row_ptr->par()->highestFontInRange(row_ptr->pos(), pos_end);
+ LyXFont::FONT_SIZE maxsize =
+ row_ptr->par()->highestFontInRange(row_ptr->pos(), pos_end, size);
if (maxsize > font.size()) {
font.setSize(maxsize);