forked from diverted247/txtjs
-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.html
398 lines (367 loc) · 14.1 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
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
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>txtjs - A HTML5 canvas font and typesetting engine for CreateJS.</title>
<meta name="description" content="TxtJS provides cross-browser consistent text rendering via EaselJS (CreateJS).">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="site/pure-min.css">
<link rel="stylesheet" href="site/base.css">
<script src="dist/easeljs.js"></script>
<script src="dist/txt.umd.js"></script>
<script type="text/javascript" src="dist/pathseg.js"></script>
</head>
<body>
<div id="layout">
<!-- Menu toggle -->
<a href="#menu" id="menuLink" class="menu-link">
<!-- Hamburger icon -->
<span></span>
</a>
<div id="menu">
<div class="pure-menu pure-menu-open">
<a class="pure-menu-heading" href="#">txtjs</a>
<ul>
<li><a href="https://github.com/ReCreateJs/txtjs">Source</a></li>
<li><a href="docs">API Docs</a></li>
<li><a href="#text">Text</a></li>
<li><a href="#charactertext">CharacterText</a></li>
<li><a href="#pathtext">PathText</a></li>
<li><a href="#graphics">Graphics</a></li>
<li><a href="#accessibility">Accessibility</a></li>
<li><a href="#about">About</a></li>
<li><a href="#warning">Warning</a></li>
<li><a href="#license">License (BSD)</a></li>
</ul>
</div>
</div>
<div id="main">
<div class="header">
<h1>txtjs</h1>
<h2>A <canvas> font and typesetting engine for <a href="http://www.createjs.com/">CreateJS</a></h2>
<div id="example">
</div>
</div>
<div class="content">
<p>
<img width="100%" src="site/architecture.png"/>
</p>
<h2 class="content-subhead" id="text">Text</h2>
<p>
Text represents a Word centric textfield that wraps Word instances.
<ul>
<li>
<a href="examples#Text/text">Basics</a>
</li>
<li>
<a href="examples#Text/accessibility">Accessibility</a>
</li>
<li>
<a href="examples#Text/moon">Performance - To the Moon</a>
</li>
<li>
<a href="examples#Text/loadtest">Performance - Load Test</a>
</li>
<li>
<a href="examples/Text/input.html">Performance - Input</a>
</li>
<li>
<a href="examples#Text/cache">Performance - Font Caching</a>
</li>
<li>
<a href="examples#Text/case">Style - Typographic Case</a>
</li>
<li>
<a href="examples#Text/perchar">Style - Character styling</a>
</li>
<li>
<a href="examples#Text/percharfont">Style - Character styling with multiple fonts</a>
</li>
<li>
<a href="examples#Text/ligatures">Style - Ligatures</a>
</li>
<li>
<a href="examples#Text/tracking">Style - Tracking</a>
</li>
<li>
<a href="examples#Text/tracking_layout_test">Style - Tracking Layout Test</a>
</li>
<li>
<a href="examples#Text/stroke">Style - Stoke and Outline</a>
</li>
<li>
<a href="examples#Text/alignment">Alignment - Single line</a>
</li>
<li>
<a href="examples#Text/multiline_align">Alignment -Multi-line</a>
</li>
<li>
<a href="examples#Text/multiline_align_breaks">Alignment - Multi-line with breaks</a>
</li>
<li>
<a href="examples#Text/multiline_align_smallcaps">Alignment - Multi-line with smallcaps Case</a>
</li>
<li>
<a href="examples#Text/multiline_line_height_larger">Alignment - Multi-line with lineHeight larger</a>
</li>
<li>
<a href="examples#Text/multiline_line_height_smaller">Alignment - Multi-line with lineHeight smaller</a>
</li>
<li>
<a href="examples#Text/single_word_center_align_tracking">Alignment - Tracking</a>
</li>
<li>
<a href="examples#Text/wordwrap">Alignment - Wordwrap simple</a>
</li>
<li>
<a href="examples#Text/wordwrap_calc">Alignment - Wordwrap tuning</a>
</li>
<li>
<a href="examples#Text/single_word_oneline">Alignment - Wordwrap first word</a>
</li>
<li>
<a href="examples#Text/wordwrap_natural_newline">Alignment - Wordwrap natural and newlines</a>
</li>
<li>
<a href="examples#Text/wordwrap_natural_lineheight">Alignment - Wordwrap natural and lineHeight</a>
</li>
<li>
<a href="examples#Text/wordwrap_newline_error">Alignment - Wordwrap newline error case</a>
</li>
<li>
<a href="examples#Text/complete">Event - complete</a>
</li>
<li>
<a href="examples#Text/text_change_font">Event - Swap fonts</a>
</li>
<li>
<a href="examples#Text/child_events">Event - Child Events</a>
</li>
</ul>
</p>
<h2 class="content-subhead" id="charactertext">CharacterText</h2>
<p>
CharacterText represents a "word-less" textfield that wraps per Character.
<ul>
<li>
<a href="examples#CharacterText/text">Basics</a>
</li>
<li>
<a href="examples#CharacterText/accessibility">Accessibility</a>
</li>
<li>
<a href="examples#CharacterText/moon">Performance - To the Moon</a>
</li>
<li>
<a href="examples#CharacterText/loadtest">Performance - Load Test</a>
</li>
<li>
<a href="examples/CharacterText/input.html">Performance - Input</a>
</li>
<li>
<a href="examples#CharacterText/cache">Performance - Font Caching</a>
</li>
<li>
<a href="examples#CharacterText/case">Style - Typographic Case</a>
</li>
<li>
<a href="examples#CharacterText/perchar">Style - Character styling</a>
</li>
<li>
<a href="examples#CharacterText/percharfont">Style - Character styling with multiple fonts</a>
</li>
<li>
<a href="examples#CharacterText/ligatures">Style - Ligatures</a>
</li>
<li>
<a href="examples#CharacterText/tracking">Style - Tracking</a>
</li>
<li>
<a href="examples#CharacterText/tracking_layout_test">Style - Tracking Layout Test</a>
</li>
<li>
<a href="examples#CharacterText/stroke">Style - Stoke and Outline</a>
</li>
<li>
<a href="examples#CharacterText/alignment">Alignment - Single line</a>
</li>
<li>
<a href="examples#CharacterText/multiline_align">Alignment -Multi-line</a>
</li>
<li>
<a href="examples#CharacterText/multiline_align_breaks">Alignment - Multi-line with breaks</a>
</li>
<li>
<a href="examples#CharacterText/multiline_align_smallcaps">Alignment - Multi-line with smallcaps Case</a>
</li>
<li>
<a href="examples#CharacterText/multiline_line_height_larger">Alignment - Multi-line with lineHeight larger</a>
</li>
<li>
<a href="examples#CharacterText/multiline_line_height_smaller">Alignment - Multi-line with lineHeight smaller</a>
</li>
<li>
<a href="examples#CharacterText/single_word_center_align_tracking">Alignment - Tracking</a>
</li>
<li>
<a href="examples#CharacterText/wordwrap">Alignment - Wordwrap simple</a>
</li>
<li>
<a href="examples#CharacterText/wordwrap_calc">Alignment - Wordwrap tuning</a>
</li>
<li>
<a href="examples#CharacterText/single_word_oneline">Alignment - Wordwrap first word</a>
</li>
<li>
<a href="examples#CharacterText/wordwrap_natural_newline">Alignment - Wordwrap natural and newlines</a>
</li>
<li>
<a href="examples#CharacterText/wordwrap_natural_lineheight">Alignment - Wordwrap natural and lineHeight</a>
</li>
<li>
<a href="examples#CharacterText/wordwrap_newline_error">Alignment - Wordwrap newline error case</a>
</li>
<li>
<a href="examples#CharacterText/complete">Event - complete</a>
</li>
<li>
<a href="examples#CharacterText/text_change_font">Event - Swap fonts</a>
</li>
<li>
<a href="examples#CharacterText/child_events">Event - Child Events</a>
</li>
<li>
<a href="examples#CharacterText/autosize_expand">Fit - singleLine autoExpand</a>
</li>
<li>
<a href="examples#CharacterText/autosize_reduce">Fit - singleLine autoReduce</a>
</li>
<li>
<a href="examples#CharacterText/autosize_reduce_expand">Fit - singleLine autoReduce + autoExpand</a>
</li>
</ul>
</p>
<h2 class="content-subhead" id="pathtext">PathText</h2>
<p>
PathText represents a textfield that writes Characters to an SVGPath.
<ul>
<li>
<a href="examples#PathText/text">Basics</a>
</li>
<li>
<a href="examples#PathText/layout">Layout</a>
</li>
<li>
<a href="examples#PathText/accessibility">Accessibility</a>
</li>
<li>
<a href="examples#PathText/alignment">Alignment</a>
</li>
<li>
<a href="examples#PathText/vertical_alignment">Vertical Alignment</a>
</li>
<li>
<a href="examples#PathText/circle_last_char">Last Char Test</a>
</li>
<li>
<a href="examples#PathText/character_limit">Character Limits</a>
</li>
<li>
<a href="examples#PathText/vertical_alignment_layout">Vertical Alignment Layout</a>
</li>
<li>
<a href="examples#PathText/flipped">Flipped</a>
</li>
<li>
<a href="examples#PathText/initial">Initial Tracking</a>
</li>
<li>
<a href="examples#PathText/cache">Performance - Font Caching</a>
</li>
<li>
<a href="examples#PathText/child_events">Event - Child Events</a>
</li>
</ul>
</p>
<h2 class="content-subhead" id="graphics">Graphics</h2>
<p>
Graphics extends CreateJS's Graphics Class with the ability to render SVGPath. SVGPath is the basis for all Character and Glyph rendering/caching but can be used directly. These tests are identical to the W3C SVG Tests for SVGPath drawing. The only exception is lack of support for winding rules and 'oddeven' syntax.
<ul>
<li>
<a href="examples#Graphics/pathGraphics">W3C Test 1</a>
</li>
<li>
<a href="examples#Graphics/pathGraphics2">W3C Test 2</a>
</li>
<li>
<a href="examples#Graphics/pathGraphics3">Glyph Rendering (inverted)</a>
</li>
</ul>
</p>
<h2 class="content-subhead" id="accessibility">Accessibility</h2>
<p>
By default the txt.Accessibility API is on. The API adds DOM text elements as canvas children that matching the .text property used. The API allows you to further enhance the text written within the canvas element by controlling content in '.accessibilityText' and element order in '.accessibilityPriority'.
</p>
<h2 class="content-subhead" id="about">About</h2>
<p>
Txtjs began as an experiment (on a dive trip) to improve the quality of text on <canvas> for web to print apps at Harland Clarke. The idea was to simply render character glyphs to <canvas> using SVGPath drawing commands and build up layout logic progressively. The result is a font and typesetting engine extending CreateJS.
</p>
<p>
There are many people and projects involved directly and indirectly in the creation and refinement of txtjs.
<ul>
<li>Ted Patrick</li>
<li>Grant Pimpler</li>
<li>Hossein Gonzales</li>
<li>Stephen Hahn</li>
<li>Grant Skinner</li>
<li>Branden Hall</li>
<li><a href="https://www.harlandclarke.com/">Harland Clarke</a></li>
<li><a href="https://github.com/ericdrowell/KineticJS/">SVGPath Initial Impl.</a></li>
<li><a href="https://github.com/google/canvas-5-polyfill">SVGPath Arc Fix</a></li>
</ul>
</p>
<h2 class="content-subhead" id="warning">Warning</h2>
<p>
Please do not misuse txtjs. It is intended for use for creative applications where style and layout exceed the capabilities of
DOM Text or SVG Text. It is not a replacement for DOM Text or SVG Text but rather improves text support on <canvas> for print and design applications.
Please do not steal fonts. Txtjs contains an exporter for the txtjs font format and a selection of fonts from the Google Font project licensed as Apache/Ubuntu/OFL. Please respect font owners and their licensed rights when using txtjs in production.
</p>
<h2 class="content-subhead" id="license">License (BSD)</h2>
<p>Copyright (c) 2017, <a href="http://light.ly">Lightly LLC</a>
All rights reserved.</p>
<p>Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:</p>
<p>
<ul>
<li>Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.</li>
<li>Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.</li>
</ul>
</p>
<p>
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</p>
</div>
</div>
</div>
<script type="text/javascript" src="dist/site.umd.js"></script>
<script type="text/javascript">
txt.FontLoader.path = "font/";
const exampleEl = document.getElementById("example");
if(exampleEl){
site.initDemo(exampleEl);
}
</script>
</body>
</html>