Do not output empty statement in lyx2lyx reversion

This commit is contained in:
Juergen Spitzmueller 2024-09-17 18:26:55 +02:00
parent 2c5f284f89
commit 0a2e65c0e1

View File

@ -2564,22 +2564,29 @@ 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}')
have_appends = True
if have_appends:
pretext.append('}')
insert_to_preamble(document, pretext)