Re: Issues with implementing WYWIWYG font menu

2015-05-05 Thread Graham Cox

 On 6 May 2015, at 7:21 am, David Durkee da...@dwdurkee.com wrote:
 
 (the fonts I’m guessing)?
 


Why guess when you can measure?

However it is almost certainly the fonts. No matter how you end up displaying 
them, you still need to initialize them at some point. You can probably warm up 
the Font Manager by iterating through all of its fonts (maybe as a background 
task) but bear in mind that could occupy a lot of memory - which might not 
matter.

Back in the old days (pre Mac OSX) one of the frequently seen solutions to the 
Font menu problem was to save the font menu titles as images and use a custom 
menu definition to display these, loading the real font lazily when the user 
actually chose it. You can still do much the same trick these days I expect, 
using a custom menu item. It’s a lot of work just to avoid a small delay though.

—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

Re: Issues with implementing WYWIWYG font menu

2015-05-05 Thread Jens Alfke

 On May 5, 2015, at 2:21 PM, David Durkee da...@dwdurkee.com wrote:
 
 1) The first time the menu is opened, it takes as much as two seconds for it 
 to appear.

And it might take a lot longer than that, for a user with a lot of fonts 
installed. (I have nearly 2000.) It can also allocate a ton of RAM for glyph 
caches.

 Is there a way I can precache whatever it is that takes so long that first 
 time (the fonts I’m guessing)?

You could pre-render a sample of each font to an image, then save the image to 
a file or database keyed by the font name.

I'm not sure if it's possible to defer configuring a menu item until it's 
displayed, but if so that would speed things up a whole lot, since you'd only 
be displaying a few dozen fonts to start with.

—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: Issues with implementing WYWIWYG font menu

2015-05-05 Thread Lee Ann Rucker

On May 5, 2015, at 2:21 PM, David Durkee da...@dwdurkee.com wrote:

 Yes, this approach has worked much better. I see only two drawbacks.
 
 1) The first time the menu is opened, it takes as much as two seconds for it 
 to appear. This only seems to be true for the first instance of the menu that 
 is opened. (It’s a popup menu in a document window, so different documents 
 will each have their own instance of it.) Is there a way I can precache 
 whatever it is that takes so long that first time (the fonts I’m guessing)?
 
 2) The attributed title is also displayed in the NSPopupButton, where I would 
 rather see the font name displayed int he system font. (As in the font popup 
 in Pages.) Is there a way to force the button to not use the attributedTitle 
 of the selected NSMenuItem?

At a guess, subclass the NSPopuButtonCell and override its attributedTitle to 
return one with the system font. It’s probably just returning what it gets from 
the menuItem.

 
 David
 
 On Apr 29, 2015, at 9:44 PM, Graham Cox graham@bigpond.com wrote:
 
 
 On 30 Apr 2015, at 6:33 am, David Durkee da...@dwdurkee.com wrote:
 
 using a custom view in each NSMenuItem to draw the name of the font in its 
 own font
 
 
 This isn’t really necessary - you can just set an attributed title on a 
 standard menu item and it will draw in the Font given in the attributes. You 
 might find that is easier and less buggy than adding a view to the item.
 
 —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/lrucker%40vmware.com
 
 This email sent to lruc...@vmware.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: Issues with implementing WYWIWYG font menu

2015-05-05 Thread David Durkee
Yes, this approach has worked much better. I see only two drawbacks.

1) The first time the menu is opened, it takes as much as two seconds for it to 
appear. This only seems to be true for the first instance of the menu that is 
opened. (It’s a popup menu in a document window, so different documents will 
each have their own instance of it.) Is there a way I can precache whatever it 
is that takes so long that first time (the fonts I’m guessing)?

2) The attributed title is also displayed in the NSPopupButton, where I would 
rather see the font name displayed int he system font. (As in the font popup in 
Pages.) Is there a way to force the button to not use the attributedTitle of 
the selected NSMenuItem?

David

 On Apr 29, 2015, at 9:44 PM, Graham Cox graham@bigpond.com wrote:
 
 
 On 30 Apr 2015, at 6:33 am, David Durkee da...@dwdurkee.com wrote:
 
 using a custom view in each NSMenuItem to draw the name of the font in its 
 own font
 
 
 This isn’t really necessary - you can just set an attributed title on a 
 standard menu item and it will draw in the Font given in the attributes. You 
 might find that is easier and less buggy than adding a view to the item.
 
 —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

Re: Issues with implementing WYWIWYG font menu

2015-04-29 Thread Graham Cox

 On 30 Apr 2015, at 6:33 am, David Durkee da...@dwdurkee.com wrote:
 
 using a custom view in each NSMenuItem to draw the name of the font in its 
 own font


This isn’t really necessary - you can just set an attributed title on a 
standard menu item and it will draw in the Font given in the attributes. You 
might find that is easier and less buggy than adding a view to the item.

—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

Re: Issues with implementing WYWIWYG font menu

2015-04-29 Thread David Durkee
Oh, wow, I looked all over for something like that. Thanks,  I'll try that 
tomorrow. 

-David

 On Apr 29, 2015, at 9:44 PM, Graham Cox graham@bigpond.com wrote:
 
 
 On 30 Apr 2015, at 6:33 am, David Durkee da...@dwdurkee.com wrote:
 
 using a custom view in each NSMenuItem to draw the name of the font in its 
 own font
 
 
 This isn’t really necessary - you can just set an attributed title on a 
 standard menu item and it will draw in the Font given in the attributes. You 
 might find that is easier and less buggy than adding a view to the item.
 
 —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

Re: Issues with implementing WYWIWYG font menu

2015-04-29 Thread Steve Mills
On Apr 29, 2015, at 21:44:01, Graham Cox graham@bigpond.com wrote:
 
 
 On 30 Apr 2015, at 6:33 am, David Durkee da...@dwdurkee.com wrote:
 
 using a custom view in each NSMenuItem to draw the name of the font in its 
 own font
 
 This isn’t really necessary - you can just set an attributed title on a 
 standard menu item and it will draw in the Font given in the attributes. You 
 might find that is easier and less buggy than adding a view to the item.

David, if you end up using a custom view, I also found that it acted all whacky 
as far as having the selection show correctly, and did a bunch of stuff to work 
around it and fix it. I can provide direction if needed on that front.

--
Steve Mills
Drummer, Mac geek


___

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