Revision: 2894
          http://skim-app.svn.sourceforge.net/skim-app/?rev=2894&view=rev
Author:   hofman
Date:     2007-09-11 06:19:36 -0700 (Tue, 11 Sep 2007)

Log Message:
-----------
Separate contents and text of Note annotation by double-space rather than a 
newline for FDF export, as newlines are removed by SKPDFDocument.

Modified Paths:
--------------
    trunk/SKFDFParser.m
    trunk/SKPDFAnnotationNote.m

Modified: trunk/SKFDFParser.m
===================================================================
--- trunk/SKFDFParser.m 2007-09-11 11:46:23 UTC (rev 2893)
+++ trunk/SKFDFParser.m 2007-09-11 13:19:36 UTC (rev 2894)
@@ -315,12 +315,14 @@
     if ([type isEqualToString:@"Text"]) {
         [dictionary setObject:@"Note" forKey:@"type"];
         if (contents = [dictionary objectForKey:@"contents"]) {
-            unsigned contentsEnd, end;
-            [contents getLineStart:NULL end:&end contentsEnd:&contentsEnd 
forRange:NSMakeRange(0, 0)];
-            if (contentsEnd < end) {
-                [dictionary setObject:[contents substringToIndex:contentsEnd] 
forKey:@"contents"];
-                if (end < [contents length])
-                    [dictionary setObject:[[[NSAttributedString alloc] 
initWithString:[contents substringFromIndex:end]] autorelease] forKey:@"text"];
+            NSRange r = [contents rangeOfString:@"  "];
+            if (NSMaxRange(r) < [contents length]) {
+                NSFont *font = [NSFont fontWithName:[[NSUserDefaults 
standardUserDefaults] stringForKey:SKAnchoredNoteFontNameKey]
+                                               size:[[NSUserDefaults 
standardUserDefaults] floatForKey:SKAnchoredNoteFontSizeKey]];
+                NSAttributedString *attrString = [[[NSAttributedString alloc] 
initWithString:[contents substringFromIndex:NSMaxRange(r)]
+                                                    attributes:[NSDictionary 
dictionaryWithObjectsAndKeys:font, NSFontAttributeName, nil]] autorelease];
+                [dictionary setObject:attrString forKey:@"text"];
+                [dictionary setObject:[contents substringToIndex:r.location] 
forKey:@"contents"];
             }
         }
     } else if ([validTypes containsObject:type] == NO) {

Modified: trunk/SKPDFAnnotationNote.m
===================================================================
--- trunk/SKPDFAnnotationNote.m 2007-09-11 11:46:23 UTC (rev 2893)
+++ trunk/SKPDFAnnotationNote.m 2007-09-11 13:19:36 UTC (rev 2894)
@@ -263,8 +263,8 @@
     }
     [string appendString:@"/Contents("];
     [string appendString:contents ? [contents stringByEscapingParenthesis] : 
@""];
-    if ([self text]) {
-        [string appendString:@"\n"];
+    if ([[self text] length]) {
+        [string appendString:@"  "];
         [string appendString:[[[self text] string] 
stringByEscapingParenthesis]];
     }
     [string appendString:@")"];


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to