From 336cb70ae2a4945c95da8da792b846ad4b13659e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Spitzm=C3=BCller?= Date: Wed, 8 Apr 2009 08:07:42 +0000 Subject: [PATCH] * lyx_2_0.py: fix xetex routine. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@29150 a592a061-630c-0410-9148-cb99ea01b6c8 --- lib/lyx2lyx/lyx_2_0.py | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/lib/lyx2lyx/lyx_2_0.py b/lib/lyx2lyx/lyx_2_0.py index ec4f979bb0..fd0eabd518 100644 --- a/lib/lyx2lyx/lyx_2_0.py +++ b/lib/lyx2lyx/lyx_2_0.py @@ -200,6 +200,10 @@ def revert_xetex(document): " Reverts documents that use XeTeX " i = find_token(document.header, '\\use_xetex', 0) if i == -1: + document.warning("Malformed LyX document: Missing \\use_xetex.") + return + if get_value(document.header, "\\use_xetex", i) == 'false': + del document.header[i] return del document.header[i] # 1.) set doc encoding to utf8-plain @@ -235,17 +239,22 @@ def revert_xetex(document): # 3.) set preamble stuff pretext = '%% This document must be processed with xelatex!\n' pretext += '\\usepackage{fontspec}\n' - pretext += '\\setmainfont[Mapping=tex-text]{' + roman + '}\n' - pretext += '\\setsansfont[' - if sf_scale != 100: - pretext += 'Scale=' + str(sf_scale / 100) + ',' - pretext += 'Mapping=tex-text]{' + sans + '}\n' - pretext += '\\setmonofont' - if tt_scale != 100: - pretext += '[Scale=' + str(tt_scale / 100) + ']' - pretext += '{' + typewriter + '}\n' + if roman != "default": + pretext += '\\setmainfont[Mapping=tex-text]{' + roman + '}\n' + if sans != "default": + pretext += '\\setsansfont[' + if sf_scale != 100: + pretext += 'Scale=' + str(sf_scale / 100) + ',' + pretext += 'Mapping=tex-text]{' + sans + '}\n' + if typewriter != "default": + pretext += '\\setmonofont' + if tt_scale != 100: + pretext += '[Scale=' + str(tt_scale / 100) + ']' + pretext += '{' + typewriter + '}\n' if osf: pretext += '\\defaultfontfeatures{Numbers=OldStyle}\n' + pretext += '\usepackage{xunicode}\n' + pretext += '\usepackage{xltxtra}\n' insert_to_preamble(0, document, pretext) # 4.) reset font settings i = find_token(document.header, "\\font_roman", 0)