summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/lualatex/simurgh/simurgh-fonts.sty
blob: d44055abc92ca909fc1624eef98c565703c9b64e (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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{simurgh-fonts}[2013/09/18 v0.01a fonts]
\newfontscript{Parsi}{arab}
\newfontlanguage{Parsi}{FAR}
\aliasfontfeatureoption{Numbers}{Arabic}{Parsi}
\ExplSyntaxOn
\DeclareDocumentCommand \setmainparsifont { O{} m } {
  \fontspec_select:nn{Script=Parsi,Numbers=Parsi,Language=Parsi,#1}{#2}
  \use:x {
    \exp_not:N \DeclareRobustCommand \exp_not:N \parsimainfont {
      \exp_not:N \fontencoding {\g_fontspec_encoding_tl}
      \exp_not:N \fontfamily {\l_fontspec_family_tl} \exp_not:N \selectfont
    }
  }
  \cs_set_eq:NN \rmdefault \l_fontspec_family_tl
  \normalfont
}
\DeclareDocumentCommand \setmainlatinfont { O{} m } {
  \fontspec_select:nn{Ligatures=TeX,#1}{#2}
  \use:x {
    \exp_not:N \DeclareRobustCommand \exp_not:N \latinmainfont {
      \exp_not:N \fontencoding {\g_fontspec_encoding_tl}
      \exp_not:N \fontfamily {\l_fontspec_family_tl} \exp_not:N \selectfont
    }
  }
}
\cs_set_eq:NN \setlatinsansfont \setsansfont
\cs_set_eq:NN \setlatinmonofont \setmonofont
\DeclareDocumentCommand \loadnewparsifont { m O{} m } {
  \fontspec_select:nn{Script=Parsi,Numbers=Parsi,Language=Parsi,#2}{#3}
  \use:x {
    \exp_not:N \DeclareRobustCommand \exp_not:N #1 {
      \exp_not:N \fontencoding {\g_fontspec_encoding_tl}
      \exp_not:N \fontfamily {\l_fontspec_family_tl} \exp_not:N \selectfont
    }
  }
}
\DeclareDocumentCommand \loadnewlatinfont { m O{} m } {
  \fontspec_select:nn{Ligatures=TeX,#2}{#3}
  \use:x {
    \exp_not:N \DeclareRobustCommand \exp_not:N #1 {
      \exp_not:N \fontencoding {\g_fontspec_encoding_tl}
      \exp_not:N \fontfamily {\l_fontspec_family_tl} \exp_not:N \selectfont
    }
  }
}
\newcommand\parsisfdefault{}
\newcommand\parsittdefault{}
\newcommand\iranicdefault{}
\newcommand\navardefault{}
\newcommand\pookdefault{}
\newcommand\sayehdefault{}
\DeclareRobustCommand\parsisffamily
        {\not@math@alphabet\parsisffamily\mathparsisf
         \fontfamily\parsisfdefault\selectfont}
\DeclareRobustCommand\parsittfamily
        {\not@math@alphabet\parsittfamily\mathparsitt
         \fontfamily\parsittdefault\selectfont}
\DeclareRobustCommand\iranicfamily
        {\not@math@alphabet\iranicfamily\mathiranic
         \fontfamily\iranicdefault\selectfont}
\DeclareRobustCommand\navarfamily
        {\not@math@alphabet\navarfamily\mathnavar
         \fontfamily\navardefault\selectfont}
\DeclareRobustCommand\pookfamily
        {\not@math@alphabet\pookfamily\mathpook
         \fontfamily\pookdefault\selectfont}
\DeclareRobustCommand\sayehfamily
        {\not@math@alphabet\sayehfamily\mathsayeh
         \fontfamily\sayehdefault\selectfont}
\DeclareTextFontCommand{\textparsisf}{\parsisffamily}
\DeclareTextFontCommand{\textparsitt}{\parsittfamily}
\DeclareTextFontCommand{\textiranic}{\iranicfamily}
\DeclareTextFontCommand{\textnavar}{\navarfamily}
\DeclareTextFontCommand{\textpook}{\pookfamily}
\DeclareTextFontCommand{\textsayeh}{\sayehfamily}
\DeclareDocumentCommand \setparsisansfont { O{} m } {
  \fontspec_set_family:Nnn \parsisfdefault {Script=Parsi,Numbers=Parsi,Language=Parsi,#1}{#2}
  \normalfont
}
\DeclareDocumentCommand \setparsimonofont { O{} m } {
  \fontspec_set_family:Nnn \parsittdefault {Script=Parsi,Numbers=Parsi,Language=Parsi,#1}{#2}
  \normalfont
}
\DeclareDocumentCommand \setnavarfont { O{} m } {
  \fontspec_set_family:Nnn \navardefault {Script=Parsi,Numbers=Parsi,Language=Parsi,#1}{#2}
  \normalfont
}
\DeclareDocumentCommand \setpookfont { O{} m } {
  \fontspec_set_family:Nnn \pookdefault {Script=Parsi,Numbers=Parsi,Language=Parsi,#1}{#2}
  \normalfont
}

\DeclareDocumentCommand \setsayehfont { O{} m } {
  \fontspec_set_family:Nnn \sayehdefault {Script=Parsi,Numbers=Parsi,Language=Parsi,#1}{#2}
  \normalfont
}

\DeclareDocumentCommand \setiranicfont { O{} m } {
  \fontspec_set_family:Nnn \iranicdefault {Script=Parsi,Numbers=Parsi,Language=Parsi,#1}{#2}
  \normalfont
}
\ExplSyntaxOff

\def\reset@latinfont{%
\let\normalfont\latinmainfont%
\let\reset@font\normalfont%
\latinmainfont}


\def\reset@parsifont{%
\let\normalfont\parsimainfont%
\let\reset@font\normalfont%
\parsimainfont}


\simurgh@AtEndPreamble{%
  \if@simurgh@csundef{parsimainfont}{%
    \simurgh@error{choose the main parsi font}{}}%
    {}%
}



% this is not good at all; it requires heaps of improvements
\setmainlatinfont[ExternalLocation,BoldFont={lmroman10-bold},BoldItalicFont={lmroman10-bolditalic},ItalicFont={lmroman10-italic},SmallCapsFont={lmromancaps10-regular},SlantedFont={lmromanslant10-regular},BoldSlantedFont={lmromanslant10-bold}]{lmroman10-regular}

\endinput