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

unknown operator error printed when opening a CJK font #118

Closed
bitinn opened this issue May 19, 2015 · 2 comments
Closed

unknown operator error printed when opening a CJK font #118

bitinn opened this issue May 19, 2015 · 2 comments

Comments

@bitinn
Copy link

bitinn commented May 19, 2015

The font is https://github.com/adobe-fonts/source-han-sans

The code I use: https://github.com/bitinn/character-map

opentype.load(opts.f, function(err, font) {
    if (err) {
        console.log(err);
        return;
    }

    if (!font.glyphs || font.glyphs.length === 0) {
        console.log('no glyphs found in this font');
        return;
    }

    var table = '';
    font.glyphs.forEach(function(glyph) {
        if (!glyph.unicode) {
            return;
        }

        table += String.fromCharCode(glyph.unicode);
    });

    console.log(table);
});

The errors I see:

Glyph 123: unknown operator 9
Glyph 123: unknown operator 9
Glyph 162: unknown operator 0
Glyph 162: unknown operator 0
Glyph 162: unknown operator 0
Glyph 162: unknown operator 0
...
@bitinn
Copy link
Author

bitinn commented May 19, 2015

My guess is they are no big deal (I do get the correct characters at the end), but how can I suppress it?

@Connum
Copy link
Contributor

Connum commented Oct 30, 2023

I just tried several fonts of that font family with the latest master, using this adapted code:

var table = '';
Array.from(Object.values(font.glyphs.glyphs)).forEach(function(glyph) {
    if (!glyph.unicode) {
        return;
    }

    table += String.fromCharCode(glyph.unicode);
});

console.log(table);

It seems like this issue has been remedied over the years, so I'm closing this old issue. Please reopen or create a new one in case there is still anything wrong.

@Connum Connum closed this as completed Oct 30, 2023
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

2 participants