From 1c668318257da2ac217d8292e9f7ad88dc7a107e Mon Sep 17 00:00:00 2001 From: Richard Heck Date: Sat, 12 Dec 2015 13:19:41 -0500 Subject: [PATCH] Fix a couple minor issues noticed by tests. --- lib/lyx2lyx/lyx_2_0.py | 9 ++++----- lib/lyx2lyx/lyx_2_1.py | 6 +++++- lib/lyx2lyx/lyx_2_2.py | 9 ++++++--- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/lib/lyx2lyx/lyx_2_0.py b/lib/lyx2lyx/lyx_2_0.py index 7914cc4995..9b237c92e6 100644 --- a/lib/lyx2lyx/lyx_2_0.py +++ b/lib/lyx2lyx/lyx_2_0.py @@ -2394,13 +2394,12 @@ def revert_script(document): def convert_use_xetex(document): " convert \\use_xetex to \\use_non_tex_fonts " - i = 0 i = find_token(document.header, "\\use_xetex", 0) if i == -1: - return - - val = get_value(document.header, "\\use_xetex", 0) - document.header[i] = "\\use_non_tex_fonts " + val + document.header.insert(-1, "\\use_non_tex_fonts 0") + else: + val = get_value(document.header, "\\use_xetex", 0) + document.header[i] = "\\use_non_tex_fonts " + val def revert_use_xetex(document): diff --git a/lib/lyx2lyx/lyx_2_1.py b/lib/lyx2lyx/lyx_2_1.py index c71f04667c..a61f9e995c 100644 --- a/lib/lyx2lyx/lyx_2_1.py +++ b/lib/lyx2lyx/lyx_2_1.py @@ -1440,6 +1440,10 @@ def revert_mdnomath(document): document.header[i] = "\\font_roman %s" % mathdesign_dict[val] +def convert_mathfonts(document): + document.header.insert(-1, "\\font_math auto") + + def convert_mdnomath(document): " Change mathdesign font name " @@ -4826,7 +4830,7 @@ convert = [ [437, []], [438, []], [439, []], - [440, []], + [440, [convert_mathfonts]], [441, [convert_mdnomath]], [442, []], [443, []], diff --git a/lib/lyx2lyx/lyx_2_2.py b/lib/lyx2lyx/lyx_2_2.py index c4121c1342..130011e16e 100644 --- a/lib/lyx2lyx/lyx_2_2.py +++ b/lib/lyx2lyx/lyx_2_2.py @@ -2010,9 +2010,12 @@ def convert_fontsettings(document): i = find_token(document.header, f + " ", 0) if i == -1: document.warning("Malformed LyX document: No " + f + "!") - j = j + 1 - continue - value = document.header[i][len(f):].strip() + # we can fix that + # note that with i = -1, this will insert at the end + # of the header + value = fontdefaults[j] + else: + value = document.header[i][len(f):].strip() if fontquotes[j]: if use_non_tex_fonts == "true": document.header[i:i+1] = [f + ' "' + fontdefaults[j] + '" "' + value + '"']