discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSMenuItem setAttributedTitle


From: Fred Kiefer
Subject: Re: NSMenuItem setAttributedTitle
Date: Fri, 23 Oct 2020 21:58:06 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.3.2

Am 19.10.20 um 20:21 schrieb Aaron Carr:
> Hi
>
> Ive been  trying to change the font of an NSMenuItem, looking at the source, 
> setAttributedTitle is:
>
> -(void) setAttributedTitle: (NSAttributedString *)title
> {
>   // FIXME
>   [self setTitle: [title string]];
> }
>
> Am i reading this right, is it essentially bypassed ? if so, what is the best 
> way to say bold/italic/underline an NSMenuItem ?

Currently there is no proper way of doing so. You would need to grap
hold of the corresponding NSMenuItemCell and set the font there
directly. But you really shouldn't go down that way. Instead it would
not be to hard to implement attributed string support in NSMenuItem and
NSMenuItemCell, at least for the standard theme. Ivan already explained
the limits of doing this for other setups.

The main obstacle here is that the current code here needs a cleanup, or
rather a proper rewrite. There are many duplications and
inconsistencies. For example the alternate text of the menu item cell
would never be displayed.

Patches are highly welcome,
Fred





reply via email to

[Prev in Thread] Current Thread [Next in Thread]