summaryrefslogtreecommitdiff
path: root/tex/context/modules/mkiv/s-fonts-engines.mkiv
blob: 1b1f664b8baab73db0aa62a5ea4f34eb4f18c483 (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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
%D \module
%D   [      file=s-fonts-engines, % was: s-fnt-22
%D        version=2017.06.21,
%D          title=\CONTEXT\ Style File,
%D       subtitle=Compare engines and such,
%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 This module is just for me when I wanted to check some husayni (by Idris)
%D regression. Interesting is that fina should be disabled for hb (otherwise
%D garbage) and that some substitutions are ignored in hb (1.1.3), so we can
%D only compare some examples. Don't expect this style to be stable as I
%D might change default features.

\startmodule[fonts-engines]

\usemodule[fonts-steps]
\usemodule[fonts-plugins]

\enabletrackers[fonts.reorderlookups]

\startsetups otftracker-extra-context
    \definedfont[\getvariable{otftracker}{font}*\getvariable{otftracker}{features} at \getvariable{otftracker}{size}]\relax
    \setotfcompositiondirection{\getvariable{otftracker}{direction}}\relax
    \getvariable{otftracker}{sample}\relax
\stopsetups

\startsetups otftracker-extra-context-reordered
    \definedfont[\getvariable{otftracker}{font}*otftracker-context-reordered at \getvariable{otftracker}{size}]\relax
    \setotfcompositiondirection{\getvariable{otftracker}{direction}}\relax
    \getvariable{otftracker}{sample}\relax
\stopsetups

\startsetups otftracker-extra-harfbuzz
    \definedfont[\getvariable{otftracker}{font}*otftracker-harfbuzz-native at \getvariable{otftracker}{size}]\relax
    \setotfcompositiondirection{\getvariable{otftracker}{direction}}\relax
    \getvariable{otftracker}{sample}\relax
\stopsetups

\startsetups otftracker-extra-uniscribe
    \definedfont[\getvariable{otftracker}{font}*otftracker-harfbuzz-uniscribe at \getvariable{otftracker}{size}]\relax
    \setotfcompositiondirection{\getvariable{otftracker}{direction}}\relax
    \getvariable{otftracker}{sample}\relax
\stopsetups

\definecolor[otftracker-overlay-1][a=1,t=.5,b=1]
\definecolor[otftracker-overlay-2][a=1,t=.5,g=1]
\definecolor[otftracker-overlay-3][a=1,t=.5,r=1]

% This is a sort of a check against xetex but with limited font trickery because we bypass
% the normal font handling. It's no big deal for a test. The biggest problem is that we
% run into default features and we don't know what is turned on by default. We also need
% to disable tagging so that hb itself can do some (init/medi/fina) magic in setting
% features.

\startsetups otftracker-extra
    \start
        \blank
        \definefontfeature
          [otftracker-context-reordered]
          [\getvariable{otftracker}{features}]
          [reorderlookups=arab]
        \definefontfeature
          [otftracker-harfbuzz-uniscribe]
          [\getvariable{otftracker}{features}]
          [mode=plug,
           features=harfbuzz,
           shaper=uniscribe,
         % stch=nothing,
         % ccmp=nothing,
         % locl=nothing,
         % rlig=nothing,
         % calt=nothing,
         % mset=nothing,
           fina=nothing, % looks like the libs does something special
           init=nothing, % looks like the libs does something special
           medi=nothing, % looks like the libs does something special
           isol=nothing, % looks like the libs does something special
         % method=binary,
           script=arabic]
        \definefontfeature
          [otftracker-harfbuzz-native]
          [\getvariable{otftracker}{features}]
          [mode=plug,
           features=harfbuzz,
           shaper=native,
         % stch=nothing,
         % ccmp=nothing,
         % locl=nothing,
         % rlig=nothing,
         % calt=nothing,
         % mset=nothing,
           fina=nothing, % looks like the libs does something special
           init=nothing, % looks like the libs does something special
           medi=nothing, % looks like the libs does something special
           isol=nothing, % looks like the libs does something special
           script=arabic]
        \doifelsesomething {\getvariable{otftracker}{comment}} {
            \def\ExtraComment{
                \TB
                \NC
                    comment
                \NC
                    \vtop {
                        \hsize\dimexpr\hsize-10em\relax
                        \veryraggedright
                        \getvariable{otftracker}{comment}
                    }
                \NC \NR
            }
        } {
            \def\ExtraComment{}
        }
        \starttabulate[|lTB|l|]
            \NC
                context
            \NC
                \showglyphs \showfontkerns
                \enabletrackers[otf.sample.silent]
                \ruledhbox{\directsetup{otftracker-extra-context}}
                \disabletrackers[otf.sample]
            \NC \NR \TB \NC
                reordered
            \NC
                \showglyphs \showfontkerns
                \enabletrackers[otf.sample.silent]
                \ruledhbox{\directsetup{otftracker-extra-context-reordered}}
                \disabletrackers[otf.sample]
            \NC \NR \TB \NC
                harfbuzz
            \NC
                \showglyphs \showfontkerns
                \enabletrackers[fonts.plugins.hb.colors]
                \ruledhbox{\directsetup{otftracker-extra-harfbuzz}}
                \disabletrackers[fonts.plugins.hb.colors]
            \NC \NR \TB \NC
                uniscribe
            \NC
                \showglyphs \showfontkerns
                \enabletrackers[fonts.plugins.hb.colors]
                \ruledhbox{\directsetup{otftracker-extra-uniscribe}}
                \disabletrackers[fonts.plugins.hb.colors]
            \NC \NR \TB \NC
                context
            \NC
                \showglyphs \showfontkerns
                \ruledhbox{\directsetup{otftracker-extra-context}}
            \NC \NR \TB \NC
                harfbuzz
            \NC
                \showglyphs \showfontkerns
                \ruledhbox{\directsetup{otftracker-extra-harfbuzz}}
            \NC \NR \TB \NC
                uniscribe
            \NC
                \showglyphs \showfontkerns
                \ruledhbox{\directsetup{otftracker-extra-uniscribe}}
            \NC \NR \TB \NC
                context harfbuzz
            \NC
                \showglyphs \showfontkerns
                \hbox to \zeropoint {
                    \ruledhbox{\color[otftracker-overlay-1]{\directsetup{otftracker-extra-harfbuzz}}}
                    \hss
                }
                \ruledhbox{\color[otftracker-overlay-3]{\directsetup{otftracker-extra-context}}}
            \NC \NR \TB \NC
                uniscribe harfbuzz
            \NC
                \showglyphs \showfontkerns
                \hbox to \zeropoint {
                    \ruledhbox{\color[otftracker-overlay-1]{\directsetup{otftracker-extra-harfbuzz}}}
                    \hss
                }
                \ruledhbox{\color[otftracker-overlay-2]{\directsetup{otftracker-extra-uniscribe}}}
            \NC \NR \TB \NC
                context uniscribe
            \NC
                \showglyphs \showfontkerns
                \hbox to \zeropoint {
                    \ruledhbox{\color[otftracker-overlay-1]{\directsetup{otftracker-extra-uniscribe}}}
                    \hss
                }
                \ruledhbox{\color[otftracker-overlay-2]{\directsetup{otftracker-extra-context}}}
            \NC \NR
            \ExtraComment
        \stoptabulate
    \stop
\stopsetups

\stopmodule