From 9f61c8d4af02df1f56dfadfad296fb09d20ee40c Mon Sep 17 00:00:00 2001 From: Juergen Spitzmueller Date: Tue, 6 Aug 2019 19:29:18 +0200 Subject: [PATCH] Add more fontsizes to KOMA classes. Theoretically, KOMA supports any font size. We add a sensible range. --- development/FORMAT | 4 +++- lib/layouts/scrclass.inc | 4 +++- lib/lyx2lyx/lyx_2_4.py | 36 ++++++++++++++++++++++++++++++++++-- 3 files changed, 40 insertions(+), 4 deletions(-) diff --git a/development/FORMAT b/development/FORMAT index b6ca416932..4bf18da61e 100644 --- a/development/FORMAT +++ b/development/FORMAT @@ -8,7 +8,9 @@ changes happened in particular if possible. A good example would be ----------------------- 2019-08-06 Jürgen Spitzmüller - * Format incremented to 585: Add more page sizes to KOMA and memoir. + * Format incremented to 585: + - Add more page sizes to KOMA and memoir. + - Add more font sizes to KOMA. 2019-07-26 Joel Kulesza * Format incremented to 584: support for revision InsetInfo addition of diff --git a/lib/layouts/scrclass.inc b/lib/layouts/scrclass.inc index ab64f2d24b..55003610ac 100644 --- a/lib/layouts/scrclass.inc +++ b/lib/layouts/scrclass.inc @@ -8,13 +8,15 @@ # Labeling is now used also in non-KOMA classes -Format 77 +Format 78 SecNumDepth 2 TocDepth 2 DefaultStyle Standard Provides subscript 1 ClassOptions + FontSize 9|10|11|12|13|14|15|16|17|18|19|20 + FontSizeFormat fontsize=$$s PageSize a0paper|a1paper|a2paper|a3paper|a4paper|a5paper|a6paper|b0paper|b1paper|b2paper|b3paper|b4paper|b5paper|b6paper|c0paper|c1paper|c2paper|c3paper|c4paper|c5paper|c6paper|executivepaper|legalpaper|letterpaper End diff --git a/lib/lyx2lyx/lyx_2_4.py b/lib/lyx2lyx/lyx_2_4.py index 1f47342407..47311b67c7 100644 --- a/lib/lyx2lyx/lyx_2_4.py +++ b/lib/lyx2lyx/lyx_2_4.py @@ -3160,7 +3160,7 @@ def revert_pagesizes(document): def convert_pagesizes(document): " Convert to new page sizes in memoir and KOMA to options " - if document.textclass != "memoir" and document.textclass[:2] != "scr": + if document.textclass != "memoir" and document.textclass[:3] != "scr": return i = find_token(document.header, "\\use_geometry true", 0) @@ -3183,6 +3183,38 @@ def convert_pagesizes(document): # Maintain use of geometry document.header[1] = "\\use_geometry true" +def revert_komafontsizes(document): + " Revert new font sizes in KOMA to options " + + if document.textclass[:3] != "scr": + return + + i = find_token(document.header, "\\paperfontsize", 0) + if i == -1: + document.warning("Malformed LyX document! Missing \\paperfontsize header.") + return + + defsizes = ["default", "10", "11", "12"] + + val = get_value(document.header, "\\paperfontsize", i) + if val in defsizes: + # nothing to do + return + + document.header[i] = "\\paperfontsize default" + + fsize = "fontsize=" + val + + i = find_token(document.header, "\\options", 0) + if i == -1: + i = find_token(document.header, "\\textclass", 0) + if i == -1: + document.warning("Malformed LyX document! Missing \\textclass header.") + return + document.header.insert(i, "\\options " + fsize) + return + document.header[i] = document.header[i] + "," + fsize + ## @@ -3234,7 +3266,7 @@ convert = [ [585, [convert_pagesizes]] ] -revert = [[584, [revert_pagesizes]], +revert = [[584, [revert_pagesizes,revert_komafontsizes]], [583, [revert_vcsinfo_rev_abbrev]], [582, [revert_ChivoFont,revert_CrimsonProFont]], [581, [revert_CantarellFont,revert_FiraFont]],