• 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
Re: ATSUI Bounding box
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ATSUI Bounding box


  • Subject: Re: ATSUI Bounding box
  • From: Lennart Kudling <email@hidden>
  • Date: Thu, 9 Mar 2006 19:55:28 +0100

Sorry, the attachment didn't make it through: http:// lennart.kudling.de/bearing.png

Am 09.03.2006 um 19:52 schrieb Lennart Kudling:

Hi all,

i am the founder of the GPL vector graphics editor Chlor (http:// chlor.sourceforge.net/).

I have difficulties to calculate the exact (device independent) bounding box of text. My code looks like this:

	OSStatus status = noErr;
	ATSTrapezoid trapezoid;

	status = ATSUGetGlyphBounds(
		m_atsuTextLayout,
		FloatToFixed( m_origin->x ),
		FloatToFixed( m_origin->y ),
		kATSUFromTextBeginning,
		kATSUToTextEnd,
		kATSUseFractionalOrigins,
		1,
		&trapezoid,
		NULL );

m_boundingBox = [[CRect alloc] init];
[m_boundingBox setPointX: FixedToFloat( trapezoid.lowerLeft.x ) Y: FixedToFloat( trapezoid.lowerLeft.y )];
[m_boundingBox addPointX: FixedToFloat( trapezoid.upperRight.x ) Y: FixedToFloat( trapezoid.upperRight.y )];


The full source can be seen here: http://cvs.sourceforge.net/ viewcvs.py/chlor/src/CText.m?rev=1.19&view=log

The problem is, that there is some offset (bearing?) as can be seen in the attached screenshot. I tried several ideas but cannot get rid of this offset.

I would be really glad if someone could tell me what i am doing wrong.

Thanks,
Lenny _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >ATSUI Bounding box (From: Lennart Kudling <email@hidden>)

  • Prev by Date: Re: Select an Item in NSOutlineView
  • Next by Date: Design Decision: Passing Information Between Two Applications
  • Previous by thread: ATSUI Bounding box
  • Next by thread: Design Decision: Passing Information Between Two Applications
  • Index(es):
    • Date
    • Thread