Re: How to insert a screen-only character in an NSTextView?

2012-09-03 Thread William Squires
This would be better handled with some sort of filter applied at I/O time (i.e. 
when you read/write the file) I would think. That is, let your model objects 
handle the translation, and let the view objects do what view objects are 
supposed to do. Trying to fiddle around with low-level NSTextStorage just seems 
to be a way to waste several afternoons pulling out your hair in frustration, 
methinks!


On Aug 31, 2012, at 10:24 AM, Koen van der Drift wrote:

 Is it possible to insert character/glyphs in an NSTextView without
 changing the underlying NSTextStorage ?  The goal is to have some
 special characters (eg a hyphen) at specific places in the string that
 is displayed in the view. So when the data is saved, the special
 characters are not part of it.
 
 Thanks,
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/wsquires%40satx.rr.com
 
 This email sent to wsqui...@satx.rr.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: How to insert a screen-only character in an NSTextView?

2012-09-03 Thread Kyle Sluder
On Sep 3, 2012, at 3:06 PM, William Squires wsqui...@satx.rr.com wrote:

 This would be better handled with some sort of filter applied at I/O time 
 (i.e. when you read/write the file) I would think. That is, let your model 
 objects handle the translation, and let the view objects do what view objects 
 are supposed to do. Trying to fiddle around with low-level NSTextStorage just 
 seems to be a way to waste several afternoons pulling out your hair in 
 frustration, methinks!

I disagree. NSTextStorage *is* a model object. It's far better to actually 
understand and and use the text system (including glyph generation) rather than 
fake it by transforming the model on read/write and ensuring your 
transformations are perfect mirrors, are applied at the right times, and 
correctly interact with the pasteboard, undo manager, Services, Input Methods, 
and VoiceOver.

--Kyle Sluder
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: How to insert a screen-only character in an NSTextView?

2012-09-03 Thread Ross Carter
I think Kyle and William are saying the same thing: leave NSTextStorage alone 
and adjust the presentation as needed.


On Sep 3, 2012, at 6:57 PM, Kyle Sluder k...@ksluder.com wrote:

 On Sep 3, 2012, at 3:06 PM, William Squires wsqui...@satx.rr.com wrote:
 
 This would be better handled with some sort of filter applied at I/O time 
 (i.e. when you read/write the file) I would think. That is, let your model 
 objects handle the translation, and let the view objects do what view 
 objects are supposed to do. Trying to fiddle around with low-level 
 NSTextStorage just seems to be a way to waste several afternoons pulling out 
 your hair in frustration, methinks!
 
 I disagree. NSTextStorage *is* a model object. It's far better to actually 
 understand and and use the text system (including glyph generation) rather 
 than fake it by transforming the model on read/write and ensuring your 
 transformations are perfect mirrors, are applied at the right times, and 
 correctly interact with the pasteboard, undo manager, Services, Input 
 Methods, and VoiceOver.
 
 --Kyle Sluder
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/rosscarterdev%40me.com
 
 This email sent to rosscarter...@me.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: How to insert a screen-only character in an NSTextView?

2012-09-03 Thread Koen van der Drift
I've decided not to use this in my app and try something else to make 
annotations in my textView. Thanks all for the input though.

- Koen.

On Sep 3, 2012, at 18:57, Kyle Sluder k...@ksluder.com wrote:

 On Sep 3, 2012, at 3:06 PM, William Squires wsqui...@satx.rr.com wrote:
 
 This would be better handled with some sort of filter applied at I/O time 
 (i.e. when you read/write the file) I would think. That is, let your model 
 objects handle the translation, and let the view objects do what view 
 objects are supposed to do. Trying to fiddle around with low-level 
 NSTextStorage just seems to be a way to waste several afternoons pulling out 
 your hair in frustration, methinks!
 
 I disagree. NSTextStorage *is* a model object. It's far better to actually 
 understand and and use the text system (including glyph generation) rather 
 than fake it by transforming the model on read/write and ensuring your 
 transformations are perfect mirrors, are applied at the right times, and 
 correctly interact with the pasteboard, undo manager, Services, Input 
 Methods, and VoiceOver.
 
 --Kyle Sluder
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/koenvanderdrift%40gmail.com
 
 This email sent to koenvanderdr...@gmail.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: How to insert a screen-only character in an NSTextView?

2012-09-01 Thread Koen van der Drift
Does anyone know where I can get the sample project for that session 
(WWDC_2010_114.xcodeproj)? The developer website only has the video and slides, 
but no source.

