// Is this correct WRT change tracking?
docstring const latex1 = encoding.latexChar(next);
docstring const latex2 = encoding.latexChar(c);
- os << latex1 << '{' << latex2 << '}';
+ if (docstring(1, next) == latex1) {
+ // the encoding supports the combination
+ os << latex2 << latex1;
+ return latex1.length() + latex2.length();
+ } else
+ os << latex1 << '{' << latex2 << '}';
return latex1.length() + latex2.length() + 2;
}
}
if (runparams.verbatim) {
+ // FIXME UNICODE: This can fail if c cannot
+ // be encoded in the current encoding.
os.put(c);
return;
}
break;
default:
-
// LyX, LaTeX etc.
if (latexSpecialPhrase(os, i, column, runparams))
return;
// but we should avoid ligatures
if (i + 1 >= int(text_.size()) || text_[i + 1] != c)
return true;
- os << "\\,{}";
- column += 3;
- // Alternative code:
- //os << "\\textcompwordmark{}";
- //column += 19;
+ os << "\\textcompwordmark{}";
+ column += 19;
return true;
case '|':
os.put(c);
{
switch (c) {
case '-':
+ // within \ttfamily, "--" is merged to "-" (no endash)
+ // so we avoid this rather irritating ligature
if (i + 1 < int(text_.size()) && text_[i + 1] == '-') {
- // "--" in Typewriter mode -> "-{}-"
os << "-{}";
column += 2;
} else
os << '-';
return true;
- // I assume this is hack treating typewriter as verbatim
- // FIXME UNICODE: This can fail if c cannot be encoded
- // in the current encoding.
-
- case '\0':
- return true;
-
- // Those characters are not directly supported.
- case '\\':
- case '\"':
- case '$': case '&':
- case '%': case '#': case '{':
- case '}': case '_':
- case '~':
- case '^':
- case '*': case '[':
- case ' ':
- return false;
-
+ // everything else has to be checked separately
+ // (depending on the encoding)
default:
- // With Typewriter font, these characters exist.
- os.put(c);
- return true;
+ return false;
}
}
// Switch file encoding if necessary (and allowed)
if (!runparams.verbatim &&
- runparams.encoding->package() == Encoding::none &&
- font.language()->encoding()->package() == Encoding::none) {
+ runparams.encoding->package() != Encoding::none &&
+ font.language()->encoding()->package() != Encoding::none) {
pair<bool, int> const enc_switch = switchEncoding(os, bparams,
runparams, *(font.language()->encoding()));
if (enc_switch.first) {
}
}
- // Set the encoding to that returned from simpleTeXSpecialChars (see
+ // Set the encoding to that returned from latexSpecialChar (see
// comment for encoding member in OutputParams.h)
runparams.encoding = rp.encoding;
}
}
+bool Paragraph::isChar(pos_type pos) const
+{
+ if (Inset const * inset = getInset(pos))
+ return inset->isChar();
+ char_type const c = d->text_[pos];
+ return !isLetterChar(c) && !isDigit(c) && !lyx::isSpace(c);
+}
+
+
+bool Paragraph::isSpace(pos_type pos) const
+{
+ if (Inset const * inset = getInset(pos))
+ return inset->isSpace();
+ char_type const c = d->text_[pos];
+ return lyx::isSpace(c);
+}
+
+
Language const *
Paragraph::getParLanguage(BufferParams const & bparams) const
{
// There was no inset at the beginning, so we need to create one with
// the key and label of the one we erased.
- InsetBibitem * inset = new InsetBibitem(InsetCommandParams(BIBITEM_CODE));
- inset->setBuffer(const_cast<Buffer &>(buffer));
+ InsetBibitem * inset =
+ new InsetBibitem(buffer, InsetCommandParams(BIBITEM_CODE));
// restore values of previously deleted item in this par.
if (!oldkey.empty())
inset->setParam("key", oldkey);