diff options
Diffstat (limited to 'Master/texmf-dist/tex/lualatex/novel/novel-FontDefaults.sty')
-rw-r--r-- | Master/texmf-dist/tex/lualatex/novel/novel-FontDefaults.sty | 261 |
1 files changed, 261 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/lualatex/novel/novel-FontDefaults.sty b/Master/texmf-dist/tex/lualatex/novel/novel-FontDefaults.sty new file mode 100644 index 00000000000..72426d40435 --- /dev/null +++ b/Master/texmf-dist/tex/lualatex/novel/novel-FontDefaults.sty @@ -0,0 +1,261 @@ +%% +%% This is file `novel-FontDefaults.sty', part of class `novel'. +%% Copyright 2017 Robert Allgeyer. +%% +%% +%% This file may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3c +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% +\ProvidesFile{novel-FontDefaults.sty}% +[2017/03/01 v1.0.6 LaTeX file (default fonts)] +%% + + +%% +%% This file is loaded \AtEndPreamble. +%% +%% Most TeX installations will use Latin Modern or Computer Modern +%% as default fonts. These are unsuitable for commercial fiction. +%% But `novel' class uses Libertinus as defaults. +%% Change them using \SetMasterFont and other fontspec commands, in Preamble. +% Libertinus Serif has Regular, Italic, Bold, Bold Italic. +% Here, Semibold over-rides Bold. +% +%% Now to activate the font definitions: +% +\defaultfontfeatures{} % reset +% +% The mono font: +\defaultfontfeatures[\ttfamily]{% mono font has no kerning or common ligatures + SmallCapsFeatures={Renderer=Basic},Ligatures=TeX,% +}% +\ifthenelse{\equal{\ttdefault}{lmtt} \OR \equal{\ttdefault}{cmtt}}{ % over-ride: + \IfFontExistsTF{Libertinus Mono}{ + \setmonofont[% + ItalicFont={},% Doesn't have these. + BoldFont={},% + BoldItalicFont={},% + ]{Libertinus Mono} + }{ + \IfFontExistsTF{Linux Libertine Mono O}{ + \setmonofont{Linux Libertine Mono O} + }{ + \setmonofont{Latin Modern Mono}% Eeek! Only because you have it! + } + } +}{} % User \setmonofont, so leave alone. +% +%% +\defaultfontfeatures{} % reset +% Main and sans fonts use kerning, ligatures, and OldStyle numbers if available: +\defaultfontfeatures[\rmfamily,\sffamily]{% + SmallCapsFeatures={Renderer=Basic},Kerning=On,Numbers=OldStyle,% + Ligatures=Common,Ligatures=TeX,% +}% +% The sans font: +\ifthenelse{\equal{\sfdefault}{lmss} \OR \equal{\sfdefault}{cmss}}{ % over-ride: + \IfFontExistsTF{Libertinus Sans}{ + \setsansfont{Libertinus Sans} + }{ + \IfFontExistsTF{Linux Biolinum O}{ + \setsansfont{Linux Biolinum O} + }{ + \setsansfont{Latin Modern Sans}% Eeek! Only because you have it! + } + } +}{} % User \setsansfont, so leave alone. +%% +% At this point, if \rmdefault is something other than lmr or cmr, it probably +% means that the user issued \setmainfont. But that's ineffective in this +% class, because it will be over-written. Use \SetMasterFont instead: +\ifthenelse{\equal{\rmdefault}{lmr} \OR \equal{\rmdefault}{cmr}}{}{% + \ClassWarning{novel}{^^JDid you use \string\setmainfont\space in Preamble?^^J% + The \string\setmainfont\space command is ineffective in `novel' class.^^J% + Use \string\SetMasterFont\space instead. This Warning may be spurious if^^J% + you have an unusual configuration for your TeX installation.^^J}% +}% +% The masterfont: +\if@masterfontset\else + \IfFontExistsTF{Libertinus Serif}{ + \SetMasterFont[% + BoldFont=libertinusserif-semibold.otf,% + BoldItalicFont=libertinusserif-semibolditalic.otf,% + ]{Libertinus Serif} + }{ + \IfFontExistsTF{Linux Libertine O}{ + \SetMasterFont[% + BoldFont=LinLibertine_RZ.otf,% + BoldItalicFont=LinLibertine_RZI.otf,% + ]{Linux Libertine O} + }{ + \SetMasterFont[% + SmallCapsFont={Latin Modern Roman Caps}% + ]{Latin Modern Roman}% Eeek! Only because you have it! + \let\scshape\oldscshape % or small caps won't work + \let\smcp\oldscshape % ditto + } + } +\fi +% Now we are ready to set the main font: +\setmainfont[\@masterfontfeatures]{\@masterfontname} +% +%% +\defaultfontfeatures{} % reset +% The novel-specific display fonts use these defaults: +\defaultfontfeatures{% + SmallCapsFeatures={Renderer=Basic},Kerning=On,% + Ligatures=TeX,Ligatures=CommonOff,Numbers=Lining,% +}% +% The novel-specific fonts: +\if@chapterfontset\else + \SetChapterFont[\@masterfontfeatures,Scale=1.6]{\@masterfontname} +\fi +\newfontfamily\chapterfont[\@chapterfontfeatures]{\@chapterfontname} +% +\if@subchfontset\else + \SetSubchFont[\@masterfontfeatures,Scale=1.2]{\@masterfontname} +\fi +\newfontfamily\subchfont[\@subchfontfeatures]{\@subchfontname} +% +\newif \if@headfontdefault +\if@headfontset\else + \SetHeadFont[\@masterfontfeatures,Scale=0.92]{\@masterfontname} + \global\@headfontdefaulttrue +\fi +\newfontfamily\headfont[\@headfontfeatures]{\@headfontname} +%% +\defaultfontfeatures{} % reset +\defaultfontfeatures{% for decofont + SmallCapsFeatures={Renderer=Basic},Kerning=On,Ligatures=TeX,% +}% +%% The decofont must be NovelDeco.otf or a user modification of that font: +\if@decofontset\else + \IfFontExistsTF{NovelDeco.otf}{ + \SetDecoFont{NovelDeco} + }{} +\fi +%% +\gdef\acronym#1{#1}% Re-defined below, if decofont available. +%% +%% Now to get the decofont activated: +% Decorative glyphs, only in this font. Should not be re-set by user: +\gdef\decoglyph#1{~} % If NovelDeco not found, non-breaking space in main text. +% +\if@gotdeco % NovelDeco or a user-defined alternative was found: + \newfontface\@decoglyph[% + \@decofontfeatures,% + ]{\@decofontname} + \newfontface\@decoglypha[% + \@decofontfeatures,RawFeature=+ss01,% + ]{\@decofontname} + \newfontface\@decoglyphb[% + \@decofontfeatures,RawFeature=+ss02,% + ]{\@decofontname} + \newfontface\@decoglyphc[% + \@decofontfeatures,RawFeature=+ss03,% + ]{\@decofontname} + % + \gdef\decoglyph#1{% Be sure to use % without preceding space: + \IfBeginWith{#1}{s}{% numeral superscript + \StrBehind{#1}{s}[\@tempdecoglyph]{\@decoglyph{#1}}% + }{}% + \IfBeginWith{#1}{r}{% regular weight symbol + \StrBehind{#1}{r}[\@tempdecoglyph]{\@decoglyph\symbol{\@tempdecoglyph}}% + }{}% + \IfBeginWith{#1}{l}{% light weight symbol + \StrBehind{#1}{l}[\@tempdecoglyph]{\@decoglypha\symbol{\@tempdecoglyph}}% + }{}% + \IfBeginWith{#1}{e}{% extra light weight symbol + \StrBehind{#1}{e}[\@tempdecoglyph]{\@decoglyphb\symbol{\@tempdecoglyph}}% + }{}% + \IfBeginWith{#1}{t}{% thin weight symbol + \StrBehind{#1}{t}[\@tempdecoglyph]{\@decoglyphc\symbol{\@tempdecoglyph}}% + }{}% + }% end gdef decoglyph + % + % The trouble with acronyms is that they look too big in regular capitals, + % and too small in small caps. Command \acronym{} tries to provide an + % intermediate size. The letters were drawn from Linux Libertine, scaled, + % weights adjusted, the placed in NovelDeco.otf. + \gdef\acronym#1{{\decofont{#1}}} + % +\fi% end \if@gotdeco +% +%% +% Any other fonts will use these defaults: +\defaultfontfeatures{} % reset +% The novel-specific display fonts use these defaults: +\defaultfontfeatures{% + SmallCapsFeatures={Renderer=Basic},% + Ligatures=TeX,% +}% +% +%% + + +% Get rid of previously-defined fake polyglossia commands, +% but you can still use \setkeys from that package: +\let\SetMainLanguage\relax +\let\SetDefaultLanguage\relax +\let\SetOtherLanguage\relax +\let\SetOtherLanguages\relax +\let\setmainlanguage\relax +\let\setdefaultlanguage\relax +\let\setotherlanguage\relax +\let\setotherlanguages\relax +% Now that the basic fonts are defined, we can load these packages: +\RequirePackage{polyglossia} % Instead of babel. +% +\ifthenelse{\equal{\@setmainlang}{}}{ + \setmainlanguage{english} +}{ + \ifthenelse{\equal{\@setmainlangopt}{}}{ + \setmainlanguage{\@setmainlang} + }{ + \setmainlanguage[\@setmainlangopt]{\@setmainlang} + } +} +\ifthenelse{\equal{\@setotherlang}{}}{}{ + \ifthenelse{\equal{\@setotherlangopt}{}}{ + \setotherlanguage{\@setotherlang} + }{ + \setotherlanguage[\@setotherlangopt]{\@setotherlang} + } +} +\ifthenelse{\equal{\@setotherlangs}{}}{}{ + \ifthenelse{\equal{\@setotherlangsopt}{}}{ + \setotherlanguages{\@setotherlangs} + }{ + \setotherlanguages[\@setotherlangsopt]{\@setotherlangs} + } +} +%% This provides default microtype settings, allows the user to over-ride, and +% hopefully prevents the user from choosing inappropriate settings: +\let\microtypesetup\relax % fake command no longer needed +\if@setmicrotype % user wrote \microtypesetup{} in Preamble + \IfSubStr{\@mymicrotypesetup}{config}{% user specified own config file + \gdef\@mymicrotypeset{\@mymicrotypesetup} + }{ % default to novel's config file + \gdef\@mymicrotypeset{% + config=novel-microtype,\@mymicrotypesetup} + } +\else % user did not write \microtypesetup{} in Preamble + \gdef\@mymicrotypeset{% + config=novel-microtype,stretch=20,shrink=20} +\fi +\RequirePackage[\@mymicrotypeset,final,tracking]{microtype} +% +%% + + + +% +%% End of file `novel-FontDefaults.sty' + + |