commit 0a2e65c0e17fd3682c07c267deee1297404dadc9
Author: Juergen Spitzmueller <sp...@lyx.org>
Date:   Tue Sep 17 18:26:55 2024 +0200

    Do not output empty statement in lyx2lyx reversion
---
 lib/lyx2lyx/lyx_2_4.py | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/lib/lyx2lyx/lyx_2_4.py b/lib/lyx2lyx/lyx_2_4.py
index baa214c9a7..763e2b86f8 100644
--- a/lib/lyx2lyx/lyx_2_4.py
+++ b/lib/lyx2lyx/lyx_2_4.py
@@ -2564,24 +2564,31 @@ def revert_babelfont(document):
     # set preamble stuff
     pretext = ['%% This document must be processed with xelatex or lualatex!']
     pretext.append('\\AtBeginDocument{%')
+    have_appends = False
     if roman != "default":
         pretext.append('\\babelfont{rm}[Mapping=tex-text]{' + roman + '}')
+        have_appends = True
     if sans != "default":
         sf = '\\babelfont{sf}['
         if sf_scale != 100.0:
             sf += 'Scale=' + str(sf_scale / 100.0) + ','
         sf += 'Mapping=tex-text]{' + sans + '}'
         pretext.append(sf)
+        have_appends = True
     if typew != "default":
         tw = '\\babelfont{tt}'
         if tt_scale != 100.0:
             tw += '[Scale=' + str(tt_scale / 100.0) + ']'
         tw += '{' + typew + '}'
         pretext.append(tw)
+        have_appends = True
     if osf:
         pretext.append('\\defaultfontfeatures{Numbers=OldStyle}')
-    pretext.append('}')
-    insert_to_preamble(document, pretext)
+        have_appends = True
+
+    if have_appends:
+        pretext.append('}')
+        insert_to_preamble(document, pretext)
 
 
 def revert_minionpro(document):
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to