NSATSTypesetter Line computation problem
NSATSTypesetter Line computation problem
- Subject: NSATSTypesetter Line computation problem
- From: chaitanya pandit <email@hidden>
- Date: Tue, 19 Aug 2008 13:13:10 -0400
In my application i use a custom text container to lay text around a
hole, the problem occurs when i have two holes side by side.
In this case the line would be broken down in to three line fragments.
The problem occurs when the rightmost fragment has bigger font than
the ones on the left.
I lhave overridden NSATSTypesetter's
"getLineFragmentRect: usedRect: remainingRect:
forStartingGlyphAtIndex: proposedRect: lineSpacing:
paragraphSpacingBefore: paragraphSpacingAfter: " method
and i just log the rectangle values after i call super
This is the first case where the first line has no intersecting holes,
it behaves fine
Here is the log for the same:
2008-08-19 13:01:04.952 testApp[6033:813] Logging Rect Info...
2008-08-19 13:01:04.953 testApp[6033:813] Proposed Rect: {{0, 0}, {1e
+07, 11}}
2008-08-19 13:01:04.954 testApp[6033:813] LineFragment Rect: {{0, 0},
{482, 11}}
2008-08-19 13:01:04.960 testApp[6033:813] Remaining Rect: {{0, 0}, {0,
0}}
2008-08-19 13:01:04.963 testApp[6033:813] ____________________
2008-08-19 13:01:04.964 testApp[6033:813] Logging Rect Info...
2008-08-19 13:01:04.969 testApp[6033:813] Proposed Rect: {{0, 11}, {1e
+07, 11}}
2008-08-19 13:01:04.972 testApp[6033:813] LineFragment Rect: {{0, 11},
{110.664, 11}}
2008-08-19 13:01:04.979 testApp[6033:813] Remaining Rect: {{190.664,
11}, {291.336, 11}}
2008-08-19 13:01:04.979 testApp[6033:813] ____________________
2008-08-19 13:01:04.980 testApp[6033:813] Logging Rect Info...
2008-08-19 13:01:04.982 testApp[6033:813] Proposed Rect: {{0, 11}, {1e
+07, 106}}
2008-08-19 13:01:04.982 testApp[6033:813] LineFragment Rect: {{0, 11},
{30.6669, 106}}
2008-08-19 13:01:04.983 testApp[6033:813] Remaining Rect: {{110.667,
11}, {371.333, 106}}
2008-08-19 13:01:04.983 testApp[6033:813] ____________________
2008-08-19 13:01:04.984 testApp[6033:813] Logging Rect Info...
2008-08-19 13:01:04.984 testApp[6033:813] Proposed Rect: {{0, 11}, {1e
+07, 106}}
2008-08-19 13:01:04.985 testApp[6033:813] LineFragment Rect: {{0, 11},
{30.6669, 106}}
2008-08-19 13:01:04.985 testApp[6033:813] Remaining Rect: {{110.667,
11}, {371.333, 106}}
2008-08-19 13:01:04.986 testApp[6033:813] ____________________
2008-08-19 13:01:04.986 testApp[6033:813] Logging Rect Info...
2008-08-19 13:01:04.987 testApp[6033:813] Proposed Rect: {{0, 11}, {1e
+07, 106}}
2008-08-19 13:01:04.987 testApp[6033:813] LineFragment Rect: {{0, 11},
{30.6669, 106}}
2008-08-19 13:01:04.988 testApp[6033:813] Remaining Rect: {{110.667,
11}, {371.333, 106}}
2008-08-19 13:01:04.988 testApp[6033:813] ____________________
2008-08-19 13:01:04.989 testApp[6033:813] Logging Rect Info...
2008-08-19 13:01:04.990 testApp[6033:813] Proposed Rect: {{110.667,
11}, {1e+07, 11}}
2008-08-19 13:01:04.990 testApp[6033:813] LineFragment Rect:
{{190.664, 11}, {291.336, 106}}
2008-08-19 13:01:04.991 testApp[6033:813] Remaining Rect: {{0, 0}, {0,
0}}
2008-08-19 13:01:04.991 testApp[6033:813] ____________________
2008-08-19 13:01:04.993 testApp[6033:813] Logging Rect Info...
2008-08-19 13:01:04.993 testApp[6033:813] Proposed Rect: {{190.664,
11}, {1e+07, 106}}
2008-08-19 13:01:04.994 testApp[6033:813] LineFragment Rect:
{{190.665, 11}, {291.336, 106}}
2008-08-19 13:01:04.994 testApp[6033:813] Remaining Rect: {{0, 0}, {0,
0}}
2008-08-19 13:01:04.995 testApp[6033:813] ____________________
The problem occurs when the hole in the centre is moved op and
intersects with the first line
Log for this is:
2008-08-19 13:04:13.884 testApp[6033:813] Logging Rect Info...
2008-08-19 13:04:13.885 testApp[6033:813] Proposed Rect: {{0, 0}, {1e
+07, 11}}
2008-08-19 13:04:13.886 testApp[6033:813] LineFragment Rect: {{0, 0},
{110.664, 11}}
2008-08-19 13:04:13.886 testApp[6033:813] Remaining Rect: {{190.664,
0}, {291.336, 11}}
2008-08-19 13:04:13.887 testApp[6033:813] ____________________
2008-08-19 13:04:13.891 testApp[6033:813] Logging Rect Info...
2008-08-19 13:04:13.891 testApp[6033:813] Proposed Rect: {{190.664,
0}, {1e+07, 11}}
2008-08-19 13:04:13.892 testApp[6033:813] LineFragment Rect:
{{190.664, 0}, {291.336, 11}}
2008-08-19 13:04:13.892 testApp[6033:813] Remaining Rect: {{0, 0}, {0,
0}}
2008-08-19 13:04:13.892 testApp[6033:813] ____________________
2008-08-19 13:04:13.893 testApp[6033:813] Logging Rect Info...
2008-08-19 13:04:13.894 testApp[6033:813] Proposed Rect: {{0, 11}, {1e
+07, 11}}
2008-08-19 13:04:13.894 testApp[6033:813] LineFragment Rect: {{0, 11},
{110.664, 11}}
2008-08-19 13:04:13.894 testApp[6033:813] Remaining Rect: {{190.664,
11}, {291.336, 11}}
2008-08-19 13:04:13.895 testApp[6033:813] ____________________
2008-08-19 13:04:13.895 testApp[6033:813] Logging Rect Info...
2008-08-19 13:04:13.896 testApp[6033:813] Proposed Rect: {{190.664,
11}, {1e+07, 11}}
2008-08-19 13:04:13.896 testApp[6033:813] LineFragment Rect:
{{190.664, 11}, {291.336, 11}}
2008-08-19 13:04:13.899 testApp[6033:813] Remaining Rect: {{0, 0}, {0,
0}}
2008-08-19 13:04:13.909 testApp[6033:813] ____________________
2008-08-19 13:04:13.914 testApp[6033:813] Logging Rect Info...
2008-08-19 13:04:13.915 testApp[6033:813] Proposed Rect: {{190.664,
11}, {1e+07, 106}}
2008-08-19 13:04:13.915 testApp[6033:813] LineFragment Rect:
{{190.664, 11}, {291.336, 106}}
2008-08-19 13:04:13.916 testApp[6033:813] Remaining Rect: {{0, 0}, {0,
0}}
2008-08-19 13:04:13.916 testApp[6033:813] ____________________
The problem is that after it computes the first line fragment for the
second line, it should again call the first line frag with bigger
height but it doesn't do so, instead it directly sets the line frag.
for the first line fragment and never comes back to it.
So if you refer the above code, after the third log, it should again
call with Proposed Rect {{0, 11}, {1e+07, 106}}, but it doesn't do so
as it has already set the line frag. for it
I'd really appreciate if anyone could help me with this.
Thanks
Chaitanya
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden