Re: Button title irregularities

2008-12-03 Thread Ricky Sharp


On Dec 2, 2008, at 7:15 PM, Randall Meadows wrote:


On Dec 2, 2008, at 5:31 PM, Aki Inoue wrote:


You're using Helveitca 12.0 as your label font.


Actually, it's:

(gdb) po labelFont
ArialMT 12.00 pt. P [] (0x001c0e30) fobj=0x162670a0, spc=3.33

Use [NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize: 
[yourButton controlSize]]] instead.


And I'm using that because that's what my client used on their  
iPhone app, and they want the Mac app to have the exact same look  
and feel.


Please don't do this; the iPhone and desktop experience are _way_  
different and what you're doing makes no sense.


I recently had my iPhone app reviewed by some members of Apple's UI  
team at one of the tech talk conferences.  My situation was the  
opposite; moving an app from desktop to iPhone.  In some places, I  
fell into the trap of providing a UI that contained desktop-style  
metaphors.


Also keep in mind that an iPhone OS app is much more simplified in  
terms of functions than for the desktop.


Having said all that, on the iPhone OS, use the defined system  
controls, system fonts, etc.  Then, do the same for the desktop.


However, there are definitely some things you can do to both apps to  
ensure they come from the same tree.  Color schemes are very useful  
here.  For example, for my math app, Each mathematical operation was  
given a color.  These colors are used in various parts of the app.   
Some other purely graphical elements are also shared.


Finally, make sure to read both the Macintosh and iPhone Human  
Interface Guideline documents.


___
Ricky A. Sharp mailto:[EMAIL PROTECTED]
Instant Interactive(tm)   http://www.instantinteractive.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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Button title irregularities

2008-12-02 Thread Randall Meadows
I am porting an iPhone app to the Mac, and the client desires the  
exact same look-and-feel on the Mac as they have on the iPhone.  So I  
am doing some custom drawing to achieve that.  It's mostly going OK,  
but I've found myself wasting far too much time on this one little  
detail, and it's killing me...


I'm drawing a button with a custom background, and setting an  
attributed title on it.  There is no border, custom background image  
for both normal and alternate states, and a title for both normal and  
alternate states.


When I set an attributed title on it, using a custom font, custom  
paragraph style (necessary to center the title), and a custom color,  
the text of the title is shifted down 1 pixel when compared to the  
standard button.   Thinking that that 1 pixel difference was due to  
the different font, I tried again, setting an attributed title that  
*only* contain the custom color.


This time, the title was shifted UP 1 pixel from that of a standard  
button (2 pixels higher than with the fully attributed title).  I  
tried playing around with the line spacing of the paragraph style, but  
that made no difference.


You can see for yourself in this image: http://www.not-pc.com/Buttons.png 
.  (The custom background was not drawn and the border was added to  
make it easier to see.)  Here's the code I'm using to create the button:


button = [NSButton new];
[button setButtonType:NSToggleButton];
[button setBezelStyle:NSRegularSquareBezelStyle/ 
*NSRoundRectBezelStyle*/];

//[button setBordered:NO];
NSDictionary*attrs;
NSMutableParagraphStyle *style = [NSMutableParagraphStyle new];
[style setAlignment:NSCenterTextAlignment];
[style setLineSpacing:10];
attrs = [NSDictionary dictionaryWithObjectsAndKeys:
//   labelFont, NSFontAttributeName,
[NSColor blackColor], NSForegroundColorAttributeName,
//  style, NSParagraphStyleAttributeName,
nil];
[button setAttributedTitle:@Show attributes:attrs];

Is there anything standard I can do to fix this?  Yeah, I know 1  
pixel isn't that much of a difference, but that's like a 5% error, and  
it's noticeable.

___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Button title irregularities

2008-12-02 Thread Aki Inoue

You're using Helveitca 12.0 as your label font.

Use [NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize: 
[yourButton controlSize]]] instead.


Aki

On 2008/12/02, at 13:39, Randall Meadows wrote:

I am porting an iPhone app to the Mac, and the client desires the  
exact same look-and-feel on the Mac as they have on the iPhone.  So  
I am doing some custom drawing to achieve that.  It's mostly going  
OK, but I've found myself wasting far too much time on this one  
little detail, and it's killing me...


I'm drawing a button with a custom background, and setting an  
attributed title on it.  There is no border, custom background image  
for both normal and alternate states, and a title for both normal  
and alternate states.


When I set an attributed title on it, using a custom font, custom  
paragraph style (necessary to center the title), and a custom color,  
the text of the title is shifted down 1 pixel when compared to the  
standard button.   Thinking that that 1 pixel difference was due to  
the different font, I tried again, setting an attributed title that  
*only* contain the custom color.


This time, the title was shifted UP 1 pixel from that of a standard  
button (2 pixels higher than with the fully attributed title).  I  
tried playing around with the line spacing of the paragraph style,  
but that made no difference.


You can see for yourself in this image: http://www.not-pc.com/Buttons.png 
.  (The custom background was not drawn and the border was added to  
make it easier to see.)  Here's the code I'm using to create the  
button:


button = [NSButton new];
[button setButtonType:NSToggleButton];
[button setBezelStyle:NSRegularSquareBezelStyle/ 
*NSRoundRectBezelStyle*/];

//[button setBordered:NO];
NSDictionary*attrs;
NSMutableParagraphStyle *style = [NSMutableParagraphStyle new];
[style setAlignment:NSCenterTextAlignment];
[style setLineSpacing:10];
attrs = [NSDictionary dictionaryWithObjectsAndKeys:
//   labelFont, NSFontAttributeName,
   [NSColor blackColor], NSForegroundColorAttributeName,
//  style, NSParagraphStyleAttributeName,
   nil];
[button setAttributedTitle:@Show attributes:attrs];

Is there anything standard I can do to fix this?  Yeah, I know 1  
pixel isn't that much of a difference, but that's like a 5% error,  
and it's noticeable.

___

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:
http://lists.apple.com/mailman/options/cocoa-dev/aki%40apple.com

This email sent to [EMAIL PROTECTED]


___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Button title irregularities

2008-12-02 Thread Randall Meadows

On Dec 2, 2008, at 5:31 PM, Aki Inoue wrote:


You're using Helveitca 12.0 as your label font.


Actually, it's:

(gdb) po labelFont
ArialMT 12.00 pt. P [] (0x001c0e30) fobj=0x162670a0, spc=3.33

Use [NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize: 
[yourButton controlSize]]] instead.


And I'm using that because that's what my client used on their iPhone  
app, and they want the Mac app to have the exact same look and feel.

___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Button title irregularities

2008-12-02 Thread Benjamin Dobson


On 3 Dec 2008, at 01:15:32, Randall Meadows wrote:

And I'm using that because that's what my client used on their  
iPhone app, and they want the Mac app to have the exact same look  
and feel.


Then why not use Helvetica?
___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]