Add sans serif font "cantarell"

This commit is contained in:
Kornel Benko 2019-07-14 21:44:58 +02:00
parent ed856c9f4d
commit 97a099b137
4 changed files with 64 additions and 4 deletions

View File

@ -474,6 +474,7 @@
\TestPackage{biolinum}
\TestPackage{biolinum-type1}
%\TestFont[glic1000]{cbgreek}% for Greek % suported by LyX but too large to force downloading
\TestPackage{cantarell}
\TestPackage{ccfonts}
\TestFont[ccr10]{concrete} % required by ccfonts
\TestFont[eorm10]{ecc} % required by ccfonts

View File

@ -654,6 +654,28 @@ AltFont biolinum-2012
MoreOptions 1
EndFont
Font cantarell
GuiName "Cantarell Sans Serif"
Family sf
OsfOption oldstyle
Package cantarell
PackageOption "defaultsans"
MoreOptions 1
FontEncoding T2A,T1,OT1
ScaleOption scale=$$val
AltFonts cantarell1
EndFont
AltFont cantarell1
GuiName "Cantarell Sans Serif"
Family sf
OsfOption oldstyle
OsfDefault 0
Package cantarell
ScaleOption scale=$$val
FontEncoding T2A,T1,OT1
EndFont
Font cmbr
GuiName "CM Bright"
Family sf

View File

@ -173,6 +173,9 @@ def createFontMapping(fontlist):
'NotoSansExtralight,extralight'],
"sans", "sf", "noto-sans", "scaled")
fm.expandFontMapping(['NotoMonoRegular,regular'], "typewriter", "tt", "noto-mono", "scaled")
elif font == 'Cantarell':
fm.expandFontMapping(['cantarell,defaultsans'],
"sans", "sf", "cantarell", "scaled", "oldstyle")
return fm
def convert_fonts(document, fm):
@ -383,6 +386,22 @@ def revert_AdobeFonts(document):
if revert_fonts(document, fm, fontmap):
add_preamble_fonts(document, fontmap)
def convert_CantarellFont(document):
" Handle Cantarell font definition to LaTeX "
if find_token(document.header, "\\use_non_tex_fonts false", 0) != -1:
fm = createFontMapping(['Cantarell'])
convert_fonts(document, fm)
def revert_CantarellFont(document):
" Revert native Cantarell font definition to LaTeX "
if find_token(document.header, "\\use_non_tex_fonts false", 0) != -1:
fontmap = dict()
fm = createFontMapping(['Cantarell'])
if revert_fonts(document, fm, fontmap, True):
add_preamble_fonts(document, fontmap)
def removeFrontMatterStyles(document):
" Remove styles Begin/EndFrontmatter"
@ -2623,6 +2642,22 @@ def revert_AdobeFonts_xopts(document):
add_preamble_fonts(document, fontmap)
def revert_CantarellFont_xopts(document):
" Revert native (extended) Cantarell font definition (with extra options) to LaTeX "
i = find_token(document.header, '\\use_non_tex_fonts', 0)
if i == -1:
document.warning("Malformed LyX document: Missing \\use_non_tex_fonts.")
return
if str2bool(get_value(document.header, "\\use_non_tex_fonts", i)):
return
fontmap = dict()
fm = createFontMapping(['Cantarell'])
if revert_fonts(document, fm, fontmap, True):
add_preamble_fonts(document, fontmap)
def convert_osf(document):
" Convert \\font_osf param to new format "
@ -2882,10 +2917,12 @@ convert = [
[578, []],
[579, []],
[580, []],
[581, [convert_osf]]
[581, [convert_osf]],
[582, [convert_CantarellFont]],
]
revert = [[580, [revert_texfontopts,revert_osf]],
revert = [[581, [revert_CantarellFont, revert_CantarellFont_xopts]],
[580, [revert_texfontopts,revert_osf]],
[579, [revert_minionpro, revert_plainNotoFonts_xopts, revert_notoFonts_xopts, revert_IBMFonts_xopts, revert_AdobeFonts_xopts, revert_font_opts]], # keep revert_font_opts last!
[578, [revert_babelfont]],
[577, [revert_drs]],

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 581 // spitz: split osf to font families
#define LYX_FORMAT_TEX2LYX 581
#define LYX_FORMAT_LYX 582 // Kornel: Add cantarell sans serif font
#define LYX_FORMAT_TEX2LYX 582
#if LYX_FORMAT_TEX2LYX != LYX_FORMAT_LYX
#ifndef _MSC_VER