On 12/14/2015 03:48 PM, Georg Baum wrote: > Jean-Marc Lasgouttes wrote: > >> Le 13/12/2015 17:10, Richard Heck a écrit : >>> On 12/13/2015 04:28 AM, Georg Baum wrote: >>>> Richard Heck wrote: >>>> >>>>> Patch. >>>> Why is font_math not required? In current master it is always written, >>>> and if this was not required in former versions, then there should be >>>> some lyx2lyx step to add it (like for \use_xetex). The other change >>>> looks good. >>> I can do it the other way, i.e., have it added in lyx2lyx. But the >>> lyx2lyx code does not otherwise seem to demand it. Nor does LyX itself, >>> which will default to "auto" if it's not set. > OK, I was not aware of that when I wrote the lyx2lyx code. > >> I think we try to avoid relying on default values, because they may >> change. > Indeed. Actually I do not care very much, so skipping the warning in lyx2lyx > would be fine with me as well, but if this is done, then it should be done > for all font settings, since they are all optional in LyX.
I guess I agree with JMarc in the end: It should have been set explicitly in the conversion to 440. This is easy enough to do. New patch attached. OK? Richard
>From e4439fbc13d2a0fff8696a30ebba997bc81c4037 Mon Sep 17 00:00:00 2001 From: Richard Heck <rgh...@lyx.org> 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 7914cc4..9b237c9 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 c71f046..a61f9e9 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 c4121c1..130011e 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 + '"'] -- 2.1.0