From b501845b2c3012b99fd7778f9aab8d7b5351eb92 Mon Sep 17 00:00:00 2001 From: Juergen Spitzmueller Date: Sat, 18 Aug 2012 14:45:41 +0200 Subject: [PATCH] Support for the mathdesign fonts (#6072) --- development/FORMAT | 4 ++ lib/chkconfig.ltx | 6 ++- lib/doc/LaTeXConfig.lyx | 109 +++++++++++++++++++++++++++++++++++++++- lib/latexfonts | 37 +++++++++++++- lib/lyx2lyx/lyx_2_1.py | 37 +++++++++++++- src/version.h | 4 +- 6 files changed, 188 insertions(+), 9 deletions(-) diff --git a/development/FORMAT b/development/FORMAT index 1df9ccfad3..e11e017ca0 100644 --- a/development/FORMAT +++ b/development/FORMAT @@ -11,6 +11,10 @@ adjustments are made to tex2lyx and bugs are fixed in lyx2lyx. ----------------------- +2012-08-18 Jürgen Spitzmüller + * Format incremented to 436 + Support for the mathdesign LaTeX fonts. + 2012-08-17 Jürgen Spitzmüller * Format incremented to 435 Support for the txtt LaTeX font. diff --git a/lib/chkconfig.ltx b/lib/chkconfig.ltx index c58f5797de..2e7c57b60a 100644 --- a/lib/chkconfig.ltx +++ b/lib/chkconfig.ltx @@ -362,6 +362,10 @@ \TestPackage{libertine} \TestPackage{lmodern} \TestPackage{luximono} +\TestPackage{mathdesign}% For Roman fonts +\TestPackage{mdbch} +\TestPackage{mdput} +\TestPackage{mdugm} \TestPackage{tipa} \TestPackage{tipx} \TestPackage{txfonts}% For the txtt monospaced font @@ -381,7 +385,7 @@ %\TestPackage{txfonts}% But see above! %\TestPackage{pxfonts} %\TestPackage{mathabx} -%\TestPackage{mathdesign} +%\TestPackage{mathdesign}% But see above! %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/lib/doc/LaTeXConfig.lyx b/lib/doc/LaTeXConfig.lyx index 9fa79879a6..42b702f5d6 100644 --- a/lib/doc/LaTeXConfig.lyx +++ b/lib/doc/LaTeXConfig.lyx @@ -1,5 +1,5 @@ #LyX 2.1 created this file. For more info see http://www.lyx.org/ -\lyxformat 435 +\lyxformat 436 \begin_document \begin_header \textclass article @@ -617,6 +617,110 @@ libertine(-legacy) serif families of fonts. \end_layout +\begin_layout Subsection +Mathdesign +\end_layout + +\begin_layout Description +Found: +\begin_inset Info +type "package" +arg "mathdesign" +\end_inset + + +\end_layout + +\begin_layout Description +CTAN: +\family typewriter +fonts/mathdesign/ +\end_layout + +\begin_layout Description +Notes: The +\family sans +mathdesign +\family default + package provides access to three popular roman fonts and extends them with + matching math fonts. + If you select one of the following roman fonts in LyX via +\family sans +\size normal +Layout\SpecialChar \menuseparator +Document\SpecialChar \menuseparator +Fonts +\family default +\size default +, the +\family sans +mathdesign +\family default + package and thus the respective math fonts is automatically loaded: +\end_layout + +\begin_layout Itemize + +\family sans +Adobe Garamond (Mathdesign) +\family default +. + +\series bold +Found: +\series default + +\begin_inset Info +type "package" +arg "mdugm" +\end_inset + + +\end_layout + +\begin_layout Itemize + +\family sans +Bitstream Charter (Mathdesign) +\family default +. + +\series bold +Found: +\series default + +\begin_inset Info +type "package" +arg "mdbch" +\end_inset + + +\end_layout + +\begin_layout Itemize + +\family sans +Utopia (Mathdesign) +\family default +. + +\series bold +Found: +\series default + +\begin_inset Info +type "package" +arg "mdput" +\end_inset + + +\end_layout + +\begin_layout Standard +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 psnfss \end_layout @@ -652,7 +756,8 @@ psnfss fonts in \family sans \size normal -Layout->Document +Layout\SpecialChar \menuseparator +Document \family default \size default . diff --git a/lib/latexfonts b/lib/latexfonts index 681831d186..12f5a2c05e 100644 --- a/lib/latexfonts +++ b/lib/latexfonts @@ -93,7 +93,7 @@ Font chancery EndFont Font charter - GuiName "Bitstream Charter" + GuiName "Bitstream Charter (PSNFSS)" Family rm Package charter EndFont @@ -118,6 +118,39 @@ Font lmodern Package lmodern EndFont +Font mdbch + GuiName "Bitstream Charter (Mathdesign)" + Family rm + OsfOption expert + ScOption expert + OsfScOption expert + Package mathdesign + PackageOption charter + Requires mdbch +EndFont + +Font mdput + GuiName "Utopia (Mathdesign)" + Family rm + OsfOption expert + ScOption expert + OsfScOption expert + Package mathdesign + PackageOption utopia + Requires mdput +EndFont + +Font mdugm + GuiName "Adobe Garamond (Mathdesign)" + Family rm + OsfOption expert + ScOption expert + OsfScOption expert + Package mathdesign + PackageOption garamond + Requires mdugm +EndFont + Font newcent GuiName "New Century Schoolbook" Family rm @@ -146,7 +179,7 @@ EndFont # fourier supersedes utopia.sty, but does # not work with OT1 encoding. Font utopia - GuiName "Utopia" + GuiName "Utopia (Fourier)" Family rm OsfOption oldstyle ScOption expert diff --git a/lib/lyx2lyx/lyx_2_1.py b/lib/lyx2lyx/lyx_2_1.py index 86e03851f6..713e227faf 100644 --- a/lib/lyx2lyx/lyx_2_1.py +++ b/lib/lyx2lyx/lyx_2_1.py @@ -838,10 +838,10 @@ def revert_libertine(document): preamble = "\\usepackage" if osf: preamble += "[osf]" + document.header[j] = "\\font_osf false" preamble += "{libertine}" add_to_preamble(document, [preamble]) document.header[i] = "\\font_roman default" - document.header[j] = "\\font_osf false" def revert_txtt(document): @@ -855,6 +855,37 @@ def revert_txtt(document): document.header[i] = "\\font_typewriter default" +def revert_mathdesign(document): + " Revert native mathdesign font definition to LaTeX " + + if find_token(document.header, "\\use_non_tex_fonts false", 0) != -1: + mathdesign_dict = { + "mdbch": "charter", + "mdput": "utopia", + "mdugm": "garamond" + } + i = find_token(document.header, "\\font_roman", 0) + if i == -1: + return + val = get_value(document.header, "\\font_roman", i) + if val in mathdesign_dict.keys(): + preamble = "\\usepackage[%s" % mathdesign_dict[val] + expert = False + j = find_token(document.header, "\\font_osf true", 0) + if j != -1: + expert = True + document.header[j] = "\\font_osf false" + l = find_token(document.header, "\\font_sc true", 0) + if l != -1: + expert = True + document.header[l] = "\\font_sc false" + if expert: + preamble += ",expert" + preamble += "]{mathdesign}" + add_to_preamble(document, [preamble]) + document.header[i] = "\\font_roman default" + + ## # Conversion hub # @@ -882,10 +913,12 @@ convert = [ [432, []], [433, [convert_armenian]], [434, []], - [435, []] + [435, []], + [436, []] ] revert = [ + [434, [revert_mathdesign]], [434, [revert_txtt]], [433, [revert_libertine]], [432, [revert_armenian]], diff --git a/src/version.h b/src/version.h index 06cd46d99f..1948ddbd83 100644 --- a/src/version.h +++ b/src/version.h @@ -30,8 +30,8 @@ extern char const * const lyx_version_info; // Do not remove the comment below, so we get merge conflict in // independent branches. Instead add your own. -#define LYX_FORMAT_LYX 435 // spitz: support for the txtt font -#define LYX_FORMAT_TEX2LYX 435 // spitz: support for the txtt font +#define LYX_FORMAT_LYX 436 // spitz: support for the mathdesign fonts +#define LYX_FORMAT_TEX2LYX 436 // spitz: support for the mathdesign fonts #if LYX_FORMAT_TEX2LYX != LYX_FORMAT_LYX #ifndef _MSC_VER