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

Issue with Glyph Mapping #39

Closed
quasado opened this issue May 25, 2014 · 5 comments
Closed

Issue with Glyph Mapping #39

quasado opened this issue May 25, 2014 · 5 comments

Comments

@quasado
Copy link

quasado commented May 25, 2014

Using the free "Open Sans Regular Italic" TrueType font and requesting a glyph for the character "I" yields in a returned glyph code of zero which is surely wrong and returns the typical "no-char" rectangle. Using the glyph inspector of opentype.js however shows a number of "44" for the letter "I".
Having debugged seems that CmapEncoding.prototype.charToGlyphIndex returns zero but I couldn't figure why not having really understood what the code does.

The font file mentioned can be gathered from here: http://www.fontsquirrel.com/fonts/open-sans (Choose "Italic" in the style box, then download TTF)

@fpirsch
Copy link
Collaborator

fpirsch commented May 25, 2014

Hello,
what do you mean by "requesting a glyph" ? What method are you using ?
font.charToGlyphIndex('I') (I as in uppercase i) returns 918. This font has a lot of different "I"s, and glyph 44 which is an I with serifs, feels strange in a sans-serif font.

@quasado
Copy link
Author

quasado commented May 25, 2014

hi,

thanks for getting back on this. I was ment to say that calling font.charToGlyph('I') on the given font returns the first glyph (the no-glyph rectangle) with a glyph index of zero.

@fpirsch
Copy link
Collaborator

fpirsch commented May 25, 2014

It should work :
opensans

Do you get the same error with other characters, or with other fonts ?
Are you sure you are calling font.charToGlyph('I') from inside the opentype.load() callback ?

@quasado
Copy link
Author

quasado commented May 26, 2014

Hi,

Hmm this is really really weird. Yes, the call is done after the font is properly loaded. It works perfectly for all kind of glyphs except the uppercase I. Trying another font with the exact same code works as expected, so the code seems to be okay. I can really not explain myself what should be the case for this :(

Btw., we're using your great library in our free Design Tool Gravit (http://www.quasado.com/gravit) for custom text rendering allowing us to apply any kind of vector effects to text shapes :)

@quasado
Copy link
Author

quasado commented May 26, 2014

Ok, I am closing this. It seems that with the local version I do have it happens (I am using the latest one installed via bower). Doing the same with the online version works quite right.

@quasado quasado closed this as completed May 26, 2014
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