type-imp-cambria.mkiv /size: 5188 b    last modification: 2024-01-16 09:03
1%D \module
2%D   [       file=type-imp-cambria,
3%D        version=2007.07.30,
4%D          title=\CONTEXT\ Typescript Macros,
5%D       subtitle=Microsoft Cambria,
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 use Dejavu as it covers wider range of monospaced glyphs.
15
16\loadtypescriptfile[dejavu]
17
18\starttypescriptcollection[cambria]
19
20    \pushglobalsetups
21
22        \startsetups[cambria]
23            \setupmathradical[\c!leftmargin=.05mq,\c!mindepth=.05mx]%
24        \stopsetups
25
26    \popglobalsetups
27
28    % microsoft: cambria.ttc cambriab.ttf cambriai.ttf cambriaz.ttf
29    % ascender : cambmath.ttf cambria.ttf cambriab.ttf cambriai.ttf cambriaz.ttf
30
31    \doifunknownfontfeature {cambria-math-bold} {\definefontfeature[cambria-math-bold][boldened]}
32
33    \starttypescript [\s!math] [cambria,cambria-x,cambria-y,cambria-nt,cambria-m,cambria-a]
34        \checkedmapfontsize[\typescripttwo][\s!script]      [.73]
35        \checkedmapfontsize[\typescripttwo][\s!scriptscript][.60]
36    \stoptypescript
37
38    \starttypescript [\s!math,\s!serif] [cambria,cambria-x,cambria-y,cambria-nt]
39        % whatever matches
40        \definefontsynonym [CambriaMath]  [\s!name:cambriamath]
41        \definefontsynonym [CambriaSerif] [\s!name:cambria]
42    \stoptypescript
43    \starttypescript [\s!math,\s!serif] [cambria-m]
44        % microsoft cabria
45        \definefontsynonym [CambriaMath]  [\s!file:cambria.ttc(Cambria Math)]
46        \definefontsynonym [CambriaSerif] [\s!file:cambria.ttc(Cambria)]
47    \stoptypescript
48    \starttypescript [\s!math,\s!serif] [cambria-a]
49        % ascender cambria
50        \definefontsynonym [CambriaMath]  [\s!file:cambmath.ttf]
51        \definefontsynonym [CambriaSerif] [\s!file:cambria.ttf]
52    \stoptypescript
53
54    % We load a goodies file that will apply a patch to the font. As a demonstration
55    % we apply the patch when caching and when scaling which is why we also specify
56    % the goodies file with the name.
57
58    \starttypescript [\s!math] [cambria,cambria-m,cambria-a] [\s!name]
59        \loadfontgoodies[cambria-math]
60        \definefontsynonym [\s!MathRoman]     [CambriaMath] [\s!features={\s!math\mathsizesuffix,cambria:mathextra,mathextra},\s!goodies=cambria-math]
61        \definefontsynonym [\s!MathRomanBold] [CambriaMath] [\s!features={\s!math\mathsizesuffix,cambria-math-bold,cambria:mathextra,mathextra},\s!goodies=cambria-math]
62    \stoptypescript
63    \starttypescript [\s!math] [cambria-nt] [\s!name]
64        \loadfontgoodies[cambria-math]
65        \definefontsynonym [\s!MathRoman]     [CambriaMath] [\s!features={\s!math\mathsizesuffix,cambria:mathextra,mathextra}]
66        \definefontsynonym [\s!MathRomanBold] [CambriaMath] [\s!features={\s!math\mathsizesuffix,cambria-math-bold,cambria:mathextra,mathextra}]
67    \stoptypescript
68    \starttypescript [\s!math] [cambria-x] [\s!name]
69        \loadfontgoodies[cambria-math]
70        \definefontsynonym [\s!MathRoman]     [CambriaMath] [\s!features={\s!math,cambria:mathextra,mathextra},\s!goodies=cambria-math]
71        \definefontsynonym [\s!MathRomanBold] [CambriaMath] [\s!features={\s!math,cambria-math-bold,cambria:mathextra,mathextra},\s!goodies=cambria-math]
72    \stoptypescript
73    \starttypescript [\s!math] [cambria-y] [\s!name]
74        \loadfontgoodies[cambria-math]
75        \definefontsynonym [\s!MathRoman]     [CambriaMath] [\s!features={\s!math-nostack\mathsizesuffix,cambria:mathextra,mathextra},\s!goodies=cambria-math]
76        \definefontsynonym [\s!MathRomanBold] [CambriaMath] [\s!features={\s!math-nostack\mathsizesuffix,cambria-math-bold,cambria:mathextra,mathextra},\s!goodies=cambria-math]
77    \stoptypescript
78
79    \starttypescript [\s!serif] [cambria,cambria-m,cambria-a,cambria-nt] [\s!name]
80        \setups[\s!font:\s!fallback:\s!serif]
81        \definefontsynonym [\s!Serif]           [CambriaSerif]              [\s!features=\s!default,\s!goodies=cambria]
82        \definefontsynonym [\s!SerifBold]       [\s!name:cambriabold]       [\s!features=\s!default,\s!goodies=cambria]
83        \definefontsynonym [\s!SerifItalic]     [\s!name:cambriaitalic]     [\s!features=\s!default,\s!goodies=cambria]
84        \definefontsynonym [\s!SerifBoldItalic] [\s!name:cambriabolditalic] [\s!features=\s!default,\s!goodies=cambria]
85    \stoptypescript
86
87    \starttypescript [cambria,cambria-m,cambria-a]
88        % any
89        \definetypeface [cambria] [\s!rm] [\s!serif] [\typescriptone] [\s!default]
90        \definetypeface [cambria] [\s!tt] [\s!mono]  [dejavu]         [\s!default]
91        \definetypeface [cambria] [\s!mm] [\s!math]  [\typescriptone] [\s!default]
92    \stoptypescript
93    \starttypescript [cambria-x,cambria-y,cambria-nt]
94        % test x
95        \definetypeface [\typescriptone] [\s!rm] [\s!serif] [cambria]        [\s!default]
96        \definetypeface [\typescriptone] [\s!tt] [\s!mono]  [dejavu]         [\s!default]
97        \definetypeface [\typescriptone] [\s!mm] [\s!math]  [\typescriptone] [\s!default]
98    \stoptypescript
99
100\stoptypescriptcollection
101