-----------------------
2019-08-06 Jürgen Spitzmüller <spitz@lyx.org>
- * 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 <jkulesza@gmail.com>
* Format incremented to 584: support for revision InsetInfo addition of
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)
# 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
+
##
[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]],