diff --git a/development/FORMAT b/development/FORMAT index 83b73a1446..80d6ab374b 100644 --- a/development/FORMAT +++ b/development/FORMAT @@ -11,6 +11,12 @@ adjustments are made to tex2lyx and bugs are fixed in lyx2lyx. ----------------------- + +2012-09-24 Jürgen Spitzmüller + * Format incremented to 443: basic support for unicode-math: + Empty file format change (in case it turns out we need to + do something). + 2012-09-23 Jürgen Spitzmüller * Format incremented to 442: support for the newtxmath fonts: - \usepackage{newtxmath} > \font_math newtxmath diff --git a/lib/chkconfig.ltx b/lib/chkconfig.ltx index 1b82164a73..41ddde2c25 100644 --- a/lib/chkconfig.ltx +++ b/lib/chkconfig.ltx @@ -336,6 +336,7 @@ \TestPackage[turkmen.ldf]{turkmen} \TestPackage{ulem} \TestPackage{undertilde} +\TestPackage{unicode-math} \TestPackage{units} \TestPackage{url} \TestPackage{varioref} diff --git a/lib/lyx2lyx/lyx_2_1.py b/lib/lyx2lyx/lyx_2_1.py index acb36d5a35..fb836ab306 100644 --- a/lib/lyx2lyx/lyx_2_1.py +++ b/lib/lyx2lyx/lyx_2_1.py @@ -1134,10 +1134,12 @@ convert = [ [439, []], [440, []], [441, [convert_mdnomath]], - [442, []] + [442, []], + [443, []] ] revert = [ + [442, []], [441, [revert_newtxmath]], [440, [revert_mdnomath]], [439, [revert_mathfonts]], diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp index c53d0ec921..c99b467282 100644 --- a/src/BufferParams.cpp +++ b/src/BufferParams.cpp @@ -1419,8 +1419,13 @@ bool BufferParams::writeLaTeX(otexstream & os, LaTeXFeatures & features, if (useNonTeXFonts && !ams.empty()) os << from_ascii(ams); - if (useNonTeXFonts) + if (useNonTeXFonts) { os << "\\usepackage{fontspec}\n"; + if (fonts_math != "auto" && features.isAvailable("unicode-math")) { + features.require("unicode-math"); + os << "\\usepackage{unicode-math}\n"; + } + } // font selection must be done before loading fontenc.sty string const fonts = loadFonts(features); diff --git a/src/Encoding.cpp b/src/Encoding.cpp index b758787e28..6447e33eec 100644 --- a/src/Encoding.cpp +++ b/src/Encoding.cpp @@ -698,7 +698,9 @@ void Encodings::validate(char_type c, LaTeXFeatures & features, bool for_mathed) (!for_mathed && !it->second.textcommand.empty()); bool const plain_utf8 = (features.runparams().encoding->name() == "utf8-plain"); // with utf8-plain, we only load packages when in mathed (see #7766) - if (math_mode || (use_math && !plain_utf8)) { + // and if we do not use unicode-math + if ((math_mode && !features.isRequired("unicode-math")) + || (use_math && !plain_utf8)) { if (!it->second.mathpreamble.empty()) { if (it->second.mathfeature()) { string feats = it->second.mathpreamble; diff --git a/src/frontends/qt4/GuiDocument.cpp b/src/frontends/qt4/GuiDocument.cpp index 6802f6f1ae..b461aa6910 100644 --- a/src/frontends/qt4/GuiDocument.cpp +++ b/src/frontends/qt4/GuiDocument.cpp @@ -1778,8 +1778,6 @@ void GuiDocument::osFontsChanged(bool nontexfonts) fontModule->fontencLA->setEnabled(tex_fonts); fontModule->fontencCO->setEnabled(tex_fonts); - fontModule->fontsMathCO->setEnabled(tex_fonts); - fontModule->fontsMathLA->setEnabled(tex_fonts); if (!tex_fonts) fontModule->fontencLE->setEnabled(false); else @@ -1902,6 +1900,11 @@ void GuiDocument::updateFontlist() fontModule->fontsRomanCO->addItem(qt_("Default"), QString("default")); fontModule->fontsSansCO->addItem(qt_("Default"), QString("default")); fontModule->fontsTypewriterCO->addItem(qt_("Default"), QString("default")); + QString unimath = qt_("Non-TeX Fonts Default"); + if (!LaTeXFeatures::isAvailable("unicode-math")) + unimath += qt_(" (not available)"); + fontModule->fontsMathCO->addItem(qt_("Class Default (TeX Fonts)"), QString("auto")); + fontModule->fontsMathCO->addItem(unimath, QString("default")); QFontDatabase fontdb; QStringList families(fontdb.families()); @@ -3203,14 +3206,10 @@ void GuiDocument::paramsToDialog() fontModule->fontencLA->setEnabled(false); fontModule->fontencCO->setEnabled(false); fontModule->fontencLE->setEnabled(false); - fontModule->fontsMathCO->setEnabled(false); - fontModule->fontsMathLA->setEnabled(false); } else { fontModule->fontencLA->setEnabled(true); fontModule->fontencCO->setEnabled(true); fontModule->fontencLE->setEnabled(true); - fontModule->fontsMathCO->setEnabled(true); - fontModule->fontsMathLA->setEnabled(true); romanChanged(rpos); sansChanged(spos); ttChanged(tpos); diff --git a/src/version.h b/src/version.h index f3252ef2d2..99f411a1d9 100644 --- a/src/version.h +++ b/src/version.h @@ -30,8 +30,8 @@ extern char const * const lyx_version_info; // Do not remove the comment below, so we get merge conflict in // independent branches. Instead add your own. -#define LYX_FORMAT_LYX 442 // spitz: support for newtxmath -#define LYX_FORMAT_TEX2LYX 442 // spitz: support for newtxmath +#define LYX_FORMAT_LYX 443 // spitz: basic support for unicode-math +#define LYX_FORMAT_TEX2LYX 443 // spitz: basic support for unicode-math #if LYX_FORMAT_TEX2LYX != LYX_FORMAT_LYX #ifndef _MSC_VER