From 7aaa85915fbec1b934ee9ce8511abd28d7921444 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Uwe=20St=C3=B6hr?= Date: Tue, 4 Apr 2017 23:02:47 +0200 Subject: [PATCH] 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 --- development/FORMAT | 7 ++++ .../Win32/packaging/installer/Packages.txt | 1 + lib/chkconfig.ltx | 1 + lib/latexfonts | 32 +++++++++++++++++++ lib/lyx2lyx/lyx_2_3.py | 23 ++++++++++++- src/tex2lyx/Preamble.cpp | 27 +++++++++++++--- src/version.h | 4 +-- 7 files changed, 88 insertions(+), 7 deletions(-) diff --git a/development/FORMAT b/development/FORMAT index c601311c83..a1931efc2f 100644 --- a/development/FORMAT +++ b/development/FORMAT @@ -7,6 +7,13 @@ changes happened in particular if possible. A good example would be ----------------------- +2017-04-04 Uwe Stöhr + * Format incremented to 536: support for Noto fonts. + - \usepackage[rm]{noto} > \font_roman "NotoSerif-TLF" "" + - \usepackage[sf]{noto} > \font_sans "NotoSans-TLF" "" + - \renewcommand{\ttdefault}{NotoMono-TLF} + > \font_typewriter "NotoMono-TLF" "" + 2017-03-19 Enrico Forestieri * 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 diff --git a/development/Win32/packaging/installer/Packages.txt b/development/Win32/packaging/installer/Packages.txt index dd3a150898..9e6f75285c 100644 --- a/development/Win32/packaging/installer/Packages.txt +++ b/development/Win32/packaging/installer/Packages.txt @@ -157,6 +157,7 @@ luxi mathdesign minion2newtx newtx +noto binhex symbol tex-gyre diff --git a/lib/chkconfig.ltx b/lib/chkconfig.ltx index 544ce7cbd2..bccd179f7d 100644 --- a/lib/chkconfig.ltx +++ b/lib/chkconfig.ltx @@ -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} diff --git a/lib/latexfonts b/lib/latexfonts index bf6152ac38..1475e7ef1d 100644 --- a/lib/latexfonts +++ b/lib/latexfonts @@ -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 diff --git a/lib/lyx2lyx/lyx_2_3.py b/lib/lyx2lyx/lyx_2_3.py index ddf7822fb9..4d0e403fa7 100644 --- a/lib/lyx2lyx/lyx_2_3.py +++ b/lib/lyx2lyx/lyx_2_3.py @@ -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]], diff --git a/src/tex2lyx/Preamble.cpp b/src/tex2lyx/Preamble.cpp index 26563f818c..b9d9a61aec 100644 --- a/src/tex2lyx/Preamble.cpp +++ b/src/tex2lyx/Preamble.cpp @@ -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; diff --git a/src/version.h b/src/version.h index 5a03e0d312..874491df62 100644 --- a/src/version.h +++ b/src/version.h @@ -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 -- 2.39.2