fit = function fit(state) {
    if (!state.fit) {
        // nope
        if (!state.root || !(state.root.getAttribute('data-layout') || '').match(/fit/)) {
            state.fit = false;
            return;
        }

        // create fit info object
        var style = window.getComputedStyle(state.root, null);

        state.fit = true;
        state.fitInfo = {
            currentFontSize: parseInt(style.getPropertyValue('font-size'), 10)
        };
    }

    // get available width from parent node
    state.fitInfo.availableWidth = state.root.parentNode.clientWidth;

    // the space our target element uses
    state.fitInfo.currentWidth = state.root.scrollWidth;

    // let's calculate the new font size
    var newFontSize = Math.min(Math.max(4, state.fitInfo.availableWidth / state.fitInfo.currentWidth * state.fitInfo.currentFontSize), 1024);

    // size has not changed enough?
    var dist = Math.abs(newFontSize - state.fitInfo.currentFontSize);

    // prevents flickering on firefox / safari / ie by not redrawing tiny font size changes
    if (dist <= 1) return;

    state.fitInfo.currentFontSize = newFontSize;

    state.root.style.fontSize = state.fitInfo.currentFontSize + 'px';

    // redraw once more to quickly create better fit
    if (state.fitInfo.currentWidth / state.fitInfo.availableWidth < 0.5) {
        requestAnimationFrame(function () {
            return fit(state);
        });
    }
}
Drawer
@param state
@param draw
@param present
@param drawViews