Allow defaultfamily change with non_TeX fonts (#12608)

This commit is contained in:
Juergen Spitzmueller 2022-12-11 14:46:10 +01:00
parent c59634b8c7
commit 163844a6d0
24 changed files with 52 additions and 32 deletions

View File

@ -7,6 +7,9 @@ changes happened in particular if possible. A good example would be
-----------------------
2022-12-11 Jürgen Spitzmüller <spitz@lyx.org>
* Format incremented to 613: Support \\fonts_default_family for non-TeX fonts.
2022-12-04 Daniel Ramöller <d.lyx@web.de>
* Format incremented to 612: Implement support for starred crossref commands (with
hyperref) which suppress links:

View File

@ -4540,6 +4540,7 @@ def revert_index_macros(document):
def revert_starred_refs(document):
" Revert starred refs "
i = find_token(document.header, "\\use_hyperref true", 0)
use_hyperref = (i != -1)
i = 0
@ -4604,6 +4605,7 @@ def revert_starred_refs(document):
def convert_starred_refs(document):
" Convert inset index macros "
i = 0
while True:
i = find_token(document.body, "\\begin_inset CommandInset ref", i)
@ -4617,7 +4619,25 @@ def convert_starred_refs(document):
newlineat = end - 2
document.body.insert(newlineat, "nolink \"false\"")
i = end + 1
def revert_familydefault(document):
" Revert \\font_default_family for non-TeX fonts "
if find_token(document.header, "\\use_non_tex_fonts true", 0) == -1:
return
i = find_token(document.header, "\\font_default_family", 0)
if i == -1:
document.warning("Malformed LyX document: Can't find \\font_default_family header")
return
dfamily = get_value(document.header, "\\font_default_family", i)
if dfamily == "default":
return
document.header[i] = "\\font_default_family default"
add_to_preamble(document, ["\\renewcommand{\\familydefault}{\\" + dfamily + "}"])
##
# Conversion hub
@ -4692,10 +4712,12 @@ convert = [
[609, []],
[610, []],
[611, []],
[612, [convert_starred_refs]]
[612, [convert_starred_refs]],
[613, []]
]
revert = [[611, [revert_starred_refs]],
revert = [[612, [revert_familydefault]],
[611, [revert_starred_refs]],
[610, []],
[609, [revert_index_macros]],
[608, [revert_document_metadata]],

View File

@ -2448,8 +2448,6 @@ void GuiDocument::osFontsChanged(bool nontexfonts)
langModule->encodingCO->setEnabled(tex_fonts);
inputencodingToDialog();
fontModule->fontsDefaultCO->setEnabled(tex_fonts);
fontModule->fontsDefaultLA->setEnabled(tex_fonts);
fontModule->cjkFontLE->setEnabled(tex_fonts);
fontModule->cjkFontLA->setEnabled(tex_fonts);
@ -3864,11 +3862,8 @@ void GuiDocument::applyView()
bp_.fonts_sans_osf = fontModule->fontSansOsfCB->isChecked();
bp_.fonts_typewriter_osf = fontModule->fontTypewriterOsfCB->isChecked();
if (nontexfonts)
bp_.fonts_default_family = "default";
else
bp_.fonts_default_family = GuiDocument::fontfamilies[
fontModule->fontsDefaultCO->currentIndex()];
bp_.fonts_default_family = GuiDocument::fontfamilies[
fontModule->fontsDefaultCO->currentIndex()];
if (fontModule->fontsizeCO->currentIndex() == 0)
bp_.fontsize = "default";

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.4
\lyxformat 612
\lyxformat 613
\begin_document
\begin_header
\save_transient_properties true

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.4
\lyxformat 612
\lyxformat 613
\begin_document
\begin_header
\save_transient_properties true

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.4
\lyxformat 612
\lyxformat 613
\begin_document
\begin_header
\save_transient_properties true

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.4
\lyxformat 612
\lyxformat 613
\begin_document
\begin_header
\save_transient_properties true

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.4
\lyxformat 612
\lyxformat 613
\begin_document
\begin_header
\save_transient_properties true

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.4
\lyxformat 612
\lyxformat 613
\begin_document
\begin_header
\save_transient_properties true

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.4
\lyxformat 612
\lyxformat 613
\begin_document
\begin_header
\save_transient_properties true

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.4
\lyxformat 612
\lyxformat 613
\begin_document
\begin_header
\save_transient_properties true

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.4
\lyxformat 612
\lyxformat 613
\begin_document
\begin_header
\save_transient_properties true

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.4
\lyxformat 612
\lyxformat 613
\begin_document
\begin_header
\save_transient_properties true

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.4
\lyxformat 612
\lyxformat 613
\begin_document
\begin_header
\save_transient_properties true

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.4
\lyxformat 612
\lyxformat 613
\begin_document
\begin_header
\save_transient_properties true

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.4
\lyxformat 612
\lyxformat 613
\begin_document
\begin_header
\save_transient_properties true

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.4
\lyxformat 612
\lyxformat 613
\begin_document
\begin_header
\save_transient_properties true

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.4
\lyxformat 612
\lyxformat 613
\begin_document
\begin_header
\save_transient_properties true

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.4
\lyxformat 612
\lyxformat 613
\begin_document
\begin_header
\save_transient_properties true

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.4
\lyxformat 612
\lyxformat 613
\begin_document
\begin_header
\save_transient_properties true

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.4
\lyxformat 612
\lyxformat 613
\begin_document
\begin_header
\save_transient_properties true

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.4
\lyxformat 612
\lyxformat 613
\begin_document
\begin_header
\save_transient_properties true

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.4
\lyxformat 612
\lyxformat 613
\begin_document
\begin_header
\save_transient_properties true

View File

@ -32,8 +32,8 @@ extern char const * const lyx_version_info;
// Do not remove the comment below, so we get merge conflict in
// independent branches. Instead add your own.
#define LYX_FORMAT_LYX 612 // RKH & DR: Starred cross-references
#define LYX_FORMAT_TEX2LYX 612
#define LYX_FORMAT_LYX 613 // spitz: \defaultfamily for non-TeX fonts
#define LYX_FORMAT_TEX2LYX 613
#if LYX_FORMAT_TEX2LYX != LYX_FORMAT_LYX
#ifndef _MSC_VER