mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-10 20:04:46 +00:00
Introducing FontList::hasChangeInRange()
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21067 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
db997edc21
commit
65b3790153
@ -211,4 +211,20 @@ Font_size FontList::highestInRange
|
||||
return maxsize;
|
||||
}
|
||||
|
||||
|
||||
bool FontList::hasChangeInRange(pos_type pos, int len) const
|
||||
{
|
||||
// FIXME: can't we use fontIterator(pos) instead?
|
||||
const_iterator cit = list_.begin();
|
||||
const_iterator end = list_.end();
|
||||
for (; cit != end; ++cit) {
|
||||
if (cit->pos() >= pos)
|
||||
break;
|
||||
}
|
||||
if (cit != end && pos + len - 1 > cit->pos())
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace lyx
|
||||
|
@ -103,6 +103,12 @@ public:
|
||||
Font_size def_size
|
||||
) const;
|
||||
|
||||
/// is there a font change in middle of the word?
|
||||
bool hasChangeInRange(
|
||||
pos_type pos, ///< position in the paragraph.
|
||||
int len ///< length of the range to check.
|
||||
) const;
|
||||
|
||||
private:
|
||||
///
|
||||
List list_;
|
||||
|
@ -600,17 +600,7 @@ bool Paragraph::Private::isTextAt(string const & str, pos_type pos) const
|
||||
return false;
|
||||
}
|
||||
|
||||
// is there a font change in middle of the word?
|
||||
FontList::const_iterator cit = fontlist_.begin();
|
||||
FontList::const_iterator end = fontlist_.end();
|
||||
for (; cit != end; ++cit) {
|
||||
if (cit->pos() >= pos)
|
||||
break;
|
||||
}
|
||||
if (cit != end && pos + len - 1 > cit->pos())
|
||||
return false;
|
||||
|
||||
return true;
|
||||
return fontlist_.hasChangeInRange(pos, len);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user