Thanks,

- Koen.





On Aug 31, 2012, at 6:26 PM, Koen van der Drift koenvanderdr...@gmail.com 
wrote:

 Was it session 114 from 2012?
 
 - Koen.
 
 
 On Aug 31, 2012, at 5:38 PM, Koen van der Drift koenvanderdr...@gmail.com 
 wrote:
 
 Do you know what year? The videos for 2010, 2011 and 1012 are online.
 
 - Koen.
 
 
 On Aug 31, 2012, at 4:55 PM, Ross Carter rosscarter...@me.com wrote:
 
 Or a custom NSGlyphGenerator. There was a WWDC session on this a few years 
 back.
 
 
 
 On Aug 31, 2012, at 2:21 PM, Kyle Sluder k...@ksluder.com wrote:
 
 
 
 


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: How to insert a screen-only character in an NSTextView?

2012-09-01 Thread Ross Carter
I'll send it to you in a separate email.

Ross

On Sep 1, 2012, at 8:30 AM, Koen van der Drift koenvanderdr...@gmail.com 
wrote:

 Does anyone know where I can get the sample project for that session 
 (WWDC_2010_114.xcodeproj)? The developer website only has the video and 
 slides, but no source.
 
 Thanks,
 
 - Koen.
 
 
 
 
 
 On Aug 31, 2012, at 6:26 PM, Koen van der Drift koenvanderdr...@gmail.com 
 wrote:
 
 Was it session 114 from 2012?
 
 - Koen.
 
 
 On Aug 31, 2012, at 5:38 PM, Koen van der Drift koenvanderdr...@gmail.com 
 wrote:
 
 Do you know what year? The videos for 2010, 2011 and 1012 are online.
 
 - Koen.
 
 
 On Aug 31, 2012, at 4:55 PM, Ross Carter rosscarter...@me.com wrote:
 
 Or a custom NSGlyphGenerator. There was a WWDC session on this a few years 
 back.
 
 
 
 On Aug 31, 2012, at 2:21 PM, Kyle Sluder k...@ksluder.com wrote:
 
 
 
 
 

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: How to insert a screen-only character in an NSTextView?

2012-09-01 Thread Koen van der Drift
Not yet there, but as a follow up question, how do I get the width of a 
monospaced font? I need this to calculate the rect that a textcontainer needs 
for x amount of fonts.

- Koen.


On Aug 31, 2012, at 4:55 PM, Ross Carter rosscarter...@me.com wrote:

 Or a custom NSGlyphGenerator. There was a WWDC session on this a few years 
 back.
 
 
 
 On Aug 31, 2012, at 2:21 PM, Kyle Sluder k...@ksluder.com wrote:
 
 On Fri, Aug 31, 2012, at 08:24 AM, Koen van der Drift wrote:
 Is it possible to insert character/glyphs in an NSTextView without
 changing the underlying NSTextStorage ?  The goal is to have some
 special characters (eg a hyphen) at specific places in the string that
 is displayed in the view. So when the data is saved, the special
 characters are not part of it.
 
 Glyphs aren't part of the text storage. So you would create a custom
 typesetter, hook it up to the layout manager of the text view you use
 for on-screen drawing, and have it generate additional glyphs.
 
 --Kyle Sluder
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/rosscarterdev%40me.com
 
 This email sent to rosscarter...@me.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: How to insert a screen-only character in an NSTextView?

2012-09-01 Thread Kyle Sluder
On Sep 1, 2012, at 8:22 PM, Koen van der Drift koenvanderdr...@gmail.com 
wrote:

 Not yet there, but as a follow up question, how do I get the width of a 
 monospaced font? I need this to calculate the rect that a textcontainer needs 
 for x amount of fonts.

Why don't you just perform layout and ask the layout manager for the text it 
used?

--Kyle Sluder
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: How to insert a screen-only character in an NSTextView?

2012-09-01 Thread Koen van der Drift

On Sep 1, 2012, at 11:26 PM, Kyle Sluder k...@ksluder.com wrote:

 Why don't you just perform layout and ask the layout manager for the text it 
 used?

I'd like to make the text display in a column that is exactly x characters 
width. I thought I need to control that with setting the size of a 
textcontainer?

- Koen.
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: How to insert a screen-only character in an NSTextView?

