From e55ed79da964cf009faeace98f3f869ff1908d73 Mon Sep 17 00:00:00 2001 From: Kornel Benko Date: Sun, 7 Apr 2019 11:05:42 +0200 Subject: [PATCH] Extend handling of Noto fonts Added the possibility to use options Regular, Medium, Thin, Light, Extralight --- development/FORMAT | 3 ++ lib/chkconfig.ltx | 3 ++ lib/latexfonts | 101 +++++++++++++++++++++++++++++++++++++++++ lib/lyx2lyx/lyx_2_4.py | 30 +++++++++++- src/version.h | 4 +- 5 files changed, 138 insertions(+), 3 deletions(-) diff --git a/development/FORMAT b/development/FORMAT index d38e809f17..48309d380d 100644 --- a/development/FORMAT +++ b/development/FORMAT @@ -7,6 +7,9 @@ changes happened in particular if possible. A good example would be ----------------------- +2019-04-07 Kornel Benko + * format incremented to 572: Extended Noto fonts. + 2019-04-03 Jürgen Spitzmüller * format incremented to 571: Add \cmidrule trimming support \cmidrule(lr){n-n} diff --git a/lib/chkconfig.ltx b/lib/chkconfig.ltx index d8b027f001..dbdb7ed449 100644 --- a/lib/chkconfig.ltx +++ b/lib/chkconfig.ltx @@ -487,6 +487,9 @@ \TestPackage{newtxmath} \TestPackage[binhex.tex]{binhex} % required by newtxmath \TestPackage{noto} +\TestPackage{noto-serif} +\TestPackage{noto-sans} +\TestPackage{noto-mono} \TestPackage{paratype} \TestFont[psyr]{symbol} \TestPackage{tgadventor} diff --git a/lib/latexfonts b/lib/latexfonts index 31f008832b..53032a441c 100644 --- a/lib/latexfonts +++ b/lib/latexfonts @@ -359,6 +359,51 @@ Font newcent Package newcent EndFont +Font NotoSerifRegular + GuiName "Noto Serif Regular" + Family rm + Package noto-serif + PackageOption regular + OsfDefault 0 + OsfOption osf +EndFont + +Font NotoSerifMedium + GuiName "Noto Serif Medium" + Family rm + Package noto-serif + PackageOption medium + OsfDefault 0 + OsfOption osf +EndFont + +Font NotoSerifThin + GuiName "Noto Serif Thin" + Family rm + Package noto-serif + PackageOption thin + OsfDefault 0 + OsfOption osf +EndFont + +Font NotoSerifLight + GuiName "Noto Serif Light" + Family rm + Package noto-serif + PackageOption light + OsfDefault 0 + OsfOption osf +EndFont + +Font NotoSerifExtralight + GuiName "Noto Serif Extralight" + Family rm + Package noto-serif + PackageOption extralight + OsfDefault 0 + OsfOption osf +EndFont + Font NotoSerif-TLF GuiName "Noto Serif" Family rm @@ -720,6 +765,54 @@ Font lmss Requires lmodern EndFont +Font NotoSansRegular + GuiName "Noto Sans Regular" + Family sf + ScaleOption scaled=$$val + Package noto-sans + OsfDefault 0 + OsfOption osf +EndFont + +Font NotoSansMedium + GuiName "Noto Sans Medium" + Family sf + ScaleOption scaled=$$val + Package noto-sans + OsfDefault 0 + OsfOption osf +EndFont + +Font NotoSansThin + GuiName "Noto Sans Thin" + Family sf + ScaleOption scaled=$$val + Package noto-sans + PackageOption thin + OsfDefault 0 + OsfOption osf +EndFont + +Font NotoSansLight + GuiName "Noto Sans Light" + Family sf + ScaleOption scaled=$$val + Package noto-sans + PackageOption light + OsfDefault 0 + OsfOption osf +EndFont + +Font NotoSansExtralight + GuiName "Noto Sans Extralight" + Family sf + ScaleOption scaled=$$val + Package noto-sans + PackageOption extralight + OsfDefault 0 + OsfOption osf +EndFont + Font NotoSans-TLF GuiName "Noto Sans" Family sf @@ -869,6 +962,14 @@ Font luximono Package luximono EndFont +Font NotoMonoRegular + GuiName "Noto Mono Regular" + Family tt + ScaleOption scaled=$$val + Package noto-mono + PackageOption regular +EndFont + Font NotoMono-TLF GuiName "Noto Mono" Family tt diff --git a/lib/lyx2lyx/lyx_2_4.py b/lib/lyx2lyx/lyx_2_4.py index 3bf7a6b2d1..6e69e3605e 100644 --- a/lib/lyx2lyx/lyx_2_4.py +++ b/lib/lyx2lyx/lyx_2_4.py @@ -158,6 +158,16 @@ def createFontMapping(fontlist): fm.expandFontMapping(['ADOBESourceSerifPro'], "roman", None, "sourceserifpro") fm.expandFontMapping(['ADOBESourceSansPro'], "sans", "sf", "sourcesanspro", "scaled") fm.expandFontMapping(['ADOBESourceCodePro'], "typewriter", "tt", "sourcecodepro", "scaled") + elif font == 'Noto': + fm.expandFontMapping(['NotoSerifRegular,regular', 'NotoSerifMedium,medium', + 'NotoSerifThin,thin', 'NotoSerifLight,light', + 'NotoSerifExtralight,extralight'], + "roman", None, "noto-serif") + fm.expandFontMapping(['NotoSansRegular,regular', 'NotoSansMedium,medium', + 'NotoSansThin,thin', 'NotoSansLight,light', + 'NotoSansExtralight,extralight'], + "sans", "sf", "noto-sans", "scaled") + fm.expandFontMapping(['NotoMonoRegular'], "typewriter", "tt", "noto-mono", "scaled") return fm def convert_fonts(document, fm): @@ -273,6 +283,22 @@ def revert_fonts(document, fm, fontmap): ### ############################################################################### +def convert_notoFonts(document): + " Handle Noto fonts definition to LaTeX " + + if find_token(document.header, "\\use_non_tex_fonts false", 0) != -1: + fm = createFontMapping(['Noto']) + convert_fonts(document, fm) + +def revert_notoFonts(document): + " Revert native Noto font definition to LaTeX " + + if find_token(document.header, "\\use_non_tex_fonts false", 0) != -1: + fontmap = dict() + fm = createFontMapping(['Noto']) + revert_fonts(document, fm, fontmap) + add_preamble_fonts(document, fontmap) + def convert_latexFonts(document): " Handle DejaVu and IBMPlex fonts definition to LaTeX " @@ -1608,10 +1634,12 @@ convert = [ [568, []], [569, []], [570, []], - [571, []] + [571, []], + [572, [convert_notoFonts]] # Added options thin, light, extralight for Noto ] revert = [ + [571, [revert_notoFonts]], [570, [revert_cmidruletrimming]], [569, [revert_bibfileencodings]], [568, [revert_tablestyle]], diff --git a/src/version.h b/src/version.h index 2b900966ca..bfdc4212ff 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 571 // spitz: cmidrule trimming -#define LYX_FORMAT_TEX2LYX 571 +#define LYX_FORMAT_LYX 572 // kornel: Noto fonts expanded to use more options +#define LYX_FORMAT_TEX2LYX 572 #if LYX_FORMAT_TEX2LYX != LYX_FORMAT_LYX #ifndef _MSC_VER -- 2.39.2