• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Custom line breaking in NSTextView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Custom line breaking in NSTextView


  • Subject: Re: Custom line breaking in NSTextView
  • From: Aki Inoue <email@hidden>
  • Date: Mon, 1 Aug 2005 18:04:29 -0700

You can split the current layout session by overriding -[NSTypesetter setParagraphGlyphRange:separatorGlyphRange:] based on the number of glyphs.

As I commented to Matsumoto-san's message, I recognize needs for easier (more direct in other words) manipulation in the area. Please stay tuned for a future enhancement.

Aki

Aki Inoue <email@hidden> wrote:


1) Determine which is the first character that no longer fits on the
   current line;

2) Once that character is found, go back from there and look for a
   suitable place where to break the line.

Your suggestion would allow me to customize 2), which is not what I
want; I need to customize 1).


I really don't see why you think it doesn't work.


Because I tried it. :-)


In order to fit a pre-defined number of characters in a line, you need to
specify sufficiently large number for the container width. From there,
the glyph position passed to the method should be always larger than the
number of characters.



It doesn't appear to work that way. For a text container that is wider
than my line of text, lineBreakBeforeIndex:withinRange: is not called at
all (why should it). The method is only called after the typesetter
determined that the line doesn't fit into the container rect, and then
it passes a range up to the first character that doesn't fit. That's
too late for me; I need to hook into the decision which characters do or
don't fit on a line.


I really don't know how else to put it: you told me how to customize 2)
(see top of mail), which I don't need to do; I need to customize 1), and
I can't figure out how to do that easily.



-- Stefan Haller Ableton http://www.ableton.com/


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Prev by Date: How do I write a fetch request that will get the entity with the max value?
  • Next by Date: Re: Obj-C compiler warnings
  • Previous by thread: Re: How do I write a fetch request that will get the entity with the max value?
  • Next by thread: Calling a class's methods from within it's +(void)initialize
  • Index(es):
    • Date
    • Thread