so i found out a nice way to get the width of strings, and taht is to obtain a glyph which can then be used to obtain a rectangle which can then be used to obtain the width
seems pretty silly to have to go through all that, but then there is no getTheWidthOfThisStringInPixels:WithThisFont: method
so i found out that glyphs can't recognize non letter characters... like 'space', numbers, quotes, and other punctuation
if i have an entire string how can i loop through all the letters and identify when i've come across a non-letter so i can then get the glyph for it.
what i have is
i saw "+" is coded as "plus" to get the glyph... so what's everything else and how do determine when i have something that isn't a letter?
i am also working under the assumption that glyphs will help me in this same manner if the language uses a non roman alphabet
seems pretty silly to have to go through all that, but then there is no getTheWidthOfThisStringInPixels:WithThisFont: method
so i found out that glyphs can't recognize non letter characters... like 'space', numbers, quotes, and other punctuation
if i have an entire string how can i loop through all the letters and identify when i've come across a non-letter so i can then get the glyph for it.
what i have is
Code:
if([word length] > 0) {
for(unsigned int i = 0; i < [word length]; i++){
NSGlyph gly = [aFont glyphWithName: [NSString stringWithFormat: @"%C", [word characterAtIndex: i]]];
if(gly) {
// do stuff
}
}
}
i saw "+" is coded as "plus" to get the glyph... so what's everything else and how do determine when i have something that isn't a letter?
i am also working under the assumption that glyphs will help me in this same manner if the language uses a non roman alphabet