add support for the PT fonts

- fileformat change
- I also started https://wiki.lyx.org/LyX/NewInLyX24 for new features
This commit is contained in:
Uwe Stöhr 2018-03-10 19:59:48 +01:00
parent b8adb0f933
commit d3c51876a9
23 changed files with 149 additions and 46 deletions

View File

@ -7,8 +7,13 @@ changes happened in particular if possible. A good example would be
-----------------------
2018-02-23 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
2018-03-10 Uwe Stöhr <uwestoehr@web.de>
* Format incremented to 546: support for ParaType fonts.
- \usepackage{PTSerif} > \font_roman "PTSerif-TLF"
- \usepackage[scaled=x.xx]{PTSans} > \font_sans "PTSans-TLF""
- \usepackage[scaled=x.xx]{PTMono} > \font_typewriter "PTMono-TLF"
2018-02-23 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* format incremented to 545: Add "literal" param to inset include
This is used by the lstinput caption.

View File

@ -464,6 +464,7 @@
\TestPackage{newtxmath}
\TestPackage[binhex.tex]{binhex} % required by newtxmath
\TestPackage{noto}
\TestPackage{paratype}
\TestFont[psyr]{symbol}
\TestPackage{tgadventor}
\TestPackage{tgbonum}

View File

@ -356,6 +356,20 @@ AltFont pplj
SwitchDefault 1
EndFont
Font PTSerif-TLF
GuiName "ParaType Serif"
Family rm
Requires paratype
Package PTSerif
CompleteFont paratype
EndFont
AltFont paratype
GuiName "ParaType Serif"
Family rm
Package paratype
EndFont
Font times
GuiName "Times Roman"
Family rm
@ -582,6 +596,14 @@ Font NotoSans-TLF
Requires noto
EndFont
Font PTSans-TLF
GuiName "ParaType Sans"
Family sf
ScaleOption scaled=$$val
Requires paratype
Package PTSans
EndFont
Font tgadventor
GuiName "TeX Gyre Adventor"
Family sf
@ -670,6 +692,14 @@ Font NotoMono-TLF
Requires noto
EndFont
Font PTMono-TLF
GuiName "ParaType Mono"
Family tt
ScaleOption scaled=$$val
Requires paratype
Package PTMono
EndFont
Font tgcursor
GuiName "TeX Gyre Cursor"
Family tt

View File

