-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
92 lines (77 loc) · 2.57 KB
/
index.html
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
<!doctype html>
<html class="no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Prototypo.js | Parametric Font Engine.</title>
<meta name="description" content="">
<!-- it's an app, disable zooming on mobile devices -->
<meta name="viewport" content="target-densitydpi=device-dpi, initial-scale=1.0, user-scalable=no" />
<!-- Place favicon.ico and apple-touch-icon.png in the root directory -->
<link rel="stylesheet" href="bower_components/knacss/css/knacss.css">
<style>
</style>
<script src="//localhost:8081"></script>
</head>
<body>
<!--[if lt IE 10]>
<p class="chromeframe">You are using an outdated browser. <a href="http://browsehappy.com/">Upgrade your browser today</a> or <a href="http://www.google.com/chromeframe/?redirect=true">install Google Chrome Frame</a> to better experience this site.</p>
<![endif]-->
<h1 class="pam">
Prototypo.js
</h1>
<canvas id="canvas1" width="512" height="512"></canvas>
<script src="dist/prototypo.js"></script>
<script>
/* global prototypo */
prototypo.setup('canvas1');
var xhr = new XMLHttpRequest(),
font,
fontSrc,
glyph;
// synchronous request, YOLO
xhr.open('GET', 'node_modules/test.ptf/dist/font.json', false);
xhr.onload = function() {
if ( this.status === 200 ) {
fontSrc = JSON.parse(this.response);
}
};
xhr.send();
font = prototypo.parametricFont( fontSrc );
glyph = font.glyphMap.L;
glyph.update({ width: 10, thickness: 10, xHeight: 400 });
glyph.visible = true;
glyph.contours.forEach(function(contour) {
if ( contour.skeleton ) {
contour.visible = false;
} else {
contour.visible = true;
}
});
glyph.components.forEach(function(component) {
component.visible = true;
component.contours.forEach(function(contour) {
if ( contour.skeleton ) {
contour.visible = false;
} else {
contour.visible = true;
}
});
});
prototypo.paper.view.update();
// console.log(glyph.solvingOrder.map(path => path.join('.')));
console.log(glyph);
// console.log(glyph.contours[3].exportSVG());
window.glyph = glyph;
window.font = font;
</script>
<script>
/* jshint ignore:start */
// google analytics
var _gaq=[['_setAccount','UA-41962243-3'],['_trackPageview']];
(function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];
g.src=('https:'==location.protocol?'//ssl':'//www')+'.google-analytics.com/ga.js';
s.parentNode.insertBefore(g,s)}(document,'script'));
</script>
</body>
</html>