Skip to content

Getting "Unimplemented type: 7" while decoding PBF generated via node-fontnik #830

Closed

Description

@fnicollet

Hello,
A week ago, I added an issue "Is it possible to retrieve every font used in mapbox-gl-js for every charset-range?" (#809), @yhahn redirected me to this script https://github.com/mapbox/node-fontnik/blob/master/bin/build-glyphs which worked after a bit of fiddling.
I download the Open Sans variants from http://fr.fonts2u.com/open-sans-bold.police (if you scroll down, you can download the whole thing).
Then I ran those commands:

build-glyphs "Open Sans Regular" glyphs/regular/
build-glyphs "Open Sans Italic " glyphs/italic/
build-glyphs "Open Sans Semibold " glyphs/semibold/
build-glyphs "Open Sans Bold" glyphs/bold/

Which gave me PBFs files for every variant. But when I try to use them with mapbox-gl-js, I get an error "Unimplemented type: 7" here:

Protobuf.prototype.skip = function(val) {
    // TODO: bounds checking
    var type = val & 0x7;
    switch (type) {
        /* varint */ case Protobuf.Varint: while (this.buf[this.pos++] > 0x7f); break;
        /* 64 bit */ case Protobuf.Int64: this.pos += 8; break;
        /* length */ case Protobuf.Message: var bytes = this.readVarint(); this.pos += bytes; break;
        /* 32 bit */ case Protobuf.Int32: this.pos += 4; break;
        default: throw new Error('Unimplemented type: ' + type);
    }
};

When I compare the files:
https://mapbox.s3.amazonaws.com/gl-glyphs-256/Open%20Sans%20Semibold,%20Arial%20Unicode%20MS%20Bold/0-255.pbf
is 83Ko while mine is only 42Ko

Is there something I am doing wrong? Are there different "Open sans" in the wild and I don't have the right one?

Thanks for your help,
Fabien

Activity

  1. fnicollet commented on Nov 14, 2014

    @fnicollet
    ContributorAuthor

    Just realised that most of the other ranges are 1ko pbf, probably empty. The font I downloaded must only contain the latin range or something. Still, would be nice to know which font mapbox used

  2. fnicollet commented on Nov 14, 2014

    @fnicollet
    ContributorAuthor

    Side question, are all the character ranges needed/used? because if i grab the PBF from Mapbox from 0 to 65533, the total file size is about 30Mo, which seem quite a lot!

  3. jfirebaugh commented on Nov 20, 2014

    @jfirebaugh
    Contributor

    Can you provide a link to one of the PBFs that generates the error?

  4. fnicollet commented on Nov 20, 2014

    @fnicollet
    ContributorAuthor
  5. mikemorris commented on Nov 20, 2014

    @mikemorris
    Contributor

    Unimplemented type: 7 is usually related to PBFs not being compressed as expected.

  6. jfirebaugh commented on Nov 20, 2014

    @jfirebaugh
    Contributor

    Yeah, the pbfs are gzip compressed and need to be served with Content-Encoding: gzip (or gunzipped before serving) -- that's probably the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions