Skip navigation.
 
mllayout manager muffs glyph to character mapping ?
FROM : Robert Clair
DATE : Tue Dec 28 15:09:46 2004

I'm trying to use the layout manager to map glyphs back to characters:

      characterRange =
            [layoutManager characterRangeForGlyphRange: glyphRange
                                actualGlyphRange: &actualGlyphRange];

after loading the text storage with an attributed string.

It seems to screw up with ligatures: it finds the first one if it is
the first glyph in the string but otherwise it misses them.

I tried logging it in  aloop over the glyphs with with

     printf( "glyphRange: %d %d actualGlyphRange: %d %d  characterRange:
%d %d\n",
       glyphRange.location, glyphRange.length,
       actualGlyphRange.location, actualGlyphRange.length,
       characterRange.location, characterRange.length );

For the string "fl fl aa" - using Times Roman in which "fl" is a
ligature I get
the results:

glyphRange: 0 1 actualGlyphRange: 0 2  characterRange: 0 2
glyphRange: 1 1 actualGlyphRange: 1 1  characterRange: 1 1
glyphRange: 2 1 actualGlyphRange: 2 1  characterRange: 2 1
glyphRange: 3 1 actualGlyphRange: 3 1  characterRange: 3 1
glyphRange: 4 1 actualGlyphRange: 4 1  characterRange: 4 1
glyphRange: 5 1 actualGlyphRange: 5 1  characterRange: 5 1

It finds the first ligature, but not the second.

With the string "aa fl aa" I get:

glyphRange: 0 1 actualGlyphRange: 0 1  characterRange: 0 1
glyphRange: 1 1 actualGlyphRange: 1 1  characterRange: 1 1
glyphRange: 2 1 actualGlyphRange: 2 1  characterRange: 2 1
glyphRange: 3 1 actualGlyphRange: 3 1  characterRange: 3 1
glyphRange: 4 1 actualGlyphRange: 4 1  characterRange: 4 1
glyphRange: 5 1 actualGlyphRange: 5 1  characterRange: 5 1
glyphRange: 6 1 actualGlyphRange: 6 1  characterRange: 6 1

nothing.

I know the layout manager emits a null glyph for ligatures, but isn't
this supposed to keep track of things ? This is inconsistent
no matter how you look at it.


....Bob Clair

Related mailsAuthorDate
No related mails found.