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

ATSUI Bounding box


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

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


  • Follow-Ups:
    • Re: ATSUI Bounding box
      • From: Lennart Kudling <email@hidden>
  • Prev by Date: Re: Headers and referencing pre defined objects.
  • Next by Date: Re: Select an Item in NSOutlineView
  • Previous by thread: Re: Dropping controls on subclassed NSView
  • Next by thread: Re: ATSUI Bounding box
  • Index(es):
    • Date
    • Thread