From 5170489b983c08c8be8d878996710eb0f6db2679 Mon Sep 17 00:00:00 2001 From: Juergen Spitzmueller Date: Sun, 23 Sep 2012 12:30:19 +0200 Subject: [PATCH] More no-math fonts For the sake of completeness, it is now also possible to load fourier and the mathdesign fonts without changing the default math font. --- development/FORMAT | 7 +++++- lib/latexfonts | 46 +++++++++++++++++++++++++++++++++++---- lib/lyx2lyx/lyx_2_1.py | 49 +++++++++++++++++++++++++++++++++++++++++- src/version.h | 4 ++-- 4 files changed, 98 insertions(+), 8 deletions(-) diff --git a/development/FORMAT b/development/FORMAT index 5b4e68c4e8..2de4974716 100644 --- a/development/FORMAT +++ b/development/FORMAT @@ -11,9 +11,14 @@ adjustments are made to tex2lyx and bugs are fixed in lyx2lyx. ----------------------- +2012-09-23 Jürgen Spitzmüller + * Format incremented to 441: + - rename fonts: mdbch > md-charter, mdput > md-utopia, mdugm > md-garamond + - add support for the mathdesign fonts without loading mathfonts + (via \renewcommand{\rmfamily}{mdbch|mdput|mdugm} 2012-09-22 Jürgen Spitzmüller - * Format incremented to 440 + * Format incremented to 440: Math (TeX) font UI. New Buffer param "\math_font ", supported values are: diff --git a/lib/latexfonts b/lib/latexfonts index 60f5402d6d..9a89739254 100644 --- a/lib/latexfonts +++ b/lib/latexfonts @@ -160,7 +160,7 @@ AltFont lmr Requires lmodern EndFont -Font mdbch +Font md-charter GuiName "Bitstream Charter (Mathdesign)" Family rm OsfOption expert @@ -170,9 +170,17 @@ Font mdbch PackageOption charter Requires mdbch Provides amssymb,amsfonts + NoMathFont mdbch EndFont -Font mdput +AltFont mdbch + GuiName "Bitstream Charter (Mathdesign)" + Family rm + SwitchDefault 1 + Requires mdbch +EndFont + +Font md-utopia GuiName "Utopia (Mathdesign)" Family rm OsfOption expert @@ -182,9 +190,17 @@ Font mdput PackageOption utopia Requires mdput Provides amssymb,amsfonts + NoMathFont mdput EndFont -Font mdugm +AltFont mdput + GuiName "Utopia (Mathdesign)" + Family rm + SwitchDefault 1 + Requires mdput +EndFont + +Font md-garamond GuiName "Adobe Garamond (Mathdesign)" Family rm OsfOption expert @@ -194,6 +210,14 @@ Font mdugm PackageOption garamond Requires mdugm Provides amssymb,amsfonts + NoMathFont mdugm +EndFont + +AltFont mdugm + GuiName "Adobe Garamond (Mathdesign)" + Family rm + SwitchDefault 1 + Requires mdugm EndFont Font minionpro @@ -327,6 +351,7 @@ Font utopia Package fourier AltFonts utopia-sty OT1Font utopia-sty + NoMathFont futs EndFont AltFont utopia-sty @@ -335,6 +360,19 @@ AltFont utopia-sty Package utopia EndFont +AltFont futs + GuiName "Utopia (Fourier)" + Family rm + SwitchDefault 1 + OsfFont futj +EndFont + +AltFont futj + GuiName "Utopia (Fourier)" + Family rm + SwitchDefault 1 +EndFont + # # SANS SERIF FONTS @@ -463,4 +501,4 @@ Font eulervm GuiName "Euler VM" Family math Package eulervm -EndFont \ No newline at end of file +EndFont diff --git a/lib/lyx2lyx/lyx_2_1.py b/lib/lyx2lyx/lyx_2_1.py index ed54c16197..b1c82f5c06 100644 --- a/lib/lyx2lyx/lyx_2_1.py +++ b/lib/lyx2lyx/lyx_2_1.py @@ -1023,6 +1023,8 @@ def revert_mathfonts(document): "palatino": "\\renewcommand{\\rmdefault}{ppl}", "palatino-osf": "\\renewcommand{\\rmdefault}{pplj}", "times": "\\renewcommand{\\rmdefault}{ptm}", + "utopia": "\\renewcommand{\\rmdefault}{futs}", + "utopia-osf": "\\renewcommand{\\rmdefault}{futj}", } j = find_token(document.header, "\\font_roman", 0) if j != -1: @@ -1037,6 +1039,49 @@ def revert_mathfonts(document): document.header[k] = "\\font_osf false" del document.header[i] + +def revert_mdnomath(document): + " Revert mathdesign and fourier without math " + + if find_token(document.header, "\\use_non_tex_fonts false", 0) != -1: + mathdesign_dict = { + "md-charter": "mdbch", + "md-utopia": "mdput", + "md-garamond": "mdugm" + } + 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(): + j = find_token(document.header, "\\font_math", 0) + if j == -1: + document.header[i] = "\\font_roman %s" % mathdesign_dict[val] + mval = get_value(document.header, "\\font_math", j) + if mval == "default": + document.header[i] = "\\font_roman default" + add_to_preamble(document, "\\renewcommand{\\rmdefault}{%s}" % mathdesign_dict[val]) + else: + document.header[i] = "\\font_roman %s" % mathdesign_dict[val] + + +def convert_mdnomath(document): + " Change mathdesign font name " + + if find_token(document.header, "\\use_non_tex_fonts false", 0) != -1: + mathdesign_dict = { + "mdbch": "md-charter", + "mdput": "md-utopia", + "mdugm": "md-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(): + document.header[i] = "\\font_roman %s" % mathdesign_dict[val] + + ## # Conversion hub # @@ -1069,10 +1114,12 @@ convert = [ [437, []], [438, []], [439, []], - [440, []] + [440, []], + [441, [convert_mdnomath]] ] revert = [ + [440, [revert_mdnomath]], [439, [revert_mathfonts]], [438, [revert_minionpro]], [437, [revert_ipadeco, revert_ipachar]], diff --git a/src/version.h b/src/version.h index 42dcffec6b..9fbc5e3fd3 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 440 // spitz: basic UI for math (TeX) fonts -#define LYX_FORMAT_TEX2LYX 440 // spitz: basic UI for math (TeX) fonts +#define LYX_FORMAT_LYX 441 // spitz: mathdesign tex font changes +#define LYX_FORMAT_TEX2LYX 441 // spitz: mathdesign tex font changes #if LYX_FORMAT_TEX2LYX != LYX_FORMAT_LYX #ifndef _MSC_VER