Revision: 2887
http://skim-app.svn.sourceforge.net/skim-app/?rev=2887&view=rev
Author: hofman
Date: 2007-09-10 16:33:39 -0700 (Mon, 10 Sep 2007)
Log Message:
-----------
QuadPoints in FDF files seem to be relative to the page rather than relative to
the bounds of the annotation, so we need to correct for that.
Modified Paths:
--------------
trunk/SKFDFParser.m
trunk/SKPDFAnnotationNote.m
Modified: trunk/SKFDFParser.m
===================================================================
--- trunk/SKFDFParser.m 2007-09-10 23:15:23 UTC (rev 2886)
+++ trunk/SKFDFParser.m 2007-09-10 23:33:39 UTC (rev 2887)
@@ -40,6 +40,7 @@
#import <Quartz/Quartz.h>
#import "NSScanner_SKExtensions.h"
#import "NSCharacterSet_SKExtensions.h"
+#import "NSGeometry_SKExtensions.h"
#import "SKStringConstants.h"
@@ -111,6 +112,7 @@
CGPDFReal real;
CGPDFInteger integer;
BOOL success = YES;
+ NSRect bounds = NSZeroRect;
if (CGPDFDictionaryGetName(annot, "Type", &name) == NO || strcmp(name,
"Annot") != 0) {
success = NO;
@@ -125,7 +127,8 @@
if (CGPDFDictionaryGetArray(annot, "Rect", &array)) {
CGPDFReal l, b, r, t;
if (CGPDFArrayGetCount(array) == 4 && CGPDFArrayGetNumber(array, 0,
&l) && CGPDFArrayGetNumber(array, 1, &b) && CGPDFArrayGetNumber(array, 2, &r)
&& CGPDFArrayGetNumber(array, 3, &t)) {
- [dictionary setObject:NSStringFromRect(NSMakeRect(l, b, r - l, t -
b)) forKey:@"bounds"];
+ bounds = NSMakeRect(l, b, r - l, t - b);
+ [dictionary setObject:NSStringFromRect(bounds) forKey:@"bounds"];
}
} else {
success = NO;
@@ -271,7 +274,7 @@
for (i = 0; i < count; i++) {
NSPoint point;
if (CGPDFArrayGetNumber(array, i, &point.x) &&
CGPDFArrayGetNumber(array, ++i, &point.y))
- [quadPoints addObject:NSStringFromPoint(point)];
+ [quadPoints
addObject:NSStringFromPoint(SKSubstractPoints(point, bounds.origin))];
}
[dictionary setObject:quadPoints forKey:@"quadrilateralPoints"];
}
Modified: trunk/SKPDFAnnotationNote.m
===================================================================
--- trunk/SKPDFAnnotationNote.m 2007-09-10 23:15:23 UTC (rev 2886)
+++ trunk/SKPDFAnnotationNote.m 2007-09-10 23:33:39 UTC (rev 2887)
@@ -980,10 +980,11 @@
NSEnumerator *pointEnum = [[self quadrilateralPoints] objectEnumerator];
NSValue *value;
NSPoint point;
+ NSRect bounds = [self bounds];
[string appendString:@"/QuadPoints["];
while (value = [pointEnum nextObject]) {
point = [value pointValue];
- [string appendFormat:@"%f %f ", point.x, point.y];
+ [string appendFormat:@"%f %f ", point.x + NSMinX(bounds), point.y +
NSMinY(bounds)];
}
[string appendString:@"]"];
return string;
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