using namespace std;
using namespace lyx::support;
-// gcc < 4.8.0 and msvc < 2015 do not support C++11 thread_local
-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 8
+// OSX clang, gcc < 4.8.0, and msvc < 2015 do not support C++11 thread_local
+#if defined(__APPLE__) || (defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 8)
#define THREAD_LOCAL_STATIC static __thread
#elif defined(_MSC_VER) && (_MSC_VER < 1900)
#define THREAD_LOCAL_STATIC static __declspec(thread)
/// Inset identifier (above 0x10ffff, for ucs-4)
char_type const META_INSET = 0x200001;
-}
+} // namespace
/////////////////////////////////////////////////////////////////////
typedef SkipPositions::const_iterator SkipPositionsIterator;
void appendSkipPosition(SkipPositions & skips, pos_type const pos) const;
-
+
Language * getSpellLanguage(pos_type const from) const;
Language * locateSpellRange(pos_type & from, pos_type & to,
}
bool ignoreWord(docstring const & word) const ;
-
+
void setMisspelled(pos_type from, pos_type to, SpellChecker::Result state)
{
pos_type textsize = owner_->size();
}
break;
case '\"':
- os << "\\char34" << termcmd;
- column += 9;
+ os << "\\textquotedbl" << termcmd;
+ column += 14;
break;
case '$': case '&':
case 0x2013:
case 0x2014:
- if (bparams.use_dash_ligatures && !bparams.useNonTeXFonts) {
+ // XeTeX's dash behaviour is determined via a global setting
+ if (bparams.use_dash_ligatures
+ && owner_->getFontSettings(bparams, i).fontInfo().family() != TYPEWRITER_FAMILY
+ && (!bparams.useNonTeXFonts || runparams.flavor != OutputParams::XETEX)) {
if (c == 0x2013) {
// en-dash
os << "--";
os << "\\textvertline" << termcmd;
column += 14;
return true;
+ case 0x2013:
+ os << "\\textendash" << termcmd;
+ column += 12;
+ return true;
+ case 0x2014:
+ os << "\\textemdash" << termcmd;
+ column += 12;
+ return true;
default:
return false;
}
void Paragraph::Private::validate(LaTeXFeatures & features) const
{
+ Buffer const & buf = inset_owner_->buffer();
+ BufferParams const & bp = features.runparams().is_child
+ ? buf.masterParams() : buf.params();
if (layout_->inpreamble && inset_owner_) {
bool const is_command = layout_->latextype == LATEX_COMMAND;
- Buffer const & buf = inset_owner_->buffer();
- BufferParams const & bp = features.runparams().is_child
- ? buf.masterParams() : buf.params();
Font f;
// Using a string stream here circumvents the encoding
// switching machinery of odocstream. Therefore the
for (; icit != iend; ++icit) {
if (icit->inset) {
features.inDeletedInset(owner_->isDeleted(icit->pos));
+ if (icit->inset->lyxCode() == FOOT_CODE) {
+ // FIXME: an item inset would make things much easier.
+ if ((layout_->latextype == LATEX_LIST_ENVIRONMENT
+ || (layout_->latextype == LATEX_ITEM_ENVIRONMENT
+ && layout_->margintype == MARGIN_FIRST_DYNAMIC))
+ && (icit->pos < begin_of_body_
+ || (icit->pos == begin_of_body_
+ && (icit->pos == 0 || text_[icit->pos - 1] != ' '))))
+ features.saveNoteEnv("description");
+ }
icit->inset->validate(features);
features.inDeletedInset(false);
if (layout_->needprotect &&
// then the contents
for (pos_type i = 0; i < int(text_.size()) ; ++i) {
- BufferEncodings::validate(text_[i], features);
+ char_type c = text_[i];
+ if (c == 0x0022) {
+ if (features.runparams().isFullUnicode() && bp.useNonTeXFonts)
+ features.require("textquotedblp");
+ else if (bp.main_font_encoding() != "T1"
+ || ((&owner_->getFontSettings(bp, i))->language()->internalFontEncoding()))
+ features.require("textquotedbl");
+ }
+ if (!bp.use_dash_ligatures
+ && (c == 0x2013 || c == 0x2014)
+ && bp.useNonTeXFonts
+ && features.runparams().flavor == OutputParams::XETEX)
+ // XeTeX's dash behaviour is determined via a global setting
+ features.require("xetexdashbreakstate");
+ BufferEncodings::validate(c, features);
}
}
s.erase();
}
-}
+} // namespace
void Paragraph::write(ostream & os, BufferParams const & bparams,
return true;
}
-} // namespace anon
+} // namespace
int Paragraph::Private::startTeXParParams(BufferParams const & bparams,
runparams.wasDisplayMath = runparams.inDisplayMath;
runparams.inDisplayMath = false;
bool deleted_display_math = false;
+ Change const & change = runparams.inDeletedInset
+ ? runparams.changeOfDeletedInset : lookupChange(i);
// Check whether a display math inset follows
if (d->text_[i] == META_INSET
// cannot set it here because it is a counter.
deleted_display_math = isDeleted(i);
}
+ if (bparams.output_changes && deleted_display_math
+ && runningChange == change
+ && change.type == Change::DELETED
+ && !os.afterParbreak()) {
+ // A display math in the same paragraph follows.
+ // We have to close and then reopen \lyxdeleted,
+ // otherwise the math will be shifted up.
+ OutputParams rp = runparams;
+ if (open_font) {
+ bool needPar = false;
+ column += running_font.latexWriteEndChanges(
+ os, bparams, rp, basefont,
+ basefont, needPar);
+ open_font = false;
+ }
+ basefont = getLayoutFont(bparams, outerfont);
+ running_font = basefont;
+ column += Changes::latexMarkChange(os, bparams,
+ Change(Change::INSERTED), change, rp);
+ }
}
- Change const & change = runparams.inDeletedInset
- ? runparams.changeOfDeletedInset : lookupChange(i);
-
if (bparams.output_changes && runningChange != change) {
if (open_font) {
bool needPar = false;
bool const using_begin_end = runparams.use_polyglossia ||
!lang_end_command.empty();
if (!running_lang.empty() &&
+ (!using_begin_end || running_lang == openLanguageName()) &&
current_font.language()->encoding()->package() == Encoding::CJK) {
string end_tag = subst(lang_end_command,
"$$lang",
char_type const c = d->text_[i];
// A display math inset inside an ulem command will be output
- // as a box of width \columnwidth, so we have to either disable
+ // as a box of width \linewidth, so we have to either disable
// indentation if the inset starts a paragraph, or start a new
// line to accommodate such box. This has to be done before
// writing any font changing commands.
flag = false;
}
}
-}
+} // namespace
docstring Paragraph::simpleLyXHTMLOnePar(Buffer const & buf,
FontShape curr_fs = INHERIT_SHAPE;
FontFamily curr_fam = INHERIT_FAMILY;
FontSize curr_size = FONT_SIZE_INHERIT;
-
- string const default_family =
- buf.masterBuffer()->params().fonts_default_family;
+
+ string const default_family =
+ buf.masterBuffer()->params().fonts_default_family;
vector<html::FontTag> tagsToOpen;
vector<html::EndFontTag> tagsToClose;
-
+
// parsing main loop
for (pos_type i = initial; i < size(); ++i) {
// let's not show deleted material in the output
curstate = font.fontInfo().underbar();
if (font_old.underbar() != curstate)
doFontSwitch(tagsToOpen, tagsToClose, ubar_flag, curstate, html::FT_UBAR);
-
+
// strikeout
curstate = font.fontInfo().strikeout();
if (font_old.strikeout() != curstate)
InsetCommandParams(BIBITEM_CODE));
Font font(inherit_font, buffer.params().language);
- insertInset(0, inset, font, Change(track_changes ? Change::INSERTED
+ insertInset(0, inset, font, Change(track_changes ? Change::INSERTED
: Change::UNCHANGED));
return 1;
}
-void Paragraph::setBuffer(Buffer & b)
+void Paragraph::setInsetBuffers(Buffer & b)
{
d->insetlist_.setBuffer(b);
}
to = from;
return;
}
- // no break here, we go to the next
+ // fall through
case WHOLE_WORD:
// If we are already at the beginning of a word, do nothing
if (!from || isWordSeparator(from - 1))
break;
- // no break here, we go to the next
+ // fall through
case PREVIOUS_WORD:
// always move the cursor to the beginning of previous word