From: Jürgen Spitzmüller Date: Tue, 1 Feb 2011 14:00:23 +0000 (+0000) Subject: * BufferParams.{cpp,h}: X-Git-Tag: 2.0.0~945 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=a37190ee62f0cc2152fe271bd7fa668c1e20e9b3;p=features.git * BufferParams.{cpp,h}: - go back to Maping=tex-text for XeTeX and use Ligatures=TeX only for LuaTeX. This gets users of older distributions (such as TeXLive 2009) back into the XeTeX game. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37402 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp index 42eebeaba0..3ecf73184c 100644 --- a/src/BufferParams.cpp +++ b/src/BufferParams.cpp @@ -1367,9 +1367,10 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features, // font selection must be done before loading fontenc.sty string const fonts = - loadFonts(fonts_roman, fonts_sans, - fonts_typewriter, fonts_expert_sc, fonts_old_figures, - fonts_sans_scale, fonts_typewriter_scale, useNonTeXFonts); + loadFonts(fonts_roman, fonts_sans, fonts_typewriter, + fonts_expert_sc, fonts_old_figures, + fonts_sans_scale, fonts_typewriter_scale, + useNonTeXFonts, features); if (!fonts.empty()) { os << from_ascii(fonts); nlines = @@ -2583,7 +2584,8 @@ string const BufferParams::loadFonts(string const & rm, string const & sf, string const & tt, bool const & sc, bool const & osf, int const & sfscale, int const & ttscale, - bool const & use_systemfonts) const + bool const & use_systemfonts, + LaTeXFeatures & features) const { /* The LaTeX font world is in a flux. In the PSNFSS font interface, several packages have been replaced by others, that might not @@ -2604,9 +2606,9 @@ string const BufferParams::loadFonts(string const & rm, ostringstream os; /* Fontspec (XeTeX, LuaTeX): we provide GUI support for oldstyle - * numbers (Numbers=OldStyle) and sf/tt scaling. The Ligatures=TeX - * option assures TeX ligatures (such as "--") are resolved. - * Note that tt does not use these ligatures. + * numbers (Numbers=OldStyle) and sf/tt scaling. The Ligatures=TeX/ + * Mapping=tex-text option assures TeX ligatures (such as "--") + * are resolved. Note that tt does not use these ligatures. * TODO: * -- add more GUI options? * -- add more fonts (fonts for other scripts) @@ -2614,8 +2616,19 @@ string const BufferParams::loadFonts(string const & rm, * OldStyle, enable/disable the widget accordingly. */ if (use_systemfonts) { + // "Mapping=tex-text" and "Ligatures=TeX" are equivalent. + // However, until v.2 (2010/07/11) fontspec only knew + // Mapping=tex-text (for XeTeX only); then "Ligatures=TeX" + // was introduced for both XeTeX and LuaTeX (LuaTeX + // didn't understand "Mapping=tex-text", while XeTeX + // understood both. With most recent versions, both + // variants are understood by both engines. However, + // we want to provide support for at least TeXLive 2009. + string const texmapping = + (features.runparams().flavor == OutputParams::XETEX) ? + "Mapping=tex-text" : "Ligatures=TeX"; if (rm != "default") { - os << "\\setmainfont[Ligatures=TeX"; + os << "\\setmainfont[" << texmapping; if (osf) os << ",Numbers=OldStyle"; os << "]{" << parseFontName(rm) << "}\n"; @@ -2625,10 +2638,10 @@ string const BufferParams::loadFonts(string const & rm, if (sfscale != 100) os << "\\setsansfont[Scale=" << float(sfscale) / 100 - << ",Ligatures=TeX]{" + << "," << texmapping << "]{" << sans << "}\n"; else - os << "\\setsansfont[Ligatures=TeX]{" + os << "\\setsansfont[" << texmapping << "]{" << sans << "}\n"; } if (tt != "default") { diff --git a/src/BufferParams.h b/src/BufferParams.h index e5a443cb81..2606e6fc31 100644 --- a/src/BufferParams.h +++ b/src/BufferParams.h @@ -374,7 +374,8 @@ public: std::string const & sf, std::string const & tt, bool const & sc, bool const & osf, int const & sfscale, int const & ttscale, - bool const & use_nonlatexfonts) const; + bool const & use_nonlatexfonts, + LaTeXFeatures & features) const; /// get the appropriate cite engine (natbib handling) CiteEngine citeEngine() const;