• 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
Helvetica in NSQuickDrawView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Helvetica in NSQuickDrawView


  • Subject: Helvetica in NSQuickDrawView
  • From: Dix Lorenz <email@hidden>
  • Date: Fri, 25 Apr 2003 12:04:18 +0200

Hi,

I have ported some old (10 years?) Quickdraw-code into my brandnew Cocoa-App, using NSQuickDrawView. I am more than amazed how well it worked and how easy the transition was, but I have one problem: I am using GetFontInfo and TEGetHeight to find the needed height for a text without drawing it. This code has worked all these years and continues to work... Unless I use Helvetica. Using Helvetica 12 pt, I get a TextHeight of 12, which is obviously to small. It works for other fonts I tried (Lucida Grande and Arial)...

The code in question:

FontInfo theFontInfo;
::GetFontInfo(&theFontInfo);
(*mTE)->lineHeight = (theFontInfo.descent + theFontInfo.ascent + theFontInfo.leading);

int theHeight = ::TEGetHeight(32767,1,mTE);

I know the Apple Docs say I shouldn't use TextEdit anymore and use MLTE, but if there is a way to simply find the height of a text, just using a Grafport, without actually drawing it, I didn't see it...

Any suggestions or ideas?

Thanks,
Dix
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Helvetica in NSQuickDrawView
      • From: Andrew Thompson <email@hidden>
  • Prev by Date: Is there a Bug in Cocoa's NSView ?
  • Next by Date: Problem with NSScrollView - Resolved
  • Previous by thread: Re: Is there a Bug in Cocoa's NSView ?
  • Next by thread: Re: Helvetica in NSQuickDrawView
  • Index(es):
    • Date
    • Thread