Re: How do I set a NSTextView's font in Interface Builder?

2017-03-27 Thread Daryle Walker

> On Mar 24, 2017, at 2:28 PM, Keary Suska  wrote:
> 
>> On Mar 24, 2017, at 10:33 AM, Jens Alfke  wrote:
>> 
>>> On Mar 23, 2017, at 6:35 PM, Daryle Walker  wrote:
>>> 
>>> I have the NSTextView selected in its storyboard scene. And I have the 
>>> Attributes Inspector active. The entry for the font is empty. Clicking the 
>>> squared-T gives a pop-up with a “Custom” font and changing it to one of the 
>>> fixed selections (User, fixed) doesn’t do any actual change. 
>> 
>> This is a longstanding bug, or maybe it’s an API issue. The problem is that 
>> the view’s text is empty, and an empty NSAttributedString can’t have any 
>> attributes because the attributes are associated with characters.
>> 
>> IIRC you can fix this by adding some placeholder text, even a single space, 
>> in the view, then replacing it at runtime.
> 
> I don’t believe that is actually true. Attributes *can* apply to an empty 
> range. Alternatively, or additionally, I believe if you call 
> setTypingAttributes: on an empty text view that any new types text will use 
> the specified attributes.

I solved this by starting to play with UserDefaults. I added my font as a 
default, then referenced it in the text view with Cocoa Bindings.

— 
Daryle Walker
Mac, Internet, and Video Game Junkie
darylew AT mac DOT 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 do I set a NSTextView's font in Interface Builder?

2017-03-24 Thread Keary Suska

> On Mar 24, 2017, at 3:08 PM, Jens Alfke  wrote:
> 
>> On Mar 24, 2017, at 11:28 AM, Keary Suska  wrote:
>> 
>> I don’t believe that is actually true. Attributes *can* apply to an empty 
>> range. 
> 
> It may be that the serialized form of the string in the nib doesn’t preserve 
> the attributes. Or that they’re not preserved by the view when the user types 
> the first character. (It’s been about eight years since I dealt with this 
> problem…)

I think that is certainly the case—I have never been able to get attributes to 
persist that were specified in IB, though I haven’t tried with the new Xcode 
options.

HTH,

Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"


___

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 do I set a NSTextView's font in Interface Builder?

2017-03-24 Thread Jens Alfke

> On Mar 24, 2017, at 11:28 AM, Keary Suska  wrote:
> 
> I don’t believe that is actually true. Attributes *can* apply to an empty 
> range.

It may be that the serialized form of the string in the nib doesn’t preserve 
the attributes. Or that they’re not preserved by the view when the user types 
the first character. (It’s been about eight years since I dealt with this 
problem…)

> Alternatively, or additionally, I believe if you call setTypingAttributes: on 
> an empty text view that any new types text will use the specified attributes.

Yes, you can do that too.

—Jens
___

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 do I set a NSTextView's font in Interface Builder?

2017-03-24 Thread Keary Suska

> On Mar 24, 2017, at 10:33 AM, Jens Alfke  wrote:
> 
> 
>> On Mar 23, 2017, at 6:35 PM, Daryle Walker  wrote:
>> 
>> I have the NSTextView selected in its storyboard scene. And I have the 
>> Attributes Inspector active. The entry for the font is empty. Clicking the 
>> squared-T gives a pop-up with a “Custom” font and changing it to one of the 
>> fixed selections (User, fixed) doesn’t do any actual change. 
> 
> This is a longstanding bug, or maybe it’s an API issue. The problem is that 
> the view’s text is empty, and an empty NSAttributedString can’t have any 
> attributes because the attributes are associated with characters.
> 
> IIRC you can fix this by adding some placeholder text, even a single space, 
> in the view, then replacing it at runtime.

I don’t believe that is actually true. Attributes *can* apply to an empty 
range. Alternatively, or additionally, I believe if you call 
setTypingAttributes: on an empty text view that any new types text will use the 
specified attributes.

HTH,

Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"


___

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 do I set a NSTextView's font in Interface Builder?

2017-03-24 Thread Jens Alfke

> On Mar 23, 2017, at 6:35 PM, Daryle Walker  wrote:
> 
> I have the NSTextView selected in its storyboard scene. And I have the 
> Attributes Inspector active. The entry for the font is empty. Clicking the 
> squared-T gives a pop-up with a “Custom” font and changing it to one of the 
> fixed selections (User, fixed) doesn’t do any actual change. 

This is a longstanding bug, or maybe it’s an API issue. The problem is that the 
view’s text is empty, and an empty NSAttributedString can’t have any attributes 
because the attributes are associated with characters.

IIRC you can fix this by adding some placeholder text, even a single space, in 
the view, then replacing it at runtime.

—Jens
___

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 do I set a NSTextView's font in Interface Builder?

2017-03-23 Thread Daryle Walker
I have the NSTextView selected in its storyboard scene. And I have the 
Attributes Inspector active. The entry for the font is empty. Clicking the 
squared-T gives a pop-up with a “Custom” font and changing it to one of the 
fixed selections (User, fixed) doesn’t do any actual change. This makes the 
text-view with the initial font (the application/user non-fixed-width font). Is 
there a way to change the text-view’s font in IB?

— 
Daryle Walker
Mac, Internet, and Video Game Junkie
darylew AT mac DOT 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