summaryrefslogtreecommitdiff
path: root/fonts/beuron/tex/beuron.sty
blob: c40412382c50493cdca2f3bc270ab8f4bff4ac6e (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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
% beuron.sty
% Paket für die Schrift der Beuroner Kunstschule
% Beuronese art script package
% Version 1.3
% Autor: K. Wehr
% 17. Januar 2018
% U.I.O.G.D.

% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% 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.3 or later is part of all distributions of LaTeX
% version 2005/12/01 or later.


\RequirePackage{expl3}
\ProvidesExplPackage {beuron} {2018/01/17} {1.3} {Beuronese art script package}

\RequirePackage{xparse}

\bool_lazy_or:nnT {\sys_if_engine_xetex_p:} {\sys_if_engine_luatex_p:}
   {
      \RequirePackage{fontspec}

      \fontspec_set_family:Nnn \l_beuron_schriftfamilie_tl
         {
            FontFace = {c}{n}{BeuronCondensed-Regular.otf},
            FontFace = {x}{n}{BeuronExtended-Regular.otf}
         }
         {
            Beuron-Regular.otf
         }
   }

\cs_generate_variant:Nn \tl_replace_all:Nnn {Nxn}

\box_new:N \l_beuron_mittepunkt_box
\skip_new:N \l_beuron_mittepunktabstand_skip

\tl_const:Nn \c_beuron_dehnbarer_doppelpunkt_tl
   {
      \penalty10000
      \skip_horizontal:N \l_beuron_mittepunktabstand_skip
      \c_colon_str
      \skip_horizontal:N \l_beuron_mittepunktabstand_skip
   }

% #1: Sollen Leerzeichen erhalten bleiben?
% #2: Text
\cs_new_protected:Npn \beuron_replace:nn #1#2
   {
      \skip_set:Nn \l_beuron_mittepunktabstand_skip {0em plus0.14em minus0.1em}

      \tl_set:Nn \l_tmpa_tl {#2}
      \tl_replace_all:Nnn \l_tmpa_tl {Ä} {AE}
      \tl_replace_all:Nnn \l_tmpa_tl {ä} {AE}
      \tl_replace_all:Nnn \l_tmpa_tl {Ö} {OE}
      \tl_replace_all:Nnn \l_tmpa_tl {ö} {OE}
      \tl_replace_all:Nnn \l_tmpa_tl {Ü} {UE}
      \tl_replace_all:Nnn \l_tmpa_tl {ü} {UE}
      \tl_replace_all:Nnn \l_tmpa_tl {ß} {SS}
      \tl_replace_all:Nxn \l_tmpa_tl {\c_colon_str \c_space_tl} {\c_beuron_dehnbarer_doppelpunkt_tl}
      \tl_replace_all:Nxn \l_tmpa_tl {\c_colon_str} {\c_beuron_dehnbarer_doppelpunkt_tl}

      \bool_if:NF #1
         {
            \hbox_set:Nn \l_beuron_mittepunkt_box {/}

            \tl_replace_all:Nnn \l_tmpa_tl {~}
               {
                  \skip_horizontal:N \l_beuron_mittepunktabstand_skip
                  \cleaders
                     \box_use:N \l_beuron_mittepunkt_box
                     \skip_horizontal:n {\box_wd:N \l_beuron_mittepunkt_box}
                  \skip_horizontal:N \l_beuron_mittepunktabstand_skip
               }
         }

      \l_tmpa_tl
   }

\cs_generate_variant:Nn \beuron_replace:nn {no}

\NewDocumentCommand \textbeuron {s m}
   {
      \group_begin:
      \bool_lazy_or:nnTF {\sys_if_engine_xetex_p:} {\sys_if_engine_luatex_p:}
         {
            \fontfamily{\l_beuron_schriftfamilie_tl}
            \fontseries{m}
            \fontshape{n}
            \selectfont
         }
         {
            \usefont{T1}{beuron}{m}{n}
         }
      \beuron_replace:no {#1}{#2}
      \group_end:
   }

\NewDocumentCommand \textbeuronc {s m}
   {
      \group_begin:
      \bool_lazy_or:nnTF {\sys_if_engine_xetex_p:} {\sys_if_engine_luatex_p:}
         {
            \fontfamily{\l_beuron_schriftfamilie_tl}
            \fontseries{c}
            \fontshape{n}
            \selectfont
         }
         {
            \usefont{T1}{beuron}{c}{n}
         }
      \beuron_replace:no {#1}{#2}
      \group_end:
   }

\NewDocumentCommand \textbeuronx {s m}
   {
      \group_begin:
      \bool_lazy_or:nnTF {\sys_if_engine_xetex_p:} {\sys_if_engine_luatex_p:}
         {
            \fontfamily{\l_beuron_schriftfamilie_tl}
            \fontseries{x}
            \fontshape{n}
            \selectfont
         }
         {
            \usefont{T1}{beuron}{x}{n}
         }
      \beuron_replace:no {#1}{#2}
      \group_end:
   }

\NewDocumentCommand \beuronOmega { }
   {
      \group_begin:
      \bool_lazy_or:nnTF {\sys_if_engine_xetex_p:} {\sys_if_engine_luatex_p:}
         {
            \fontfamily{\l_beuron_schriftfamilie_tl}
            \fontshape{n}
            \selectfont
            \symbol{937}
         }
         {
            \fontencoding{T1}
            \fontfamily{beuron}
            \fontshape{n}
            \selectfont
            \symbol{141}
         }
      \group_end:
   }