Interface NSLayoutManagerDelegate


  • public interface NSLayoutManagerDelegate
    • Method Detail

      • layoutManagerBoundingBoxForControlGlyphAtIndexForTextContainerProposedLineFragmentGlyphPositionCharacterIndex

        default CGRect layoutManagerBoundingBoxForControlGlyphAtIndexForTextContainerProposedLineFragmentGlyphPositionCharacterIndex​(NSLayoutManager layoutManager,
                                                                                                                                     long glyphIndex,
                                                                                                                                     NSTextContainer textContainer,
                                                                                                                                     CGRect proposedRect,
                                                                                                                                     CGPoint glyphPosition,
                                                                                                                                     long charIndex)
        Invoked for resolving the glyph metrics for NSControlCharacterWhitespaceAction control character.
      • layoutManagerDidCompleteLayoutForTextContainerAtEnd

        default void layoutManagerDidCompleteLayoutForTextContainerAtEnd​(NSLayoutManager layoutManager,
                                                                         NSTextContainer textContainer,
                                                                         boolean layoutFinishedFlag)
        This is sent whenever a container has been filled. This method can be useful for paginating. The textContainer might be nil if we have completed all layout and not all of it fit into the existing containers. The atEnd flag indicates whether all layout is complete.
      • layoutManagerLineSpacingAfterGlyphAtIndexWithProposedLineFragmentRect

        default double layoutManagerLineSpacingAfterGlyphAtIndexWithProposedLineFragmentRect​(NSLayoutManager layoutManager,
                                                                                             long glyphIndex,
                                                                                             CGRect rect)
        Returns the spacing after the line ending with glyphIndex.
      • layoutManagerParagraphSpacingAfterGlyphAtIndexWithProposedLineFragmentRect

        default double layoutManagerParagraphSpacingAfterGlyphAtIndexWithProposedLineFragmentRect​(NSLayoutManager layoutManager,
                                                                                                  long glyphIndex,
                                                                                                  CGRect rect)
        Returns the paragraph spacing after the line ending with glyphIndex.
      • layoutManagerParagraphSpacingBeforeGlyphAtIndexWithProposedLineFragmentRect

        default double layoutManagerParagraphSpacingBeforeGlyphAtIndexWithProposedLineFragmentRect​(NSLayoutManager layoutManager,
                                                                                                   long glyphIndex,
                                                                                                   CGRect rect)
        Returns the paragraph spacing before the line starting with glyphIndex.
      • layoutManagerShouldBreakLineByHyphenatingBeforeCharacterAtIndex

        default boolean layoutManagerShouldBreakLineByHyphenatingBeforeCharacterAtIndex​(NSLayoutManager layoutManager,
                                                                                        long charIndex)
        Invoked while determining the hyphenation point. When NO, NSLayoutManager tries to find the next hyphenation opportunity before charIndex
      • layoutManagerShouldBreakLineByWordBeforeCharacterAtIndex

        default boolean layoutManagerShouldBreakLineByWordBeforeCharacterAtIndex​(NSLayoutManager layoutManager,
                                                                                 long charIndex)
        Invoked while determining the soft line break point. When NO, NSLayoutManager tries to find the next line break opportunity before charIndex
      • layoutManagerShouldGenerateGlyphsPropertiesCharacterIndexesFontForGlyphRange

        default long layoutManagerShouldGenerateGlyphsPropertiesCharacterIndexesFontForGlyphRange​(NSLayoutManager layoutManager,
                                                                                                  org.moe.natj.general.ptr.ConstCharPtr glyphs,
                                                                                                  org.moe.natj.general.ptr.ConstNIntPtr props,
                                                                                                  org.moe.natj.general.ptr.ConstNUIntPtr charIndexes,
                                                                                                  UIFont aFont,
                                                                                                  NSRange glyphRange)
        Glyph generation *********************** This is sent whenever layoutManager is about to store the initial glyph information via -setGlyphs:properties:characterIndexes:forGlyphRange:. This method allows customizing the initial glyph generation process. It can invoke -setGlyphs:properties:characterIndexes:forGlyphRange: with modified glyph information. The return value specifies the actual glyph range stored in this method. By returning 0, it can indicate layoutManager to do the default processing. Note that querying glyph information surrounding glyphRange could lead to recursion since the data might not be available, yet.
      • layoutManagerShouldSetLineFragmentRectLineFragmentUsedRectBaselineOffsetInTextContainerForGlyphRange

        default boolean layoutManagerShouldSetLineFragmentRectLineFragmentUsedRectBaselineOffsetInTextContainerForGlyphRange​(NSLayoutManager layoutManager,
                                                                                                                             CGRect lineFragmentRect,
                                                                                                                             CGRect lineFragmentUsedRect,
                                                                                                                             org.moe.natj.general.ptr.NFloatPtr baselineOffset,
                                                                                                                             NSTextContainer textContainer,
                                                                                                                             NSRange glyphRange)
        Allows NSLayoutManagerDelegate to customize the line fragment geometry before committing to the layout cache. The implementation of this method should make sure that the modified fragments are still valid inside the text container coordinate. When it returns YES, the layout manager uses the modified rects. Otherwise, it ignores the rects returned from this method.
      • layoutManagerShouldUseActionForControlCharacterAtIndex

        default long layoutManagerShouldUseActionForControlCharacterAtIndex​(NSLayoutManager layoutManager,
                                                                            long action,
                                                                            long charIndex)
        Returns the control character action for the control character at charIndex.
      • layoutManagerTextContainerDidChangeGeometryFromSize

        default void layoutManagerTextContainerDidChangeGeometryFromSize​(NSLayoutManager layoutManager,
                                                                         NSTextContainer textContainer,
                                                                         CGSize oldSize)
        This is sent right before layoutManager invalidates the layout due to textContainer changing geometry. The receiver of this method can react to the geometry change and perform adjustments such as recreating the exclusion path.
      • layoutManagerDidInvalidateLayout

        default void layoutManagerDidInvalidateLayout​(NSLayoutManager sender)
        Layout processing *********************** This is sent whenever layout or glyphs become invalidated in a layout manager which previously had all layout complete.