mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 05:16:21 +00:00
ctests: Dedicated test and comments for "lyx2lyx.lyx_2_4.revert_fonts".
This commit is contained in:
parent
c2db448ff5
commit
8060c8e488
179
autotests/export/lyx2lyx/lyx_2_4_test.lyx
Normal file
179
autotests/export/lyx2lyx/lyx_2_4_test.lyx
Normal file
@ -0,0 +1,179 @@
|
||||
#LyX 2.4 created this file. For more info see https://www.lyx.org/
|
||||
\lyxformat 566
|
||||
\begin_document
|
||||
\begin_header
|
||||
\save_transient_properties true
|
||||
\origin unavailable
|
||||
\textclass article
|
||||
\use_default_options true
|
||||
\maintain_unincluded_children false
|
||||
\language english
|
||||
\language_package default
|
||||
\inputencoding auto
|
||||
\fontencoding auto
|
||||
\font_roman "IBMPlexSerif" "Century Schoolbook L"
|
||||
\font_sans "DejaVuSans" "DejaVu Sans"
|
||||
\font_typewriter "DejaVuSansMono" "Courier 10 Pitch"
|
||||
\font_math "auto" "auto"
|
||||
\font_default_family default
|
||||
\use_non_tex_fonts false
|
||||
\font_sc false
|
||||
\font_osf false
|
||||
\font_sf_scale 100 100
|
||||
\font_tt_scale 100 100
|
||||
\use_microtype false
|
||||
\use_dash_ligatures false
|
||||
\graphics default
|
||||
\default_output_format default
|
||||
\output_sync 0
|
||||
\bibtex_command default
|
||||
\index_command default
|
||||
\float_placement class
|
||||
\float_alignment class
|
||||
\paperfontsize default
|
||||
\spacing single
|
||||
\use_hyperref false
|
||||
\papersize default
|
||||
\use_geometry false
|
||||
\use_package amsmath 1
|
||||
\use_package amssymb 1
|
||||
\use_package cancel 1
|
||||
\use_package esint 1
|
||||
\use_package mathdots 1
|
||||
\use_package mathtools 1
|
||||
\use_package mhchem 1
|
||||
\use_package stackrel 1
|
||||
\use_package stmaryrd 1
|
||||
\use_package undertilde 1
|
||||
\cite_engine basic
|
||||
\cite_engine_type default
|
||||
\biblio_style plain
|
||||
\use_bibtopic false
|
||||
\use_indices false
|
||||
\paperorientation portrait
|
||||
\suppress_date false
|
||||
\justification true
|
||||
\use_refstyle 1
|
||||
\use_minted 0
|
||||
\index Index
|
||||
\shortcut idx
|
||||
\color #008000
|
||||
\end_index
|
||||
\secnumdepth 3
|
||||
\tocdepth 3
|
||||
\paragraph_separation indent
|
||||
\paragraph_indentation default
|
||||
\is_math_indent 0
|
||||
\math_numbering_side default
|
||||
\quotes_style english
|
||||
\dynamic_quotes 0
|
||||
\papercolumns 1
|
||||
\papersides 1
|
||||
\paperpagestyle default
|
||||
\tracking_changes false
|
||||
\output_changes false
|
||||
\html_math_output 0
|
||||
\html_css_as_file 0
|
||||
\html_be_strict false
|
||||
\end_header
|
||||
|
||||
\begin_body
|
||||
|
||||
\begin_layout Description
|
||||
Font
|
||||
\begin_inset space ~
|
||||
\end_inset
|
||||
|
||||
conversion:
|
||||
\end_layout
|
||||
|
||||
\begin_deeper
|
||||
\begin_layout Standard
|
||||
With
|
||||
\begin_inset Quotes eld
|
||||
\end_inset
|
||||
|
||||
DejaVu .*
|
||||
\begin_inset Quotes erd
|
||||
\end_inset
|
||||
|
||||
or
|
||||
\begin_inset Quotes eld
|
||||
\end_inset
|
||||
|
||||
IBM Plex .*
|
||||
\begin_inset Quotes erd
|
||||
\end_inset
|
||||
|
||||
as TeX font,
|
||||
\begin_inset Quotes eld
|
||||
\end_inset
|
||||
|
||||
use-non-TeX fonts
|
||||
\begin_inset Quotes erd
|
||||
\end_inset
|
||||
|
||||
|
||||
\begin_inset Quotes eld
|
||||
\end_inset
|
||||
|
||||
false
|
||||
\begin_inset Quotes erd
|
||||
\end_inset
|
||||
|
||||
, and configured non-TeX fonts:
|
||||
\end_layout
|
||||
|
||||
\begin_layout Itemize
|
||||
back conversion calls
|
||||
\begin_inset Quotes eld
|
||||
\end_inset
|
||||
|
||||
revert_latexFonts
|
||||
\begin_inset Quotes erd
|
||||
\end_inset
|
||||
|
||||
, which calls
|
||||
\begin_inset Quotes eld
|
||||
\end_inset
|
||||
|
||||
revert_fonts
|
||||
\begin_inset Quotes erd
|
||||
\end_inset
|
||||
|
||||
, which
|
||||
\end_layout
|
||||
|
||||
\begin_layout Itemize
|
||||
ignored Quotes around a configured
|
||||
\begin_inset Quotes eld
|
||||
\end_inset
|
||||
|
||||
non-TeX font
|
||||
\begin_inset Quotes erd
|
||||
\end_inset
|
||||
|
||||
and
|
||||
\end_layout
|
||||
|
||||
\begin_layout Itemize
|
||||
stripped the part after the space in the
|
||||
\begin_inset Quotes eld
|
||||
\end_inset
|
||||
|
||||
non-TeX font
|
||||
\begin_inset Quotes erd
|
||||
\end_inset
|
||||
|
||||
name
|
||||
\end_layout
|
||||
|
||||
\begin_layout Standard
|
||||
\paragraph_spacing single
|
||||
leading to a corrupt file.
|
||||
Fixed in [c2091bec/lyxgit].
|
||||
\end_layout
|
||||
|
||||
\end_deeper
|
||||
\end_body
|
||||
\end_document
|
@ -60,10 +60,6 @@ export/export/latex/iconv-error-nomenclature_pdf2
|
||||
check_load/templates/acmart
|
||||
export/templates/acmart_lyx23
|
||||
|
||||
# lyx2lyx generates an invalid file when forward-converting a file with
|
||||
# whitespace in the "non-tex font" setting:
|
||||
export/examples/ja/multilingual_lyx.*
|
||||
|
||||
# Failing LyX2LyX conversions for old versions:
|
||||
#
|
||||
# "beamer" lyx2lyx fails sometimes for versions < 2.1
|
||||
|
@ -219,9 +219,9 @@ def convert_fonts(document, fm):
|
||||
j = find_token(document.header, ft, 0)
|
||||
if j != -1:
|
||||
val = get_value(document.header, ft, j)
|
||||
vals = val.split()
|
||||
vals[0] = '"' + fn + '"'
|
||||
document.header[j] = ft + ' ' + ' '.join(vals)
|
||||
words = val.split() # ! splits also values like '"DejaVu Sans"'
|
||||
words[0] = '"' + fn + '"'
|
||||
document.header[j] = ft + ' ' + ' '.join(words)
|
||||
|
||||
def revert_fonts(document, fm, fontmap):
|
||||
" Revert native font definition to LaTeX "
|
||||
@ -243,8 +243,8 @@ def revert_fonts(document, fm, fontmap):
|
||||
continue
|
||||
ft = mo.group(1) # 'roman', 'sans', 'typewriter', 'math'
|
||||
val = get_value(document.header, ft, i)
|
||||
words = val.split()
|
||||
font = words[0].replace('"', '')
|
||||
words = val.split(' ') # ! splits also values like '"DejaVu Sans"'
|
||||
font = words[0].strip('"') # TeX font name has no whitespace
|
||||
if not font in fm.font2pkgmap:
|
||||
i += 1
|
||||
continue
|
||||
@ -253,7 +253,7 @@ def revert_fonts(document, fm, fontmap):
|
||||
if not val in fontmap:
|
||||
fontmap[val] = []
|
||||
words[0] = '"default"'
|
||||
document.header[i] = ft + ' ' + ' '.join(words)
|
||||
document.header[i] = ft + ' ' + ' '.join(words)
|
||||
if fontinfo.scaleopt != None:
|
||||
xval = get_value(document.header, "\\font_" + fontinfo.scaletype + "_scale", 0)
|
||||
mo = rscales.search(xval)
|
||||
@ -600,7 +600,7 @@ def revert_floatalignment(document):
|
||||
alcmd = put_cmd_in_ert("\\raggedleft{}")
|
||||
if len(alcmd) > 0:
|
||||
document.body[l+1:l+1] = alcmd
|
||||
i += 1
|
||||
i += 1
|
||||
|
||||
|
||||
def revert_tuftecite(document):
|
||||
@ -730,7 +730,7 @@ def revert_vcolumns(document):
|
||||
if vval != "":
|
||||
needarray = True
|
||||
vval += "V{\\linewidth}"
|
||||
|
||||
|
||||
document.body[col_line] = document.body[col_line][:-1] + " special=\"" + vval + "\">"
|
||||
# ERT newlines and linebreaks (since LyX < 2.4 automatically inserts parboxes
|
||||
# with newlines, and we do not want that)
|
||||
@ -776,7 +776,7 @@ def revert_bibencoding(document):
|
||||
if engine in ["biblatex", "biblatex-natbib"]:
|
||||
biblatex = True
|
||||
|
||||
# Map lyx to latex encoding names
|
||||
# Map lyx to latex encoding names
|
||||
encodings = {
|
||||
"utf8" : "utf8",
|
||||
"utf8x" : "utf8x",
|
||||
@ -1328,7 +1328,7 @@ def revert_l7ninfo(document):
|
||||
continue
|
||||
arg = find_token(document.body, 'arg', i, j)
|
||||
argv = get_quoted_value(document.body, "arg", arg)
|
||||
# remove trailing colons, menu accelerator (|...) and qt accelerator (&), while keeping literal " & "
|
||||
# remove trailing colons, menu accelerator (|...) and qt accelerator (&), while keeping literal " & "
|
||||
argv = argv.rstrip(':').split('|')[0].replace(" & ", "</amp;>").replace("&", "").replace("</amp;>", " & ")
|
||||
document.body[i : j+1] = argv
|
||||
i = i + 1
|
||||
|
Loading…
Reference in New Issue
Block a user