Debian Codegraph @

texmf-dist/tex/optex/base/f-lmfonts.opm

raw
1 %% This is part of the OpTeX project, see http://petr.olsak.net/optex
2
3 \_famdecl [Latin Modern] \LMfonts {TeX Gyre fonts based on Computer Modern}
4 {\roman \sans \quotset \ttset \ttprop \ttlight \ttcond \upital
5 \dunhill submods:\caps \slant \nbold \bolder} {\rm \bf \it \bi \tt} {LM}
6 {[lmroman10-regular]}
7 {\_def\_fontnamegen {[\_optname{lm\_subfamV.\_currV}]:\_fontfeatures}}
8
9 \_wlog{\_detokenize{%
10 Modifiers (selects subfamily):^^J
11 \modreset .. implicit values (serif, bold extended, nocaps)^^J
12 \sans ...... sans serif subfamily^^J
13 \quotset ... quotation subfamily^^J
14 \ttset ..... typewriter subfamily^^J
15 \ttprop .... proportional typewriter-like subfamily^^J
16 \ttlight ... light typewriter subfamily^^J
17 \ttcond .... condensed typewriter subfamily^^J
18 \upital .... upright italic (only \rm)^^J
19 \dunhill ... dunhill roman subfamily (only \rm, \it)^^J%
20 Sub-modifiers (selects special variants of given subfamily):^^J
21 \caps ...... caps & small caps (available only at limited shapes)^^J
22 \slant ..... slanted (default in some subfamilies)^^J
23 \nbold ..... normal bold (extended bold is default)^^J
24 \bolder .... extended bold^^J%
25 Note: Text fonts support optical sizes, but LatinModern-Math only for scripts.^^J
26 Use another CM-like family if optical sizes not wanted: \fontfam[NewCM].
27 }}
28
29 \_def\_LMregfont #1 #2 #3{%
30 \_edef\_tmp {\_noexpand\_regoptsizes #1 #2 \_ea\_detokenize\_ea{#3}}%
31 \_lowercase\_ea{\_tmp}% OTF file names are lowercase
32 }
33 \_def \_regoptFS {5 <5.5 6 <6.5 7 <7.5 8 <8.5 9 <9.5 10 <11.1 12 <15 17 <*}
34 \_def \_regoptFT {5 <5.5 6 <6.5 7 <7.5 8 <8.5 9 <9.5 10 <11.1 12 <*}
35 \_def \_regoptST {7 <7.5 8 <8.5 9 <9.5 10 <11.1 12 <*}
36 \_def \_regoptES {8 <8.5 9 <9.5 10 <11.1 12 <15 17 <*}
37 \_def \_regoptET {8 <8.5 9 <9.5 10 <11.1 12 <*}
38 \_def \_regoptT {10 <*}
39 \_def \_regoptE {8 <*}
40
41 \_LMregfont lmrm.r LMRoman?-Regular \_regoptFS % 5-17
42 \_LMregfont lmrm.bx LMRoman?-Bold \_regoptFT % 5-12
43 \_LMregfont lmrm.i LMRoman?-Italic \_regoptST % 7-12
44 \_LMregfont lmrm.bxi LMRoman?-BoldItalic \_regoptT % 10
45 \_LMregfont lmrm.isl LMRomanSlant?-Regular \_regoptES % 8-17
46 \_LMregfont lmrm.bxisl LMRomanSlant?-Bold \_regoptT % 10
47 \_LMregfont lmrm.b LMRomanDemi?-Regular \_regoptT % 10
48 \_LMregfont lmrm.bi LMRomanDemi?-Oblique \_regoptT % 10
49
50 \_LMregfont lmss.r LMSans?-Regular \_regoptES % 8-17
51 \_LMregfont lmss.bx LMSans?-Bold \_regoptT % 10
52 \_LMregfont lmss.i LMSans?-Oblique \_regoptES % 8-17
53 \_LMregfont lmss.bxi LMSans?-BoldOblique \_regoptT % 10
54 \_LMregfont lmss.b LMSansDemiCond?-Regular \_regoptT % 10
55 \_LMregfont lmss.bi LMSansDemiCond?-Oblique \_regoptT % 10
56
57 \_LMregfont lmsq.r LMSansQuot?-Regular \_regoptE % 8
58 \_LMregfont lmsq.b LMSansQuot?-Bold \_regoptE % 8
59 \_LMregfont lmsq.i LMSansQuot?-Oblique \_regoptE % 8
60 \_LMregfont lmsq.bi LMSansQuot?-BoldOblique \_regoptE % 8
61
62 \_LMregfont lmtt.r LMMono?-Regular \_regoptET % 8-12
63 \_LMregfont lmtt.b LMMonoLt?-Bold \_regoptT % 10
64 \_LMregfont lmtt.i LMMono?-Italic \_regoptT % 10
65 \_LMregfont lmtt.bi LMMonoLt?-BoldOblique \_regoptT % 10
66 \_LMregfont lmtt.isl LMMonoSlant?-Regular \_regoptT % 10
67 \_optfontalias {lmtt.bisl} {lmtt.bi}
68
69 \_LMregfont lmtp.r LMMonoPropLt?-Regular \_regoptT % 10
70 \_LMregfont lmtp.bx LMMonoPropLt?-Bold \_regoptT % 10
71 \_LMregfont lmtp.i LMMonoPropLt?-Oblique \_regoptT % 10
72 \_LMregfont lmtp.bxi LMMonoPropLt?-BoldOblique \_regoptT % 10
73 \_LMregfont lmtp.b LMMonoProp?-Regular \_regoptT % 10
74 \_LMregfont lmtp.bi LMMonoProp?-Oblique \_regoptT % 10
75
76 \_LMregfont lmtl.r LMMonoLt?-Regular \_regoptT % 10
77 \_LMregfont lmtl.i LMMonoLt?-Oblique \_regoptT % 10
78
79 \_LMregfont lmtc.r LMMonoLtCond?-Regular \_regoptT % 10
80 \_LMregfont lmtc.i LMMonoLtCond?-Oblique \_regoptT % 10
81
82 \_LMregfont lmrm.rc LMRomanCaps?-Regular \_regoptT % 10
83 \_LMregfont lmrm.ic LMRomanCaps?-Oblique \_regoptT % 10
84 \_LMregfont lmtt.rc LMMonoCaps?-Regular \_regoptT % 10
85 \_LMregfont lmtt.ic LMMonoCaps?-Oblique \_regoptT % 10
86
87 \_LMregfont lmmu.r LMRomanUnsl?-Regular \_regoptT % 10
88 \_LMregfont lmdu.r LMRomanDunh?-Regular \_regoptT % 10
89 \_LMregfont lmdu.sl LMRomanDunh?-Oblique \_regoptT % 10
90
91 % main modifiers (they select a subfamily)
92 \_moddef \resetmod {\_fsetV subfam=rm \_fvars r bx i bxi }
93 \_moddef \sans {\_fsetV subfam=ss \_fvars r bx i bxi }
94 \_moddef \quotset {\_fsetV subfam=sq \_fvars r b i bi }
95 \_moddef \ttset {\_fsetV subfam=tt \_fvars r b i bi }
96 \_moddef \ttprop {\_fsetV subfam=tp \_fvars r b i bi }
97 \_moddef \ttlight {\_fsetV subfam=tl \_fvars r . i . }
98 \_moddef \ttcond {\_fsetV subfam=tc \_fvars r . i . }
99 \_moddef \upital {\_fsetV subfam=mu \_fvars r . . . }
100 \_moddef \dunhill {\_fsetV subfam=du \_fvars r . sl . }
101
102 % submodifiers (they select special variants in a subfamily)
103 \_moddef \nbold {\_onlyif subfam=rm,ss,tp: {\_fvars r b i bi }}
104 \_moddef \bolder {\_onlyif subfam=rm,ss,tp: {\_fvars r bx i bxi }}
105 \_moddef \slant {\_onlyif subfam=rm: {\_fvars r bx isl bxisl }%
106 \_onlyif subfam=tt: {\_fvars r b isl bisl }}
107 \_moddef \caps {\_onlyif subfam=rm,tt: {\_fvars rc . ic . }}
108
109 %\_famvardef\tt{\_LMfonts \_addto\_fontfeatures{-tlig;}\_ttset \_rm}
110 %\_private \LMfonts \ttset ; % used in \tt, % removed 2022-02-22
111
112 \_initfontfamily % new font family must be initialized
113
114 \_loadmath {[latinmodern-math]}
115
116 \_endcode
117
118 \secc[optsizes] How to write the font family file with optical sizes
119
120 You can use \^`\_optname` macro when `\_fontnamegen` in expanded. This macro is fully
121 expandable and its input is `<internal-template>` and its output is a
122 part of the font file name `<size-dependent-template>` with respect to given
123 optical size.
124
125 You can declare a collection of `<size-dependent-template>`s for one
126 given `<internal-template>` by the \^`\_regoptsizes` macro.
127 The syntax is shown for one real case:
128
129 \begtt
130 \_regoptsizes lmr.r lmroman?-regular
131 5 <5.5 6 <6.5 7 <7.5 8 <8.5 9 <9.5 10 <11.1 12 <15 17 <*
132 \endtt
133
134 In general:
135
136 \begtt \catcode`\<=13
137 \_regoptsizes <internal-template> <general-ouput-template> <resizing-data>
138 \endtt
139
140 Suppose our example above. Then `\_optname{lmr.r}` expands to
141 lmroman?-regular where the question mark is substituted by a number
142 depending on current `\_optsize`. If the `\_optsize` lies between two boundary
143 values (they are prefixed by \code{<} character) then the number written between
144 them is used. For example if $11.1 \lt `\_optsize` \le 15$ then 12 is
145 substituted instead question mark. The <resizing-data> virtually begins
146 with zero \code{<0}, but it is not explicitly written. The right part of
147 <resizing-data> must be terminated by \code{<*} which means "less than infinity".
148
149 If `\_optname` gets an argument which is not registered <internal-template>
150 then it expands to `\_failedoptname` which typically ends with an error message
151 about missing font. You can redefine `\_failedoptname` macro to some
152 existing font if you find it useful.
153
154 We are using a special macro `\_LMregfont` in `f-lmfonts.opm`.
155 It sets the file names to
156 lowercase and enables us to use shortcuts instead of real <resizing-data>.
157 There are shortcuts `\_regoptFS`, `\_regoptT`, etc. here. The collection of
158 `<internal-templates>` are declared, each of them covers a collection of real
159 file names.
160
161 The \^`\_optfontalias` `{<new-template>} {<internal-template>}` declares
162 `<new-template>` with the same meaning as previously declared
163 `<internal-template>`.
164
165 The `\_optname` macro can be used even if no otical sizes are provided by
166 a font family. Suppose that font file names are much more chaotic (because
167 artists are very creative people), so you need to declare more systematic
168 `<internal-templates>` and do an alias from each `<internal-template>` to
169 `<real-font-name>`. For example, you can do it as follows:
170
171 \begtt
172 \def\fontalias #1 #2 {\_regoptsizes #1 ?#2 {} <*}
173 % alias name real font name
174 \fontalias crea-a-regular {Creative Font}
175 \fontalias crea-a-bold {Creative FontBold}
176 \fontalias crea-a-italic {Creative olique}
177 \fontalias crea-a-bolditalic {Creative Bold plus italic}
178 \fontalias crea-b-regular {Creative Regular subfam}
179 \fontalias crea-b-bold {Creative subfam bold}
180 \fontalias crea-b-italic {Creative-subfam Oblique}
181 \fontalias crea-b-bolditalic {Creative Bold subfam Oblique}
182 \endtt
183
184 Another example of a font family with optical sizes is Antykwa Półtawskiego.
185 The optical sizes feature is deactivated by default and it is switched on by
186 `\osize` font modifier:
187
188 \printdoc f-poltawski.opm