font-lib.mklx /size: 6049 b    last modification: 2024-01-16 09:02
1%D \module
2%D   [       file=font-lib,
3%D        version=2011.01.13, % (copied fron font-ini)
4%D          title=\CONTEXT\ Font Macros,
5%D       subtitle=Libraries,
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\writestatus{loading}{ConTeXt Font Macros / Libraries}
15
16\unprotect
17
18\newinteger\scaledfontmode
19\newinteger\scaledfontsize
20\newinteger\lastfontid
21
22\newinteger\c_font_future_glyph_scale
23\newinteger\c_font_scaled_font_mode_saved
24\newinteger\c_font_scaled_points
25
26\ifdefined\globalbodyfontsize \else \newdimension\globalbodyfontsize \fi
27\ifdefined\localbodyfontsize  \else \newdimension\localbodyfontsize  \fi
28\ifdefined\bodyfontsize       \else \newdimension\bodyfontsize       \fi
29
30\registerctxluafile{font-ini}{autosuffix}
31\registerctxluafile{font-log}{}
32\registerctxluafile{font-con}{autosuffix} % kind of early
33%registerctxluafile{font-cft}{}
34\registerctxluafile{font-enc}{}
35\registerctxluafile{font-fmp}{autosuffix}
36\registerctxluafile{font-agl}{}           % if needed we can comment this and delay loading
37\registerctxluafile{font-cid}{}           % cid maps
38\registerctxluafile{font-map}{}
39
40% helpers
41
42\registerctxluafile{font-otr}{}           % opentype fontloader
43\registerctxluafile{font-web}{}           % opentype fontloader
44\registerctxluafile{font-cff}{autosuffix} % quadratic outlines
45\registerctxluafile{font-ttf}{autosuffix} % cubic outlines
46\registerctxluafile{font-dsp}{autosuffix}
47\registerctxluafile{font-hsh}{autosuffix} % hashes used by context
48\registerctxluafile{font-vfc}{autosuffix}
49\registerctxluafile{font-prv}{}           % needs hashes
50\registerctxluafile{font-vir}{}
51\registerctxluafile{font-nod}{}
52\registerctxluafile{font-oti}{}           % otf initialization
53\registerctxluafile{font-ott}{}           % otf tables (first)
54\registerctxluafile{font-otl}{autosuffix}
55\registerctxluafile{font-oto}{autosuffix}
56\registerctxluafile{font-otj}{autosuffix}
57\registerctxluafile{font-oup}{}
58\registerctxluafile{font-ota}{autosuffix}
59\registerctxluafile{font-ots}{autosuffix}
60\registerctxluafile{font-otd}{autosuffix}
61\registerctxluafile{font-otc}{}
62\registerctxluafile{font-oth}{}
63% \doifelsefileexists{font-osd-new.lmt}{
64%     \registerctxluafile{font-osd-new}{autosuffix}
65% } {
66    \registerctxluafile{font-osd}{}
67% }
68%registerctxluafile{font-osm}{}
69\registerctxluafile{font-ogr}{autosuffix}
70
71% we use otf code for type one
72
73\registerctxluafile{font-onr}{autosuffix}
74\registerctxluafile{font-one}{autosuffix}
75\registerctxluafile{font-afk}{}
76
77\registerctxluafile{font-txt}{autosuffix}
78
79% tfm
80
81\registerctxluafile{font-tpk}{autosuffix}
82\registerctxluafile{font-tfm}{autosuffix}
83
84% name database
85
86\registerctxluafile{font-syn}{}
87\registerctxluafile{font-trt}{}
88
89% shapes
90
91\registerctxluafile{font-shp}{autosuffix}
92
93% so far
94
95\registerctxluafile{font-pat}{} % patchers
96
97\registerctxluafile{node-fnt}{autosuffix} % here
98
99\registerctxluafile{font-lua}{}
100
101\registerctxluafile{font-enh}{autosuffix}
102
103\registerctxluafile{good-ini}{}
104\registerctxluafile{good-gen}{autosuffix}
105\registerctxluafile{good-ctx}{}
106\registerctxluafile{good-mth}{autosuffix}
107
108\registerctxluafile{font-def}{autosuffix}
109\registerctxluafile{font-ctx}{autosuffix} % after def as it overloads
110
111% extensions, order matters
112
113\registerctxluafile{font-imp-checks}{autosuffix}
114\registerctxluafile{font-imp-ligatures}{autosuffix}
115\registerctxluafile{font-imp-tex}{}
116\registerctxluafile{font-imp-reorder}{}
117\registerctxluafile{font-imp-properties}{autosuffix}
118\registerctxluafile{font-imp-unicode}{}
119\registerctxluafile{font-imp-text}{autosuffix}
120\registerctxluafile{font-imp-math}{autosuffix}
121\registerctxluafile{font-imp-notused}{}
122\registerctxluafile{font-imp-effects}{autosuffix}
123\registerctxluafile{font-imp-quality}{autosuffix}
124\registerctxluafile{font-imp-italics}{autosuffix}
125\registerctxluafile{font-imp-dimensions}{}
126\registerctxluafile{font-imp-spacekerns}{}
127\registerctxluafile{font-imp-tweaks}{}
128\registerctxluafile{font-imp-combining}{}
129\registerctxluafile{font-imp-scripts}{autosuffix}
130\registerctxluafile{font-imp-sanitize}{autosuffix} % fixes for indic fonts
131\registerctxluafile{font-imp-digits}{autosuffix}
132
133\registerctxluafile{font-imp-tracing}{autosuffix} % comes last!
134
135\registerctxluafile{font-fbk}{autosuffix}
136
137\registerctxluafile{font-aux}{}
138
139\registerctxluafile{font-lig}{autosuffix} % only for experiments so try to avoid it
140
141%D Some low level helpers
142%D
143%D \starttyping
144%D \def\TestLookup#specification%
145%D   {\dolookupfontbyspec{#specification}
146%D     pattern: #specification, found: \dolookupnoffound
147%D    \blank
148%D    \dorecurse {\dolookupnoffound} {%
149%D      \recurselevel:~\dolookupgetkeyofindex{fontname}{\recurselevel}\quad
150%D    }%
151%D    \blank}
152%D
153%D \TestLookup{familyname=helveticaneue}
154%D \TestLookup{familyname=helveticaneue,weight=bold}
155%D \TestLookup{familyname=helveticaneue,weight=bold,style=italic}
156%D \stoptyping
157
158%D We can also move the lookups to the fonts.namespace (of commands) one can also
159%D directly use the clf calls when speed is needed.
160
161% todo: public implementors:
162
163\permanent          \def\dolookupfontbyspec     #1{\clf_fontlookupinitialize{#1}}
164\permanent          \def\dolookupnoffound         {\clf_fontlookupnoffound}
165\permanent          \def\dolookupgetkeyofindex#1#2{\clf_fontlookupgetkeyofindex{#1}\numexpr#2\relax}
166\permanent          \def\dolookupgetkey         #1{\clf_fontlookupgetkey{#1}}
167\permanent          \def\cleanfontname          #1{\clf_cleanfontname{#1}}
168\permanent\protected\def\setfontofid            #1{\clf_setfontofid\numexpr#1\relax}
169
170%D I have to put it someplace, so here:
171%D
172%D \starttyping
173%D     \definefontfeature[test][mode=plug,features=text]
174%D     \definefont[FontA][Serif*test]
175%D     \definefont[FontB][Serif*test]
176%D     {\FontA aaa}{\FontB\glyphscale 1200  bbb}
177%D     {\FontA aaa}{\FontB\glyphscale 1200  bbb}
178%D \stoptyping
179
180\protect \endinput
181