ReCreateJS/txtjs

View on GitHub
index.html

Summary

Maintainability
Test Coverage
<!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 &lt;canvas&gt; 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 &lt;canvas&gt; for web to print apps at Harland Clarke. The idea was to simply render character glyphs to &lt;canvas&gt; 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 &lt;canvas&gt; 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>