src/layouts/FontLayout.js
function FontLayout(context, options) {

        // Prepare
        size = context.size;
        direction = context.direction;
        text = options.text || 'KLMNOPQRSTUVW';
        spacing = (options.spacing === undefined) ? 10 : options.spacing;
        offset = 0;
        set.size[0] = options.segmentSize ? options.segmentSize[0] : 20;
        set.size[1] = options.segmentSize ? options.segmentSize[1] : 4;

        for (var i = 0; i < text.length; i++) {
            var charSegments = charMap[text.charAt(i)] || charMap['?'];
            for (var j = 0; j < 8; j++) {
                if (charSegments & (1 << j)) {
                    node = context.next();
                    if (!node) {
                        return;
                    }
                    var segment = segmentMap[j];
                    set.translate[0] = (set.size[0] * segment[0]) + (segment[3] * set.size[1]);
                    set.translate[1] = (set.size[0] * segment[1]) + (segment[4] * set.size[1]);
                    set.translate[direction] += offset;
                    set.rotate[2] = (segment[2] * Math.PI * 2);
                    set.scrollLength = i ? 0 : (direction ? (set.size[0] * 2) : set.size[1]);
                    if ((j === 0) && (i < (text.length - 1))) {
                        set.scrollLength += spacing;
                    }
                    context.set(node, set);
                }
            }

            // Advance offset for next character
            offset += (direction ? (set.size[0] * 2) : set.size[0]) + spacing;
        }
    }
function FontLayout(context, options) {

        // Prepare
        size = context.size;
        direction = context.direction;
        text = options.text || 'KLMNOPQRSTUVW';
        spacing = (options.spacing === undefined) ? 10 : options.spacing;
        offset = 0;
        set.size[0] = options.segmentSize ? options.segmentSize[0] : 20;
        set.size[1] = options.segmentSize ? options.segmentSize[1] : 4;

        for (var i = 0; i < text.length; i++) {
            var charSegments = charMap[text.charAt(i)] || charMap['?'];
            for (var j = 0; j < 8; j++) {
                if (charSegments & (1 << j)) {
                    node = context.next();
                    if (!node) {
                        return;
                    }
                    var segment = segmentMap[j];
                    set.translate[0] = (set.size[0] * segment[0]) + (segment[3] * set.size[1]);
                    set.translate[1] = (set.size[0] * segment[1]) + (segment[4] * set.size[1]);
                    set.translate[direction] += offset;
                    set.rotate[2] = (segment[2] * Math.PI * 2);
                    set.scrollLength = i ? 0 : (direction ? (set.size[0] * 2) : set.size[1]);
                    if ((j === 0) && (i < (text.length - 1))) {
                        set.scrollLength += spacing;
                    }
                    context.set(node, set);
                }
            }

            // Advance offset for next character
            offset += (direction ? (set.size[0] * 2) : set.size[0]) + spacing;
        }
    }
Font-layout