-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpan.html
More file actions
363 lines (300 loc) · 11.4 KB
/
pan.html
File metadata and controls
363 lines (300 loc) · 11.4 KB
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
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
<!DOCTYPE html>
<html lang="en" spellcheck="false">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Pan</title>
<link rel="stylesheet" href="css/reset.css" />
<link rel="stylesheet" href="css/main.css" />
<link rel="stylesheet" href="css/project.css" />
<link rel="stylesheet" href="css/main700.css" />
<link rel="stylesheet" href="css/project700.css" />
<link
rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Source+Code+Pro:wght@300;600&display=swap"
/>
</head>
<body>
<div id="tagline">
<p>
<br />> <b><a href="https://hallotype.github.io/">HalloType</a></b> =
Thom Janssen = font maker, type engineer, programmer, creative coder
<a href="./type/fonts.html"
><span class="typelink"> > typefaces </span></a
>
</p>
</div>
<!-- <div id="gohere">
↑↑↑
<br/>
go here!
</div>
<div id="construction">
<br/>
← still<br/>
← under<br/>
↙︎ construction<br/>
↙︎
</div> -->
<div id="main">
<img src='content/pan/cover.png'/>
<p class="description">Pan is a variable type system. The idea is to slice the glyphs in various ways and draw contours with the slice-data. <br>
Since the drawings are not compatible, featureSubstitutions are needed. Currently five axes [Steps, Angle, Shape, Offset, Inner] controle what glyph is shown. A special set of tools was needed to create the GSUB table that can handle this.<br><br>
</p>
<style>
.table, .table-row {
max-width: 900px;
}
.td {
max-width: 180px;
}
.td img {
max-width: calc(900px * .2);
}
</style>
<div class="table">
<div class="tbody">
<div class="table-row">
<div class="td"><img src="content/pan/Axis_Steps.gif" alt=""></div>
<div class="td"><img src="content/pan/Axis_Angle.gif" alt=""></div>
<div class="td"><img src="content/pan/Axis_Shapes.gif" alt=""></div>
<div class="td"><img src="content/pan/Axis_Offset.gif" alt=""></div>
<div class="td"><img src="content/pan/Axis_Inner.gif" alt=""></div>
</div>
<div class="table-row">
<p class="td">Steps</p>
<p class="td">Angle</p>
<p class="td">Shapes</p>
<p class="td">Offset</p>
<p class="td">Inner</p>
</div>
</div>
</div>
<p class="description alert">
I recommend to view my site in <b>Chrome</b> or <b>Firefox</b>, since it handles Variable Fonts much better than MacOS’ Core Text. <br>
<br>
I started creating this font system in 2017. Back then, in MacOS, only one axis was working for featureSubstitutions. Now in 2020, it seems that it is still not fully solved in MacOS.
</p><img src='content/pan/SWITCH.gif'/>
<link rel="stylesheet" href="type/css/Pan_Clock.css" />
<style>
#varUnit.w {
background-color: #ffc600;
padding-bottom: 36px;
}
.Pan_Clock p {
font-size: 266px;
}
@media only screen and (max-width: 700px) {
#varUnit.w {
display: none;
}
}
</style>
<div class="Pan_Clock w" id="varUnit">
<p contenteditable="false" class="lineView">
<span class="H">H</span><span class="sep">:</span><span class="M">M</span
><span class="sep">:</span><span class="S">S</span><br />
</p>
<div></div>
<script type="text/javascript">
var wght = 30; //
// https://codepen.io/jordantart/pen/QyJpyr
//
function clock_angles(hour, minute, second, milsec) {
var minAngle = 360 * (minute / 60);
var hourAngle = 360 * ((hour % 12) / 12) + (360 / 12) * (minute / 60);
var secAngle = 360 * (second / 60);
var milSecAngle = 360 * (milsec / 1000);
return [hourAngle, minAngle, secAngle, milSecAngle];
}
var d = new Date(); // for now
//d.getHours(); // => 9
//d.getMinutes(); // => 30
//d.getSeconds(); // => 51
var t = clock_angles(
d.getHours(),
d.getMinutes(),
d.getSeconds(),
d.getMilliseconds()
);
console.log(t);
console.log();
const Pan_ClockSliders = document.querySelector("#sliders-Pan_Clock");
var joopie = setTimeout(Pan_ClockChanger, 0);
function Pan_ClockChanger() {
setTimeout(Pan_ClockChanger, 5);
var d = new Date(); // for now
var t = clock_angles(
d.getHours(),
d.getMinutes(),
d.getSeconds(),
d.getMilliseconds()
);
let fontElementsH = document.querySelectorAll(".H");
fontElementsH.forEach(function (fontElement) {
fontElement.style.cssText =
"font-variation-settings:" +
"'ANGL' " +
t[0]
});
let fontElementsM = document.querySelectorAll(".M");
fontElementsM.forEach(function (fontElement) {
fontElement.style.cssText =
"font-variation-settings:" +
"'ANGL' " +
t[1]
});
let fontElementsS = document.querySelectorAll(".S");
fontElementsS.forEach(function (fontElement) {
fontElement.style.cssText =
"font-variation-settings:" +
"'ANGL' " +
t[2]
});
// let fontElementsSep = document.querySelectorAll(".sep");
// fontElementsSep.forEach(function (fontElement) {
// fontElement.style.cssText =
// "font-variation-settings:" +
// "'wght' " +
// wght +
// ",'ANGL' " +
// t[3] +
// ",'STEP' " +
// 60;
// });
}
</script>
</div>
<style>
#angler {
position: relative;
font-size: 72px;
background-color: #66e5cc;
max-width: 900px;
text-align: center;
padding-top: 110px;
max-width: 900px;
min-height: 350px;
background-color: aquamarine;
color: black;
text-align: center;
margin-top: 12px;
font-size: 200px;
}
</style>
<link rel='stylesheet' href='type/css/PanAngler.css'/>
<div class='PanAngler noLowercase' id='angler'>
<p style="background-color: #66e5cc" class='instruction'>mouse over</p>
<p contenteditable="false" class="lineView var">
<span class="A">A</span><span class="N">N</span><span class="G">G</span><span class="L">L</span><span class="E">E</span><span class="R">R</span>
</p>
<script>
function calcAngleDegrees(x, y) {
return Math.ceil((
Math.atan2(y, x) * 180 / Math.PI
+ 90 + 360 ) % 360);
}
function getAngle (x,y, x1=450, y1=225) {
var angle = calcAngleDegrees(x-x1, y-y1);
return angle;
}
document.getElementById('angler').addEventListener('mousemove', updateAngles)
function getPos(e) {
var rect = document.getElementById('angler').getBoundingClientRect();
var x = e.clientX - rect.left;
var y = e.clientY - rect.top;
return { x, y }
}
function updateAngles(e) {
var pos = getPos(e);
// console.log(pos)
var a = getAngle(pos.x, pos.y, x1=72);
var letters = document.querySelectorAll(".A");
letters.forEach(function (lett) {lett.style.cssText = "font-variation-settings: 'ANGL' " + a ; });
var a = getAngle(pos.x, pos.y, x1=232);
var letters = document.querySelectorAll(".N");
letters.forEach(function (lett) {lett.style.cssText = "font-variation-settings: 'ANGL' " + a ; });
var a = getAngle(pos.x, pos.y, x1=391);
var letters = document.querySelectorAll(".G");
letters.forEach(function (lett) {lett.style.cssText = "font-variation-settings: 'ANGL' " + a ; });
var a = getAngle(pos.x, pos.y, x1=536);
var letters = document.querySelectorAll(".L");
letters.forEach(function (lett) {lett.style.cssText = "font-variation-settings: 'ANGL' " + a ; });
var a = getAngle(pos.x, pos.y, x1=663);
var letters = document.querySelectorAll(".E");
letters.forEach(function (lett) {lett.style.cssText = "font-variation-settings: 'ANGL' " + a ; });
var a = getAngle(pos.x, pos.y, x1=800);
var letters = document.querySelectorAll(".R");
letters.forEach(function (lett) {lett.style.cssText = "font-variation-settings: 'ANGL' " + a ; });
}
</script>
</div>
<style>
</style>
<p class=""><br><br>Here is a visualisation of my workflow. </p>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mermaid/8.7.0/mermaid.min.js"></script>
<div class="mermaid">
%%{init: {'securityLevel': 'loose','theme': 'base', 'themeVariables': { 'fontFamily':'Source Code Pro', 'primaryColor': '#00CCCC', 'edgeLabelBackground':'#ffffee', 'tertiaryColor': '#fff0f0'}}}%%
graph TD;
PREF[Parameters and Settings];
SD[Slice Data]
DG[Draw Glyphs];
ADDUFO[Add to UFO];
OTFea[Generate OT Features];
DSD[Generate Desingnspace Document];
TTX1[Generate TTX FeatureVariations];
ComVarTT[Compile VarTT];
TTXextract[Extract GSUB table];
MergeTables[Merge GSUB tables];
ParseGSUB[Parse GSUB table];
PREF --> SD;
PREF --> DSD;
PREF --> TTX1;
SD --> DG --> ADDUFO --> OTFea;
DSD --> ComVarTT --> TTXextract --> MergeTables --> ParseGSUB;
TTX1 --> MergeTables;
ComVarTT --> ParseGSUB
</div>
<link rel='stylesheet' href='type/css/Pan_demo.css'/>
<div class='Pan_demo noLowercase' id='varUnit'>
<p style="font-size: 144px;" contenteditable="true" class="lineView">PAN DEMO</p>
<div class='varSup' style='text-transform: capitalize;' id='sliders-Pan_demo'>
<input type='range' class='ax' min='2.0' max='60.0' value='40' name='Pan_demowght' id='Pan_demowght'><label for='Pan_demowght'>Weight</label><br>
<input type='range' class='ax' min='30.0' max='50.0' value='50.0' name='Pan_demoSTEP' id='Pan_demoSTEP'><label for='Pan_demoSTEP'>Steps</label><br>
<input type='range' class='ax' min='0.0' max='330.0' value='30' name='Pan_demoANGL' id='Pan_demoANGL'><label for='Pan_demoANGL'>Angle</label><br>
<input type='range' class='ax' min='0.0' max='4.0' value='1' name='Pan_demoSHAP' id='Pan_demoSHAP'><label for='Pan_demoSHAP'>Shape</label><br>
<input type='range' class='ax' min='0.0' max='1.0' value='0.0' name='Pan_demoINNR' id='Pan_demoINNR'><label for='Pan_demoINNR'>Inner</label><br>
<input type='range' class='ax' min='-60.0' max='60.0' value='30' name='Pan_demoPOIN' id='Pan_demoPOIN'><label for='Pan_demoPOIN'>Point</label><br>
</div>
<script>
const Pan_demoSliders = document.querySelector("#sliders-Pan_demo");
Pan_demoSliders.oninput = Pan_demoChanger;
function Pan_demoChanger(e) {
console.log(document.querySelector("#Pan_demoSHAP").value);
if (document.querySelector("#Pan_demoSHAP").value >= 0 && document.querySelector("#Pan_demoSHAP").value <= 1.5 || document.querySelector("#Pan_demoSHAP").value >= 2.5 && document.querySelector("#Pan_demoSHAP").value <= 3.5){
document.querySelector("#Pan_demoPOIN").removeAttribute('disabled');
} else {
document.querySelector("#Pan_demoPOIN").setAttribute('disabled',"");
}
let fontElements = document.querySelectorAll("div.Pan_demo");
fontElements.forEach(function (fontElement) {
fontElement.style.cssText =
"font-variation-settings:" +
"'wght' " + document.querySelector("#Pan_demowght").value
+",'STEP' " + document.querySelector("#Pan_demoSTEP").value
+",'ANGL' " + document.querySelector("#Pan_demoANGL").value
+",'SHAP' " + document.querySelector("#Pan_demoSHAP").value
+",'INNR' " + document.querySelector("#Pan_demoINNR").value
+",'POIN' " + document.querySelector("#Pan_demoPOIN").value
});}</script>
</div>
</div>
<div id="bottomline"> </div>
<div id="footer">
<p class="left">
<a href="http://www.twitter.com/thomhendrik">Twitter</a><br>
<a href="http://www.instagram.com/thomhendrik">Instagram</a><br>
</p>
</div>
</body>
</html>