mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 10:00:33 +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
|
||||
|
Loading…
Reference in New Issue
Block a user