latexfonts: support for the Noto fonts

- fileformat change
- the support to scale the sf and the tt fonts can be added later, see enhancement #10611
This commit is contained in:
Uwe Stöhr 2017-04-04 23:02:47 +02:00
parent 50e21b7166
commit 7aaa85915f
7 changed files with 88 additions and 7 deletions

View File

@ -7,6 +7,13 @@ changes happened in particular if possible. A good example would be
-----------------------
2017-04-04 Uwe Stöhr <uwestoehr@web.de>
* Format incremented to 536: support for Noto fonts.
- \usepackage[rm]{noto} > \font_roman "NotoSerif-TLF" "<nontexfont>"
- \usepackage[sf]{noto} > \font_sans "NotoSans-TLF" "<nontexfont>"
- \renewcommand{\ttdefault}{NotoMono-TLF}
> \font_typewriter "NotoMono-TLF" "<nontexfont>"
2017-03-19 Enrico Forestieri <forenr@lyx.org>
* Format incremented to 535: support for en/em-dash as ligatures.
The en- and em-dashes (U+2013 and U+2014) are now exported as

View File

@ -157,6 +157,7 @@ luxi
mathdesign
minion2newtx
newtx
noto
binhex
symbol
tex-gyre

View File

@ -455,6 +455,7 @@
\TestPackage{MinionPro}
\TestFont[rzmnr]{minion2newtx}
\TestPackage{newtxmath}
\TestPackage{noto}
\TestPackage[binhex.tex]{binhex} % required by newtxmath
\TestFont[psyr]{symbol}
\TestPackage{tgadventor}

View File

@ -289,6 +289,20 @@ Font newcent
Package newcent
EndFont
Font NotoSerif-TLF
GuiName "Noto Serif"
Family rm
SwitchDefault 1
Requires noto
CompleteFont noto
EndFont
AltFont noto
GuiName "Noto Serif"
Family rm
Package noto
EndFont
Font palatino
GuiName "Palatino"
Family rm
@ -538,6 +552,13 @@ Font lmss
Requires lmodern
EndFont
Font NotoSans-TLF
GuiName "Noto Sans"
Family sf
SwitchDefault 1
Requires noto
EndFont
Font tgadventor
GuiName "TeX Gyre Adventor"
Family sf
@ -611,6 +632,17 @@ Font luximono
Package luximono
EndFont
Font NotoMono-TLF
GuiName "Noto Mono"
Family tt
SwitchDefault 1
ScaleOption $$val
Preamble
\newcommand*{\NotoMono@scale}{$$val}
EndPreamble
Requires noto
EndFont
Font tgcursor
GuiName "TeX Gyre Cursor"
Family tt

View File

@ -1941,6 +1941,25 @@ def revert_dashligatures(document):
i += 1
def revert_noto(document):
" Revert Noto font definitions to LaTeX "
if find_token(document.header, "\\use_non_tex_fonts false", 0) != -1:
preamble = ""
i = find_token(document.header, "\\font_roman \"NotoSerif-TLF\"", 0)
if i != -1:
add_to_preamble(document, ["\\renewcommand{\\rmdefault}{NotoSerif-TLF}"])
document.header[i] = document.header[i].replace("NotoSerif-TLF", "default")
i = find_token(document.header, "\\font_sans \"NotoSans-TLF\"", 0)
if i != -1:
add_to_preamble(document, ["\\renewcommand{\\sfdefault}{NotoSans-TLF}"])
document.header[i] = document.header[i].replace("NotoSans-TLF", "default")
i = find_token(document.header, "\\font_typewriter \"NotoMono-TLF\"", 0)
if i != -1:
add_to_preamble(document, ["\\renewcommand{\\ttdefault}{NotoMono-TLF}"])
document.header[i] = document.header[i].replace("NotoMono-TLF", "default")
##
# Conversion hub
#
@ -1973,10 +1992,12 @@ convert = [
[532, [convert_literalparam]],
[533, []],
[534, []],
[535, [convert_dashligatures]]
[535, [convert_dashligatures]],
[536, []]
]
revert = [
[535, [revert_noto]],
[534, [revert_dashligatures]],
[533, [revert_chapterbib]],
[532, [revert_multibib]],

View File

@ -127,16 +127,16 @@ 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", "tgbonum", "tgchorus", "tgpagella", "tgschola", "tgtermes",
"utopia", 0};
"mathptmx", "newcent", "NotoSerif-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", "tgadventor", "tgheros", 0};
"kurierc", "kurierl", "kurierlc", "lmss", "NotoSans-TLF", "tgadventor", "tgheros", 0};
const char * const known_typewriter_fonts[] = { "beramono", "cmtl", "cmtt",
"courier", "lmtt", "luximono", "fourier", "libertineMono-type1", "lmodern",
"mathpazo", "mathptmx", "newcent", "tgcursor", "txtt", 0};
"mathpazo", "mathptmx", "newcent", "NotoMono-TLF", "tgcursor", "txtt", 0};
const char * const known_math_fonts[] = { "eulervm", "newtxmath", 0};
@ -760,6 +760,25 @@ void Preamble::handle_package(Parser &p, string const & name,
h_font_osf = "true";
}
if (name == "noto") {
// noto can have several options
if (opts.empty())
h_font_roman[0] = "NotoSerif-TLF";
string::size_type pos = opts.find("rm");
if (pos != string::npos)
h_font_roman[0] = "NotoSerif-TLF";
pos = opts.find("sf");
if (pos != string::npos)
h_font_sans[0] = "NotoSans-TLF";
pos = opts.find("nott");
if (pos != string::npos) {
h_font_roman[0] = "NotoSerif-TLF";
h_font_sans[0] = "NotoSans-TLF";
}
// noto as typewriter is handled in handling of \ttdefault
// special cases are handled in handling of \rmdefault and \sfdefault
}
// sansserif fonts
if (is_known(name, known_sans_fonts)) {
h_font_sans[0] = name;

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 535 // ef: support for en/em-dash as ligatures
#define LYX_FORMAT_TEX2LYX 535
#define LYX_FORMAT_LYX 536 // uwestoehr: support for Noto fonts
#define LYX_FORMAT_TEX2LYX 536
#if LYX_FORMAT_TEX2LYX != LYX_FORMAT_LYX
#ifndef _MSC_VER