mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 01:59:02 +00:00
Split osf options to families
Nowadays we support sf and tt fonts with osf options, so this needs to be selectable separately. File format change.
This commit is contained in:
parent
996079de49
commit
dcf06fdb22
@ -7,6 +7,10 @@ changes happened in particular if possible. A good example would be
|
||||
|
||||
-----------------------
|
||||
|
||||
2019-07-14 Jürgen Spitzmüller <spitz@lyx.org>
|
||||
* Format incremented to 581: split osf options to rm, sf, and tt
|
||||
\font_osf => \font_roman_osf, \font_sans_osf, \font_typewriter_osf
|
||||
|
||||
2019-07-11 Uwe Stöhr <uwestoehr@web.de>
|
||||
Jürgen Spitzmüller <spitz@lyx.org>
|
||||
* Format incremented to 580: support for document font options
|
||||
|
@ -2579,7 +2579,6 @@ def revert_notoFonts_xopts(document):
|
||||
def revert_IBMFonts_xopts(document):
|
||||
" Revert native IBM font definition (with extra options) to LaTeX "
|
||||
|
||||
|
||||
i = find_token(document.header, '\\use_non_tex_fonts', 0)
|
||||
if i == -1:
|
||||
document.warning("Malformed LyX document: Missing \\use_non_tex_fonts.")
|
||||
@ -2611,6 +2610,104 @@ def revert_AdobeFonts_xopts(document):
|
||||
add_preamble_fonts(document, fontmap)
|
||||
|
||||
|
||||
def convert_osf(document):
|
||||
" Convert \\font_osf param to new format "
|
||||
|
||||
NonTeXFonts = False
|
||||
i = find_token(document.header, '\\use_non_tex_fonts', 0)
|
||||
if i == -1:
|
||||
document.warning("Malformed LyX document: Missing \\use_non_tex_fonts.")
|
||||
else:
|
||||
NonTeXFonts = str2bool(get_value(document.header, "\\use_non_tex_fonts", i))
|
||||
|
||||
i = find_token(document.header, '\\font_osf', 0)
|
||||
if i == -1:
|
||||
document.warning("Malformed LyX document: Missing \\font_osf.")
|
||||
return
|
||||
|
||||
osfsf = ["biolinum", "ADOBESourceSansPro", "NotoSansRegular", "NotoSansMedium", "NotoSansThin", "NotoSansLight", "NotoSansExtralight" ]
|
||||
osftt = ["ADOBESourceCodePro", "NotoMonoRegular" ]
|
||||
|
||||
osfval = str2bool(get_value(document.header, "\\font_osf", i))
|
||||
document.header[i] = document.header[i].replace("\\font_osf", "\\font_roman_osf")
|
||||
|
||||
if NonTeXFonts:
|
||||
document.header.insert(i, "\\font_sans_osf false")
|
||||
document.header.insert(i + 1, "\\font_typewriter_osf false")
|
||||
return
|
||||
|
||||
if osfval:
|
||||
x = find_token(document.header, "\\font_sans", 0)
|
||||
if x == -1:
|
||||
document.warning("Malformed LyX document: Missing \\font_sans.")
|
||||
else:
|
||||
# We need to use this regex since split() does not handle quote protection
|
||||
sffont = re.findall(r'[^"\s]\S*|".+?"', document.header[x])
|
||||
sf = sffont[1].strip('"')
|
||||
if sf in osfsf:
|
||||
document.header.insert(i, "\\font_sans_osf true")
|
||||
else:
|
||||
document.header.insert(i, "\\font_sans_osf false")
|
||||
|
||||
x = find_token(document.header, "\\font_typewriter", 0)
|
||||
if x == -1:
|
||||
document.warning("Malformed LyX document: Missing \\font_typewriter.")
|
||||
else:
|
||||
# We need to use this regex since split() does not handle quote protection
|
||||
ttfont = re.findall(r'[^"\s]\S*|".+?"', document.header[x])
|
||||
tt = ttfont[1].strip('"')
|
||||
if tt in osftt:
|
||||
document.header.insert(i + 1, "\\font_sans_osf true")
|
||||
else:
|
||||
document.header.insert(i + 1, "\\font_sans_osf false")
|
||||
|
||||
else:
|
||||
document.header.insert(i, "\\font_sans_osf false")
|
||||
document.header.insert(i + 1, "\\font_typewriter_osf false")
|
||||
|
||||
|
||||
def revert_osf(document):
|
||||
" Revert \\font_*_osf params "
|
||||
|
||||
NonTeXFonts = False
|
||||
i = find_token(document.header, '\\use_non_tex_fonts', 0)
|
||||
if i == -1:
|
||||
document.warning("Malformed LyX document: Missing \\use_non_tex_fonts.")
|
||||
else:
|
||||
NonTeXFonts = str2bool(get_value(document.header, "\\use_non_tex_fonts", i))
|
||||
|
||||
i = find_token(document.header, '\\font_roman_osf', 0)
|
||||
if i == -1:
|
||||
document.warning("Malformed LyX document: Missing \\font_roman_osf.")
|
||||
return
|
||||
|
||||
osfval = str2bool(get_value(document.header, "\\font_roman_osf", i))
|
||||
document.header[i] = document.header[i].replace("\\font_roman_osf", "\\font_osf")
|
||||
|
||||
i = find_token(document.header, '\\font_sans_osf', 0)
|
||||
if i == -1:
|
||||
document.warning("Malformed LyX document: Missing \\font_sans_osf.")
|
||||
return
|
||||
|
||||
osfval = str2bool(get_value(document.header, "\\font_sans_osf", i))
|
||||
del document.header[i]
|
||||
|
||||
i = find_token(document.header, '\\font_typewriter_osf', 0)
|
||||
if i == -1:
|
||||
document.warning("Malformed LyX document: Missing \\font_typewriter_osf.")
|
||||
return
|
||||
|
||||
osfval |= str2bool(get_value(document.header, "\\font_typewriter_osf", i))
|
||||
del document.header[i]
|
||||
|
||||
if osfval:
|
||||
i = find_token(document.header, '\\font_osf', 0)
|
||||
if i == -1:
|
||||
document.warning("Malformed LyX document: Missing \\font_osf.")
|
||||
return
|
||||
document.header[i] = "\\font_osf true"
|
||||
|
||||
|
||||
##
|
||||
# Conversion hub
|
||||
#
|
||||
@ -2652,10 +2749,12 @@ convert = [
|
||||
[577, [convert_linggloss]],
|
||||
[578, []],
|
||||
[579, []],
|
||||
[580, []]
|
||||
[580, []],
|
||||
[581, [convert_osf]]
|
||||
]
|
||||
|
||||
revert = [[579, [revert_minionpro, revert_plainNotoFonts_xopts, revert_notoFonts_xopts, revert_IBMFonts_xopts, revert_AdobeFonts_xopts, revert_font_opts]], # keep revert_font_opts last!
|
||||
revert = [[580, [revert_osf]],
|
||||
[579, [revert_minionpro, revert_plainNotoFonts_xopts, revert_notoFonts_xopts, revert_IBMFonts_xopts, revert_AdobeFonts_xopts, revert_font_opts]], # keep revert_font_opts last!
|
||||
[578, [revert_babelfont]],
|
||||
[577, [revert_drs]],
|
||||
[576, [revert_linggloss, revert_subexarg]],
|
||||
|
@ -419,7 +419,9 @@ BufferParams::BufferParams()
|
||||
use_microtype = false;
|
||||
use_dash_ligatures = true;
|
||||
fonts_expert_sc = false;
|
||||
fonts_old_figures = false;
|
||||
fonts_roman_osf = false;
|
||||
fonts_sans_osf = false;
|
||||
fonts_typewriter_osf = false;
|
||||
fonts_sans_scale[0] = 100;
|
||||
fonts_sans_scale[1] = 100;
|
||||
fonts_typewriter_scale[0] = 100;
|
||||
@ -832,8 +834,12 @@ string BufferParams::readToken(Lexer & lex, string const & token,
|
||||
lex >> useNonTeXFonts;
|
||||
} else if (token == "\\font_sc") {
|
||||
lex >> fonts_expert_sc;
|
||||
} else if (token == "\\font_osf") {
|
||||
lex >> fonts_old_figures;
|
||||
} else if (token == "\\font_roman_osf") {
|
||||
lex >> fonts_roman_osf;
|
||||
} else if (token == "\\font_sans_osf") {
|
||||
lex >> fonts_sans_osf;
|
||||
} else if (token == "\\font_typewriter_osf") {
|
||||
lex >> fonts_typewriter_osf;
|
||||
} else if (token == "\\font_roman_opts") {
|
||||
lex >> font_roman_opts;
|
||||
} else if (token == "\\font_sf_scale") {
|
||||
@ -1257,7 +1263,9 @@ void BufferParams::writeFile(ostream & os, Buffer const * buf) const
|
||||
<< "\n\\font_default_family " << fonts_default_family
|
||||
<< "\n\\use_non_tex_fonts " << convert<string>(useNonTeXFonts)
|
||||
<< "\n\\font_sc " << convert<string>(fonts_expert_sc)
|
||||
<< "\n\\font_osf " << convert<string>(fonts_old_figures);
|
||||
<< "\n\\font_roman_osf " << convert<string>(fonts_roman_osf)
|
||||
<< "\n\\font_sans_osf " << convert<string>(fonts_sans_osf)
|
||||
<< "\n\\font_typewriter_osf " << convert<string>(fonts_typewriter_osf);
|
||||
if (!font_roman_opts.empty())
|
||||
os << "\n\\font_roman_opts \"" << font_roman_opts << "\"";
|
||||
os << "\n\\font_sf_scale " << fonts_sans_scale[0]
|
||||
@ -3406,7 +3414,7 @@ string const BufferParams::loadFonts(LaTeXFeatures & features) const
|
||||
if (!font_roman_opts.empty())
|
||||
os << font_roman_opts << ',';
|
||||
os << texmapping;
|
||||
if (fonts_old_figures)
|
||||
if (fonts_roman_osf)
|
||||
os << ",Numbers=OldStyle";
|
||||
os << "]{" << parseFontName(fontsRoman()) << "}\n";
|
||||
}
|
||||
@ -3419,6 +3427,8 @@ string const BufferParams::loadFonts(LaTeXFeatures & features) const
|
||||
os << "\\setsansfont";
|
||||
os << "[Scale="
|
||||
<< float(fontsSansScale()) / 100 << ',';
|
||||
if (fonts_sans_osf)
|
||||
os << "Numbers=OldStyle,";
|
||||
if (!font_sans_opts.empty())
|
||||
os << font_sans_opts << ',';
|
||||
os << texmapping << "]{"
|
||||
@ -3428,6 +3438,8 @@ string const BufferParams::loadFonts(LaTeXFeatures & features) const
|
||||
os << "\\babelfont{sf}[";
|
||||
else
|
||||
os << "\\setsansfont[";
|
||||
if (fonts_sans_osf)
|
||||
os << "Numbers=OldStyle,";
|
||||
if (!font_sans_opts.empty())
|
||||
os << font_sans_opts << ',';
|
||||
os << texmapping << "]{"
|
||||
@ -3443,6 +3455,8 @@ string const BufferParams::loadFonts(LaTeXFeatures & features) const
|
||||
os << "\\setmonofont";
|
||||
os << "[Scale="
|
||||
<< float(fontsTypewriterScale()) / 100;
|
||||
if (fonts_typewriter_osf)
|
||||
os << ",Numbers=OldStyle";
|
||||
if (!font_typewriter_opts.empty())
|
||||
os << ',' << font_typewriter_opts;
|
||||
os << "]{"
|
||||
@ -3452,8 +3466,17 @@ string const BufferParams::loadFonts(LaTeXFeatures & features) const
|
||||
os << "\\babelfont{tt}";
|
||||
else
|
||||
os << "\\setmonofont";
|
||||
if (!font_typewriter_opts.empty())
|
||||
os << '[' << font_typewriter_opts << ']';
|
||||
if (!font_typewriter_opts.empty() || fonts_typewriter_osf) {
|
||||
os << '[';
|
||||
if (fonts_typewriter_osf)
|
||||
os << "Numbers=OldStyle";
|
||||
if (!font_typewriter_opts.empty()) {
|
||||
if (fonts_typewriter_osf)
|
||||
os << ',';
|
||||
os << font_typewriter_opts;
|
||||
}
|
||||
os << ']';
|
||||
}
|
||||
os << '{' << mono << "}\n";
|
||||
}
|
||||
}
|
||||
@ -3468,22 +3491,22 @@ string const BufferParams::loadFonts(LaTeXFeatures & features) const
|
||||
|
||||
// ROMAN FONTS
|
||||
os << theLaTeXFonts().getLaTeXFont(from_ascii(fontsRoman())).getLaTeXCode(
|
||||
dryrun, ot1, complete, fonts_expert_sc, fonts_old_figures,
|
||||
dryrun, ot1, complete, fonts_expert_sc, fonts_roman_osf,
|
||||
nomath, font_roman_opts);
|
||||
|
||||
// SANS SERIF
|
||||
os << theLaTeXFonts().getLaTeXFont(from_ascii(fontsSans())).getLaTeXCode(
|
||||
dryrun, ot1, complete, fonts_expert_sc, fonts_old_figures,
|
||||
dryrun, ot1, complete, fonts_expert_sc, fonts_sans_osf,
|
||||
nomath, font_sans_opts, fontsSansScale());
|
||||
|
||||
// MONOSPACED/TYPEWRITER
|
||||
os << theLaTeXFonts().getLaTeXFont(from_ascii(fontsTypewriter())).getLaTeXCode(
|
||||
dryrun, ot1, complete, fonts_expert_sc, fonts_old_figures,
|
||||
dryrun, ot1, complete, fonts_expert_sc, fonts_typewriter_osf,
|
||||
nomath, font_typewriter_opts, fontsTypewriterScale());
|
||||
|
||||
// MATH
|
||||
os << theLaTeXFonts().getLaTeXFont(from_ascii(fontsMath())).getLaTeXCode(
|
||||
dryrun, ot1, complete, fonts_expert_sc, fonts_old_figures,
|
||||
dryrun, ot1, complete, fonts_expert_sc, fonts_roman_osf,
|
||||
nomath);
|
||||
|
||||
return os.str();
|
||||
|
@ -283,8 +283,12 @@ public:
|
||||
bool useNonTeXFonts;
|
||||
/// use expert Small Caps
|
||||
bool fonts_expert_sc;
|
||||
/// use Old Style Figures
|
||||
bool fonts_old_figures;
|
||||
/// use Old Style Figures (rm)
|
||||
bool fonts_roman_osf;
|
||||
/// use Old Style Figures (sf)
|
||||
bool fonts_sans_osf;
|
||||
/// use Old Style Figures (tt)
|
||||
bool fonts_typewriter_osf;
|
||||
/// the options for the roman font
|
||||
std::string font_roman_opts;
|
||||
/// the scale factor of the sf font: [0] for TeX fonts, [1] for non-TeX fonts
|
||||
|
@ -1090,6 +1090,10 @@ GuiDocument::GuiDocument(GuiView & lv)
|
||||
this, SLOT(change_adaptor()));
|
||||
connect(fontModule->fontOsfCB, SIGNAL(toggled(bool)),
|
||||
this, SLOT(fontOsfToggled(bool)));
|
||||
connect(fontModule->fontSansOsfCB, SIGNAL(clicked()),
|
||||
this, SLOT(change_adaptor()));
|
||||
connect(fontModule->fontTypewriterOsfCB, SIGNAL(clicked()),
|
||||
this, SLOT(change_adaptor()));
|
||||
connect(fontModule->fontspecRomanLE, SIGNAL(textChanged(const QString &)),
|
||||
this, SLOT(change_adaptor()));
|
||||
connect(fontModule->fontspecSansLE, SIGNAL(textChanged(const QString &)),
|
||||
@ -2462,12 +2466,14 @@ void GuiDocument::updateFontOptions()
|
||||
bool scaleable = providesScale(font);
|
||||
fontModule->scaleSansSB->setEnabled(scaleable);
|
||||
fontModule->scaleSansLA->setEnabled(scaleable);
|
||||
fontModule->fontSansOsfCB->setEnabled(providesOSF(font));
|
||||
if (tex_fonts)
|
||||
font = fontModule->fontsTypewriterCO->itemData(
|
||||
fontModule->fontsTypewriterCO->currentIndex()).toString();
|
||||
scaleable = providesScale(font);
|
||||
fontModule->scaleTypewriterSB->setEnabled(scaleable);
|
||||
fontModule->scaleTypewriterLA->setEnabled(scaleable);
|
||||
fontModule->fontTypewriterOsfCB->setEnabled(providesOSF(font));
|
||||
if (tex_fonts)
|
||||
font = fontModule->fontsRomanCO->itemData(
|
||||
fontModule->fontsRomanCO->currentIndex()).toString();
|
||||
@ -2667,6 +2673,7 @@ void GuiDocument::sansChanged(int item)
|
||||
bool const scaleable = providesScale(font);
|
||||
fontModule->scaleSansSB->setEnabled(scaleable);
|
||||
fontModule->scaleSansLA->setEnabled(scaleable);
|
||||
fontModule->fontSansOsfCB->setEnabled(providesOSF(font));
|
||||
updateExtraOpts();
|
||||
}
|
||||
|
||||
@ -2680,6 +2687,7 @@ void GuiDocument::ttChanged(int item)
|
||||
bool scaleable = providesScale(font);
|
||||
fontModule->scaleTypewriterSB->setEnabled(scaleable);
|
||||
fontModule->scaleTypewriterLA->setEnabled(scaleable);
|
||||
fontModule->fontTypewriterOsfCB->setEnabled(providesOSF(font));
|
||||
updateExtraOpts();
|
||||
}
|
||||
|
||||
@ -3711,7 +3719,9 @@ void GuiDocument::applyView()
|
||||
|
||||
bp_.fonts_expert_sc = fontModule->fontScCB->isChecked();
|
||||
|
||||
bp_.fonts_old_figures = fontModule->fontOsfCB->isChecked();
|
||||
bp_.fonts_roman_osf = fontModule->fontOsfCB->isChecked();
|
||||
bp_.fonts_sans_osf = fontModule->fontSansOsfCB->isChecked();
|
||||
bp_.fonts_typewriter_osf = fontModule->fontTypewriterOsfCB->isChecked();
|
||||
|
||||
if (nontexfonts)
|
||||
bp_.fonts_default_family = "default";
|
||||
@ -4227,7 +4237,9 @@ void GuiDocument::paramsToDialog()
|
||||
fontModule->dashesCB->setChecked(!bp_.use_dash_ligatures);
|
||||
|
||||
fontModule->fontScCB->setChecked(bp_.fonts_expert_sc);
|
||||
fontModule->fontOsfCB->setChecked(bp_.fonts_old_figures);
|
||||
fontModule->fontOsfCB->setChecked(bp_.fonts_roman_osf);
|
||||
fontModule->fontSansOsfCB->setChecked(bp_.fonts_sans_osf);
|
||||
fontModule->fontTypewriterOsfCB->setChecked(bp_.fonts_typewriter_osf);
|
||||
fontModule->scaleSansSB->setValue(bp_.fontsSansScale());
|
||||
fontModule->font_sf_scale = bp_.fonts_sans_scale[!bp_.useNonTeXFonts];
|
||||
fontModule->scaleTypewriterSB->setValue(bp_.fontsTypewriterScale());
|
||||
@ -4931,6 +4943,7 @@ bool GuiDocument::providesOSF(QString const & font) const
|
||||
// FIXME: we should check if the fonts really
|
||||
// have OSF support. But how?
|
||||
return true;
|
||||
LYXERR0("osf font: " << font);
|
||||
return theLaTeXFonts().getLaTeXFont(
|
||||
qstring_to_ucs4(font)).providesOSF(ot1(),
|
||||
completeFontset(),
|
||||
|
@ -6,26 +6,29 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>534</width>
|
||||
<height>632</height>
|
||||
<width>568</width>
|
||||
<height>557</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>FontUi</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="osFontsCB">
|
||||
<property name="toolTip">
|
||||
<string>Use OpenType and TrueType fonts with the fontspec package (requires XeTeX or LuaTeX)</string>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="4" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Use non-TeX fonts (via XeTeX/LuaTeX)</string>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>126</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="1" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="fontsDefaultLA">
|
||||
<property name="text">
|
||||
@ -112,33 +115,90 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="fontsRomanCO">
|
||||
<property name="toolTip">
|
||||
<string>Select the roman (serif) typeface</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_8">
|
||||
<item>
|
||||
<widget class="QLabel" name="fontspecRomanLA">
|
||||
<property name="text">
|
||||
<string>Options:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>fontspecRomanLE</cstring>
|
||||
<widget class="QComboBox" name="fontsRomanCO">
|
||||
<property name="toolTip">
|
||||
<string>Select the roman (serif) typeface</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="fontspecRomanLE">
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="fontScCB">
|
||||
<property name="toolTip">
|
||||
<string>Here you can insert additional options (as provided by the font package)</string>
|
||||
<string>Use a real small caps shape, if the font provides one</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Use true s&mall caps</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_9">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="fontOsfCB">
|
||||
<property name="toolTip">
|
||||
<string>Use old style instead of lining figures</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Use &old style figures</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_7">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<item>
|
||||
<widget class="QLabel" name="fontspecRomanLA">
|
||||
<property name="text">
|
||||
<string>Options:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>fontspecRomanLE</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="fontspecRomanLE">
|
||||
<property name="toolTip">
|
||||
<string>Here you can insert additional options (as provided by the font package)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="fontsSansLA">
|
||||
<property name="text">
|
||||
@ -197,23 +257,53 @@
|
||||
</layout>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_10">
|
||||
<item>
|
||||
<widget class="QLabel" name="fontspecSansLA">
|
||||
<property name="text">
|
||||
<string>Options:</string>
|
||||
<widget class="QCheckBox" name="fontSansOsfCB">
|
||||
<property name="toolTip">
|
||||
<string>Use old style instead of lining figures</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>fontspecSansLE</cstring>
|
||||
<property name="text">
|
||||
<string>Use old st&yle figures</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="fontspecSansLE">
|
||||
<property name="toolTip">
|
||||
<string>Here you can insert additional options (as provided by the font package)</string>
|
||||
<spacer name="horizontalSpacer_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="fontspecSansLA">
|
||||
<property name="text">
|
||||
<string>Options:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>fontspecSansLE</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="fontspecSansLE">
|
||||
<property name="toolTip">
|
||||
<string>Here you can insert additional options (as provided by the font package)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
@ -275,23 +365,53 @@
|
||||
</layout>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_11">
|
||||
<item>
|
||||
<widget class="QLabel" name="fontspecTypewriterLA">
|
||||
<property name="text">
|
||||
<string>Options:</string>
|
||||
<widget class="QCheckBox" name="fontTypewriterOsfCB">
|
||||
<property name="toolTip">
|
||||
<string>Use old style instead of lining figures</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>fontspecTypewriterLE</cstring>
|
||||
<property name="text">
|
||||
<string>Use old style &figures</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="fontspecTypewriterLE">
|
||||
<property name="toolTip">
|
||||
<string>Here you can insert additional options (as provided by the font package)</string>
|
||||
<spacer name="horizontalSpacer_6">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QLabel" name="fontspecTypewriterLA">
|
||||
<property name="text">
|
||||
<string>Options:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>fontspecTypewriterLE</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="fontspecTypewriterLE">
|
||||
<property name="toolTip">
|
||||
<string>Here you can insert additional options (as provided by the font package)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
@ -329,60 +449,37 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="1">
|
||||
<widget class="QCheckBox" name="fontScCB">
|
||||
<property name="toolTip">
|
||||
<string>Use a real small caps shape, if the font provides one</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Use true s&mall caps</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="1">
|
||||
<widget class="QCheckBox" name="fontOsfCB">
|
||||
<property name="toolTip">
|
||||
<string>Use old style instead of lining figures</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Use &old style figures</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="1">
|
||||
<widget class="QCheckBox" name="microtypeCB">
|
||||
<property name="toolTip">
|
||||
<string>Activate extensions such as character protrusion and font expansion via the microtype package</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Enable micr&o-typographic extensions</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="13" column="1">
|
||||
<widget class="QCheckBox" name="dashesCB">
|
||||
<property name="toolTip">
|
||||
<string>By default, a line break can occur after en- and em-dashes. Checking this box prevents that.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Disallow l&ine breaks after dashes</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
<item row="2" column="0">
|
||||
<widget class="QCheckBox" name="microtypeCB">
|
||||
<property name="toolTip">
|
||||
<string>Activate extensions such as character protrusion and font expansion via the microtype package</string>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>126</height>
|
||||
</size>
|
||||
<property name="text">
|
||||
<string>Enable micr&o-typographic extensions</string>
|
||||
</property>
|
||||
</spacer>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="osFontsCB">
|
||||
<property name="toolTip">
|
||||
<string>Use OpenType and TrueType fonts with the fontspec package (requires XeTeX or LuaTeX)</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Use non-TeX fonts (via XeTeX/LuaTeX)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QCheckBox" name="dashesCB">
|
||||
<property name="toolTip">
|
||||
<string>By default, a line break can occur after en- and em-dashes. Checking this box prevents that.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Disallow l&ine breaks after dashes</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
@ -399,8 +496,6 @@
|
||||
<tabstop>fontsTypewriterCO</tabstop>
|
||||
<tabstop>scaleTypewriterSB</tabstop>
|
||||
<tabstop>cjkFontLE</tabstop>
|
||||
<tabstop>fontScCB</tabstop>
|
||||
<tabstop>fontOsfCB</tabstop>
|
||||
</tabstops>
|
||||
<includes>
|
||||
<include location="local">qt_i18n.h</include>
|
||||
|
@ -529,7 +529,9 @@ Preamble::Preamble() : one_language(true), explicit_babel(false),
|
||||
h_font_default_family = "default";
|
||||
h_use_non_tex_fonts = false;
|
||||
h_font_sc = "false";
|
||||
h_font_osf = "false";
|
||||
h_font_roman_osf = "false";
|
||||
h_font_sans_osf = "false";
|
||||
h_font_typewriter_osf = "false";
|
||||
h_font_sf_scale[0] = "100";
|
||||
h_font_sf_scale[1] = "100";
|
||||
h_font_tt_scale[0] = "100";
|
||||
@ -757,7 +759,7 @@ void Preamble::handle_package(Parser &p, string const & name,
|
||||
if (name == "garamondx") {
|
||||
h_font_roman[0] = "garamondx";
|
||||
if (opts == "osfI")
|
||||
h_font_osf = "true";
|
||||
h_font_roman_osf = "true";
|
||||
}
|
||||
|
||||
if (name == "libertine") {
|
||||
@ -767,9 +769,9 @@ void Preamble::handle_package(Parser &p, string const & name,
|
||||
// as well as libertineMono
|
||||
h_font_typewriter[0] = "libertine-mono";
|
||||
if (opts == "osf")
|
||||
h_font_osf = "true";
|
||||
h_font_roman_osf = "true";
|
||||
else if (opts == "lining")
|
||||
h_font_osf = "false";
|
||||
h_font_roman_osf = "false";
|
||||
}
|
||||
|
||||
if (name == "libertineRoman" || name == "libertine-type1") {
|
||||
@ -778,20 +780,20 @@ void Preamble::handle_package(Parser &p, string const & name,
|
||||
// and libertine-type1 do not automatically invoke
|
||||
// biolinum and libertineMono
|
||||
if (opts == "lining")
|
||||
h_font_osf = "false";
|
||||
h_font_roman_osf = "false";
|
||||
else if (opts == "osf")
|
||||
h_font_osf = "true";
|
||||
h_font_roman_osf = "true";
|
||||
}
|
||||
|
||||
if (name == "MinionPro") {
|
||||
h_font_roman[0] = "minionpro";
|
||||
vector<string> allopts = getVectorFromString(opts);
|
||||
string xopts;
|
||||
h_font_osf = "true";
|
||||
h_font_roman_osf = "true";
|
||||
h_font_math[0] = "auto";
|
||||
for (auto const & opt : allopts) {
|
||||
if (opt == "lf") {
|
||||
h_font_osf = "false";
|
||||
h_font_roman_osf = "false";
|
||||
continue;
|
||||
}
|
||||
if (opt == "onlytext") {
|
||||
@ -816,7 +818,7 @@ void Preamble::handle_package(Parser &p, string const & name,
|
||||
h_font_roman[0] = "md-utopia";
|
||||
if (opts.find("expert") != string::npos) {
|
||||
h_font_sc = "true";
|
||||
h_font_osf = "true";
|
||||
h_font_roman_osf = "true";
|
||||
}
|
||||
}
|
||||
|
||||
@ -834,7 +836,7 @@ void Preamble::handle_package(Parser &p, string const & name,
|
||||
// cochineal can have several options, e.g. [proportional,osf]
|
||||
string::size_type pos = opts.find("osf");
|
||||
if (pos != string::npos)
|
||||
h_font_osf = "true";
|
||||
h_font_roman_osf = "true";
|
||||
}
|
||||
|
||||
if (name == "noto") {
|
||||
@ -864,7 +866,7 @@ void Preamble::handle_package(Parser &p, string const & name,
|
||||
if (opt == "nott")
|
||||
continue;
|
||||
if (opt == "osf") {
|
||||
h_font_osf = "true";
|
||||
h_font_roman_osf = "true";
|
||||
continue;
|
||||
}
|
||||
if (!xopts.empty())
|
||||
@ -886,7 +888,7 @@ void Preamble::handle_package(Parser &p, string const & name,
|
||||
if (name == "XCharter") {
|
||||
h_font_roman[0] = "xcharter";
|
||||
if (opts == "osf")
|
||||
h_font_osf = "true";
|
||||
h_font_roman_osf = "true";
|
||||
}
|
||||
|
||||
if (name == "plex-serif") {
|
||||
@ -959,7 +961,7 @@ void Preamble::handle_package(Parser &p, string const & name,
|
||||
string xopts;
|
||||
for (auto const & opt : allopts) {
|
||||
if (opt == "osf") {
|
||||
h_font_osf = "true";
|
||||
h_font_roman_osf = "true";
|
||||
continue;
|
||||
}
|
||||
if (!xopts.empty())
|
||||
@ -985,7 +987,7 @@ void Preamble::handle_package(Parser &p, string const & name,
|
||||
// biolinum can have several options, e.g. [osf,scaled=0.97]
|
||||
string::size_type pos = opts.find("osf");
|
||||
if (pos != string::npos)
|
||||
h_font_osf = "true";
|
||||
h_font_sans_osf = "true";
|
||||
}
|
||||
|
||||
if (name == "PTSans") {
|
||||
@ -1057,6 +1059,10 @@ void Preamble::handle_package(Parser &p, string const & name,
|
||||
continue;
|
||||
if (opt == "semibold")
|
||||
continue;
|
||||
if (opt == "osf") {
|
||||
h_font_sans_osf = "true";
|
||||
continue;
|
||||
}
|
||||
if (!xopts.empty())
|
||||
xopts += ", ";
|
||||
xopts += opt;
|
||||
@ -1076,7 +1082,7 @@ void Preamble::handle_package(Parser &p, string const & name,
|
||||
continue;
|
||||
}
|
||||
if (opt == "osf") {
|
||||
h_font_osf = "true";
|
||||
h_font_sans_osf = "true";
|
||||
continue;
|
||||
}
|
||||
if (!xopts.empty())
|
||||
@ -1173,7 +1179,7 @@ void Preamble::handle_package(Parser &p, string const & name,
|
||||
continue;
|
||||
}
|
||||
if (opt == "osf") {
|
||||
h_font_osf = "true";
|
||||
h_font_typewriter_osf = "true";
|
||||
continue;
|
||||
}
|
||||
if (!xopts.empty())
|
||||
@ -1187,7 +1193,7 @@ void Preamble::handle_package(Parser &p, string const & name,
|
||||
|
||||
// font uses old-style figure
|
||||
if (name == "eco")
|
||||
h_font_osf = "true";
|
||||
h_font_roman_osf = "true";
|
||||
|
||||
// math fonts
|
||||
if (is_known(name, known_math_font_packages))
|
||||
@ -1614,7 +1620,9 @@ bool Preamble::writeLyXHeader(ostream & os, bool subdoc, string const & outfiled
|
||||
<< "\\font_default_family " << h_font_default_family << "\n"
|
||||
<< "\\use_non_tex_fonts " << (h_use_non_tex_fonts ? "true" : "false") << '\n'
|
||||
<< "\\font_sc " << h_font_sc << "\n"
|
||||
<< "\\font_osf " << h_font_osf << "\n";
|
||||
<< "\\font_roman_osf " << h_font_roman_osf << "\n"
|
||||
<< "\\font_sans_osf " << h_font_sans_osf << "\n"
|
||||
<< "\\font_typewriter_osf " << h_font_typewriter_osf << "\n";
|
||||
if (!h_font_roman_opts.empty())
|
||||
os << "\\font_roman_opts \"" << h_font_roman_opts << "\"" << '\n';
|
||||
os << "\\font_sf_scale " << h_font_sf_scale[0]
|
||||
|
@ -172,7 +172,9 @@ private:
|
||||
std::string h_font_default_family;
|
||||
bool h_use_non_tex_fonts;
|
||||
std::string h_font_sc;
|
||||
std::string h_font_osf;
|
||||
std::string h_font_roman_osf;
|
||||
std::string h_font_sans_osf;
|
||||
std::string h_font_typewriter_osf;
|
||||
std::string h_font_sf_scale[2];
|
||||
std::string h_font_tt_scale[2];
|
||||
bool h_font_cjk_set;
|
||||
|
@ -32,8 +32,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 580 // spitz/uwestoehr: support for fontspec options
|
||||
#define LYX_FORMAT_TEX2LYX 580
|
||||
#define LYX_FORMAT_LYX 581 // spitz: split osf to font families
|
||||
#define LYX_FORMAT_TEX2LYX 581
|
||||
|
||||
#if LYX_FORMAT_TEX2LYX != LYX_FORMAT_LYX
|
||||
#ifndef _MSC_VER
|
||||
|
Loading…
Reference in New Issue
Block a user