diff --git a/lib/widgets/GlyphTable.js b/lib/widgets/GlyphTable.js index 7e6dd01..d9a108e 100644 --- a/lib/widgets/GlyphTable.js +++ b/lib/widgets/GlyphTable.js @@ -20,12 +20,15 @@ define([ * * `loadAtOnce`: The number of glyphs to render per iteration, default 50 * `loadSerial`: render all glyphs at once, default false + * `glyphOrderFunc`: return the glyph indexes to render, see the issue + * https://github.com/graphicore/specimenTools/issues/26 */ var svgns = 'http://www.w3.org/2000/svg'; - function GlyphTable(doc, font, options) { + function GlyphTable(doc, font, options, dataAttributes) { Parent.call(this, options); + this._dataAttributes = dataAttributes; this._element = doc.createElement('div'); this._font = font; this._setDimensions = null; @@ -38,11 +41,20 @@ define([ var _p = GlyphTable.prototype = Object.create(Parent.prototype); _p.constructor = GlyphTable; + function defaultGlyphOrder() { + //jshint validthis:true + var glyphOrder = [], i, l; + for(i=0,l=this._font.glyphNames.names.length;i0;i++,loadAtOnce--) - this._initCell(this._font.glyphNames[i], i); + for(;i0;i++,loadAtOnce--) { + index = glyphOrder[i]; + this._initCell(this._font.glyphNames[index], index); + } this._loadProgress[0] = i; this._loadProgress[1] = null; @@ -186,11 +213,15 @@ define([ }; _p._initCellsSerial = function() { - var i=0 - , l= this._font.glyphNames.names.length + var glyphOrder = this.glyphOrder + , i = 0 + , l = glyphOrder.length + , index ; - for(;i