Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
fnicollet opened this issue Nov 14, 2014 · 6 comments

Comments

@fnicollet
Copy link
Contributor

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

@fnicollet
Copy link
Contributor Author

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

@fnicollet
Copy link
Contributor Author

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!

@jfirebaugh
Copy link
Contributor

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

@fnicollet
Copy link
Contributor Author

Hello,
here is the complete archive of what the script generated (with the 4 variants):
http://rg.to/file/6e760dbd3125f0cbedd7553066d0f0eb/fontnik_Open_sans.zip.html

Fabien

@mikemorris
Copy link
Contributor

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

@jfirebaugh
Copy link
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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants