Support for CrimsonPro

This commit is contained in:
Juergen Spitzmueller 2019-07-18 10:50:46 +02:00
parent 86b1331507
commit 850c5a3d55
6 changed files with 188 additions and 7 deletions

View File

@ -8,7 +8,8 @@ changes happened in particular if possible. A good example would be
-----------------------
2019-07-17 Kornel Benko <kornel@lyx.org>
* format incremented to 583: Support for the Chivo font family.
Jürgen Spitzmüller <spitz@lyx.org>
* format incremented to 583: Support for the Chivo and CrimsonPro font families.
2019-07-15 Kornel Benko <kornel@lyx.org>
Jürgen Spitzmüller <spitz@lyx.org>

View File

@ -460,6 +460,7 @@
\TestPackage{cochineal}
\TestPackage{courier}
\TestPackage{crimson}
\TestPackage{CrimsonPro}
\TestPackage{helvet}
\TestPackage{mathpazo}
\TestPackage{mathpple}

View File

@ -503,6 +503,46 @@ Notes: CM bright is a sans serif font that also provides nice sans serif
math fonts.
\end_layout
\begin_layout Subsection
\change_inserted -712698321 1563439314
Cochineal
\end_layout
\begin_layout Description
\change_inserted -712698321 1563439310
Found:
\begin_inset Info
type "package"
arg "cochineal"
\end_inset
\end_layout
\begin_layout Description
\change_inserted -712698321 1563439356
CTAN:
\family sans
fonts/cochineal
\end_layout
\begin_layout Description
\change_inserted -712698321 1563439409
Notes: The
\family sans
cochineal
\family default
package provides support for the
\emph on
Crimson
\emph default
serif font.
\end_layout
\begin_layout Subsection
Concrete
\end_layout
@ -538,6 +578,50 @@ Concrete Mathematics
concrete
\emph default
fonts.
\change_inserted -712698321 1563439208
\end_layout
\begin_layout Subsection
\change_inserted -712698321 1563439214
CrimsonPro
\end_layout
\begin_layout Description
\change_inserted -712698321 1563439209
Found:
\begin_inset Info
type "package"
arg "CrimsonPro"
\end_inset
\end_layout
\begin_layout Description
\change_inserted -712698321 1563439244
CTAN:
\family sans
fonts/crimsonpro
\end_layout
\begin_layout Description
\change_inserted -712698321 1563439296
Notes: The
\family sans
CrimsonPro
\family default
package provides support for the
\emph on
CrimsonPro
\emph default
serif font, an enhanced redesign of Crimson (Cochineal).
\change_unchanged
\end_layout
\begin_layout Subsection

View File

@ -154,6 +154,50 @@ Font cmr
OsfFont eco
EndFont
Font CrimsonPro
GuiName "Crimson Pro"
Family rm
OsfOption lf
OsfDefault 1
Package CrimsonPro
AltFonts crimson
MoreOptions 1
FontEncoding OT1,T1,LY1,TS1
EndFont
Font CrimsonProMedium
GuiName "Crimson Pro (Medium)"
Family rm
OsfOption lf
OsfDefault 1
Package CrimsonPro
PackageOptions medium
MoreOptions 1
FontEncoding OT1,T1,LY1,TS1
EndFont
Font CrimsonProLight
GuiName "Crimson Pro (Light)"
Family rm
OsfOption lf
OsfDefault 1
Package CrimsonPro
PackageOptions light
MoreOptions 1
FontEncoding OT1,T1,LY1,TS1
EndFont
Font CrimsonProExtraLight
GuiName "Crimson Pro (Extralight)"
Family rm
OsfOption lf
OsfDefault 1
Package CrimsonPro
PackageOptions extralight
MoreOptions 1
FontEncoding OT1,T1,LY1,TS1
EndFont
Font DejaVuSerif
GuiName "DejaVu Serif"
Family rm

View File

@ -183,6 +183,10 @@ def createFontMapping(fontlist):
fm.expandFontMapping(['ChivoThin,thin', 'ChivoLight,light',
'Chivo,regular', 'ChivoMedium,medium'],
"sans", "sf", "Chivo", "scale", "oldstyle")
elif font == 'CrimsonPro':
fm.expandFontMapping(['CrimsonPro', 'CrimsonProExtraLight,extralight', 'CrimsonProLight,light',
'CrimsonProMedium,medium'],
"roman", None, "CrimsonPro", None, "lf", "true")
elif font == 'Fira':
fm.expandFontMapping(['FiraSans', 'FiraSansBook,book',
'FiraSansThin,thin', 'FiraSansLight,light',
@ -3082,6 +3086,22 @@ def convert_NotoRegulars(document):
document.header[i] = " ".join(ttfont)
def convert_CrimsonProFont(document):
" Handle CrimsonPro font definition to LaTeX "
if find_token(document.header, "\\use_non_tex_fonts false", 0) != -1:
fm = createFontMapping(['CrimsonPro'])
convert_fonts(document, fm, "lf")
def revert_CrimsonProFont(document):
" Revert native CrimsonPro font definition to LaTeX "
if find_token(document.header, "\\use_non_tex_fonts false", 0) != -1:
fontmap = dict()
fm = createFontMapping(['CrimsonPro'])
if revert_fonts(document, fm, fontmap, False, True):
add_preamble_fonts(document, fontmap)
##
# Conversion hub
#
@ -3126,10 +3146,10 @@ convert = [
[580, []],
[581, [convert_osf]],
[582, [convert_AdobeFonts,convert_latexFonts,convert_notoFonts,convert_CantarellFont,convert_FiraFont]],# old font re-converterted due to extra options
[583, [convert_ChivoFont,convert_Semibolds,convert_NotoRegulars]],
[583, [convert_ChivoFont,convert_Semibolds,convert_NotoRegulars,convert_CrimsonProFont]],
]
revert = [[582, [revert_ChivoFont]],
revert = [[582, [revert_ChivoFont,revert_CrimsonProFont]],
[581, [revert_CantarellFont,revert_FiraFont]],
[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!

View File

@ -142,10 +142,10 @@ const char * const known_old_language_packages[] = {"french", "frenchle",
char const * const known_fontsizes[] = { "10pt", "11pt", "12pt", 0 };
const char * const known_roman_font_packages[] = { "ae", "beraserif", "bookman",
"ccfonts", "chancery", "charter", "cmr", "cochineal", "crimson", "DejaVuSerif", "DejaVuSerifCondensed", "fourier",
"garamondx", "libertine", "libertineRoman", "libertine-type1", "lmodern", "mathdesign", "mathpazo",
"mathptmx", "MinionPro", "newcent", "noto", "noto-serif", "PTSerif", "tgbonum", "tgchorus",
"tgpagella", "tgschola", "tgtermes", "utopia", "xcharter", 0 };
"ccfonts", "chancery", "charter", "cmr", "cochineal", "crimson", "CrimsonPro", "DejaVuSerif",
"DejaVuSerifCondensed", "fourier", "garamondx", "libertine", "libertineRoman", "libertine-type1",
"lmodern", "mathdesign", "mathpazo", "mathptmx", "MinionPro", "newcent", "noto", "noto-serif",
"PTSerif", "tgbonum", "tgchorus", "tgpagella", "tgschola", "tgtermes", "utopia", "xcharter", 0 };
const char * const known_sans_font_packages[] = { "avant", "berasans", "biolinum",
"biolinum-type1", "cantarell", "Chivo", "cmbr", "cmss", "DejaVuSans", "DejaVuSansCondensed", "FiraSans", "helvet", "iwona",
@ -947,6 +947,37 @@ void Preamble::handle_package(Parser &p, string const & name,
options.clear();
}
if (name == "CrimsonPro") {
h_font_roman_osf = "true";
for (auto const & opt : allopts) {
if (opt == "lf" || opt == "lining") {
h_font_roman_osf = "false";
continue;
}
if (opt == "proportional" || opt == "p")
continue;
if (opt == "medium") {
h_font_roman[0] = "CrimsonProMedium";
continue;
}
if (opt == "extralight") {
h_font_roman[0] = "CrimsonProExtraLight";
continue;
}
if (opt == "light") {
h_font_roman[0] = "CrimsonProLight";
continue;
}
if (!xopts.empty())
xopts += ", ";
xopts += opt;
}
if (!xopts.empty())
h_font_roman_opts = xopts;
options.clear();
}
if (name == "eco")
// font uses old-style figure
h_font_roman_osf = "true";