size_t const phrases_nr = sizeof(special_phrases)/sizeof(special_phrase);
+
+bool isEncoding(BufferParams const & bparams, LyXFont const & font,
+ string const & encoding)
+{
+ return (bparams.inputenc == encoding
+ || (bparams.inputenc == "auto"
+ && font.language()->encoding()->latexName() == encoding));
+}
+
} // namespace anon
}
+bool Paragraph::Pimpl::isMergedOnEndOfParDeletion(bool trackChanges) const {
+ // keep the logic here in sync with the logic of eraseChars()
+
+ if (!trackChanges) {
+ return true;
+ }
+
+ Change change = changes_.lookup(size());
+
+ return change.type == Change::INSERTED && change.author == 0;
+}
+
+
void Paragraph::Pimpl::setChange(Change const & change)
{
// beware of the imaginary end-of-par character!
{
BOOST_ASSERT(start >= 0 && start <= size());
BOOST_ASSERT(end > start && end <= size() + 1);
-
+
for (pos_type pos = start; pos < end; ++pos) {
switch (lookupChange(pos).type) {
case Change::UNCHANGED:
+ // accept changes in nested inset
+ if (pos < size() && owner_->isInset(pos)) {
+ owner_->getInset(pos)->acceptChanges();
+ }
+
break;
case Change::INSERTED:
changes_.set(Change(Change::UNCHANGED), pos);
+ // also accept changes in nested inset
+ if (pos < size() && owner_->isInset(pos)) {
+ owner_->getInset(pos)->acceptChanges();
+ }
break;
case Change::DELETED:
break;
}
- // also accept changes in nested insets
- if (pos < size() && owner_->isInset(pos)) {
- owner_->getInset(pos)->acceptChanges();
- }
}
}
for (pos_type pos = start; pos < end; ++pos) {
switch (lookupChange(pos).type) {
case Change::UNCHANGED:
- // also reject changes inside of insets
+ // reject changes in nested inset
if (pos < size() && owner_->isInset(pos)) {
owner_->getInset(pos)->rejectChanges();
}
{
BOOST_ASSERT(pos >= 0 && pos <= size());
+ // keep the logic here in sync with the logic of isMergedOnEndOfParDeletion()
+
if (trackChanges) {
Change change = changes_.lookup(pos);
case 0xb9: // ¹ SUPERSCRIPT ONE
case 0xac: // ¬ NOT SIGN
case 0xb5: // µ MICRO SIGN
- if ((bparams.inputenc == "latin1" ||
- bparams.inputenc == "latin9") ||
- (bparams.inputenc == "auto" &&
- (font.language()->encoding()->latexName()
- == "latin1" ||
- font.language()->encoding()->latexName()
- == "latin9"))) {
+ if (isEncoding(bparams, font, "latin1")
+ || isEncoding(bparams, font, "latin9")) {
os << "\\ensuremath{";
os.put(c);
os << '}';
}
break;
+ case 0x20ac: // EURO SIGN
+ if (isEncoding(bparams, font, "latin9")
+ || isEncoding(bparams, font, "cp1251")
+ || isEncoding(bparams, font, "utf8")
+ || isEncoding(bparams, font, "latin10")
+ || isEncoding(bparams, font, "cp858")) {
+ os.put(c);
+ } else {
+ os << "\\texteuro{}";
+ column += 10;
+ }
+ break;
+
+ // These characters are covered by latin1, but not
+ // by latin9 (a.o.). We have to support them because
+ // we switched the default of latin1-languages to latin9
+ case 0xa4: // CURRENCY SYMBOL
+ case 0xa6: // BROKEN BAR
+ case 0xa8: // DIAERESIS
+ case 0xb4: // ACUTE ACCENT
+ case 0xb8: // CEDILLA
+ case 0xbd: // 1/2 FRACTION
+ case 0xbc: // 1/4 FRACTION
+ case 0xbe: // 3/4 FRACTION
+ if (isEncoding(bparams, font, "latin1")
+ || isEncoding(bparams, font, "latin5")
+ || isEncoding(bparams, font, "utf8")) {
+ os.put(c);
+ break;
+ } else {
+ switch (c) {
+ case 0xa4:
+ os << "\\textcurrency{}";
+ column += 15;
+ break;
+ case 0xa6:
+ os << "\\textbrokenbar{}";
+ column += 16;
+ break;
+ case 0xa8:
+ os << "\\textasciidieresis{}";
+ column += 20;
+ break;
+ case 0xb4:
+ os << "\\textasciiacute{}";
+ column += 17;
+ break;
+ case 0xb8: // from latin1.def:
+ os << "\\c\\ ";
+ column += 3;
+ break;
+ case 0xbd:
+ os << "\\textonehalf{}";
+ column += 14;
+ break;
+ case 0xbc:
+ os << "\\textonequarter{}";
+ column += 17;
+ break;
+ case 0xbe:
+ os << "\\textthreequarters{}";
+ column += 20;
+ break;
+ }
+ break;
+ }
+
case '$': case '&':
case '%': case '#': case '{':
case '}': case '_':
<< endl;
features.require("noun");
lyxerr[Debug::LATEX] << "Noun enabled. Font: "
- << fcit->font().stateText(0)
+ << to_utf8(fcit->font().stateText(0))
<< endl;
}
switch (fcit->font().color()) {
default:
features.require("color");
lyxerr[Debug::LATEX] << "Color enabled. Font: "
- << fcit->font().stateText(0)
+ << to_utf8(fcit->font().stateText(0))
<< endl;
}
break;
}
}
+ // these glyphs require the textcomp package
+ if (getChar(i) == 0x20ac || getChar(i) == 0xa4
+ || getChar(i) == 0xa6 || getChar(i) == 0xa8
+ || getChar(i) == 0xb4 || getChar(i) == 0xbd
+ || getChar(i) == 0xbc || getChar(i) == 0xbe)
+ features.require("textcomp");
}
}