Re: Font alignment when using bold variant of system font

2016-10-14 Thread Samuel Williams
Just in case anyone finds this thread and wonders what the solution was,
here it is:

- (void) updateEditorHighlighting: (NSString*)expression

{

NSTextView * editor = (NSTextView*)[self currentEditor];


[self updateExpressionValue:self.stringValue into:editor.textStorage];


// This fixes a strange issue where the vertical alignment of the font is a
bit strange during editing.

NSMutableParagraphStyle * paragraphStyle = [[NSMutableParagraphStyle alloc]
init];

paragraphStyle.maximumLineHeight = [editor.layoutManager
defaultLineHeightForFont:self.font];


[editor.textStorage addAttribute:NSParagraphStyleAttributeName
value:paragraphStyle
range:NSMakeRange(0, editor.textStorage.length)];

}


On 13 October 2016 at 13:26, Samuel Williams  wrote:

> That's crazy, how can Apple make a system font which breaks existing apps!?
>
> On 13 October 2016 at 12:19, Steve Mills  wrote:
>
>> > On Oct 12, 2016, at 16:55, Samuel Williams <
>> space.ship.travel...@gmail.com> wrote:
>> >
>> > It's the standard font "San Francisco" from Apple. That's odd that it
>> would
>> > be buggy like that. I'll try what you suggested.
>>
>> Not surprising. The new San Francisco is pretty bad.
>>
>> Steve via iPad
>>
>>
>> ___
>>
>> 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/space.
>> ship.traveller%40gmail.com
>>
>> This email sent to space.ship.travel...@gmail.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: Font alignment when using bold variant of system font

2016-10-12 Thread Samuel Williams
That's crazy, how can Apple make a system font which breaks existing apps!?

On 13 October 2016 at 12:19, Steve Mills  wrote:

> > On Oct 12, 2016, at 16:55, Samuel Williams  com> wrote:
> >
> > It's the standard font "San Francisco" from Apple. That's odd that it
> would
> > be buggy like that. I'll try what you suggested.
>
> Not surprising. The new San Francisco is pretty bad.
>
> Steve via iPad
>
>
> ___
>
> 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/
> space.ship.traveller%40gmail.com
>
> This email sent to space.ship.travel...@gmail.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: Font alignment when using bold variant of system font

2016-10-12 Thread Steve Mills
> On Oct 12, 2016, at 16:55, Samuel Williams  
> wrote:
> 
> It's the standard font "San Francisco" from Apple. That's odd that it would
> be buggy like that. I'll try what you suggested.

Not surprising. The new San Francisco is pretty bad.

Steve via iPad


___

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: Font alignment when using bold variant of system font

2016-10-12 Thread Samuel Williams
It's the standard font "San Francisco" from Apple. That's odd that it would
be buggy like that. I'll try what you suggested.

On 13 October 2016 at 10:52, Jens Alfke  wrote:

> It looks as though the bold style of the font has a higher cap height,
> which causes the text view to move the baseline farther down to make room.
> I’ve seen occasional glitches like this in fonts. (What font are you using?)
>
> You might be able to work around this by setting a custom NSParagraphStyle
> in your text and setting its maximumLineHeight property.
>
> —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: Font alignment when using bold variant of system font

2016-10-12 Thread Jens Alfke
It looks as though the bold style of the font has a higher cap height, which 
causes the text view to move the baseline farther down to make room. I’ve seen 
occasional glitches like this in fonts. (What font are you using?)

You might be able to work around this by setting a custom NSParagraphStyle in 
your text and setting its maximumLineHeight property.

—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

Font alignment when using bold variant of system font

2016-10-12 Thread Samuel Williams
Hello, I've got an app "Truth Tables" which does parsing and highlighting
of an expression.

I use a custom subclass of NSTextField in a toolbar.. it's worked fine
until the system font changed I think, but I'm not 100% sure because I've
only noticed the problem recently.

Here is the font code which triggers the issue (the commented out line is
the one that causes odd alignment behaviour):

// For some reason, when using this font, the vertical alignment becomes
odd.

//NSFont * identifierFont = [[NSFontManager sharedFontManager]
convertFont:self.font toHaveTrait:NSBoldFontMask];

NSFont * identifierFont = self.font;

There is a full source code listing here:
https://gist.github.com/ioquatix/f8357f895fbefe4ad96a9e71e668dbf3

When using self.font, everything is fine. But when using the bold variant,
the alignment is a bit off.

I've made a video demonstrating the issue because it's hard to describe:
https://www.youtube.com/watch?v=CTxTYhfjz8Y

Wondering if anyone has any idea what's going on here? Or where to start
trying to figure out?

Kind regards,
Samuel
___

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