2012-09-01 Thread Kyle Sluder
On Sep 1, 2012, at 8:35 PM, Koen van der Drift koenvanderdr...@gmail.com 
wrote:

 
 On Sep 1, 2012, at 11:26 PM, Kyle Sluder k...@ksluder.com wrote:
 
 Why don't you just perform layout and ask the layout manager for the text it 
 used?
 
 I'd like to make the text display in a column that is exactly x characters 
 width.

Keep in mind that one character can generate multiple glyphs, especially since 
doing this seems to be why you started this thread in the first place. This is 
important, since characters have no visual attributes whatsoever; all drawing 
and metrics are done in terms of glyphs.

 I thought I need to control that with setting the size of a textcontainer?

You do indeed need to set the width of the text container.

Sounds like you want to use -maximumAdvancement.

--Kyle Sluder
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


How to insert a screen-only character in an NSTextView?

2012-08-31 Thread Koen van der Drift
Is it possible to insert character/glyphs in an NSTextView without
changing the underlying NSTextStorage ?  The goal is to have some
special characters (eg a hyphen) at specific places in the string that
is displayed in the view. So when the data is saved, the special
characters are not part of it.

Thanks,
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: How to insert a screen-only character in an NSTextView?

2012-08-31 Thread Kyle Sluder
On Fri, Aug 31, 2012, at 08:24 AM, Koen van der Drift wrote:
 Is it possible to insert character/glyphs in an NSTextView without
 changing the underlying NSTextStorage ?  The goal is to have some
 special characters (eg a hyphen) at specific places in the string that
 is displayed in the view. So when the data is saved, the special
 characters are not part of it.

Glyphs aren't part of the text storage. So you would create a custom
typesetter, hook it up to the layout manager of the text view you use
for on-screen drawing, and have it generate additional glyphs.

--Kyle Sluder
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: How to insert a screen-only character in an NSTextView?

2012-08-31 Thread Ross Carter
Or a custom NSGlyphGenerator. There was a WWDC session on this a few years back.



On Aug 31, 2012, at 2:21 PM, Kyle Sluder k...@ksluder.com wrote:

 On Fri, Aug 31, 2012, at 08:24 AM, Koen van der Drift wrote:
 Is it possible to insert character/glyphs in an NSTextView without
 changing the underlying NSTextStorage ?  The goal is to have some
 special characters (eg a hyphen) at specific places in the string that
 is displayed in the view. So when the data is saved, the special
 characters are not part of it.
 
 Glyphs aren't part of the text storage. So you would create a custom
 typesetter, hook it up to the layout manager of the text view you use
 for on-screen drawing, and have it generate additional glyphs.
 
 --Kyle Sluder
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/rosscarterdev%40me.com
 
 This email sent to rosscarter...@me.com
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: How to insert a screen-only character in an NSTextView?

2012-08-31 Thread Koen van der Drift
Do you know what year? The videos for 2010, 2011 and 1012 are online.

- Koen.


On Aug 31, 2012, at 4:55 PM, Ross Carter rosscarter...@me.com wrote:

 Or a custom NSGlyphGenerator. There was a WWDC session on this a few years 
 back.
 
 
 
 On Aug 31, 2012, at 2:21 PM, Kyle Sluder k...@ksluder.com wrote:
 
 


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: How to insert a screen-only character in an NSTextView?

2012-08-31 Thread Koen van der Drift
Was it session 114 from 2012?

- Koen.


On Aug 31, 2012, at 5:38 PM, Koen van der Drift koenvanderdr...@gmail.com 
wrote:

 Do you know what year? The videos for 2010, 2011 and 1012 are online.
 
 - Koen.
 
 
 On Aug 31, 2012, at 4:55 PM, Ross Carter rosscarter...@me.com wrote:
 
 Or a custom NSGlyphGenerator. There was a WWDC session on this a few years 
 back.
 
 
 
 On Aug 31, 2012, at 2:21 PM, Kyle Sluder k...@ksluder.com wrote:
 
 
 


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: How to insert a screen-only character in an NSTextView?

2012-08-31 Thread Koen van der Drift

On Aug 31, 2012, at 7:23 PM, Graham Cox appt...@me.com wrote:

 Good luck reading THAT format! I think codecs involving monks with quills are 
 needed.


Hahaha, well spotted! I have my feather pen ready!

- Koen.
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: How to insert a screen-only character in an NSTextView?

2012-08-31 Thread Graham Cox

 The videos for [] 1012 are online


Good luck reading THAT format! I think codecs involving monks with quills are 
needed.

--Graham



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com