tug-2007-fonts.tex /size: 8860 b    last modification: 2020-07-01 14:35
1\usemodule[present-slanted]
2
3\usemodule[abr-01]
4
5\definefontfeature
6  [default]
7  [method=node,
8   script=latn,
9   onum=yes]
10
11\definefont[TitleFont]   [palatinosanscom-bold*default    at 48pt] % is used when defined
12\definefont[MainTextFont][palatinosanscom-regular*default at 12pt]
13
14\setupinterlinespace
15  [line=15pt]
16
17\def\XETEX    {\dontleavehmode{\morecolor xetex}}
18\def\PDFTEX   {\dontleavehmode{\morecolor pdftex}}
19\def\LUATEX   {\dontleavehmode{\morecolor luatex}}
20\def\LUA      {\dontleavehmode{\morecolor lua}}
21\def\FONTFORGE{\dontleavehmode{\morecolor fontforge}}
22\def\OPENTYPE {\dontleavehmode{\morecolor opentype}}
23\def\TFM      {\dontleavehmode{\morecolor tfm}}
24\def\TEX      {\dontleavehmode{\morecolor tex}}
25\def\MKIV     {\dontleavehmode{\morecolor mkiv}}
26
27\def|#1|{-}
28
29\startdocument
30  [location={tug 2007 san diego},
31   author={hans hagen},
32   title={{zapfino, a},{torture test},{for luatex}}]
33
34\StartTopic{loading fonts}
35
36\StartSteps
37
38\StartItem the \OPENTYPE\ font reader is borrowed from \FONTFORGE\  \FlushStep \StopItem
39\StartItem once it was ready, we could look into such a font  \FlushStep \StopItem
40\StartItem it tooks while to figure out the format due to rather fuzzy specs  \FlushStep \StopItem
41\StartItem it took us even more time to find out that the loader was flawed  \FlushStep \StopItem
42\StartItem one reason was that fonts themselves may have bugs or be incomplete \FlushStep \StopItem
43\StartItem then we changed to \FONTFORGE\ version 2 \FlushStep \StopItem
44\StartItem this made the missing pieces surface in more complex feature handling \FlushStep \StopItem
45\StartItem while implementing features the new table format was cleaned up \FlushStep \StopItem
46
47\StopSteps
48
49\StopTopic
50
51\StartTopic{making it work}
52
53\StartSteps
54
55\StartItem the \FONTFORGE\ library loads the fonts into memory \FlushStep \StopItem
56\StartItem the internal data structures are mapped into a \LUA\ table  \FlushStep \StopItem
57\StartItem we enhance this table a bit (extra hashes as well as rearranging glyphs)  \FlushStep \StopItem
58\StartItem we save the table in a cache and compile it to bytecode \FlushStep \StopItem
59\StartItem after that reloading is fast and efficient \FlushStep \StopItem
60\StartItem when defining a font instance we share data as much as possible \FlushStep \StopItem
61\StartItem the open type specific table is translated into a \TFM\ one \FlushStep \StopItem
62\StartItem but for handling features we keep the original table available \FlushStep \StopItem
63
64\StopSteps
65
66\StopTopic
67
68\StartTopic{user control}
69
70\StartSteps
71
72\StartItem in context \MKIV\ currently we provide several interfaces \FlushStep \StopItem
73\StartItem the \XETEX\ syntax is (more or less) supported \FlushStep \StopItem
74\StartItem there is a higher level interface to associating features with fonts  \FlushStep \StopItem
75\StartItem there will be a font instance independent feature switch mechanism \FlushStep \StopItem
76\StartItem there can be generic treatments unrelated to the specific font \FlushStep \StopItem
77\StartItem fonts can be accessed by various names \FlushStep \StopItem
78\StartItem but \unknown\ using features demands that users know what they're doing \FlushStep \StopItem
79
80\StopSteps
81
82\StopTopic
83
84\StartTopic{zapfino}
85
86\StartSteps
87
88\StartItem we needed this exercise as a prelude to handling arab (which we cannot really read) \FlushStep \StopItem
89\StartItem this font provides a good testbed because has many features defined \FlushStep \StopItem
90\StartItem the associated \LUATEX\ tables are rather large \FlushStep \StopItem
91\StartItem there can be hundreds of lookups per character with lookahead and backtracking \FlushStep \StopItem
92\StartItem when writing support for such features, bugs in such fonts complicate matters \FlushStep \StopItem
93\StartItem visually checking the output is complicated by the fact that wrong alternatives may look good \FlushStep \StopItem
94\StartItem we must make sure that \TEX's other mechanisms don't spoil the game \FlushStep \StopItem
95\StartItem special care is needed for lookups that involve spaces \FlushStep \StopItem
96
97\StopSteps
98
99\page \start
100
101\definefontfeature[zapfino-a][mode=node,script=latn,language=dflt,liga=no]
102\definefontfeature[zapfino-b][mode=node,script=latn,language=dflt,liga=yes]
103\definefontfeature[zapfino-c][mode=node,script=latn,language=dflt,liga=no,clig=yes]
104\definefontfeature[zapfino-d][mode=node,script=latn,language=dflt,liga=no,calt=yes]
105\definefontfeature[zapfino-e][mode=node,script=latn,language=dflt,liga=yes,clig=yes,calt=yes]
106
107\font\testa=ZapfinoExtraLTPro*zapfino-a at 24pt
108\font\testb=ZapfinoExtraLTPro*zapfino-b at 24pt
109\font\testc=ZapfinoExtraLTPro*zapfino-c at 24pt
110\font\testd=ZapfinoExtraLTPro*zapfino-d at 24pt
111\font\teste=ZapfinoExtraLTPro*zapfino-e at 24pt
112
113\unexpanded\def\ShowSample #1 #2 %
114  {\StartTopic{examples : #2}
115   \start
116   \noligs1\nokerns1\language0
117   \setupinterlinespace[line=35pt]
118   \StartItem
119   \getvalue{test#1}%
120   \input tufte \wordright{\morecolor Mr. E.R.~Tufte}
121   \StopItem
122   \stop
123   \StopTopic}
124
125\ShowSample a nothing
126\ShowSample b ligatures
127\ShowSample c {cont ligs}
128\ShowSample d {cont alts}
129\ShowSample e all of these
130
131\page \stop
132
133\StartTopic{arabtype}
134
135\StartSteps
136
137\StartItem this font has many advanced arab related features \FlushStep \StopItem
138\StartItem there is quite some kerning and positioning going on \FlushStep \StopItem
139\StartItem vowels travel with the base characters (glyphs) and ligatures \FlushStep \StopItem
140\StartItem vowels need to be positioned relative to each other as well \FlushStep \StopItem
141
142\StopSteps
143
144\page
145
146\definefontfeature
147  [arab-none]
148  [mode=node,language=dflt,script=arab,kern=no,liga=no,dlig=no,rlig=no]
149
150\definefontfeature
151  [arab-replace]
152  [mode=node,language=dflt,script=arab,kern=no,liga=no,dlig=no,rlig=no,
153   init=yes,medi=yes,fina=yes,isol=yes]
154
155\definefontfeature
156  [arab-mark]
157  [mode=node,language=dflt,script=arab,kern=no,liga=no,dlig=no,rlig=no,
158   init=yes,medi=yes,fina=yes,isol=yes,mark=yes]
159
160\definefontfeature
161  [arab-mkmk]
162  [mode=node,language=dflt,script=arab,kern=no,liga=no,dlig=no,rlig=no,
163   init=yes,medi=yes,fina=yes,isol=yes,mkmk=yes,mark=yes]
164
165\definefontfeature
166  [arab-curs]
167  [mode=node,language=dflt,script=arab,kern=no,liga=no,dlig=no,rlig=no,
168   init=yes,medi=yes,fina=yes,isol=yes,mkmk=yes,mark=yes,curs=yes]
169
170\definefontfeature
171  [arab-kern]
172  [mode=node,language=dflt,script=arab,kern=no,liga=no,dlig=no,rlig=no,
173   init=yes,medi=yes,fina=yes,isol=yes,mkmk=yes,mark=yes,kern=yes]
174
175\definefontfeature
176  [arab-context]
177  [mode=node,language=dflt,script=arab,kern=no,liga=no,dlig=no,rlig=no,
178   init=yes,medi=yes,fina=yes,isol=yes,mkmk=yes,mark=yes,kern=yes,calt=yes]
179
180\definefontfeature
181  [arab-ligs]
182  [mode=node,language=dflt,script=arab,kern=no,liga=yes,dlig=yes,rlig=yes,
183   init=yes,medi=yes,fina=yes,isol=yes,mkmk=yes,mark=yes,curs=yes]
184
185\definefontfeature
186  [arab-ligkern]
187  [mode=node,language=dflt,script=arab,kern=no,liga=yes,dlig=yes,rlig=yes,
188   init=yes,medi=yes,fina=yes,isol=yes,mkmk=yes,mark=yes,kern=yes,curs=yes]
189
190\startbuffer
191اَلْحَمْدُ لِلّٰهِ حَمْدَ مُعْتَرِفٍ بِحَمْدِهٖ، مُغْتَرِفٌ مِنْ بِحَارِ مَجْدِهٖ، بِلِسَانِ
192الثَّنَاۤءِ شَاكِرًا، وَلِحُسْنِ اٰلاۤئِهٖ نَاشِرًا؛ اَلَّذِيْ خَلَقَ الْمَوْتَ وَالْحَيٰوةَ، وَالْخَيْرَ
193وَالشَّرَّ، وَالنَّفْعَ وَالضَّرَّ، وَالسُّكُوْنَ وَالْحَرَكَةَ، وَالْأَرْوَاحَ
194وَالْأَجْسَامَ، وَالذِّكْرَ وَالنِّسْيَانَ.
195\stopbuffer
196
197\unexpanded\def\ShowSample #1 #2 #3 %
198  {\StartTopic{arab : #1}
199   \start \setuptolerance[verytolerant,stretch]
200   \noligs1\nokerns1\language0
201   \setupinterlinespace[line=35pt]
202   \font\Test=arabtype*#3 at 35pt \Test
203   \setupinterlinespace
204   \textdir TRT
205   \pardir TRT
206   \ifnum#2=1
207     \enabletrackers[otf.analyzing]
208   \fi
209   \slantedshapedelta5cm
210   \StartItem \getbuffer \par \StopItem
211   \slantedshapedelta\zeropoint
212   \ifnum#2=1
213     \disabletrackers[otf.analyzing]
214   \fi
215   \stop
216   \StopTopic}
217
218\ShowSample analyze 1 arab-none
219\ShowSample replace 0 arab-replace
220\ShowSample mark    0 arab-mark
221\ShowSample mkmk    0 arab-mkmk
222\ShowSample curs    0 arab-curs
223\ShowSample kern    0 arab-kern
224\ShowSample context 0 arab-context
225\ShowSample ligs    0 arab-ligs
226\ShowSample ligkern 0 arab-ligkern
227
228\StartTopic{Remark}
229
230\StartItem
231    the samples on the previous pages were generated with an experimental version
232    of \LUATEX\ and \MKIV\ code and therefore may contain errors
233\StopItem
234
235\StartItem
236    when this document is generated with a post-beta version of \LUATEX\ and \CONTEXT\ the results
237    can be different
238\StopItem
239
240\StopTopic
241
242\stopdocument
243