• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Troubles with Bold and Italic fonts - Cocoa
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Troubles with Bold and Italic fonts - Cocoa


  • Subject: Troubles with Bold and Italic fonts - Cocoa
  • From: Dany Golubitsky <email@hidden>
  • Date: Sun, 13 Nov 2011 09:18:00 -0500
  • Acceptlanguage: en-US
  • Thread-topic: Troubles with Bold and Italic fonts - Cocoa

I am trying to make cocoa application draw bold or/and italic fonts. Here is the code I use:

    NSFontTraitMask fontStyle = 0;
    if (m_bBold)
        fontStyle |= NSBoldFontMask;
    if (m_bItalic)
        fontStyle |= NSItalicFontMask;

    NSFontManager* fontManager = [NSFontManager sharedFontManager];
    NSFont* font   = [fontManager fontWithFamily:@"Helvetica" traits:fontStyle weight:5 size:12];

As far as I understand all that fontManager does is just convert to the correct font name.
So it works fine. It converts Helvetica to Helvetica-Bold or Verdana to Verdana-Bold.

However, the displayed font is not always what I asked. For example, It works with Verdana (I see it bold). But it does not works with Helvetica. Although the name is converted to Helvetica-Bold, the fonts are still regular.

What is the mistake here?


[cid:email@hidden370]

Danny Golubitsky
Software Engineer

Waves Audio Ltd
Tel:  +972 3 608 4157
Fax: +972 3 608 4056

www.waves.com<http://www.waves.com>

















JPEG image

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Troubles with Bold and Italic fonts - Cocoa
      • From: Martin Hewitson <email@hidden>
  • Prev by Date: NSExceptionHandler - What is a "top-level" vs. "other" exception?
  • Next by Date: performClickWithFrame draw with offset if coordinates are flipped
  • Previous by thread: NSExceptionHandler - What is a "top-level" vs. "other" exception?
  • Next by thread: Re: Troubles with Bold and Italic fonts - Cocoa
  • Index(es):
    • Date
    • Thread