Questions tagged [nslayoutmanager]

Glyph layout engine in iOS and OSX

Responsible for converting characters drawn from NSTextStorage and laying them out as glyphs following the display/geometric constraints provided by one or more NSTextContainer.

120 questions
1
vote
1 answer

NSLayoutManager drawGlyphsForGlyphRange:atPoint:

How is the function drawGlyphsForGlyphRange:atPoint: in the class NSLayoutManager implemented? I know it's called by NSTextView and in turn calls fillBackgroundRectArray:count:forCharacterRange:color: But how does it determine the backgroundcolor,…
user965972
  • 2,489
  • 2
  • 23
  • 39
1
vote
1 answer

Using NSGlyph and memory allocation

in a method to track line breaks frequently, for a NSTextView visibleRect, i am allocating memory for NSGlyph to use NSLayoutManager getGlyphs:range:. should/can i find out how much memory this should be since i have a reference for the range…
lulu
  • 669
  • 10
  • 26
0
votes
0 answers

When using Core Text to draw an NSAttributedString, why is my text drawn repeated?

I have an NSLayoutManager subclass, overriding - (void)drawGlyphsForGlyphRange:(NSRange)glyphsToShow atPoint:(CGPoint)origin and i'm trying to draw the NSAttributedString with CoreText. This is what i see when i just call super: This is what i see…
SirRupertIII
  • 12,324
  • 20
  • 72
  • 121
0
votes
0 answers

Conforming to NSLayoutManagerDelegate breaks line spacing

I am trying to create a custom TextView. The problem I am getting is that when I try to conform to the NSLayoutManagerDelegate the highlighting of the text inside it breaks, even though I have not implemented any of the delegate methods. class…
0
votes
1 answer

How to Truncate middle text in UITextView Swift

I have to show 3 text on one UITextView , This can be multiline or single line, in Multiline there is no issue . but when there is single line enabled then text is truncated from end because i'm using .lineBreakMode =…
Dhiru
  • 3,040
  • 3
  • 25
  • 69
0
votes
1 answer

How can I adjust the vertical position of a custom underline with UITextView and NSLayoutManager with non-zero lineSpacing NSParagraphStyle?

I want to customize the underline style for NSSAttributedString because patternDot is actually just short dashes, and I want actually circular dots (e.g. see Customize underline pattern in NSAttributedString (iOS7+)). I got pretty far but I'm having…
shim
  • 9,289
  • 12
  • 69
  • 108
0
votes
1 answer

Find cursor's coordinates in NSTextView

I have wrapping NSTextView instances stacked vertically, for example: The quick brown fox jumps over the lazy dog Jackdaws love my big sphinx of quartz I need to move between them with up/down arrows. For example, when the cursor is positioned…
Ivan Mir
  • 1,209
  • 1
  • 12
  • 32
0
votes
1 answer

Adding Custom NSLayoutManager to UItextView that is created in Storyboard

I want to use the custom layout manager for a textview that is referenced from storyboard. I know that we can subclass the NSLayoutManager and assign the layout to textview in code but I want to use the textview from storyboard. I found in…
srividya
  • 419
  • 6
  • 16
0
votes
1 answer

NSLayoutManager numberOfGlyphs always showing 0, Swift

I am trying to create a multipage PDF with UITextView on each page with the required attributed text. but When I am hitting a problem once the app is Archived and distributed via TestFlight for testing. Below is a my sample codes which I used to…
retstil
  • 3
  • 4
0
votes
1 answer

Get Bounding Rectangle of String with NSLayoutManager

I have a large amount of unique strings for which I want to compute their bounding rectangle when they would be laid out in an infinitly large rectangle. Currently I use a single NSTextStorage/NSLayoutManager and loop over all strings, collecting…
Halbanonym
  • 40
  • 5
0
votes
0 answers

Adjust generated glyph rect based on custom NSAttributedString attributes

I have created a custom NSLayoutManager to render a border around certain characters in a string whenever a custom NSAttributedString attribute is found. The box is supposed to be bigger than the standard bounding box of the glyph which isn't hard…
Sam Corder
  • 5,374
  • 3
  • 25
  • 30
0
votes
1 answer

NSTextView and determining glyph position

I am trying to define y axis position for certain lines and have label next to them in an NSTextView. I am using glyphRangeForCharacterRange. It kind of works, but the text view can have a LOT of text (even ~4000-5000 lines) and is wrapped with…
Tritonal
  • 607
  • 4
  • 16
0
votes
1 answer

Swift UITextView LayoutManager subclass

I am trying to subclass a UITextView's layoutManager But keep getting crashes. The examples I have been looking at are in Objective C, so I'm getting a bit confused to how I am supposed to change the layoutManager Here is my code... class…
Dan
  • 543
  • 2
  • 13
0
votes
1 answer

Is this a UITextView transparency bug?

This issue came up in relation to a problem I had yesterday for which I should be able to create a workaround. As I investigated further, I found that it occurs more broadly than I originally thought. I had previously only noticed it in displayed…
Optimalist
  • 313
  • 2
  • 11
0
votes
2 answers

How can I register a CustomLayoutManager when I create an instance of UITextView from Storyboard

I want to adapt CustomeLayoutManager to UITextView. So I made a subclass (CustomTextView) of UITextView. final class CustomTextView: UITextView { override init(frame: CGRect, textContainer: NSTextContainer?) { let storage =…
toyu
  • 1
  • 2