From 7ff02ce76a48b0ef31e51ec892e4da573b1530fd Mon Sep 17 00:00:00 2001 From: Ansis Brammanis Date: Fri, 27 Jun 2014 11:51:44 -0700 Subject: [PATCH] remove support for embedded shaping and glyphs --- README.md | 2 -- lib/vectortilelayer.js | 64 +----------------------------------------- 2 files changed, 1 insertion(+), 65 deletions(-) diff --git a/README.md b/README.md index dde586f..bd4078d 100644 --- a/README.md +++ b/README.md @@ -62,8 +62,6 @@ An object that contains the data for a single vector tile layer. - **name** (`String) `— layer name - **extent** (`Number`, default: `4096`) — tile extent size - **length** (`Number`) — number of features in the layer -- **shaping** (`Object`) — an object with font shaping information -- **faces** (`String[]`) — an array of font faces used #### Methods diff --git a/lib/vectortilelayer.js b/lib/vectortilelayer.js index 2bcd094..894b654 100644 --- a/lib/vectortilelayer.js +++ b/lib/vectortilelayer.js @@ -9,8 +9,6 @@ function VectorTileLayer(buffer, end) { this.name = null; this.extent = 4096; this.length = 0; - this.shaping = {}; - this.faces = []; // Private this._buffer = buffer; @@ -18,9 +16,7 @@ function VectorTileLayer(buffer, end) { this._values = []; this._features = []; - var stack_index = [], - labels = [], - val, tag; + var val, tag; end = end || buffer.length; @@ -43,26 +39,10 @@ function VectorTileLayer(buffer, end) { this._keys.push(buffer.readString()); } else if (tag === 4) { this._values.push(this.readFeatureValue()); - } else if (tag === 7) { - this.faces.push(buffer.readString()); - } else if (tag === 8) { - labels.push(this.readLabel()); - } else if (tag === 9) { - stack_index.push(buffer.readString()); } else { buffer.skip(val); } } - - // Build index of [stack][text] => shaping information - for (var i = 0; i < labels.length; i++) { - var label = labels[i], - text = this._values[label.text], - stack = stack_index[label.stack]; - - this.shaping[stack] = this.shaping[stack] || {}; - this.shaping[stack][text] = label.glyphs; - } } VectorTileLayer.prototype.readFeatureValue = function() { @@ -98,48 +78,6 @@ VectorTileLayer.prototype.readFeatureValue = function() { return value; }; -VectorTileLayer.prototype.readLabel = function() { - var label = { glyphs: [] }, - buffer = this._buffer, - bytes = buffer.readVarint(), - end = buffer.pos + bytes, - val, tag, faces, glyphs, x, y; - - while (buffer.pos < end) { - val = buffer.readVarint(); - tag = val >> 3; - - if (tag === 1) { - label.text = buffer.readVarint(); - } else if (tag === 2) { - label.stack = buffer.readVarint(); - } else if (tag === 3) { - faces = buffer.readPacked('Varint'); - } else if (tag === 4) { - glyphs = buffer.readPacked('Varint'); - } else if (tag === 5) { - x = buffer.readPacked('Varint'); - } else if (tag === 6) { - y = buffer.readPacked('Varint'); - } else { - buffer.skip(val); - } - } - - if (glyphs) { - for (var i = 0; i < glyphs.length; i++) { - label.glyphs.push({ - face: faces[i], - glyph: glyphs[i], - x: x[i], - y: y[i] - }); - } - } - - return label; -}; - // return feature `i` from this layer as a `VectorTileFeature` VectorTileLayer.prototype.feature = function(i) { if (i < 0 || i >= this._features.length) throw new Error('feature index out of bounds');