Danny, I'm no font expert, but you could try playing with the 'weight' setting. I see you have it set to 5. Try setting it to 0 and see if that makes a difference. Sometimes when choosing a bold font, the resulting font anyway has a given weight. At least this is something I saw only yesterday when trying to toggle a font between bold and non-bold.
Cheers, Martin On 13, Nov, 2011, at 03:18 PM, Dany Golubitsky wrote: > > 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:image001.jpg@01CCA21F.CFCEE370] > > Danny Golubitsky > Software Engineer > > Waves Audio Ltd > Tel: +972 3 608 4157 > Fax: +972 3 608 4056 > > www.waves.com<http://www.waves.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/martin.hewitson%40aei.mpg.de > > This email sent to martin.hewit...@aei.mpg.de ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Martin Hewitson Albert-Einstein-Institut Max-Planck-Institut fuer Gravitationsphysik und Universitaet Hannover Callinstr. 38, 30167 Hannover, Germany Tel: +49-511-762-17121, Fax: +49-511-762-5861 E-Mail: martin.hewit...@aei.mpg.de WWW: http://www.aei.mpg.de/~hewitson ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ _______________________________________________ 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 arch...@mail-archive.com