From: José Matox Date: Tue, 15 May 2007 23:31:47 +0000 (+0000) Subject: Add file format change to support the standard font size for ext* family of textclasses X-Git-Tag: 1.6.10~9746 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=04e3cd2297661281114b321653f91a3c1a9781b4;p=features.git Add file format change to support the standard font size for ext* family of textclasses git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18358 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/development/FORMAT b/development/FORMAT index efecc7679d..67aa63101b 100644 --- a/development/FORMAT +++ b/development/FORMAT @@ -1,5 +1,8 @@ LyX file-format changes ----------------------- +2007-05-15 José Matos + * format incremented to 271: extended textclasses accept the + normal font sizes: 10, 11 and 12pt. 2007-05-14 Martin Vermeer * format incremented to 270: support beamer \alert, \structure diff --git a/lib/lyx2lyx/LyX.py b/lib/lyx2lyx/LyX.py index 090ad03c06..35d32ad73c 100644 --- a/lib/lyx2lyx/LyX.py +++ b/lib/lyx2lyx/LyX.py @@ -74,7 +74,7 @@ format_relation = [("0_06", [200], generate_minor_versions("0.6" , 4)), ("1_2", [220], generate_minor_versions("1.2" , 4)), ("1_3", [221], generate_minor_versions("1.3" , 7)), ("1_4", range(222,246), generate_minor_versions("1.4" , 4)), - ("1_5", range(246,271), generate_minor_versions("1.5" , 0))] + ("1_5", range(246,272), generate_minor_versions("1.5" , 0))] def formats_list(): diff --git a/lib/lyx2lyx/lyx_1_5.py b/lib/lyx2lyx/lyx_1_5.py index 9cbfc79d78..898b0b90e6 100644 --- a/lib/lyx2lyx/lyx_1_5.py +++ b/lib/lyx2lyx/lyx_1_5.py @@ -1601,6 +1601,62 @@ lstinputlisting{file}[opt] r'\end_inset'] +def revert_ext_font_sizes(document): + if document.backend != "latex": return + if not document.textclass.startswith("ext"): return + + fontsize = get_value(document.header, '\\paperfontsize', 0) + if fontsize not in ('10', '11', '12'): return + fontsize += 'pt' + + i = find_token(document.header, '\\paperfontsize', 0) + document.header[i] = '\\paperfontsize default' + + i = find_token(document.header, '\\options', 0) + if i == -1: + i = find_token(document.header, '\\textclass', 0) + 1 + document.header[i:i] = ['\\options %s' % fontsize] + else: + document.header[i] += ',%s' % fontsize + + +def convert_ext_font_sizes(document): + if document.backend != "latex": return + if not document.textclass.startswith("ext"): return + + fontsize = get_value(document.header, '\\paperfontsize', 0) + if fontsize != 'default': return + + i = find_token(document.header, '\\options', 0) + if i == -1: return + + options = get_value(document.header, '\\options', i) + + fontsizes = '10pt', '11pt', '12pt' + for fs in fontsizes: + if options.find(fs) != -1: + break + else: # this else will only be attained if the for cycle had no match + return + + options = options.split(',') + for j, opt in enumerate(options): + if opt in fontsizes: + fontsize = opt[:-2] + del options[j] + break + else: + return + + k = find_token(document.header, '\\paperfontsize', 0) + document.header[k] = '\\paperfontsize %s' % fontsize + + if options: + document.header[i] = '\\options %s' % ','.join(options) + else: + del document.header[i] + + ## # Conversion hub # @@ -1630,9 +1686,13 @@ convert = [[246, []], [267, []], [268, []], [269, []], - [270, []]] + [270, []], + [271, [convert_ext_font_sizes]] + ] -revert = [[269, [revert_beamer_alert, revert_beamer_structure]], +revert = [ + [270, [revert_ext_font_sizes]], + [269, [revert_beamer_alert, revert_beamer_structure]], [268, [revert_preamble_listings_params, revert_listings_inset, revert_include_listings]], [267, [revert_CJK]], [266, [revert_utf8plain]], diff --git a/src/Buffer.cpp b/src/Buffer.cpp index ee4275b5d1..3e60932d7e 100644 --- a/src/Buffer.cpp +++ b/src/Buffer.cpp @@ -3,7 +3,7 @@ * This file is part of LyX, the document processor. * Licence details can be found in the file COPYING. * - * \author Lars Gullik Bjønnes + * \author Lars Gullik Bjønnes * * Full author contact details are available in file CREDITS. */ @@ -141,7 +141,7 @@ using std::string; namespace { -int const LYX_FORMAT = 270; +int const LYX_FORMAT = 271; } // namespace anon