I do not think its 100% safe. Since there is not necessarily a 1:1 mapping
of glyphs to chars, then some chars may be completely elided away and
have no representation in the returned set from calling this API on each
of the glyph indices. I'd have to check if its universally true but in our
implementation elided away chars typically are replaced by the
special 'invisible glyph', so it may appear to work for that reason,
but that's not guaranteed by spec.

-phil.



Jan Bösenberg (INCORS GmbH) wrote:
Hello again,

I am trying to get the number of chars that a GlyphVector represents The
following line seems to work:

 myGlyphVector.getGlyphCharIndex(myGlyphVector.getNumGlyphs());

The problem is that reading the documentation for getGlyphCharIndex(int
glyphIndex) gives me the feeling that the method should throw an
IndexOutOfBounds exception if the value of glyphIndex equals the number
of glyphs (just like you get an exception when calling
myArray[myArray.length]). But on the other hand it does not explicitly
say that any parameter greater or equal to the number of glyphs will
throw an exception. Can I reliably use the method to determine the
number of chars in a glyph vector or is there a chance that my code will
not work on other VMs or future versions? Maybe the documentation should
be updated to clarify the behaviour? Or is there even a better day to
get the number of chars represented by a glyphVector?


Thanks

Jan

===========================================================================

To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
of the message "signoff JAVA2D-INTEREST".  For general help, send
email to
[EMAIL PROTECTED] and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to