Support for the Minion Pro LaTeX font

This commit is contained in:
Juergen Spitzmueller 2012-09-19 17:46:55 +02:00
parent f4261030e2
commit e9ca6b6bf4
8 changed files with 89 additions and 8 deletions

View File

@ -11,6 +11,11 @@ adjustments are made to tex2lyx and bugs are fixed in lyx2lyx.
-----------------------
2012-09-19 Jürgen Spitzmüller <spitz@lyx.org>
* Format incremented to 439
Support for the MinionPro LaTeX font.
2012-08-23 Jürgen Spitzmüller <spitz@lyx.org>
* Format incremented to 438
Support for some IPA macros that are not unicoded.

View File

@ -366,6 +366,7 @@
\TestPackage{mdbch}
\TestPackage{mdput}
\TestPackage{mdugm}
\TestPackage{MinionPro}
\TestPackage{tgadventor}
\TestPackage{tgbonum}
\TestPackage{tgchorus}

View File

@ -1,5 +1,5 @@
#LyX 2.1 created this file. For more info see http://www.lyx.org/
\lyxformat 437
\lyxformat 438
\begin_document
\begin_header
\textclass article
@ -604,7 +604,7 @@ arg "libertine"
\begin_layout Description
CTAN:
\family sans
\family typewriter
fonts/libertine-legacy/
\end_layout
@ -721,6 +721,36 @@ If you only want the text fonts and retain LaTeX's default math font, select
a non-mathdesign variant of the respective font instead.
\end_layout
\begin_layout Subsection
MinionPro
\end_layout
\begin_layout Description
Found:
\begin_inset Info
type "package"
arg "MinionPro"
\end_inset
\end_layout
\begin_layout Description
CTAN:
\family typewriter
fonts/minionpro
\end_layout
\begin_layout Description
Notes: The
\family sans
MinionPro
\family default
package provides support for the Minion Pro font.
Note that the font itself is not part of the package and must be installed
separately (please consult the MinionPro package manual for details).
\end_layout
\begin_layout Subsection
psnfss
\end_layout

View File

@ -15,6 +15,7 @@
# CompletePackage <alternative package for the complete family>
# PackageOptions <general options to be passed to the package>
# OsfOption <option for oldstyle figure support>
# OsfDefault <0|1>
# ScOption <option for true smallcaps support>
# OsfScOption <option for combined osf and true smallcaps support>
# ScaleOption <option for font scaling>
@ -51,6 +52,9 @@
# f. ex. to load "bera" as opposed to "beraserif").
# * OsfScOption overrides any OsfOption and ScOption if both features
# are selected.
# * Set OsfDefault to true for fonts which have Old Style Figures by
# default and provide an option for lining figures. Pass this option
# to OsfOption.
# * ScaleOption supports the placeholder $$val for the scale value.
#
##########################################################################
@ -155,6 +159,15 @@ Font mdugm
Provides amssymb,amsfonts
EndFont
Font minionpro
GuiName "Minion Pro"
Family rm
OsfOption lf
OsfDefault 1
Package MinionPro
Provides amssymb,amsfonts
EndFont
Font newcent
GuiName "New Century Schoolbook"
Family rm

View File

@ -985,6 +985,25 @@ def revert_ipachar(document):
add_to_preamble(document, "\\usepackage{tone}")
def revert_minionpro(document):
" Revert native MinionPro font definition to LaTeX "
if find_token(document.header, "\\use_non_tex_fonts false", 0) != -1:
i = find_token(document.header, "\\font_roman minionpro", 0)
if i != -1:
osf = False
j = find_token(document.header, "\\font_osf true", 0)
if j != -1:
osf = True
preamble = "\\usepackage"
if osf:
document.header[j] = "\\font_osf false"
else:
preamble += "[lf]"
preamble += "{MinionPro}"
add_to_preamble(document, [preamble])
document.header[i] = "\\font_roman default"
##
# Conversion hub
#
@ -1015,10 +1034,12 @@ convert = [
[435, []],
[436, []],
[437, []],
[438, []]
[438, []],
[439, []]
]
revert = [
[438, [revert_minionpro]],
[437, [revert_ipadeco, revert_ipachar]],
[436, [revert_texgyre]],
[435, [revert_mathdesign]],

View File

@ -139,16 +139,17 @@ string const LaTeXFont::getPackageOptions(bool ot1, bool sc, bool osf, int scale
return string();
ostringstream os;
bool const needosfopt = (osf != osfdefault_);
if (!packageoption_.empty())
os << to_ascii(packageoption_);
if (sc && osf && providesOSF() && providesSC()) {
if (sc && needosfopt && providesOSF() && providesSC()) {
if (!os.str().empty())
os << ',';
if (!osfscoption_.empty())
os << to_ascii(osfscoption_);
else
os << to_ascii(osfoption_) << ',' << to_ascii(scoption_);
} else if (osf && providesOSF()) {
} else if (needosfopt && providesOSF()) {
if (!os.str().empty())
os << ',';
os << to_ascii(osfoption_);
@ -211,6 +212,7 @@ bool LaTeXFont::readFont(Lexer & lex)
LF_END,
LF_FAMILY,
LF_GUINAME,
LF_OSFDEFAULT,
LF_OSFOPTION,
LF_OSFPACKAGE,
LF_OSFSCOPTION,
@ -231,6 +233,7 @@ bool LaTeXFont::readFont(Lexer & lex)
{ "endfont", LF_END },
{ "family", LF_FAMILY },
{ "guiname", LF_GUINAME },
{ "osfdefault", LF_OSFDEFAULT },
{ "osfoption", LF_OSFOPTION },
{ "osfpackage", LF_OSFPACKAGE },
{ "osfscoption", LF_OSFSCOPTION },
@ -288,6 +291,9 @@ bool LaTeXFont::readFont(Lexer & lex)
case LF_OSFPACKAGE:
lex >> osfpackage_;
break;
case LF_OSFDEFAULT:
lex >> osfdefault_;
break;
case LF_OSFSCOPTION:
lex >> osfscoption_;
break;
@ -332,6 +338,7 @@ bool LaTeXFont::readFont(Lexer & lex)
bool LaTeXFont::read(Lexer & lex)
{
switchdefault_ = 0;
osfdefault_ = 0;
if (!lex.next()) {
lex.printError("No name given for LaTeX font: `$$Token'.");

View File

@ -59,6 +59,8 @@ public:
bool provides(std::string const & name) const;
/// Issue the familydefault switch
bool switchdefault() const { return switchdefault_; }
/// Does the font provide Old Style Figures as default?
bool osfDefault() const { return osfdefault_; }
/// Is this font available?
bool available(bool ot1 = false) const;
/// Does this font provide Old Style Figures?
@ -117,6 +119,8 @@ private:
///
docstring requires_;
///
bool osfdefault_;
///
bool switchdefault_;
///
bool available_;

View File

@ -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 438 // spitz: support IPA macros
#define LYX_FORMAT_TEX2LYX 438 // spitz: support for IPA macros
#define LYX_FORMAT_LYX 439 // spitz: support MinionPro LaTeX font
#define LYX_FORMAT_TEX2LYX 439 // spitz: support MinionPro LaTeX font
#if LYX_FORMAT_TEX2LYX != LYX_FORMAT_LYX
#ifndef _MSC_VER