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

font.widthOfGlyph() not implemented #57

Open
mashabow opened this issue Nov 30, 2016 · 5 comments
Open

font.widthOfGlyph() not implemented #57

mashabow opened this issue Nov 30, 2016 · 5 comments

Comments

@mashabow
Copy link

font.widthOfGlyph(glyph_id)

Returns the advance width (described above) for a single glyph id.

While the font.widthOfGlyph() method is listed in README.md, it doesn't seem to be implemented.

> font.widthOfGlyph(1)
TypeError: font.widthOfGlyph is not a function
@devongovett
Copy link
Member

Sorry, I need to update the docs. Use font.getGlyph(glyph_id).advanceWidth.

@Fuzzyma
Copy link

Fuzzyma commented Jun 24, 2017

@devongovett any chance that we can have a normal width and a "spacing" (which computes advancedWith - with)? That would make fontkit usable with letter spacing. Atm you dont know how big the space is between the lettes

@Pomax
Copy link
Contributor

Pomax commented Jun 27, 2017

@Fuzzyma are you thinking of a shorthand call for glyph.advanceWidth - glyph.bbox.width?

@Fuzzyma
Copy link

Fuzzyma commented Jun 27, 2017

Well it looks like thats exactly what I am looking for :D

@symil
Copy link

symil commented Feb 21, 2020

Quick bump to say that the README still indicates font.widthOfGlyph(glyph_id) instead of font.getGlyph(glyph_id).advanceWidth.

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

5 participants