@ -24,7 +24,7 @@ import sys, os
# Uncomment only what you need to import, please.
from parser_tools import (find_end_of_inset, find_token)
from parser_tools import (find_end_of_inset, find_token, get_value)
# del_token, del_value, del_complete_lines,
# find_complete_lines, find_end_of, find_end_of_layout,
# find_re, find_substring, find_token_backwards,
@ -32,8 +32,8 @@ from parser_tools import (find_end_of_inset, find_token)
# get_quoted_value, is_in_inset, set_bool_value
# find_tokens, find_token_exact, check_token, get_option_value
#from lyx2lyx_tools import (add_to_preamble, put_cmd_in_ert, revert_font_attrs,
# insert_to_preamble, latex_length)
from lyx2lyx_tools import (add_to_preamble)
# put_cmd_in_ert, revert_font_attrs, insert_to_preamble, latex_length
# get_ert, lyx2latex, lyx2verbatim, length_in_bp, convert_info_insets
# revert_flex_inset, hex2ratio, str2bool
@ -87,16 +87,57 @@ def revert_lst_literalparam(document):
del document.body[k]
def revert_paratype(document):
" Revert ParaType font definitions to LaTeX "
if find_token(document.header, "\\use_non_tex_fonts false", 0) != -1:
preamble = ""
i1 = find_token(document.header, "\\font_roman \"PTSerif-TLF\"", 0)
i2 = find_token(document.header, "\\font_sans \"default\"", 0)
i3 = find_token(document.header, "\\font_typewriter \"default\"", 0)
j = find_token(document.header, "\\font_sans \"PTSans-TLF\"", 0)
sfval = get_value(document.header, "\\font_sf_scale", 0)
document.warning("sfval: " + str(sfval))
# cutoff " 100"
sfval = sfval[:-4]
sfoption = ""
if sfval != "100":
sfoption = "scaled=" + format(float(sfval) / 100, '.2f')
k = find_token(document.header, "\\font_typewriter \"PTMono-TLF\"", 0)
ttval = get_value(document.header, "\\font_tt_scale", 0)
# cutoff " 100"
ttval = ttval[:-4]
ttoption = ""
if ttval != "100":
ttoption = "scaled=" + format(float(ttval) / 100, '.2f')
if i1 != -1 and i2 != -1 and i3!= -1:
add_to_preamble(document, ["\\usepackage{paratype}"])
else:
if i1!= -1:
add_to_preamble(document, ["\\usepackage{PTSerif}"])
if j!= -1:
if sfoption != "":
add_to_preamble(document, ["\\usepackage[" + sfoption + "]{PTSans}"])
else:
add_to_preamble(document, ["\\usepackage{PTSans}"])
if k!= -1:
if ttoption != "":
add_to_preamble(document, ["\\usepackage[" + ttoption + "]{PTMono}"])
else:
add_to_preamble(document, ["\\usepackage{PTMono}"])
##
# Conversion hub
#
supported_versions = ["2.4.0", "2.4"]
convert = [
[545, [convert_lst_literalparam]]
[545, [convert_lst_literalparam]],
[546, []]
]
revert = [
[545, [revert_paratype]],
[544, [revert_lst_literalparam]]
]

View File

