summaryrefslogtreecommitdiff
path: root/macros/unicodetex/latex/fontsetup/fspgfsdidotot.sty
blob: f8c312c02c2535e8bb71d885a4377ab4b729fc62 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49

\RequirePackage{fontspec}

\setmainfont[ItalicFont=GFSOlga,
            BoldFont=GFSDidotBold,
            BoldItalicFont=GFSDidotBoldItalic,SlantedFont=GFSDidotItalic,
            SmallCapsFeatures={Numbers=OldStyle}]{GFSDidot.otf}
\newfontfamily{\GFSDidotoSubstFont}[%
            ItalicFont=GFSDidotItalic,
            BoldFont=GFSDidotBold,
            BoldItalicFont=GFSDidotBoldItalic,
            SmallCapsFeatures={Numbers=OldStyle}]{GFSDidot.otf}


\RequirePackage{unicode-math}
%\setmathfont{XITSMath-Regular.otf}
\setmathfont{NewCMMath-Book.otf}
\setmathfont[range=\mathup/{num,latin,Latin,greek,Greek}]{GFSDidot.otf} 
\setmathfont[range=\mathbfup/{num,latin,Latin,greek,Greek}]{GFSDidotBold.otf} 
\setmathfont[range=\mathit/{greek,Greek}]{GFSOlga.otf}
\setmathfont[range=\mathit/{num,latin,Latin}]{GFSDidotItalic.otf}
\setmathfont[range=\mathbfit/{num,latin,Latin,greek,Greek}]{GFSDidotBoldItalic.otf}

%% the next code replaces non-existent Olga Latin with GFSDidotItalic Latin
\XeTeXinterchartokenstate=1%
\newXeTeXintercharclass\GFSDidotoSubst%
\count255="0021%
\loop\ifnum\count255<"0341%
  \XeTeXcharclass\count255=\GFSDidotoSubst%
  \advance\count255 by 1%
\repeat%
\XeTeXinterchartoks 0 \GFSDidotoSubst = {\begingroup\GFSDidotoSubstFont}%
\XeTeXinterchartoks 4095 \GFSDidotoSubst = {\begingroup\GFSDidotoSubstFont}%
\XeTeXinterchartoks \GFSDidotoSubst 0 = {\endgroup}%
\XeTeXinterchartoks \GFSDidotoSubst 4095 = {\endgroup}%
%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%% Fix epsilons %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\AtBeginDocument{\renewcommand{\epsilon}{\textit{ε}}
\renewcommand{\varepsilon}{\textsl{ε}}}
%%%%%%%%% Fix phi %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newfontfamily\phifix[Scale=1.2]{GFSDidotItalic.otf}
\AtBeginDocument{\renewcommand{\phi}{\textrm{\phifix\char"03D5}}}
%%%%%%%%% Fix theta %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\AtBeginDocument{\renewcommand{\theta}{\textsl{θ}}
\renewcommand{\vartheta}{\textit{θ}}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\endinput