ATSUI Bounding box
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