mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-23 21:40:19 +00:00
Very basic support for unicode-math
With non-TeX fonts, you can select a 'Non-TeX Font Default' math font, which simply loads unicode-math without actually selecting a math font, this then uses the default math otf font, currently Latin Modern. Other fonts still need to be set manually in the preamble, via \setmathfont. The implementation suppresses unneeded package requests from unicodesymbols, but the output still uses macros instead of full unicode (both is possible with unicode-math). The whole thing is a proof of concept, and it needs to be tested. I have tested it with the math manual, which compiles and seems to display correctly if I remove some hardcoded package loadings. OTOH I have not much experience with math. This addresses #7449 partly.
This commit is contained in:
parent
b99a2a6255
commit
8bf5d4b461
@ -11,6 +11,12 @@ adjustments are made to tex2lyx and bugs are fixed in lyx2lyx.
|
||||
|
||||
-----------------------
|
||||
|
||||
|
||||
2012-09-24 Jürgen Spitzmüller <spitz@lyx.org>
|
||||
* 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 <spitz@lyx.org>
|
||||
* Format incremented to 442: support for the newtxmath fonts:
|
||||
- \usepackage{newtxmath} > \font_math newtxmath
|
||||
|
@ -336,6 +336,7 @@
|
||||
\TestPackage[turkmen.ldf]{turkmen}
|
||||
\TestPackage{ulem}
|
||||
\TestPackage{undertilde}
|
||||
\TestPackage{unicode-math}
|
||||
\TestPackage{units}
|
||||
\TestPackage{url}
|
||||
\TestPackage{varioref}
|
||||
|
@ -1134,10 +1134,12 @@ convert = [
|
||||
[439, []],
|
||||
[440, []],
|
||||
[441, [convert_mdnomath]],
|
||||
[442, []]
|
||||
[442, []],
|
||||
[443, []]
|
||||
]
|
||||
|
||||
revert = [
|
||||
[442, []],
|
||||
[441, [revert_newtxmath]],
|
||||
[440, [revert_mdnomath]],
|
||||
[439, [revert_mathfonts]],
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user