NSLayoutManager - measuring text with trailing space

  • I asked about a similar issue a while back, but this time I'm trying
    to do something different.

    I have a line of text in an NSAttributedString that contains trailing
    spaces.  I want to measure the text taking the whitespace into
    account.  The NSLayoutManager routines I've used return the actual
    bounds that are covered with glyphs, but ignore the trailing space.
    Is there some way to measure the text with that space accounted for?

    Scott
  • On Oct 2, 2006, at 1:01 PM, Scott Thompson wrote:

    > I asked about a similar issue a while back, but this time I'm
    > trying to do something different.
    >
    > I have a line of text in an NSAttributedString that contains
    > trailing spaces.  I want to measure the text taking the whitespace
    > into account.  The NSLayoutManager routines I've used return the
    > actual bounds that are covered with glyphs, but ignore the trailing
    > space.  Is there some way to measure the text with that space
    > accounted for?

    Try the -rectArrayForCharacter/GlyphRange:withinSelectedCharacter/
    GlyphRange:inTextContainer:rectCount: methods.  These are the methods
    used to obtain the selection highlight rects.

    Douglas Davidson
previous month october 2006 next month
MTWTFSS
            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31          
Go to today