@ -127,16 +127,17 @@ char const * const known_fontsizes[] = { "10pt", "11pt", "12pt", 0 };
const char * const known_roman_fonts[] = { "ae", "beraserif", "bookman",
"ccfonts", "chancery", "charter", "cmr", "cochineal", "crimson", "fourier",
"garamondx", "libertine", "libertine-type1", "lmodern", "mathdesign", "mathpazo",
"mathptmx", "newcent", "NotoSerif-TLF", "tgbonum", "tgchorus", "tgpagella", "tgschola",
"tgtermes", "utopia", 0};
"mathptmx", "newcent", "NotoSerif-TLF", "PTSerif-TLF", "tgbonum", "tgchorus",
"tgpagella", "tgschola", "tgtermes", "utopia", 0 };
const char * const known_sans_fonts[] = { "avant", "berasans", "biolinum-type1",
"cmbr", "cmss", "helvet", "iwona", "iwonac", "iwonal", "iwonalc", "kurier",
"kurierc", "kurierl", "kurierlc", "lmss", "NotoSans-TLF", "tgadventor", "tgheros", 0};
"kurierc", "kurierl", "kurierlc", "lmss", "NotoSans-TLF", "PTSans-TLF", "tgadventor",
"tgheros", 0 };
const char * const known_typewriter_fonts[] = { "beramono", "cmtl", "cmtt",
"courier", "lmtt", "luximono", "fourier", "libertineMono-type1", "lmodern",
"mathpazo", "mathptmx", "newcent", "NotoMono-TLF", "tgcursor", "txtt", 0};
"mathpazo", "mathptmx", "newcent", "NotoMono-TLF", "PTMono-TLF", "tgcursor", "txtt", 0 };
const char * const known_math_fonts[] = { "eulervm", "newtxmath", 0};
@ -798,6 +799,16 @@ void Preamble::handle_package(Parser &p, string const & name,
// special cases are handled in handling of \rmdefault and \sfdefault
}
if (name == "paratype") {
// in this case all fonts are ParaType
h_font_roman[0] = "PTSerif-TLF";
h_font_sans[0] = "default";
h_font_typewriter[0] = "default";
}
if (name == "PTSerif")
h_font_roman[0] = "PTSerif-TLF";
// sansserif fonts
if (is_known(name, known_sans_fonts)) {
h_font_sans[0] = name;
@ -815,6 +826,14 @@ void Preamble::handle_package(Parser &p, string const & name,
h_font_osf = "true";
}
if (name == "PTSans") {
h_font_sans[0] = "PTSans-TLF";
if (options.size() >= 1) {
if (scale_as_percentage(opts, h_font_sf_scale[0]))
options.clear();
}
}
// typewriter fonts
if (is_known(name, known_typewriter_fonts)) {
// fourier can be set as roman font _only_
@ -828,8 +847,15 @@ void Preamble::handle_package(Parser &p, string const & name,
}
}
if (name == "libertineMono-type1") {
if (name == "libertineMono-type1")
h_font_typewriter[0] = "libertine-mono";
if (name == "PTMono") {
h_font_typewriter[0] = "PTMono-TLF";
if (options.size() >= 1) {
if (scale_as_percentage(opts, h_font_tt_scale[0]))
options.clear();
}
}
// font uses old-style figure

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.3
\lyxformat 545
#LyX file created by tex2lyx 2.4
\lyxformat 546
\begin_document
\begin_header
\save_transient_properties true

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.3
\lyxformat 545
#LyX file created by tex2lyx 2.4
\lyxformat 546
\begin_document
\begin_header
\save_transient_properties true

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.3
\lyxformat 545
#LyX file created by tex2lyx 2.4
\lyxformat 546
\begin_document
\begin_header
\save_transient_properties true

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.3
\lyxformat 545
#LyX file created by tex2lyx 2.4
\lyxformat 546
\begin_document
\begin_header
\save_transient_properties true

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.3
\lyxformat 545
#LyX file created by tex2lyx 2.4
\lyxformat 546
\begin_document
\begin_header
\save_transient_properties true

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.3
\lyxformat 545
#LyX file created by tex2lyx 2.4
\lyxformat 546
\begin_document
\begin_header
\save_transient_properties true

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.3
\lyxformat 545
#LyX file created by tex2lyx 2.4
\lyxformat 546
\begin_document
\begin_header
\save_transient_properties true

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.3
\lyxformat 545
#LyX file created by tex2lyx 2.4
\lyxformat 546
\begin_document
\begin_header
\save_transient_properties true

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.3
\lyxformat 545
#LyX file created by tex2lyx 2.4
\lyxformat 546
\begin_document
\begin_header
\save_transient_properties true

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.3
\lyxformat 545
#LyX file created by tex2lyx 2.4
\lyxformat 546
\begin_document
\begin_header
\save_transient_properties true

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.3
\lyxformat 545
#LyX file created by tex2lyx 2.4
\lyxformat 546
\begin_document
\begin_header
\save_transient_properties true

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.3
\lyxformat 545
#LyX file created by tex2lyx 2.4
\lyxformat 546
\begin_document
\begin_header
\save_transient_properties true

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.3
\lyxformat 545
#LyX file created by tex2lyx 2.4
\lyxformat 546
\begin_document
\begin_header
\save_transient_properties true

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.3
\lyxformat 545
#LyX file created by tex2lyx 2.4
\lyxformat 546
\begin_document
\begin_header
\save_transient_properties true

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.3
\lyxformat 545
#LyX file created by tex2lyx 2.4
\lyxformat 546
\begin_document
\begin_header
\save_transient_properties true

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.3
\lyxformat 545
#LyX file created by tex2lyx 2.4
\lyxformat 546
\begin_document
\begin_header
\save_transient_properties true

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.3
\lyxformat 545
#LyX file created by tex2lyx 2.4
\lyxformat 546
\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 545 // spitz: literal for include
#define LYX_FORMAT_TEX2LYX 545
#define LYX_FORMAT_LYX 546 // uwestoehr: support for ParaType fonts
#define LYX_FORMAT_TEX2LYX 546
#if LYX_FORMAT_TEX2LYX != LYX_FORMAT_LYX
#ifndef _MSC_VER