FROM : delanoy
DATE : Wed Jul 19 19:50:34 2006
>Put an NSLog on your "parsty" as soon as it is set (i.e. before you change
>it, as it comes from super). I think you'll see right away that you've made
>an unwarranted and incorrect assumption.
I don't quite follow you ? Before sending my original post, I analized this
problem with the debugger ( I redid that after your last post, to be sure)
and it seems that everything goes as planned during the compilation phase.
To quote the debugger :
(gdb) po parsty (*just before the line [parsty setAlignment:
NSCenterTextAlignment] gets called*)
Alignment 4, LineSpacing 0, ParagraphSpacing 0, ParagraphSpacingBefore 0,
HeadIndent 0, TailIndent 0, FirstLineHeadIndent 0, LineHeight 0/0,
LineHeightMultiple 0, LineBreakMode 0, Tabs (288C, 576R),
DefaultTabInterval 0, Blocks (null), Lists (null), BaseWritingDirection
-1, HyphenationFactor 0, TighteningFactor 0.05, HeaderLevel 0
(gdb) po parsty (* just after that line has been executed *)
Alignment 2, LineSpacing 0, ParagraphSpacing 0, ParagraphSpacingBefore 0,
HeadIndent 0, TailIndent 0, FirstLineHeadIndent 0, LineHeight 0/0,
LineHeightMultiple 0, LineBreakMode 0, Tabs (288C, 576R),
DefaultTabInterval 0, Blocks (null), Lists (null), BaseWritingDirection
-1, HyphenationFactor 0, TighteningFactor 0.05, HeaderLevel 0
All I understand here is that the Alignement parameter has been
modified in parsty, exactly as I wanted.
What am I supposed to ``see right away" here ? Is there some parameter
that should be nonzero ?
Ewan
> On or about 7/19/06 2:14 AM, thus spake "<email_removed>"
>>
>> -(NSAttributedString*) pageFooter
>> {
>> NSAttributedString* oldFooter;
>> NSMutableAttributedString* newFooter;
>> unsigned footerLength;
>> NSRange range;
>> NSDictionary* attributes;
>> NSMutableParagraphStyle* parsty;
>>
>> oldFooter=[super pageFooter];
>> footerLength=[oldFooter length];
>> range.location=0;
>> range.length=footerLength;
>> attributes=[oldFooter
>> attributesAtIndex: 0
>> longestEffectiveRange: NULL
>> inRange: range];
>> parsty=[attributes objectForKey : NSParagraphStyleAttributeName];
>> [parsty setAlignment: NSCenterTextAlignment];
>> newFooter=
>> [[NSMutableAttributedString alloc]
>> initWithAttributedString: oldFooter];
>> [newFooter
>> addAttribute: NSParagraphStyleAttributeName
>> value: parsty
>> range: range];
>> return newFooter;
>> }
DATE : Wed Jul 19 19:50:34 2006
>Put an NSLog on your "parsty" as soon as it is set (i.e. before you change
>it, as it comes from super). I think you'll see right away that you've made
>an unwarranted and incorrect assumption.
I don't quite follow you ? Before sending my original post, I analized this
problem with the debugger ( I redid that after your last post, to be sure)
and it seems that everything goes as planned during the compilation phase.
To quote the debugger :
(gdb) po parsty (*just before the line [parsty setAlignment:
NSCenterTextAlignment] gets called*)
Alignment 4, LineSpacing 0, ParagraphSpacing 0, ParagraphSpacingBefore 0,
HeadIndent 0, TailIndent 0, FirstLineHeadIndent 0, LineHeight 0/0,
LineHeightMultiple 0, LineBreakMode 0, Tabs (288C, 576R),
DefaultTabInterval 0, Blocks (null), Lists (null), BaseWritingDirection
-1, HyphenationFactor 0, TighteningFactor 0.05, HeaderLevel 0
(gdb) po parsty (* just after that line has been executed *)
Alignment 2, LineSpacing 0, ParagraphSpacing 0, ParagraphSpacingBefore 0,
HeadIndent 0, TailIndent 0, FirstLineHeadIndent 0, LineHeight 0/0,
LineHeightMultiple 0, LineBreakMode 0, Tabs (288C, 576R),
DefaultTabInterval 0, Blocks (null), Lists (null), BaseWritingDirection
-1, HyphenationFactor 0, TighteningFactor 0.05, HeaderLevel 0
All I understand here is that the Alignement parameter has been
modified in parsty, exactly as I wanted.
What am I supposed to ``see right away" here ? Is there some parameter
that should be nonzero ?
Ewan
> On or about 7/19/06 2:14 AM, thus spake "<email_removed>"
>>
>> -(NSAttributedString*) pageFooter
>> {
>> NSAttributedString* oldFooter;
>> NSMutableAttributedString* newFooter;
>> unsigned footerLength;
>> NSRange range;
>> NSDictionary* attributes;
>> NSMutableParagraphStyle* parsty;
>>
>> oldFooter=[super pageFooter];
>> footerLength=[oldFooter length];
>> range.location=0;
>> range.length=footerLength;
>> attributes=[oldFooter
>> attributesAtIndex: 0
>> longestEffectiveRange: NULL
>> inRange: range];
>> parsty=[attributes objectForKey : NSParagraphStyleAttributeName];
>> [parsty setAlignment: NSCenterTextAlignment];
>> newFooter=
>> [[NSMutableAttributedString alloc]
>> initWithAttributedString: oldFooter];
>> [newFooter
>> addAttribute: NSParagraphStyleAttributeName
>> value: parsty
>> range: range];
>> return newFooter;
>> }
| Related mails | Author | Date |
|---|---|---|
| delanoy | Jul 18, 19:54 | |
| Matt Neuburg | Jul 18, 21:13 | |
| delanoy | Jul 19, 11:14 | |
| delanoy | Jul 19, 19:50 | |
| Matt Neuburg | Jul 19, 20:19 | |
| Michael Tsai | Jul 19, 20:29 | |
| Matt Neuburg | Jul 19, 21:25 | |
| delanoy | Jul 20, 09:17 |






Cocoa mail archive

