Extend handling of Noto fonts

Added the possibility to use options Regular, Medium, Thin, Light, Extralight
This commit is contained in:
Kornel Benko 2019-04-07 11:05:42 +02:00
parent 23fecedbb0
commit e55ed79da9
5 changed files with 138 additions and 3 deletions

View File

@ -7,6 +7,9 @@ changes happened in particular if possible. A good example would be
-----------------------
2019-04-07 Kornel Benko <kornel@lyx.org>
* format incremented to 572: Extended Noto fonts.
2019-04-03 Jürgen Spitzmüller <spitz@lyx.org>
* format incremented to 571: Add \cmidrule trimming support
\cmidrule(lr){n-n}

View File

@ -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}

View File

@ -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

View File

@ -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]],

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 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