Layout const & style);
/// Output consecutive unicode chars, belonging to the same script as
- /// specified by the latex macro \p ltx, to \p os starting from \p c.
+ /// specified by the latex macro \p ltx, to \p os starting from \p i.
/// \return the number of characters written.
- int writeScriptChars(odocstream & os, char_type c, docstring const & ltx,
- Change &, Encoding const &, pos_type &);
+ int writeScriptChars(odocstream & os, docstring const & ltx,
+ Change &, Encoding const &, pos_type & i);
/// This could go to ParagraphParameters if we want to.
int startTeXParParams(BufferParams const &, odocstream &, TexRow &,
// This is actually very common when parsing buffers (and
// maybe inserting ascii text)
- if (pos == text_.size()) {
+ if (pos == pos_type(text_.size())) {
// when appending characters, no need to update tables
text_.push_back(c);
return;
int Paragraph::Private::writeScriptChars(odocstream & os,
- char_type c,
docstring const & ltx,
Change & runningChange,
Encoding const & encoding,
pos_type & i)
{
- // We only arrive here when a proper language for character c has not
- // been specified (i.e., it could not be translated in the current
+ // FIXME: modifying i here is not very nice...
+
+ // We only arrive here when a proper language for character text_[i] has
+ // not been specified (i.e., it could not be translated in the current
// latex encoding) and it belongs to a known script.
- // Parameter ltx contains the latex translation of c as specified in
+ // Parameter ltx contains the latex translation of text_[i] as specified in
// the unicodesymbols file and is something like "\textXXX{<spec>}".
- // The latex macro name "textXXX" specifies the script to which c
+ // The latex macro name "textXXX" specifies the script to which text_[i]
// belongs and we use it in order to check whether characters from the
// same script immediately follow, such that we can collect them in a
// single "\textXXX" macro. So, we have to retain "\textXXX{<spec>"
docstring const latex = encoding.latexChar(c);
if (Encodings::isKnownScriptChar(c, script)
&& prefixIs(latex, from_ascii("\\" + script)))
- column += writeScriptChars(os, c, latex,
+ column += writeScriptChars(os, latex,
running_change, encoding, i) - 1;
else if (latex.length() > 1 && latex[latex.length() - 1] != '}') {
// Prevent eating of a following
void Paragraph::appendString(docstring const & s, Font const & font,
Change const & change)
{
- size_t end = s.size();
+ pos_type end = s.size();
size_t oldsize = d->text_.size();
size_t newsize = oldsize + end;
size_t capacity = d->text_.capacity();
// track change
d->changes_.insert(change, i);
}
- d->fontlist_.setRange(oldsize, newsize, font);
+ d->fontlist_.set(oldsize, font);
+ d->fontlist_.set(newsize - 1, font);
}
void Paragraph::resetFonts(Font const & font)
{
- d->fontlist_.setRange(0, d->text_.size(), font);
+ d->fontlist_.clear();
+ d->fontlist_.set(0, font);
+ d->fontlist_.set(d->text_.size() - 1, font);
}
// Gets uninstantiated font setting at position.