summaryrefslogtreecommitdiff
path: root/tex/context/fonts/mkiv/type-imp-stix.mkiv
blob: 3ac0b72572d27fa813826ae5005358a6321f523b (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
%D \module
%D   [       file=type-otf,
%D        version=2007.07.30,
%D          title=\CONTEXT\ Typescript Macros,
%D       subtitle=Stix,
%D         author=Hans Hagen,
%D           date=\currentdate,
%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.

%D We provide typescripts for version one and two of the stix fonts. There is a
%D xits variant based on the first (not opentype) release that also provides
%D bidirectional math. With (in 2022) stixtwo being frozsen for 2 years we can make
%D these the default now.
%D
%D Users should be aware of the fact that the stix filenames keep changing so if
%D something fails, make sure you have the files and that the names below match
%D those on your system. In \TEX\ distributions there's 2 and Two and math can have
%D -Regular appended or not. You can expect the \CONTEXT\ distribution to be kept up
%D to date.
%D
%D Per november 2022 we swithched from \OPENTYPE\ (otf) files to \TRUETYPE\ (ttf)
%D files. The main reason is that the metrics are cleaner, especially when one peeks
%D into the font for the purpose tweaking math (boundingbox, true positioning
%D unaffected by excessive hinting shown in in FontForge). It is yet unclear to us
%D (MS & HH) why there is this difference, but it might relate to the toolchain used
%D for generating these fonts. We might even switch to (smaller) unhinted \TRUETYPE\
%D fonts at some point but then we need to generate them ourselves). Anyway, the end
%D results are the same but we just want to be able to view it right.

\definefontfeature
  [stixtwomath]
  [ss02=yes] % otherwise weird (non italic) g

\definefontfeature[stixtwomath][copymathscripts=yes] % see lfg file

\starttypescriptcollection[stix]

    \doifunknownfontfeature {stixtwo-math-bold} {\definefontfeature[stixtwo-math-bold][boldened]}

    \starttypescript [\s!math] [stix,stixtwo,stix-nt,stixtwo-nt,xits]
        \checkedmapfontsize[\typescripttwo][\s!script]      [.70]
        \checkedmapfontsize[\typescripttwo][\s!scriptscript][.55]
    \stoptypescript

    \starttypescript [\s!math] [stix,stixtwo,xits] [\s!name]
        \definefontsynonym[\s!MathRoman]    [\s!file:stixtwomath-regular.ttf][\s!features={\s!math\mathsizesuffix,stixtwomath,stixtwo:mathextra,mathextra},\s!goodies=stixtwo-math]
        \definefontsynonym[\s!MathRomanBold][\s!file:stixtwomath-regular.ttf][\s!features={\s!math\mathsizesuffix,stixtwo-math-bold,stixtwomath,stixtwo:mathextra,mathextra},\s!goodies=stixtwo-math]
    \stoptypescript

    \starttypescript [\s!math] [stix-nt,stixtwo-nt] [\s!name]
        \definefontsynonym[\s!MathRoman][\s!file:stixtwomath-regular.ttf][\s!features={\s!math\mathsizesuffix,stixtwomath,stixtwo:mathextra,mathextra}]
        \definefontsynonym[\s!MathRomanBold][\s!file:stixtwomath-regular.ttf][\s!features={\s!math\mathsizesuffix,stixtwo-math-bold,stixtwomath,stixtwo:mathextra,mathextra}]
    \stoptypescript

    \starttypescript [\s!serif] [stix,stixtwo,xits] [\s!name]
        \setups[\s!font:\s!fallback:\s!serif]
        \definefontsynonym[\s!Serif]          [\s!file:stixtwotext-regular.ttf]   [\s!features=\s!default]
        \definefontsynonym[\s!SerifBold]      [\s!file:stixtwotext-bold.ttf]      [\s!features=\s!default]
        \definefontsynonym[\s!SerifItalic]    [\s!file:stixtwotext-italic.ttf]    [\s!features=\s!default]
        \definefontsynonym[\s!SerifBoldItalic][\s!file:stixtwotext-bolditalic.ttf][\s!features=\s!default]
    \stoptypescript

    \starttypescript[stix,stixtwo,xits,stix-nt,stixtwo-nt]
        \definetypeface [\typescriptone] [\s!rm] [\s!serif] [stixtwo]    [\s!default]
        \definetypeface [\typescriptone] [\s!ss] [\s!serif] [stixtwo]    [\s!default]
        \definetypeface [\typescriptone] [\s!tt] [\s!mono]  [dejavu]     [\s!default] [\s!rscale=0.895]
    \stoptypescript
    \starttypescript[stix,stixtwo,xits]
        \definetypeface [\typescriptone] [\s!mm] [\s!math]  [stixtwo]    [\s!default] [\s!direction=\s!both]
    \stoptypescript
    \starttypescript[stix-nt,stixtwo-nt]
        \definetypeface [\typescriptone] [\s!mm] [\s!math]  [stixtwo-nt] [\s!default] [\s!direction=\s!both]
    \stoptypescript

\stoptypescriptcollection