Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8492793
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T22:49:34+00:00 2026-06-10T22:49:34+00:00

When using -[NSString drawInRect:withAttributes:], mainly when using the built-in Helvetica Neue but also with

  • 0

When using -[NSString drawInRect:withAttributes:], mainly when using the built-in Helvetica Neue but also with other fonts, the kerning is really bad. However, when the same string is rendered in Text Edit (which uses NSTextView) the kerning is great. Consider these two strings:

Bad kerning

Good kerning

For small point sizes, the first case (rendered in Cocoa) is nearly illegible, while the second case (from Text Edit) is much better. I don’t think that kerning information is being used at all here. If I apply the NSKernAttribute with a value of 0.0 (which according to the documentation turns off kerning) I get the same result, the one at the top.

I also tried using Core Text with CTLineDraw, but still got the bad kerning. So my question is, is there anything special I need to do to enable kerning in the Cocoa text system? If not, how does NSTextView apply kerning?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T22:49:36+00:00Added an answer on June 10, 2026 at 10:49 pm

    The top example is ‘tighter’ and the bottom one is ‘looser’ see -[NSTextView tightenKerning], -[NSTextView loosenKerning]. Here Apple is confusingly referring to what everyone else calls ‘Tracking’ as ‘Kerning’ ie. a constant amount of additional space (positive or negative) uniformly applied between each glyph, after the ‘character advance’ specified in the font, to make text appear, well, tighter or looser.

    The default ‘tightness’ or ‘looseness’ is a property of the rendering engine, not the font, and could easily be different between different OSX versions, apps or UI elements.

    In a font, the kerning table is for adjustments to the character advance needed by specific pairs of glyphs, eg, in my hypothetical font: ‘AV’ is listed as a kerning pair – the ‘A’ should have a smaller advance when the character following it is a ‘V’.

    The OSX fonts Helvetica and HelveticaNeue (and many of the other fonts) have no kerning information at all, so you are right that no kerning information is being used in your examples.

    If the font has no Kerning info, your question “How do i enable kerning in the Cocoa text system?” doesn’t make sense or doesn’t mean what you think it means (?).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using [NSString drawInRect:] to draw text to a texture and everything works fine
So I am seemingly encountering some strange behavior when using NSString 's -sizeWithFont family
I am having trouble using a NSString with unicode characters like 'ç' and 'ñ'.
I can draw many things using this : NSString *imagePath = [[NSBundle mainBundle] pathForResource:@dummy2.png
I got a string that contains the current date by using this : NSString
I know I can loop through each character of two NSString objects using characterAtIndex:
I am using NSURLConnection to send same data ( NSString ) to the server
I am using the following code to convert an NSString to an NSDate :
why are we using here 5 parameters for stringWithFormat : return [NSString stringWithFormat:NSLocalizedString(@LatLongFormat, @LatLongFormat),
I want to convert a NSString to int64_t and then print it out using:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.