mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-25 10:58:52 +00:00
Basic UI for math (TeX) fonts
This addresses #6543 by adding an option to prevent fonts such as Palatino and Times to automatically adapt the math font (IOW it lets you load the text font only for a bunch of fonts where this is easily possible). Furthermore it adds an interface to select a specific math font, which is defined in latexfonts. Currently, this is only euler (the only one I know), but if there are other math-only tex fonts, they can be added easily (but note that this changes the file format). Non-TeX math fonts are not yet supported. Eventually, unicode-math support can use the existing UI, but this is not on my agenda.
This commit is contained in:
parent
1a248c68b4
commit
8f9898994d
@ -12,6 +12,16 @@ adjustments are made to tex2lyx and bugs are fixed in lyx2lyx.
|
|||||||
-----------------------
|
-----------------------
|
||||||
|
|
||||||
|
|
||||||
|
2012-09-22 Jürgen Spitzmüller <spitz@lyx.org>
|
||||||
|
* Format incremented to 440
|
||||||
|
Math (TeX) font UI.
|
||||||
|
New Buffer param "\math_font <value>",
|
||||||
|
supported values are:
|
||||||
|
* "auto": automatically adapt math font (the status quo ante).
|
||||||
|
* "default": use class default, i.e. prevent TeX font packages
|
||||||
|
from changing the math font, if possible.
|
||||||
|
* "eulervm": use the eulervm package.
|
||||||
|
|
||||||
2012-09-19 Jürgen Spitzmüller <spitz@lyx.org>
|
2012-09-19 Jürgen Spitzmüller <spitz@lyx.org>
|
||||||
* Format incremented to 439
|
* Format incremented to 439
|
||||||
Support for the MinionPro LaTeX font.
|
Support for the MinionPro LaTeX font.
|
||||||
|
@ -357,6 +357,7 @@
|
|||||||
\TestPackage{ccfonts}
|
\TestPackage{ccfonts}
|
||||||
\TestPackage{cmbright}
|
\TestPackage{cmbright}
|
||||||
\TestPackage{eco}
|
\TestPackage{eco}
|
||||||
|
\TestPackage{eulervm}
|
||||||
\TestPackage{feyn}
|
\TestPackage{feyn}
|
||||||
\TestPackage{fourier}
|
\TestPackage{fourier}
|
||||||
\TestPackage{libertine}
|
\TestPackage{libertine}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#LyX 2.1 created this file. For more info see http://www.lyx.org/
|
#LyX 2.1 created this file. For more info see http://www.lyx.org/
|
||||||
\lyxformat 438
|
\lyxformat 440
|
||||||
\begin_document
|
\begin_document
|
||||||
\begin_header
|
\begin_header
|
||||||
\textclass article
|
\textclass article
|
||||||
@ -12,6 +12,7 @@
|
|||||||
\font_roman default
|
\font_roman default
|
||||||
\font_sans default
|
\font_sans default
|
||||||
\font_typewriter default
|
\font_typewriter default
|
||||||
|
\font_math auto
|
||||||
\font_default_family default
|
\font_default_family default
|
||||||
\use_non_tex_fonts false
|
\use_non_tex_fonts false
|
||||||
\font_sc false
|
\font_sc false
|
||||||
@ -414,6 +415,34 @@ eco
|
|||||||
Computer Modern
|
Computer Modern
|
||||||
\family default
|
\family default
|
||||||
font family.
|
font family.
|
||||||
|
\end_layout
|
||||||
|
|
||||||
|
\begin_layout Subsection
|
||||||
|
Euler Virtual Math
|
||||||
|
\end_layout
|
||||||
|
|
||||||
|
\begin_layout Description
|
||||||
|
Found:
|
||||||
|
\begin_inset Info
|
||||||
|
type "package"
|
||||||
|
arg "eulervm"
|
||||||
|
\end_inset
|
||||||
|
|
||||||
|
|
||||||
|
\end_layout
|
||||||
|
|
||||||
|
\begin_layout Description
|
||||||
|
CTAN:
|
||||||
|
\family sans
|
||||||
|
fonts/eulervm/
|
||||||
|
\end_layout
|
||||||
|
|
||||||
|
\begin_layout Description
|
||||||
|
Notes: The
|
||||||
|
\family sans
|
||||||
|
eulervm
|
||||||
|
\family default
|
||||||
|
package provides access to the Euler math fonts.
|
||||||
|
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
|
@ -6,13 +6,14 @@
|
|||||||
#
|
#
|
||||||
# Font <name>
|
# Font <name>
|
||||||
# GuiName "<Gui Name>"
|
# GuiName "<Gui Name>"
|
||||||
# Family <rm|sf|tt>
|
# Family <rm|sf|tt|math>
|
||||||
# SwitchDefault <0|1>
|
# SwitchDefault <0|1>
|
||||||
# Package <LaTeX package to be loaded>
|
# Package <LaTeX package to be loaded>
|
||||||
# Requires <LaTeX package to test for>
|
# Requires <LaTeX package to test for>
|
||||||
# AltFonts <alternative fonts (comma-separated)>
|
# AltFonts <alternative fonts (comma-separated)>
|
||||||
# OT1Font <alternative font specifically for OT1 encoding>
|
# OT1Font <alternative font specifically for OT1 encoding>
|
||||||
# CompleteFont <alternative package for the complete family>
|
# CompleteFont <alternative package for the complete family>
|
||||||
|
# NoMathFont <alternative font that does not change math>
|
||||||
# PackageOptions <general options to be passed to the package>
|
# PackageOptions <general options to be passed to the package>
|
||||||
# OsfOption <option for oldstyle figure support>
|
# OsfOption <option for oldstyle figure support>
|
||||||
# OsfFont <extra font for oldstyle figures>
|
# OsfFont <extra font for oldstyle figures>
|
||||||
@ -49,7 +50,7 @@
|
|||||||
# for Package and AltFonts.
|
# for Package and AltFonts.
|
||||||
# * OT1Font will load the defined font if the font encoding is OT1. This is
|
# * OT1Font will load the defined font if the font encoding is OT1. This is
|
||||||
# necessary since some newer font packages do not support this encoding.
|
# necessary since some newer font packages do not support this encoding.
|
||||||
# The value "none" tells LyX not to load a package in OT1 encoding.
|
# The value "none" tells LyX not to load any font in OT1 encoding.
|
||||||
# OT1Fonts need to be defined separately using AltFont ... EndFont tags.
|
# OT1Fonts need to be defined separately using AltFont ... EndFont tags.
|
||||||
# * The CompleteFont is loaded if the current font is selected as rm and
|
# * The CompleteFont is loaded if the current font is selected as rm and
|
||||||
# both sf and tt are set to "default" (this allows f. ex. to load "bera"
|
# both sf and tt are set to "default" (this allows f. ex. to load "bera"
|
||||||
@ -148,6 +149,14 @@ Font lmodern
|
|||||||
GuiName "Latin Modern Roman"
|
GuiName "Latin Modern Roman"
|
||||||
Family rm
|
Family rm
|
||||||
Package lmodern
|
Package lmodern
|
||||||
|
NoMathFont lmr
|
||||||
|
EndFont
|
||||||
|
|
||||||
|
AltFont lmr
|
||||||
|
GuiName "Latin Modern Roman"
|
||||||
|
Family rm
|
||||||
|
SwitchDefault 1
|
||||||
|
Requires lmodern
|
||||||
EndFont
|
EndFont
|
||||||
|
|
||||||
Font mdbch
|
Font mdbch
|
||||||
@ -193,6 +202,16 @@ Font minionpro
|
|||||||
OsfDefault 1
|
OsfDefault 1
|
||||||
Package MinionPro
|
Package MinionPro
|
||||||
Provides amssymb,amsfonts
|
Provides amssymb,amsfonts
|
||||||
|
NoMathFont minionpro-nomath
|
||||||
|
EndFont
|
||||||
|
|
||||||
|
AltFont minionpro-nomath
|
||||||
|
GuiName "Minion Pro"
|
||||||
|
Family rm
|
||||||
|
OsfOption lf
|
||||||
|
OsfDefault 1
|
||||||
|
Package MinionPro
|
||||||
|
PackageOption onlytext
|
||||||
EndFont
|
EndFont
|
||||||
|
|
||||||
Font newcent
|
Font newcent
|
||||||
@ -209,6 +228,7 @@ Font palatino
|
|||||||
OsfScOption osf
|
OsfScOption osf
|
||||||
Package mathpazo
|
Package mathpazo
|
||||||
AltFonts mathpple,palatino-sty
|
AltFonts mathpple,palatino-sty
|
||||||
|
NoMathFont ppl
|
||||||
Requires psnfss
|
Requires psnfss
|
||||||
EndFont
|
EndFont
|
||||||
|
|
||||||
@ -216,6 +236,7 @@ AltFont mathpple
|
|||||||
GuiName "Palatino"
|
GuiName "Palatino"
|
||||||
Family rm
|
Family rm
|
||||||
Package mathpple
|
Package mathpple
|
||||||
|
NoMathFont ppl
|
||||||
EndFont
|
EndFont
|
||||||
|
|
||||||
AltFont palatino-sty
|
AltFont palatino-sty
|
||||||
@ -224,11 +245,25 @@ AltFont palatino-sty
|
|||||||
Package palatino
|
Package palatino
|
||||||
EndFont
|
EndFont
|
||||||
|
|
||||||
|
AltFont ppl
|
||||||
|
GuiName "Palatino"
|
||||||
|
Family rm
|
||||||
|
OsfFont pplj
|
||||||
|
SwitchDefault 1
|
||||||
|
EndFont
|
||||||
|
|
||||||
|
AltFont pplj
|
||||||
|
GuiName "Palatino"
|
||||||
|
Family rm
|
||||||
|
SwitchDefault 1
|
||||||
|
EndFont
|
||||||
|
|
||||||
Font times
|
Font times
|
||||||
GuiName "Times Roman"
|
GuiName "Times Roman"
|
||||||
Family rm
|
Family rm
|
||||||
Package mathptmx
|
Package mathptmx
|
||||||
AltFonts mathptm,times-sty
|
AltFonts mathptm,times-sty
|
||||||
|
NoMathFont ptm
|
||||||
Requires psnfss
|
Requires psnfss
|
||||||
EndFont
|
EndFont
|
||||||
|
|
||||||
@ -236,6 +271,7 @@ AltFont mathptm
|
|||||||
GuiName "Times Roman"
|
GuiName "Times Roman"
|
||||||
Family rm
|
Family rm
|
||||||
Package mathptm
|
Package mathptm
|
||||||
|
NoMathFont ptm
|
||||||
EndFont
|
EndFont
|
||||||
|
|
||||||
AltFont times-sty
|
AltFont times-sty
|
||||||
@ -244,6 +280,12 @@ AltFont times-sty
|
|||||||
Package times
|
Package times
|
||||||
EndFont
|
EndFont
|
||||||
|
|
||||||
|
AltFont ptm
|
||||||
|
GuiName "Times Roman"
|
||||||
|
Family rm
|
||||||
|
SwitchDefault 1
|
||||||
|
EndFont
|
||||||
|
|
||||||
Font tgbonum
|
Font tgbonum
|
||||||
GuiName "TeX Gyre Bonum"
|
GuiName "TeX Gyre Bonum"
|
||||||
Family rm
|
Family rm
|
||||||
@ -410,3 +452,14 @@ Font txtt
|
|||||||
SwitchDefault 1
|
SwitchDefault 1
|
||||||
Requires txfonts
|
Requires txfonts
|
||||||
EndFont
|
EndFont
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# MATH FONTS
|
||||||
|
#
|
||||||
|
|
||||||
|
Font eulervm
|
||||||
|
GuiName "Euler VM"
|
||||||
|
Family math
|
||||||
|
Package eulervm
|
||||||
|
EndFont
|
@ -1004,6 +1004,39 @@ def revert_minionpro(document):
|
|||||||
add_to_preamble(document, [preamble])
|
add_to_preamble(document, [preamble])
|
||||||
document.header[i] = "\\font_roman default"
|
document.header[i] = "\\font_roman default"
|
||||||
|
|
||||||
|
|
||||||
|
def revert_mathfonts(document):
|
||||||
|
" Revert native math font definitions to LaTeX "
|
||||||
|
|
||||||
|
i = find_token(document.header, "\\font_math", 0)
|
||||||
|
if i == -1:
|
||||||
|
return
|
||||||
|
if find_token(document.header, "\\use_non_tex_fonts false", 0) != -1:
|
||||||
|
val = get_value(document.header, "\\font_math", i)
|
||||||
|
if val == "eulervm":
|
||||||
|
add_to_preamble(document, "\\usepackage{eulervm}")
|
||||||
|
elif val == "default":
|
||||||
|
mathfont_dict = {
|
||||||
|
"lmodern": "\\renewcommand{\\rmdefault}{lmr}",
|
||||||
|
"minionpro": "\\usepackage[onlytext,lf]{MinionPro}",
|
||||||
|
"minionpro-osf": "\\usepackage[onlytext]{MinionPro}",
|
||||||
|
"palatino": "\\renewcommand{\\rmdefault}{ppl}",
|
||||||
|
"palatino-osf": "\\renewcommand{\\rmdefault}{pplj}",
|
||||||
|
"times": "\\renewcommand{\\rmdefault}{ptm}",
|
||||||
|
}
|
||||||
|
j = find_token(document.header, "\\font_roman", 0)
|
||||||
|
if j != -1:
|
||||||
|
rm = get_value(document.header, "\\font_roman", j)
|
||||||
|
k = find_token(document.header, "\\font_osf true", 0)
|
||||||
|
if k != -1:
|
||||||
|
rm += "-osf"
|
||||||
|
if rm in mathfont_dict.keys():
|
||||||
|
add_to_preamble(document, mathfont_dict[rm])
|
||||||
|
document.header[j] = "\\font_roman default"
|
||||||
|
if k != -1:
|
||||||
|
document.header[k] = "\\font_osf false"
|
||||||
|
del document.header[i]
|
||||||
|
|
||||||
##
|
##
|
||||||
# Conversion hub
|
# Conversion hub
|
||||||
#
|
#
|
||||||
@ -1035,10 +1068,12 @@ convert = [
|
|||||||
[436, []],
|
[436, []],
|
||||||
[437, []],
|
[437, []],
|
||||||
[438, []],
|
[438, []],
|
||||||
[439, []]
|
[439, []],
|
||||||
|
[440, []]
|
||||||
]
|
]
|
||||||
|
|
||||||
revert = [
|
revert = [
|
||||||
|
[439, [revert_mathfonts]],
|
||||||
[438, [revert_minionpro]],
|
[438, [revert_minionpro]],
|
||||||
[437, [revert_ipadeco, revert_ipachar]],
|
[437, [revert_ipadeco, revert_ipachar]],
|
||||||
[436, [revert_texgyre]],
|
[436, [revert_texgyre]],
|
||||||
|
@ -376,6 +376,7 @@ BufferParams::BufferParams()
|
|||||||
fonts_roman = "default";
|
fonts_roman = "default";
|
||||||
fonts_sans = "default";
|
fonts_sans = "default";
|
||||||
fonts_typewriter = "default";
|
fonts_typewriter = "default";
|
||||||
|
fonts_math = "auto";
|
||||||
fonts_default_family = "default";
|
fonts_default_family = "default";
|
||||||
useNonTeXFonts = false;
|
useNonTeXFonts = false;
|
||||||
fonts_expert_sc = false;
|
fonts_expert_sc = false;
|
||||||
@ -663,6 +664,9 @@ string BufferParams::readToken(Lexer & lex, string const & token,
|
|||||||
} else if (token == "\\font_typewriter") {
|
} else if (token == "\\font_typewriter") {
|
||||||
lex.eatLine();
|
lex.eatLine();
|
||||||
fonts_typewriter = lex.getString();
|
fonts_typewriter = lex.getString();
|
||||||
|
} else if (token == "\\font_math") {
|
||||||
|
lex.eatLine();
|
||||||
|
fonts_math = lex.getString();
|
||||||
} else if (token == "\\font_default_family") {
|
} else if (token == "\\font_default_family") {
|
||||||
lex >> fonts_default_family;
|
lex >> fonts_default_family;
|
||||||
} else if (token == "\\use_non_tex_fonts") {
|
} else if (token == "\\use_non_tex_fonts") {
|
||||||
@ -988,6 +992,7 @@ void BufferParams::writeFile(ostream & os) const
|
|||||||
<< "\n\\font_roman " << fonts_roman
|
<< "\n\\font_roman " << fonts_roman
|
||||||
<< "\n\\font_sans " << fonts_sans
|
<< "\n\\font_sans " << fonts_sans
|
||||||
<< "\n\\font_typewriter " << fonts_typewriter
|
<< "\n\\font_typewriter " << fonts_typewriter
|
||||||
|
<< "\n\\font_math " << fonts_math
|
||||||
<< "\n\\font_default_family " << fonts_default_family
|
<< "\n\\font_default_family " << fonts_default_family
|
||||||
<< "\n\\use_non_tex_fonts " << convert<string>(useNonTeXFonts)
|
<< "\n\\use_non_tex_fonts " << convert<string>(useNonTeXFonts)
|
||||||
<< "\n\\font_sc " << convert<string>(fonts_expert_sc)
|
<< "\n\\font_sc " << convert<string>(fonts_expert_sc)
|
||||||
@ -2776,10 +2781,9 @@ string const BufferParams::parseFontName(string const & name) const
|
|||||||
|
|
||||||
string const BufferParams::loadFonts(LaTeXFeatures & features) const
|
string const BufferParams::loadFonts(LaTeXFeatures & features) const
|
||||||
{
|
{
|
||||||
// TODO: separate math fonts.
|
|
||||||
|
|
||||||
if (fonts_roman == "default" && fonts_sans == "default"
|
if (fonts_roman == "default" && fonts_sans == "default"
|
||||||
&& fonts_typewriter == "default")
|
&& fonts_typewriter == "default"
|
||||||
|
&& (fonts_math == "default" || fonts_math == "auto"))
|
||||||
//nothing to do
|
//nothing to do
|
||||||
return string();
|
return string();
|
||||||
|
|
||||||
@ -2843,18 +2847,27 @@ string const BufferParams::loadFonts(LaTeXFeatures & features) const
|
|||||||
bool const ot1 = (font_encoding() == "default" || font_encoding() == "OT1");
|
bool const ot1 = (font_encoding() == "default" || font_encoding() == "OT1");
|
||||||
bool const dryrun = features.runparams().dryrun;
|
bool const dryrun = features.runparams().dryrun;
|
||||||
bool const complete = (fonts_sans == "default" && fonts_typewriter == "default");
|
bool const complete = (fonts_sans == "default" && fonts_typewriter == "default");
|
||||||
|
bool const nomath = (fonts_math == "default");
|
||||||
|
|
||||||
// ROMAN FONTS
|
// ROMAN FONTS
|
||||||
os << theLaTeXFonts().getLaTeXFont(from_ascii(fonts_roman)).getLaTeXCode(
|
os << theLaTeXFonts().getLaTeXFont(from_ascii(fonts_roman)).getLaTeXCode(
|
||||||
dryrun, ot1, complete, fonts_expert_sc, fonts_old_figures);
|
dryrun, ot1, complete, fonts_expert_sc, fonts_old_figures,
|
||||||
|
nomath);
|
||||||
|
|
||||||
// SANS SERIF
|
// SANS SERIF
|
||||||
os << theLaTeXFonts().getLaTeXFont(from_ascii(fonts_sans)).getLaTeXCode(
|
os << theLaTeXFonts().getLaTeXFont(from_ascii(fonts_sans)).getLaTeXCode(
|
||||||
dryrun, ot1, complete, fonts_expert_sc, fonts_old_figures, fonts_sans_scale);
|
dryrun, ot1, complete, fonts_expert_sc, fonts_old_figures,
|
||||||
|
nomath, fonts_sans_scale);
|
||||||
|
|
||||||
// MONOSPACED/TYPEWRITER
|
// MONOSPACED/TYPEWRITER
|
||||||
os << theLaTeXFonts().getLaTeXFont(from_ascii(fonts_typewriter)).getLaTeXCode(
|
os << theLaTeXFonts().getLaTeXFont(from_ascii(fonts_typewriter)).getLaTeXCode(
|
||||||
dryrun, ot1, complete, fonts_expert_sc, fonts_old_figures, fonts_typewriter_scale);
|
dryrun, ot1, complete, fonts_expert_sc, fonts_old_figures,
|
||||||
|
nomath, fonts_typewriter_scale);
|
||||||
|
|
||||||
|
// MATH
|
||||||
|
os << theLaTeXFonts().getLaTeXFont(from_ascii(fonts_math)).getLaTeXCode(
|
||||||
|
dryrun, ot1, complete, fonts_expert_sc, fonts_old_figures,
|
||||||
|
nomath);
|
||||||
|
|
||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
@ -248,6 +248,8 @@ public:
|
|||||||
std::string fonts_sans;
|
std::string fonts_sans;
|
||||||
/// the tt font
|
/// the tt font
|
||||||
std::string fonts_typewriter;
|
std::string fonts_typewriter;
|
||||||
|
/// the math font
|
||||||
|
std::string fonts_math;
|
||||||
/// the default family (rm, sf, tt)
|
/// the default family (rm, sf, tt)
|
||||||
std::string fonts_default_family;
|
std::string fonts_default_family;
|
||||||
/// use the fonts of the OS (OpenType, True Type) directly
|
/// use the fonts of the OS (OpenType, True Type) directly
|
||||||
|
@ -442,13 +442,20 @@ bool LaTeXFeatures::isProvided(string const & name) const
|
|||||||
|| params_.font_encoding() == "OT1");
|
|| params_.font_encoding() == "OT1");
|
||||||
bool const complete = (params_.fonts_sans == "default")
|
bool const complete = (params_.fonts_sans == "default")
|
||||||
&& (params_.fonts_typewriter == "default");
|
&& (params_.fonts_typewriter == "default");
|
||||||
|
bool const nomath = (params_.fonts_math == "default");
|
||||||
return params_.documentClass().provides(name)
|
return params_.documentClass().provides(name)
|
||||||
|| theLaTeXFonts().getLaTeXFont(
|
|| theLaTeXFonts().getLaTeXFont(
|
||||||
from_ascii(params_.fonts_roman)).provides(name, ot1, complete)
|
from_ascii(params_.fonts_roman)).provides(name, ot1,
|
||||||
|
complete,
|
||||||
|
nomath)
|
||||||
|| theLaTeXFonts().getLaTeXFont(
|
|| theLaTeXFonts().getLaTeXFont(
|
||||||
from_ascii(params_.fonts_sans)).provides(name, ot1, complete)
|
from_ascii(params_.fonts_sans)).provides(name, ot1,
|
||||||
|
complete,
|
||||||
|
nomath)
|
||||||
|| theLaTeXFonts().getLaTeXFont(
|
|| theLaTeXFonts().getLaTeXFont(
|
||||||
from_ascii(params_.fonts_typewriter)).provides(name, ot1, complete);
|
from_ascii(params_.fonts_typewriter)).provides(name, ot1,
|
||||||
|
complete,
|
||||||
|
nomath);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LaTeXFeatures::mustProvide(string const & name) const
|
bool LaTeXFeatures::mustProvide(string const & name) const
|
||||||
|
@ -40,11 +40,13 @@ LaTeXFont LaTeXFont::altFont(docstring const & name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool LaTeXFont::available(bool ot1)
|
bool LaTeXFont::available(bool ot1, bool nomath)
|
||||||
{
|
{
|
||||||
if (ot1 && !ot1font_.empty())
|
if (nomath && !nomathfont_.empty())
|
||||||
|
return altFont(nomathfont_).available(ot1, nomath);
|
||||||
|
else if (ot1 && !ot1font_.empty())
|
||||||
return (ot1font_ == "none") ?
|
return (ot1font_ == "none") ?
|
||||||
true : altFont(ot1font_).available(ot1);
|
true : altFont(ot1font_).available(ot1, nomath);
|
||||||
else if (requires_.empty() && package_.empty())
|
else if (requires_.empty() && package_.empty())
|
||||||
return true;
|
return true;
|
||||||
else if (!requires_.empty()
|
else if (!requires_.empty()
|
||||||
@ -55,7 +57,7 @@ bool LaTeXFont::available(bool ot1)
|
|||||||
return true;
|
return true;
|
||||||
else if (!altfonts_.empty()) {
|
else if (!altfonts_.empty()) {
|
||||||
for (size_t i = 0; i < altfonts_.size(); ++i) {
|
for (size_t i = 0; i < altfonts_.size(); ++i) {
|
||||||
if (altFont(altfonts_[i]).available(ot1))
|
if (altFont(altfonts_[i]).available(ot1, nomath))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -63,16 +65,29 @@ bool LaTeXFont::available(bool ot1)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool LaTeXFont::providesOSF(bool ot1, bool complete)
|
bool LaTeXFont::providesNoMath(bool ot1, bool complete)
|
||||||
{
|
{
|
||||||
docstring const usedfont = getUsedFont(ot1, complete);
|
docstring const usedfont = getUsedFont(ot1, complete, false);
|
||||||
|
|
||||||
if (usedfont.empty())
|
if (usedfont.empty())
|
||||||
return false;
|
return false;
|
||||||
else if (usedfont != name_)
|
else if (usedfont != name_)
|
||||||
return altFont(usedfont).providesOSF(ot1, complete);
|
return altFont(usedfont).providesNoMath(ot1, complete);
|
||||||
|
|
||||||
|
return (!nomathfont_.empty() && available(ot1, true));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool LaTeXFont::providesOSF(bool ot1, bool complete, bool nomath)
|
||||||
|
{
|
||||||
|
docstring const usedfont = getUsedFont(ot1, complete, nomath);
|
||||||
|
|
||||||
|
if (usedfont.empty())
|
||||||
|
return false;
|
||||||
|
else if (usedfont != name_)
|
||||||
|
return altFont(usedfont).providesOSF(ot1, complete, nomath);
|
||||||
else if (!osffont_.empty())
|
else if (!osffont_.empty())
|
||||||
return altFont(osffont_).available(ot1);
|
return altFont(osffont_).available(ot1, nomath);
|
||||||
else if (!package_.empty() && !LaTeXFeatures::isAvailable(to_ascii(package_)))
|
else if (!package_.empty() && !LaTeXFeatures::isAvailable(to_ascii(package_)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -80,14 +95,14 @@ bool LaTeXFont::providesOSF(bool ot1, bool complete)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool LaTeXFont::providesSC(bool ot1, bool complete)
|
bool LaTeXFont::providesSC(bool ot1, bool complete, bool nomath)
|
||||||
{
|
{
|
||||||
docstring const usedfont = getUsedFont(ot1, complete);
|
docstring const usedfont = getUsedFont(ot1, complete, nomath);
|
||||||
|
|
||||||
if (usedfont.empty())
|
if (usedfont.empty())
|
||||||
return false;
|
return false;
|
||||||
else if (usedfont != name_)
|
else if (usedfont != name_)
|
||||||
return altFont(usedfont).providesSC(ot1, complete);
|
return altFont(usedfont).providesSC(ot1, complete, nomath);
|
||||||
else if (!package_.empty() && !LaTeXFeatures::isAvailable(to_ascii(package_)))
|
else if (!package_.empty() && !LaTeXFeatures::isAvailable(to_ascii(package_)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -95,28 +110,28 @@ bool LaTeXFont::providesSC(bool ot1, bool complete)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool LaTeXFont::providesScale(bool ot1, bool complete)
|
bool LaTeXFont::providesScale(bool ot1, bool complete, bool nomath)
|
||||||
{
|
{
|
||||||
docstring const usedfont = getUsedFont(ot1, complete);
|
docstring const usedfont = getUsedFont(ot1, complete, nomath);
|
||||||
|
|
||||||
if (usedfont.empty())
|
if (usedfont.empty())
|
||||||
return false;
|
return false;
|
||||||
else if (usedfont != name_)
|
else if (usedfont != name_)
|
||||||
return altFont(usedfont).providesScale(ot1, complete);
|
return altFont(usedfont).providesScale(ot1, complete, nomath);
|
||||||
else if (!package_.empty() && !LaTeXFeatures::isAvailable(to_ascii(package_)))
|
else if (!package_.empty() && !LaTeXFeatures::isAvailable(to_ascii(package_)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return (!scaleoption_.empty());
|
return (!scaleoption_.empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LaTeXFont::provides(std::string const & name, bool ot1, bool complete)
|
bool LaTeXFont::provides(std::string const & name, bool ot1, bool complete, bool nomath)
|
||||||
{
|
{
|
||||||
docstring const usedfont = getUsedFont(ot1, complete);
|
docstring const usedfont = getUsedFont(ot1, complete, nomath);
|
||||||
|
|
||||||
if (usedfont.empty())
|
if (usedfont.empty())
|
||||||
return false;
|
return false;
|
||||||
else if (usedfont != name_)
|
else if (usedfont != name_)
|
||||||
return altFont(usedfont).provides(name, ot1, complete);
|
return altFont(usedfont).provides(name, ot1, complete, nomath);
|
||||||
else if (provides_.empty())
|
else if (provides_.empty())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -128,12 +143,14 @@ bool LaTeXFont::provides(std::string const & name, bool ot1, bool complete)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
docstring const LaTeXFont::getUsedFont(bool ot1, bool complete)
|
docstring const LaTeXFont::getUsedFont(bool ot1, bool complete, bool nomath)
|
||||||
{
|
{
|
||||||
if (ot1 && !ot1font_.empty())
|
if (nomath && !nomathfont_.empty() && available(ot1, true))
|
||||||
|
return nomathfont_;
|
||||||
|
else if (ot1 && !ot1font_.empty())
|
||||||
return (ot1font_ == "none") ? docstring() : ot1font_;
|
return (ot1font_ == "none") ? docstring() : ot1font_;
|
||||||
else if (family_ == "rm" && complete && !completefont_.empty()
|
else if (family_ == "rm" && complete && !completefont_.empty()
|
||||||
&& altFont(completefont_).available(ot1))
|
&& altFont(completefont_).available(ot1, nomath))
|
||||||
return completefont_;
|
return completefont_;
|
||||||
else if (switchdefault_) {
|
else if (switchdefault_) {
|
||||||
if (requires_.empty()
|
if (requires_.empty()
|
||||||
@ -150,8 +167,8 @@ docstring const LaTeXFont::getUsedFont(bool ot1, bool complete)
|
|||||||
else if (!altfonts_.empty()) {
|
else if (!altfonts_.empty()) {
|
||||||
for (size_t i = 0; i < altfonts_.size(); ++i) {
|
for (size_t i = 0; i < altfonts_.size(); ++i) {
|
||||||
LaTeXFont altf = altFont(altfonts_[i]);
|
LaTeXFont altf = altFont(altfonts_[i]);
|
||||||
if (altf.available(ot1))
|
if (altf.available(ot1, nomath))
|
||||||
return altf.getUsedFont(ot1, complete);
|
return altf.getUsedFont(ot1, complete, nomath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -183,12 +200,13 @@ string const LaTeXFont::getAvailablePackage(bool dryrun)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
string const LaTeXFont::getPackageOptions(bool ot1, bool complete, bool sc, bool osf, int scale)
|
string const LaTeXFont::getPackageOptions(bool ot1, bool complete, bool sc, bool osf,
|
||||||
|
int scale, bool nomath)
|
||||||
{
|
{
|
||||||
ostringstream os;
|
ostringstream os;
|
||||||
bool const needosfopt = (osf != osfdefault_);
|
bool const needosfopt = (osf != osfdefault_);
|
||||||
bool const has_osf = providesOSF(ot1, complete);
|
bool const has_osf = providesOSF(ot1, complete, nomath);
|
||||||
bool const has_sc = providesSC(ot1, complete);
|
bool const has_sc = providesSC(ot1, complete, nomath);
|
||||||
|
|
||||||
if (!packageoption_.empty())
|
if (!packageoption_.empty())
|
||||||
os << to_ascii(packageoption_);
|
os << to_ascii(packageoption_);
|
||||||
@ -212,7 +230,7 @@ string const LaTeXFont::getPackageOptions(bool ot1, bool complete, bool sc, bool
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (scale != 100 && !scaleoption_.empty()
|
if (scale != 100 && !scaleoption_.empty()
|
||||||
&& providesScale(ot1, complete)) {
|
&& providesScale(ot1, complete, nomath)) {
|
||||||
if (!os.str().empty())
|
if (!os.str().empty())
|
||||||
os << ',';
|
os << ',';
|
||||||
os << subst(to_ascii(scaleoption_), "$$val",
|
os << subst(to_ascii(scaleoption_), "$$val",
|
||||||
@ -223,22 +241,22 @@ string const LaTeXFont::getPackageOptions(bool ot1, bool complete, bool sc, bool
|
|||||||
|
|
||||||
|
|
||||||
string const LaTeXFont::getLaTeXCode(bool dryrun, bool ot1, bool complete, bool sc,
|
string const LaTeXFont::getLaTeXCode(bool dryrun, bool ot1, bool complete, bool sc,
|
||||||
bool osf, int const & scale)
|
bool osf, bool nomath, int const & scale)
|
||||||
{
|
{
|
||||||
ostringstream os;
|
ostringstream os;
|
||||||
|
|
||||||
docstring const usedfont = getUsedFont(ot1, complete);
|
docstring const usedfont = getUsedFont(ot1, complete, nomath);
|
||||||
if (usedfont.empty())
|
if (usedfont.empty())
|
||||||
return string();
|
return string();
|
||||||
else if (usedfont != name_)
|
else if (usedfont != name_)
|
||||||
return altFont(usedfont).getLaTeXCode(dryrun, ot1, complete, sc, osf, scale);
|
return altFont(usedfont).getLaTeXCode(dryrun, ot1, complete, sc, osf, nomath, scale);
|
||||||
|
|
||||||
if (switchdefault_) {
|
if (switchdefault_) {
|
||||||
if (family_.empty()) {
|
if (family_.empty()) {
|
||||||
LYXERR0("Error: Font `" << name_ << "' has no family defined!");
|
LYXERR0("Error: Font `" << name_ << "' has no family defined!");
|
||||||
return string();
|
return string();
|
||||||
}
|
}
|
||||||
if (available(ot1) || dryrun)
|
if (available(ot1, nomath) || dryrun)
|
||||||
os << "\\renewcommand{\\" << to_ascii(family_) << "default}{"
|
os << "\\renewcommand{\\" << to_ascii(family_) << "default}{"
|
||||||
<< to_ascii(name_) << "}\n";
|
<< to_ascii(name_) << "}\n";
|
||||||
else
|
else
|
||||||
@ -249,14 +267,14 @@ string const LaTeXFont::getLaTeXCode(bool dryrun, bool ot1, bool complete, bool
|
|||||||
} else {
|
} else {
|
||||||
string const package =
|
string const package =
|
||||||
getAvailablePackage(dryrun);
|
getAvailablePackage(dryrun);
|
||||||
string const packageopts = getPackageOptions(ot1, complete, sc, osf, scale);
|
string const packageopts = getPackageOptions(ot1, complete, sc, osf, scale, nomath);
|
||||||
if (packageopts.empty() && !package.empty())
|
if (packageopts.empty() && !package.empty())
|
||||||
os << "\\usepackage{" << package << "}\n";
|
os << "\\usepackage{" << package << "}\n";
|
||||||
else if (!packageopts.empty() && !package.empty())
|
else if (!packageopts.empty() && !package.empty())
|
||||||
os << "\\usepackage[" << packageopts << "]{" << package << "}\n";
|
os << "\\usepackage[" << packageopts << "]{" << package << "}\n";
|
||||||
}
|
}
|
||||||
if (osf && providesOSF(ot1, complete) && !osffont_.empty())
|
if (osf && providesOSF(ot1, complete, nomath) && !osffont_.empty())
|
||||||
os << altFont(osffont_).getLaTeXCode(dryrun, ot1, complete, sc, osf, scale);
|
os << altFont(osffont_).getLaTeXCode(dryrun, ot1, complete, sc, osf, nomath, scale);
|
||||||
|
|
||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
@ -270,6 +288,7 @@ bool LaTeXFont::readFont(Lexer & lex)
|
|||||||
LF_END,
|
LF_END,
|
||||||
LF_FAMILY,
|
LF_FAMILY,
|
||||||
LF_GUINAME,
|
LF_GUINAME,
|
||||||
|
LF_NOMATHFONT,
|
||||||
LF_OSFDEFAULT,
|
LF_OSFDEFAULT,
|
||||||
LF_OSFFONT,
|
LF_OSFFONT,
|
||||||
LF_OSFOPTION,
|
LF_OSFOPTION,
|
||||||
@ -291,6 +310,7 @@ bool LaTeXFont::readFont(Lexer & lex)
|
|||||||
{ "endfont", LF_END },
|
{ "endfont", LF_END },
|
||||||
{ "family", LF_FAMILY },
|
{ "family", LF_FAMILY },
|
||||||
{ "guiname", LF_GUINAME },
|
{ "guiname", LF_GUINAME },
|
||||||
|
{ "nomathfont", LF_NOMATHFONT },
|
||||||
{ "osfdefault", LF_OSFDEFAULT },
|
{ "osfdefault", LF_OSFDEFAULT },
|
||||||
{ "osffont", LF_OSFFONT },
|
{ "osffont", LF_OSFFONT },
|
||||||
{ "osfoption", LF_OSFOPTION },
|
{ "osfoption", LF_OSFOPTION },
|
||||||
@ -343,6 +363,9 @@ bool LaTeXFont::readFont(Lexer & lex)
|
|||||||
case LF_GUINAME:
|
case LF_GUINAME:
|
||||||
lex >> guiname_;
|
lex >> guiname_;
|
||||||
break;
|
break;
|
||||||
|
case LF_NOMATHFONT:
|
||||||
|
lex >> nomathfont_;
|
||||||
|
break;
|
||||||
case LF_OSFOPTION:
|
case LF_OSFOPTION:
|
||||||
lex >> osfoption_;
|
lex >> osfoption_;
|
||||||
break;
|
break;
|
||||||
@ -462,7 +485,7 @@ LaTeXFonts::TexFontMap LaTeXFonts::getLaTeXFonts()
|
|||||||
|
|
||||||
LaTeXFont LaTeXFonts::getLaTeXFont(docstring const & name)
|
LaTeXFont LaTeXFonts::getLaTeXFont(docstring const & name)
|
||||||
{
|
{
|
||||||
if (name == "default")
|
if (name == "default" || name == "auto")
|
||||||
return LaTeXFont();
|
return LaTeXFont();
|
||||||
if (texfontmap_.empty())
|
if (texfontmap_.empty())
|
||||||
readLaTeXFonts();
|
readLaTeXFonts();
|
||||||
@ -476,7 +499,7 @@ LaTeXFont LaTeXFonts::getLaTeXFont(docstring const & name)
|
|||||||
|
|
||||||
LaTeXFont LaTeXFonts::getAltFont(docstring const & name)
|
LaTeXFont LaTeXFonts::getAltFont(docstring const & name)
|
||||||
{
|
{
|
||||||
if (name == "default")
|
if (name == "default" || name == "auto")
|
||||||
return LaTeXFont();
|
return LaTeXFont();
|
||||||
if (texaltfontmap_.empty())
|
if (texaltfontmap_.empty())
|
||||||
readLaTeXFonts();
|
readLaTeXFonts();
|
||||||
|
@ -56,25 +56,28 @@ public:
|
|||||||
/// Alternative requirement to test for
|
/// Alternative requirement to test for
|
||||||
docstring const & requires() { return requires_; }
|
docstring const & requires() { return requires_; }
|
||||||
/// Does this font provide a given \p feature
|
/// Does this font provide a given \p feature
|
||||||
bool provides(std::string const & name, bool ot1, bool complete);
|
bool provides(std::string const & name, bool ot1,
|
||||||
|
bool complete, bool nomath);
|
||||||
/// Issue the familydefault switch
|
/// Issue the familydefault switch
|
||||||
bool switchdefault() const { return switchdefault_; }
|
bool switchdefault() const { return switchdefault_; }
|
||||||
/// Does the font provide Old Style Figures as default?
|
/// Does the font provide Old Style Figures as default?
|
||||||
bool osfDefault() const { return osfdefault_; }
|
bool osfDefault() const { return osfdefault_; }
|
||||||
/// Is this font available?
|
/// Is this font available?
|
||||||
bool available(bool ot1);
|
bool available(bool ot1, bool nomath);
|
||||||
|
/// Does this font provide an alternative without math?
|
||||||
|
bool providesNoMath(bool ot1, bool complete);
|
||||||
/// Does this font provide Old Style Figures?
|
/// Does this font provide Old Style Figures?
|
||||||
bool providesOSF(bool ot1, bool complete);
|
bool providesOSF(bool ot1, bool complete, bool nomath);
|
||||||
/// Does this font provide optional true SmallCaps?
|
/// Does this font provide optional true SmallCaps?
|
||||||
bool providesSC(bool ot1, bool complete);
|
bool providesSC(bool ot1, bool complete, bool nomath);
|
||||||
/// Does this font provide scaling?
|
/// Does this font provide scaling?
|
||||||
bool providesScale(bool ot1, bool complete);
|
bool providesScale(bool ot1, bool complete, bool nomath);
|
||||||
/// Return the LaTeX Code
|
/// Return the LaTeX Code
|
||||||
std::string const getLaTeXCode(bool dryrun, bool ot1, bool complete,
|
std::string const getLaTeXCode(bool dryrun, bool ot1, bool complete,
|
||||||
bool sc, bool osf,
|
bool sc, bool osf, bool nomath,
|
||||||
int const & scale = 100);
|
int const & scale = 100);
|
||||||
/// Return the actually used font
|
/// Return the actually used font
|
||||||
docstring const getUsedFont(bool ot1, bool complete);
|
docstring const getUsedFont(bool ot1, bool complete, bool nomath);
|
||||||
///
|
///
|
||||||
bool read(Lexer & lex);
|
bool read(Lexer & lex);
|
||||||
///
|
///
|
||||||
@ -87,7 +90,8 @@ private:
|
|||||||
bool complete,
|
bool complete,
|
||||||
bool sc,
|
bool sc,
|
||||||
bool osf,
|
bool osf,
|
||||||
int scale);
|
int scale,
|
||||||
|
bool nomath);
|
||||||
/// Return an alternative font
|
/// Return an alternative font
|
||||||
LaTeXFont altFont(docstring const & name);
|
LaTeXFont altFont(docstring const & name);
|
||||||
///
|
///
|
||||||
@ -103,6 +107,8 @@ private:
|
|||||||
///
|
///
|
||||||
docstring completefont_;
|
docstring completefont_;
|
||||||
///
|
///
|
||||||
|
docstring nomathfont_;
|
||||||
|
///
|
||||||
docstring ot1font_;
|
docstring ot1font_;
|
||||||
///
|
///
|
||||||
docstring osffont_;
|
docstring osffont_;
|
||||||
|
@ -168,6 +168,7 @@ vector<pair<string, QString> > pagestyles;
|
|||||||
QMap<QString, QString> rmfonts_;
|
QMap<QString, QString> rmfonts_;
|
||||||
QMap<QString, QString> sffonts_;
|
QMap<QString, QString> sffonts_;
|
||||||
QMap<QString, QString> ttfonts_;
|
QMap<QString, QString> ttfonts_;
|
||||||
|
QMap<QString, QString> mathfonts_;
|
||||||
|
|
||||||
|
|
||||||
} // anonymous namespace
|
} // anonymous namespace
|
||||||
@ -817,6 +818,10 @@ GuiDocument::GuiDocument(GuiView & lv)
|
|||||||
this, SLOT(change_adaptor()));
|
this, SLOT(change_adaptor()));
|
||||||
connect(fontModule->fontsTypewriterCO, SIGNAL(activated(int)),
|
connect(fontModule->fontsTypewriterCO, SIGNAL(activated(int)),
|
||||||
this, SLOT(ttChanged(int)));
|
this, SLOT(ttChanged(int)));
|
||||||
|
connect(fontModule->fontsMathCO, SIGNAL(activated(int)),
|
||||||
|
this, SLOT(change_adaptor()));
|
||||||
|
connect(fontModule->fontsMathCO, SIGNAL(activated(int)),
|
||||||
|
this, SLOT(mathFontChanged(int)));
|
||||||
connect(fontModule->fontsDefaultCO, SIGNAL(activated(int)),
|
connect(fontModule->fontsDefaultCO, SIGNAL(activated(int)),
|
||||||
this, SLOT(change_adaptor()));
|
this, SLOT(change_adaptor()));
|
||||||
connect(fontModule->fontencCO, SIGNAL(activated(int)),
|
connect(fontModule->fontencCO, SIGNAL(activated(int)),
|
||||||
@ -1773,6 +1778,8 @@ void GuiDocument::osFontsChanged(bool nontexfonts)
|
|||||||
|
|
||||||
fontModule->fontencLA->setEnabled(tex_fonts);
|
fontModule->fontencLA->setEnabled(tex_fonts);
|
||||||
fontModule->fontencCO->setEnabled(tex_fonts);
|
fontModule->fontencCO->setEnabled(tex_fonts);
|
||||||
|
fontModule->fontsMathCO->setEnabled(tex_fonts);
|
||||||
|
fontModule->fontsMathLA->setEnabled(tex_fonts);
|
||||||
if (!tex_fonts)
|
if (!tex_fonts)
|
||||||
fontModule->fontencLE->setEnabled(false);
|
fontModule->fontencLE->setEnabled(false);
|
||||||
else
|
else
|
||||||
@ -1780,6 +1787,12 @@ void GuiDocument::osFontsChanged(bool nontexfonts)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GuiDocument::mathFontChanged(int)
|
||||||
|
{
|
||||||
|
updateFontOptions();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void GuiDocument::updateFontOptions()
|
void GuiDocument::updateFontOptions()
|
||||||
{
|
{
|
||||||
bool const tex_fonts = !fontModule->osFontsCB->isChecked();
|
bool const tex_fonts = !fontModule->osFontsCB->isChecked();
|
||||||
@ -1801,6 +1814,7 @@ void GuiDocument::updateFontOptions()
|
|||||||
fontModule->fontsRomanCO->currentIndex()).toString();
|
fontModule->fontsRomanCO->currentIndex()).toString();
|
||||||
fontModule->fontScCB->setEnabled(providesSC(font));
|
fontModule->fontScCB->setEnabled(providesSC(font));
|
||||||
fontModule->fontOsfCB->setEnabled(providesOSF(font));
|
fontModule->fontOsfCB->setEnabled(providesOSF(font));
|
||||||
|
updateMathFonts(font);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1841,6 +1855,13 @@ bool GuiDocument::completeFontset() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool GuiDocument::noMathFont() const
|
||||||
|
{
|
||||||
|
return (fontModule->fontsMathCO->itemData(
|
||||||
|
fontModule->fontsMathCO->currentIndex()).toString() == "default");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void GuiDocument::updateTexFonts()
|
void GuiDocument::updateTexFonts()
|
||||||
{
|
{
|
||||||
LaTeXFonts::TexFontMap texfontmap = theLaTeXFonts().getLaTeXFonts();
|
LaTeXFonts::TexFontMap texfontmap = theLaTeXFonts().getLaTeXFonts();
|
||||||
@ -1855,7 +1876,7 @@ void GuiDocument::updateTexFonts()
|
|||||||
}
|
}
|
||||||
docstring const family = lf.family();
|
docstring const family = lf.family();
|
||||||
docstring guiname = translateIfPossible(lf.guiname());
|
docstring guiname = translateIfPossible(lf.guiname());
|
||||||
if (!lf.available(ot1()))
|
if (!lf.available(ot1(), noMathFont()))
|
||||||
guiname += _(" (not installed)");
|
guiname += _(" (not installed)");
|
||||||
if (family == "rm")
|
if (family == "rm")
|
||||||
rmfonts_.insert(toqstr(guiname), toqstr(it->first));
|
rmfonts_.insert(toqstr(guiname), toqstr(it->first));
|
||||||
@ -1863,6 +1884,8 @@ void GuiDocument::updateTexFonts()
|
|||||||
sffonts_.insert(toqstr(guiname), toqstr(it->first));
|
sffonts_.insert(toqstr(guiname), toqstr(it->first));
|
||||||
else if (family == "tt")
|
else if (family == "tt")
|
||||||
ttfonts_.insert(toqstr(guiname), toqstr(it->first));
|
ttfonts_.insert(toqstr(guiname), toqstr(it->first));
|
||||||
|
else if (family == "math")
|
||||||
|
mathfonts_.insert(toqstr(guiname), toqstr(it->first));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1872,6 +1895,7 @@ void GuiDocument::updateFontlist()
|
|||||||
fontModule->fontsRomanCO->clear();
|
fontModule->fontsRomanCO->clear();
|
||||||
fontModule->fontsSansCO->clear();
|
fontModule->fontsSansCO->clear();
|
||||||
fontModule->fontsTypewriterCO->clear();
|
fontModule->fontsTypewriterCO->clear();
|
||||||
|
fontModule->fontsMathCO->clear();
|
||||||
|
|
||||||
// With XeTeX, we have access to all system fonts, but not the LaTeX fonts
|
// With XeTeX, we have access to all system fonts, but not the LaTeX fonts
|
||||||
if (fontModule->osFontsCB->isChecked()) {
|
if (fontModule->osFontsCB->isChecked()) {
|
||||||
@ -1912,6 +1936,14 @@ void GuiDocument::updateFontlist()
|
|||||||
fontModule->fontsTypewriterCO->addItem(tti.key(), tti.value());
|
fontModule->fontsTypewriterCO->addItem(tti.key(), tti.value());
|
||||||
++tti;
|
++tti;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fontModule->fontsMathCO->addItem(qt_("Automatic"), QString("auto"));
|
||||||
|
fontModule->fontsMathCO->addItem(qt_("Class Default"), QString("default"));
|
||||||
|
QMap<QString, QString>::const_iterator mmi = mathfonts_.constBegin();
|
||||||
|
while (mmi != mathfonts_.constEnd()) {
|
||||||
|
fontModule->fontsMathCO->addItem(mmi.key(), mmi.value());
|
||||||
|
++mmi;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1925,6 +1957,24 @@ void GuiDocument::fontencChanged(int item)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GuiDocument::updateMathFonts(QString const & rm)
|
||||||
|
{
|
||||||
|
if (fontModule->osFontsCB->isChecked())
|
||||||
|
return;
|
||||||
|
QString const math =
|
||||||
|
fontModule->fontsMathCO->itemData(fontModule->fontsMathCO->currentIndex()).toString();
|
||||||
|
int const i = fontModule->fontsMathCO->findData("default");
|
||||||
|
if (providesNoMath(rm) && i == -1)
|
||||||
|
fontModule->fontsMathCO->insertItem(1, qt_("Class Default"), QString("default"));
|
||||||
|
else if (!providesNoMath(rm) && i != -1) {
|
||||||
|
int const c = fontModule->fontsMathCO->currentIndex();
|
||||||
|
fontModule->fontsMathCO->removeItem(i);
|
||||||
|
if (c == i)
|
||||||
|
fontModule->fontsMathCO->setCurrentIndex(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void GuiDocument::romanChanged(int item)
|
void GuiDocument::romanChanged(int item)
|
||||||
{
|
{
|
||||||
if (fontModule->osFontsCB->isChecked())
|
if (fontModule->osFontsCB->isChecked())
|
||||||
@ -1933,6 +1983,7 @@ void GuiDocument::romanChanged(int item)
|
|||||||
fontModule->fontsRomanCO->itemData(item).toString();
|
fontModule->fontsRomanCO->itemData(item).toString();
|
||||||
fontModule->fontScCB->setEnabled(providesSC(font));
|
fontModule->fontScCB->setEnabled(providesSC(font));
|
||||||
fontModule->fontOsfCB->setEnabled(providesOSF(font));
|
fontModule->fontOsfCB->setEnabled(providesOSF(font));
|
||||||
|
updateMathFonts(font);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2708,6 +2759,10 @@ void GuiDocument::applyView()
|
|||||||
fromqstr(fontModule->fontsTypewriterCO->
|
fromqstr(fontModule->fontsTypewriterCO->
|
||||||
itemData(fontModule->fontsTypewriterCO->currentIndex()).toString());
|
itemData(fontModule->fontsTypewriterCO->currentIndex()).toString());
|
||||||
|
|
||||||
|
bp_.fonts_math =
|
||||||
|
fromqstr(fontModule->fontsMathCO->
|
||||||
|
itemData(fontModule->fontsMathCO->currentIndex()).toString());
|
||||||
|
|
||||||
QString const fontenc =
|
QString const fontenc =
|
||||||
fontModule->fontencCO->itemData(fontModule->fontencCO->currentIndex()).toString();
|
fontModule->fontencCO->itemData(fontModule->fontencCO->currentIndex()).toString();
|
||||||
if (fontenc == "custom")
|
if (fontenc == "custom")
|
||||||
@ -3136,14 +3191,26 @@ void GuiDocument::paramsToDialog()
|
|||||||
}
|
}
|
||||||
fontModule->fontsTypewriterCO->setCurrentIndex(tpos);
|
fontModule->fontsTypewriterCO->setCurrentIndex(tpos);
|
||||||
|
|
||||||
|
font = toqstr(bp_.fonts_math);
|
||||||
|
int mpos = fontModule->fontsMathCO->findData(font);
|
||||||
|
if (mpos == -1) {
|
||||||
|
mpos = fontModule->fontsMathCO->count();
|
||||||
|
fontModule->fontsMathCO->addItem(font + qt_(" (not installed)"), font);
|
||||||
|
}
|
||||||
|
fontModule->fontsMathCO->setCurrentIndex(mpos);
|
||||||
|
|
||||||
if (bp_.useNonTeXFonts && os_fonts_available) {
|
if (bp_.useNonTeXFonts && os_fonts_available) {
|
||||||
fontModule->fontencLA->setEnabled(false);
|
fontModule->fontencLA->setEnabled(false);
|
||||||
fontModule->fontencCO->setEnabled(false);
|
fontModule->fontencCO->setEnabled(false);
|
||||||
fontModule->fontencLE->setEnabled(false);
|
fontModule->fontencLE->setEnabled(false);
|
||||||
|
fontModule->fontsMathCO->setEnabled(false);
|
||||||
|
fontModule->fontsMathLA->setEnabled(false);
|
||||||
} else {
|
} else {
|
||||||
fontModule->fontencLA->setEnabled(true);
|
fontModule->fontencLA->setEnabled(true);
|
||||||
fontModule->fontencCO->setEnabled(true);
|
fontModule->fontencCO->setEnabled(true);
|
||||||
fontModule->fontencLE->setEnabled(true);
|
fontModule->fontencLE->setEnabled(true);
|
||||||
|
fontModule->fontsMathCO->setEnabled(true);
|
||||||
|
fontModule->fontsMathLA->setEnabled(true);
|
||||||
romanChanged(rpos);
|
romanChanged(rpos);
|
||||||
sansChanged(spos);
|
sansChanged(spos);
|
||||||
ttChanged(tpos);
|
ttChanged(tpos);
|
||||||
@ -3632,7 +3699,9 @@ bool GuiDocument::providesOSF(QString const & font) const
|
|||||||
// have OSF support. But how?
|
// have OSF support. But how?
|
||||||
return true;
|
return true;
|
||||||
return theLaTeXFonts().getLaTeXFont(
|
return theLaTeXFonts().getLaTeXFont(
|
||||||
qstring_to_ucs4(font)).providesOSF(ot1(), completeFontset());
|
qstring_to_ucs4(font)).providesOSF(ot1(),
|
||||||
|
completeFontset(),
|
||||||
|
noMathFont());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -3641,7 +3710,9 @@ bool GuiDocument::providesSC(QString const & font) const
|
|||||||
if (fontModule->osFontsCB->isChecked())
|
if (fontModule->osFontsCB->isChecked())
|
||||||
return false;
|
return false;
|
||||||
return theLaTeXFonts().getLaTeXFont(
|
return theLaTeXFonts().getLaTeXFont(
|
||||||
qstring_to_ucs4(font)).providesSC(ot1(), completeFontset());
|
qstring_to_ucs4(font)).providesSC(ot1(),
|
||||||
|
completeFontset(),
|
||||||
|
noMathFont());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -3650,7 +3721,19 @@ bool GuiDocument::providesScale(QString const & font) const
|
|||||||
if (fontModule->osFontsCB->isChecked())
|
if (fontModule->osFontsCB->isChecked())
|
||||||
return true;
|
return true;
|
||||||
return theLaTeXFonts().getLaTeXFont(
|
return theLaTeXFonts().getLaTeXFont(
|
||||||
qstring_to_ucs4(font)).providesScale(ot1(), completeFontset());
|
qstring_to_ucs4(font)).providesScale(ot1(),
|
||||||
|
completeFontset(),
|
||||||
|
noMathFont());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool GuiDocument::providesNoMath(QString const & font) const
|
||||||
|
{
|
||||||
|
if (fontModule->osFontsCB->isChecked())
|
||||||
|
return false;
|
||||||
|
return theLaTeXFonts().getLaTeXFont(
|
||||||
|
qstring_to_ucs4(font)).providesNoMath(ot1(),
|
||||||
|
completeFontset());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -122,6 +122,7 @@ private Q_SLOTS:
|
|||||||
void deleteBoxBackgroundColor();
|
void deleteBoxBackgroundColor();
|
||||||
void languageChanged(int);
|
void languageChanged(int);
|
||||||
void osFontsChanged(bool);
|
void osFontsChanged(bool);
|
||||||
|
void mathFontChanged(int);
|
||||||
void branchesRename(docstring const &, docstring const &);
|
void branchesRename(docstring const &, docstring const &);
|
||||||
private:
|
private:
|
||||||
/// validate listings parameters and return an error message, if any
|
/// validate listings parameters and return an error message, if any
|
||||||
@ -234,6 +235,8 @@ private:
|
|||||||
bool providesSC(QString const & font) const;
|
bool providesSC(QString const & font) const;
|
||||||
/// does this font provide size adjustment?
|
/// does this font provide size adjustment?
|
||||||
bool providesScale(QString const & font) const;
|
bool providesScale(QString const & font) const;
|
||||||
|
/// does this font provide an alternative without math?
|
||||||
|
bool providesNoMath(QString const & font) const;
|
||||||
///
|
///
|
||||||
void executeBranchRenaming() const;
|
void executeBranchRenaming() const;
|
||||||
///
|
///
|
||||||
@ -246,12 +249,16 @@ private:
|
|||||||
///
|
///
|
||||||
void updateTexFonts();
|
void updateTexFonts();
|
||||||
///
|
///
|
||||||
|
void updateMathFonts(QString const & rm);
|
||||||
|
///
|
||||||
void updateFontOptions();
|
void updateFontOptions();
|
||||||
///
|
///
|
||||||
bool ot1() const;
|
bool ot1() const;
|
||||||
///
|
///
|
||||||
bool completeFontset() const;
|
bool completeFontset() const;
|
||||||
///
|
///
|
||||||
|
bool noMathFont() const;
|
||||||
|
///
|
||||||
BufferParams bp_;
|
BufferParams bp_;
|
||||||
/// List of names of available modules
|
/// List of names of available modules
|
||||||
std::list<modInfoStruct> moduleNames_;
|
std::list<modInfoStruct> moduleNames_;
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>FontUi</class>
|
<class>FontUi</class>
|
||||||
<widget class="QWidget" name="FontUi">
|
<widget class="QWidget" name="FontUi">
|
||||||
@ -23,7 +24,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="2" colspan="2">
|
<item row="0" column="2">
|
||||||
<spacer name="horizontalSpacer">
|
<spacer name="horizontalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
@ -53,7 +54,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="3">
|
<item row="1" column="2">
|
||||||
<widget class="QLabel" name="BaseSizeLA">
|
<widget class="QLabel" name="BaseSizeLA">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>&Base Size:</string>
|
<string>&Base Size:</string>
|
||||||
@ -63,7 +64,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="4">
|
<item row="1" column="3">
|
||||||
<widget class="QComboBox" name="fontsizeCO">
|
<widget class="QComboBox" name="fontsizeCO">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string/>
|
<string/>
|
||||||
@ -83,7 +84,7 @@
|
|||||||
<item row="2" column="1">
|
<item row="2" column="1">
|
||||||
<widget class="QComboBox" name="fontencCO"/>
|
<widget class="QComboBox" name="fontencCO"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="3" colspan="2">
|
<item row="2" column="2" colspan="2">
|
||||||
<widget class="QLineEdit" name="fontencLE">
|
<widget class="QLineEdit" name="fontencLE">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Specify the font encoding (e.g., T1).</string>
|
<string>Specify the font encoding (e.g., T1).</string>
|
||||||
@ -124,7 +125,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="3">
|
<item row="4" column="2">
|
||||||
<widget class="QLabel" name="scaleSansLA">
|
<widget class="QLabel" name="scaleSansLA">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>S&cale (%):</string>
|
<string>S&cale (%):</string>
|
||||||
@ -134,7 +135,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="4">
|
<item row="4" column="3">
|
||||||
<widget class="QSpinBox" name="scaleSansSB">
|
<widget class="QSpinBox" name="scaleSansSB">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Scale the Sans Serif font to match the base font's dimensions</string>
|
<string>Scale the Sans Serif font to match the base font's dimensions</string>
|
||||||
@ -164,7 +165,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="3">
|
<item row="5" column="2">
|
||||||
<widget class="QLabel" name="scaleTypewriterLA">
|
<widget class="QLabel" name="scaleTypewriterLA">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Sc&ale (%):</string>
|
<string>Sc&ale (%):</string>
|
||||||
@ -174,7 +175,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="4">
|
<item row="5" column="3">
|
||||||
<widget class="QSpinBox" name="scaleTypewriterSB">
|
<widget class="QSpinBox" name="scaleTypewriterSB">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Scale the Typewriter font to match the base font's dimensions</string>
|
<string>Scale the Typewriter font to match the base font's dimensions</string>
|
||||||
@ -188,6 +189,23 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="0">
|
<item row="6" column="0">
|
||||||
|
<widget class="QLabel" name="fontsMathLA">
|
||||||
|
<property name="text">
|
||||||
|
<string>&Math:</string>
|
||||||
|
</property>
|
||||||
|
<property name="buddy">
|
||||||
|
<cstring>fontsMathCO</cstring>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="6" column="1">
|
||||||
|
<widget class="QComboBox" name="fontsMathCO">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Select the math typeface</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="7" column="0">
|
||||||
<widget class="QLabel" name="cjkFontLA">
|
<widget class="QLabel" name="cjkFontLA">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>C&JK:</string>
|
<string>C&JK:</string>
|
||||||
@ -197,14 +215,14 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="1">
|
<item row="7" column="1">
|
||||||
<widget class="QLineEdit" name="cjkFontLE">
|
<widget class="QLineEdit" name="cjkFontLE">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Input the font to be used for Chinese, Japanese or Korean (CJK) script</string>
|
<string>Input the font to be used for Chinese, Japanese or Korean (CJK) script</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="7" column="1" colspan="2">
|
<item row="8" column="1">
|
||||||
<widget class="QCheckBox" name="fontScCB">
|
<widget class="QCheckBox" name="fontScCB">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Use a real small caps shape, if the font provides one</string>
|
<string>Use a real small caps shape, if the font provides one</string>
|
||||||
@ -214,7 +232,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="8" column="1" colspan="2">
|
<item row="9" column="1">
|
||||||
<widget class="QCheckBox" name="fontOsfCB">
|
<widget class="QCheckBox" name="fontOsfCB">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Use old style instead of lining figures</string>
|
<string>Use old style instead of lining figures</string>
|
||||||
@ -224,7 +242,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="9" column="1" colspan="2">
|
<item row="10" column="1">
|
||||||
<spacer name="verticalSpacer">
|
<spacer name="verticalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
|
@ -30,8 +30,8 @@ extern char const * const lyx_version_info;
|
|||||||
|
|
||||||
// Do not remove the comment below, so we get merge conflict in
|
// Do not remove the comment below, so we get merge conflict in
|
||||||
// independent branches. Instead add your own.
|
// independent branches. Instead add your own.
|
||||||
#define LYX_FORMAT_LYX 439 // spitz: support MinionPro LaTeX font
|
#define LYX_FORMAT_LYX 440 // spitz: basic UI for math (TeX) fonts
|
||||||
#define LYX_FORMAT_TEX2LYX 439 // spitz: support MinionPro LaTeX font
|
#define LYX_FORMAT_TEX2LYX 440 // spitz: basic UI for math (TeX) fonts
|
||||||
|
|
||||||
#if LYX_FORMAT_TEX2LYX != LYX_FORMAT_LYX
|
#if LYX_FORMAT_TEX2LYX != LYX_FORMAT_LYX
|
||||||
#ifndef _MSC_VER
|
#ifndef _MSC_VER
|
||||||
|
Loading…
Reference in New Issue
Block a user