type-imp-stix.mkiv /size: 4883 b    last modification: 2025-02-21 11:03
1%D \module
2%D   [       file=type-otf,
3%D        version=2007.07.30,
4%D          title=\CONTEXT\ Typescript Macros,
5%D       subtitle=Stix,
6%D         author=Hans Hagen,
7%D           date=\currentdate,
8%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
9%C
10%C This module is part of the \CONTEXT\ macro||package and is
11%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
12%C details.
13
14%D We provide typescripts for version one and two of the stix fonts. There is a
15%D xits variant based on the first (not opentype) release that also provides
16%D bidirectional math. With (in 2022) stixtwo being frozsen for 2 years we can make
17%D these the default now.
18%D
19%D Users should be aware of the fact that the stix filenames keep changing so if
20%D something fails, make sure you have the files and that the names below match
21%D those on your system. In \TEX\ distributions there's 2 and Two and math can have
22%D -Regular appended or not. You can expect the \CONTEXT\ distribution to be kept up
23%D to date.
24%D
25%D Per november 2022 we swithched from \OPENTYPE\ (otf) files to \TRUETYPE\ (ttf)
26%D files. The main reason is that the metrics are cleaner, especially when one peeks
27%D into the font for the purpose tweaking math (boundingbox, true positioning
28%D unaffected by excessive hinting shown in in FontForge). It is yet unclear to us
29%D (MS & HH) why there is this difference, but it might relate to the toolchain used
30%D for generating these fonts. We might even switch to (smaller) unhinted \TRUETYPE\
31%D fonts at some point but then we need to generate them ourselves). Anyway, the end
32%D results are the same but we just want to be able to view it right.
33%D
34%D February, 2025: In non-compact mode the sizes of script and scriptscript
35%D come from the bodyfontenvironment. For example, for 12pt, they are 9pt and 7pt,
36%D respectively (font is loaded three times, and a bit late).
37%D In compact mode is loaded directly, and the scaling factors come from the font
38%D parameters (done in engine). We can, in both cases, override as we below. (Also
39%D possible in the goodie file.)
40
41
42\definefontfeature
43  [stixtwomath]
44  [ss02=yes] % otherwise weird (non italic) g
45
46\definefontfeature[stixtwomath][copymathscripts=yes] % see lfg file
47
48\starttypescriptcollection[stix]
49
50    \doifunknownfontfeature {stixtwo-math-bold} {\definefontfeature[stixtwo-math-bold][boldened]}
51
52    \starttypescript [\s!math] [stix,stixtwo,stix-nt,stixtwo-nt,xits]
53        \checkedmapfontsize[\typescripttwo][\s!script]      [.65]% 70 in font
54        \checkedmapfontsize[\typescripttwo][\s!scriptscript][.50]% 55 in font
55    \stoptypescript
56
57    \starttypescript [\s!math] [stix,stixtwo,xits] [\s!name]
58        \definefontsynonym[\s!MathRoman]    [\s!file:stixtwomath-regular.ttf][\s!features={\s!math\mathsizesuffix,stixtwomath,stixtwo:mathextra,mathextra},\s!goodies=stixtwo-math]
59        \definefontsynonym[\s!MathRomanBold][\s!file:stixtwomath-regular.ttf][\s!features={\s!math\mathsizesuffix,stixtwo-math-bold,stixtwomath,stixtwo:mathextra,mathextra},\s!goodies=stixtwo-math]
60    \stoptypescript
61
62    \starttypescript [\s!math] [stix-nt,stixtwo-nt] [\s!name]
63        \definefontsynonym[\s!MathRoman][\s!file:stixtwomath-regular.ttf][\s!features={\s!math\mathsizesuffix,stixtwomath,stixtwo:mathextra,mathextra}]
64        \definefontsynonym[\s!MathRomanBold][\s!file:stixtwomath-regular.ttf][\s!features={\s!math\mathsizesuffix,stixtwo-math-bold,stixtwomath,stixtwo:mathextra,mathextra}]
65    \stoptypescript
66
67    \starttypescript [\s!serif] [stix,stixtwo,xits] [\s!name]
68        \setups[\s!font:\s!fallback:\s!serif]
69        \definefontsynonym[\s!Serif]          [\s!file:stixtwotext-regular.ttf]   [\s!features=\s!default,\s!goodies=stixtwo-text]
70        \definefontsynonym[\s!SerifBold]      [\s!file:stixtwotext-bold.ttf]      [\s!features=\s!default,\s!goodies=stixtwo-text]
71        \definefontsynonym[\s!SerifItalic]    [\s!file:stixtwotext-italic.ttf]    [\s!features=\s!default,\s!goodies=stixtwo-text]
72        \definefontsynonym[\s!SerifBoldItalic][\s!file:stixtwotext-bolditalic.ttf][\s!features=\s!default,\s!goodies=stixtwo-text]
73    \stoptypescript
74
75    \starttypescript[stix,stixtwo,xits,stix-nt,stixtwo-nt]
76        \definetypeface [\typescriptone] [\s!rm] [\s!serif] [stixtwo]    [\s!default]
77        \definetypeface [\typescriptone] [\s!ss] [\s!sans]  [dejavu]     [\s!default] [\s!rscale=0.895]
78        \definetypeface [\typescriptone] [\s!tt] [\s!mono]  [dejavu]     [\s!default] [\s!rscale=0.895]
79    \stoptypescript
80    \starttypescript[stix,stixtwo,xits]
81        \definetypeface [\typescriptone] [\s!mm] [\s!math]  [stixtwo]    [\s!default] [\s!direction=\s!both]
82    \stoptypescript
83    \starttypescript[stix-nt,stixtwo-nt]
84        \definetypeface [\typescriptone] [\s!mm] [\s!math]  [stixtwo-nt] [\s!default] [\s!direction=\s!both]
85    \stoptypescript
86
87\stoptypescriptcollection
88