How to get window title bar font ^size^ ?

  • NSFont provides:

    + (NSFont *)titleBarFontOfSize:(float)fontSize

    Just what I need to get the font used in window title bars!  But,
    uhhh, what do I give for the fontSize argument?  I know it looks like
    about 13, but how do I get a "correct, supported, future-proof" answer?

    (The reason why I'm doing this is to place a little icon to the left
    of the title, so I need to know how big it is.  With lots of code,
    I've gotten it all to work...handling resizing was really fun.  But I
    have to hard-code that stupid font size.)

    When I log the subviews of the window, I get the red button, the
    yellow button, the green button and the main contentView.  I was
    hoping to get some kind of text "view" that would be the window title,
    but apparently it's not a "view".

    Thanks for any tips,

    Jerry Krinock
  • On 24 Nov 07, at 22:21, Jerry Krinock wrote:
    <snip>
    > (The reason why I'm doing this is to place a little icon to the left
    > of the title, so I need to know how big it is.  With lots of code,
    > I've gotten it all to work...handling resizing was really fun.  But
    > I have to hard-code that stupid font size.)
    >
    > When I log the subviews of the window, I get the red button, the
    > yellow button, the green button and the main contentView.  I was
    > hoping to get some kind of text "view" that would be the window
    > title, but apparently it's not a "view".

    From the NSWindow documentation:

    [[<window> standardWindowButton:NSWindowDocumentIconButton]
    setImage:<image>]

    I believe this is only available in 10.5, though.
  • On 25/11/2007, Jerry Krinock <jerry...> wrote:
    > NSFont provides:
    >
    > + (NSFont *)titleBarFontOfSize:(float)fontSize
    >
    > Just what I need to get the font used in window title bars!  But,
    > uhhh, what do I give for the fontSize argument?  I know it looks like
    > about 13, but how do I get a "correct, supported, future-proof" answer?
    >

    The discussion for +titleBarFontOfSize: says:
    "If fontSize is 0 or negative, returns the title bar font at the default size."

    -Phil
  • On 25 Nov 2007, at 07:09, Philip Q wrote:

    > On 25/11/2007, Jerry Krinock <jerry...> wrote:
    >> NSFont provides:
    >>
    >> + (NSFont *)titleBarFontOfSize:(float)fontSize
    >>
    >> Just what I need to get the font used in window title bars!  But,
    >> uhhh, what do I give for the fontSize argument?  I know it looks like
    >> about 13, but how do I get a "correct, supported, future-proof"
    >> answer?
    >>
    >
    > The discussion for +titleBarFontOfSize: says:
    > "If fontSize is 0 or negative, returns the title bar font at the
    > default size."

    Perhaps that ought to be filed as a bug -- it's very inconsistent with
    the rest of NSFont's APIs, from which you'd expect to call
    titleBarFontSize, to find out the default size.

    Bob
  • Thomas Davie wrote:

    > On 25 Nov 2007, at 07:09, Philip Q wrote:
    >
    >> The discussion for +titleBarFontOfSize: says:
    >> "If fontSize is 0 or negative, returns the title bar font at the
    >> default size."
    >
    > Perhaps that ought to be filed as a bug -- it's very inconsistent with
    > the rest of NSFont's APIs, ...?

    Inconsistent?

    All the fooFontOfSize: methods do the same thing. Always have.
previous month november 2007 next month
MTWTFSS
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30    
Go to today