Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 31 additions & 1 deletion PDFKitten.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@
2CE7BCE713897245009784B9 /* Scanner.m in Sources */ = {isa = PBXBuildFile; fileRef = 2CE7BCE613897245009784B9 /* Scanner.m */; };
2CE7BCEB1389725D009784B9 /* RenderingState.m in Sources */ = {isa = PBXBuildFile; fileRef = 2CE7BCEA1389725D009784B9 /* RenderingState.m */; };
2CE7BCEF13897294009784B9 /* Selection.m in Sources */ = {isa = PBXBuildFile; fileRef = 2CE7BCEE13897294009784B9 /* Selection.m */; };
6F54DFB61B2CD66900AB5626 /* EncodingDifferences.m in Sources */ = {isa = PBXBuildFile; fileRef = 6F54DFB51B2CD66900AB5626 /* EncodingDifferences.m */; };
6F58E2761B218DEB003BEF8A /* PDFConverter.m in Sources */ = {isa = PBXBuildFile; fileRef = 6F58E2751B218DEB003BEF8A /* PDFConverter.m */; };
6F58E2791B21A5B9003BEF8A /* amazon-dynamo-sosp2007.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 6F58E2771B21A5B9003BEF8A /* amazon-dynamo-sosp2007.pdf */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -144,6 +147,11 @@
2CE7BCEA1389725D009784B9 /* RenderingState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RenderingState.m; path = PDFKitten/RenderingState.m; sourceTree = SOURCE_ROOT; };
2CE7BCED13897293009784B9 /* Selection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Selection.h; path = PDFKitten/Selection.h; sourceTree = SOURCE_ROOT; };
2CE7BCEE13897294009784B9 /* Selection.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = Selection.m; path = PDFKitten/Selection.m; sourceTree = SOURCE_ROOT; };
6F54DFB41B2CD66900AB5626 /* EncodingDifferences.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = EncodingDifferences.h; path = PDFKitten/EncodingDifferences.h; sourceTree = SOURCE_ROOT; };
6F54DFB51B2CD66900AB5626 /* EncodingDifferences.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = EncodingDifferences.m; path = PDFKitten/EncodingDifferences.m; sourceTree = SOURCE_ROOT; };
6F58E2741B218DEB003BEF8A /* PDFConverter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PDFConverter.h; sourceTree = "<group>"; };
6F58E2751B218DEB003BEF8A /* PDFConverter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PDFConverter.m; sourceTree = "<group>"; };
6F58E2771B21A5B9003BEF8A /* amazon-dynamo-sosp2007.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; name = "amazon-dynamo-sosp2007.pdf"; path = "PDFKitten/Samples/amazon-dynamo-sosp2007.pdf"; sourceTree = SOURCE_ROOT; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -272,6 +280,7 @@
2CA0FC9A13EEB1430028DCCD /* Resources */ = {
isa = PBXGroup;
children = (
6F58E2771B21A5B9003BEF8A /* amazon-dynamo-sosp2007.pdf */,
2C77F7B31442381300767E6A /* Kurt the Cat.pdf */,
2CDC3F7A138977C0006CC6FB /* InfoPlist.strings */,
2CE7BCAA13896EFB009784B9 /* PDFKitten-Info.plist */,
Expand All @@ -292,6 +301,7 @@
2CA0FCA713EEB32D0028DCCD /* PDF Core */ = {
isa = PBXGroup;
children = (
6F58E2731B218DEB003BEF8A /* Helper */,
2CE7BCE413897225009784B9 /* Scanner */,
2CE7BCBB13897129009784B9 /* Font */,
2CE7BCE81389724B009784B9 /* RenderingState */,
Expand Down Expand Up @@ -348,6 +358,8 @@
2CE7BCBB13897129009784B9 /* Font */ = {
isa = PBXGroup;
children = (
6F54DFB41B2CD66900AB5626 /* EncodingDifferences.h */,
6F54DFB51B2CD66900AB5626 /* EncodingDifferences.m */,
2CE7BCC013897135009784B9 /* CMap.h */,
2CE7BCC113897135009784B9 /* CMap.m */,
2CE7BCC81389713D009784B9 /* Font.h */,
Expand Down Expand Up @@ -402,6 +414,16 @@
name = Selection;
sourceTree = "<group>";
};
6F58E2731B218DEB003BEF8A /* Helper */ = {
isa = PBXGroup;
children = (
6F58E2741B218DEB003BEF8A /* PDFConverter.h */,
6F58E2751B218DEB003BEF8A /* PDFConverter.m */,
);
name = Helper;
path = PDFKitten/Helper;
sourceTree = SOURCE_ROOT;
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
Expand Down Expand Up @@ -439,14 +461,15 @@
name = PDFKittenTests;
productName = PDFKittenTests;
productReference = 2C35AD6E167E02E000BA5F79 /* PDFKittenTests.octest */;
productType = "com.apple.product-type.bundle";
productType = "com.apple.product-type.bundle.ocunit-test";
};
/* End PBXNativeTarget section */

/* Begin PBXProject section */
2C0E159E13589B0B004096C7 /* Project object */ = {
isa = PBXProject;
attributes = {
LastTestingUpgradeCheck = 0630;
LastUpgradeCheck = 0450;
ORGANIZATIONNAME = "Chalmers Göteborg";
};
Expand Down Expand Up @@ -477,6 +500,7 @@
2CDC3F81138977C1006CC6FB /* MainWindow.xib in Resources */,
2CA0FCA613EEB1C00028DCCD /* PageViewController.xib in Resources */,
2C77F7B41442381300767E6A /* Kurt the Cat.pdf in Resources */,
6F58E2791B21A5B9003BEF8A /* amazon-dynamo-sosp2007.pdf in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -512,6 +536,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
6F58E2761B218DEB003BEF8A /* PDFConverter.m in Sources */,
2CE7BC9D13896EF0009784B9 /* PageView.m in Sources */,
2CE7BCAF13896EFB009784B9 /* main.m in Sources */,
2CE7BCB113896EFB009784B9 /* PDFKittenAppDelegate.m in Sources */,
Expand All @@ -532,6 +557,7 @@
2CE7BCEB1389725D009784B9 /* RenderingState.m in Sources */,
2CE7BCEF13897294009784B9 /* Selection.m in Sources */,
2CDC3F65138972E5006CC6FB /* StringDetector.m in Sources */,
6F54DFB61B2CD66900AB5626 /* EncodingDifferences.m in Sources */,
2CA0FC9413EEB11B0028DCCD /* RootViewController.m in Sources */,
2CA0FC9713EEB1210028DCCD /* PDFPage.m in Sources */,
2CA0FCA113EEB1B80028DCCD /* Page.m in Sources */,
Expand Down Expand Up @@ -627,6 +653,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CODE_SIGN_IDENTITY = "iPhone Developer";
COPY_PHASE_STRIP = NO;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
Expand All @@ -647,6 +674,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CODE_SIGN_IDENTITY = "iPhone Developer";
COPY_PHASE_STRIP = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
Expand All @@ -672,6 +700,7 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "iPhone Developer";
COPY_PHASE_STRIP = NO;
FRAMEWORK_SEARCH_PATHS = (
"\"$(SDKROOT)/Developer/Library/Frameworks\"",
Expand Down Expand Up @@ -703,6 +732,7 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "iPhone Developer";
COPY_PHASE_STRIP = YES;
FRAMEWORK_SEARCH_PATHS = (
"\"$(SDKROOT)/Developer/Library/Frameworks\"",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDESourceControlProjectFavoriteDictionaryKey</key>
<false/>
<key>IDESourceControlProjectIdentifier</key>
<string>B0D2DE6B-BC47-463C-8432-CD1C128CFF29</string>
<key>IDESourceControlProjectName</key>
<string>PDFKitten</string>
<key>IDESourceControlProjectOriginsDictionary</key>
<dict>
<key>DD37BB420EBB61E23BECC947958601C145484998</key>
<string>https://github.com/kenneth488/PDFKitten.git</string>
</dict>
<key>IDESourceControlProjectPath</key>
<string>PDFKitten.xcodeproj</string>
<key>IDESourceControlProjectRelativeInstallPathDictionary</key>
<dict>
<key>DD37BB420EBB61E23BECC947958601C145484998</key>
<string>../..</string>
</dict>
<key>IDESourceControlProjectURL</key>
<string>https://github.com/kenneth488/PDFKitten.git</string>
<key>IDESourceControlProjectVersion</key>
<integer>111</integer>
<key>IDESourceControlProjectWCCIdentifier</key>
<string>DD37BB420EBB61E23BECC947958601C145484998</string>
<key>IDESourceControlProjectWCConfigurations</key>
<array>
<dict>
<key>IDESourceControlRepositoryExtensionIdentifierKey</key>
<string>public.vcs.git</string>
<key>IDESourceControlWCCIdentifierKey</key>
<string>DD37BB420EBB61E23BECC947958601C145484998</string>
<key>IDESourceControlWCCName</key>
<string>Kenneth%20Kitten</string>
</dict>
</array>
</dict>
</plist>
2 changes: 1 addition & 1 deletion PDFKitten/CIDFont.m
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ @implementation CIDFont
- (NSString *)stringWithPDFString:(CGPDFStringRef)pdfString
{
unichar *characterIDs = (unichar *) CGPDFStringGetBytePtr(pdfString);
int length = CGPDFStringGetLength(pdfString) / sizeof(unichar);
int length = (int)(CGPDFStringGetLength(pdfString) / sizeof(unichar));
int magicalOffset = ([self isIdentity] ? 0 : 30);
NSMutableString *unicodeString = [NSMutableString string];
for (int i = 0; i < length; i++)
Expand Down
10 changes: 3 additions & 7 deletions PDFKitten/CIDType2Font.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,18 @@ - (id)initWithFontDictionary:(CGPDFDictionaryRef)dict
{
// Type 2 CID font only: set CID/GID mapping
CGPDFObjectRef streamOrName = nil;

if (CGPDFDictionaryGetObject(dict, "CIDToGIDMap", &streamOrName))
{
CGPDFObjectType type = CGPDFObjectGetType(streamOrName);
identity = (type == kCGPDFObjectTypeName);

if (type == kCGPDFObjectTypeStream)
{
CGPDFStreamRef stream = nil;
if (CGPDFObjectGetValue(streamOrName, kCGPDFObjectTypeStream, &stream))
{
cidGidMap = (NSData *) CGPDFStreamCopyData(stream, nil);
cidGidMap = (__bridge NSData *) CGPDFStreamCopyData(stream, nil);
}
}
}
Expand All @@ -34,12 +36,6 @@ - (unichar)gidWithCid:(unsigned char)cid
return (unichar) gid;
}

- (void)dealloc
{
[cidGidMap release];
[super dealloc];
}

- (NSString *)stringWithPDFString:(CGPDFStringRef)pdfString
{
size_t length = CGPDFStringGetLength(pdfString);
Expand Down
34 changes: 13 additions & 21 deletions PDFKitten/CMap.h
Original file line number Diff line number Diff line change
@@ -1,25 +1,15 @@
#import <Foundation/Foundation.h>

extern NSValue *rangeValue(unsigned int from, unsigned int to);

@interface Operator : NSObject
+ (Operator *)operatorWithStart:(NSString *)start end:(NSString *)end handler:(SEL)handler;
@property (retain) NSString *start;
@property (retain) NSString *end;
@property SEL handler;
@end

@interface CMap : NSObject {
NSMutableDictionary *context;

/* CMap ranges */
NSMutableArray *codeSpaceRanges;

/* Character mappings */
NSMutableDictionary *characterMappings;

/* Character range mappings */
NSMutableDictionary *characterRangeMappings;

/* CMap ranges */
NSMutableArray *codeSpaceRanges;

/* Character mappings */
NSMutableDictionary *characterMappings;

/* Character range mappings */
NSMutableDictionary *characterRangeMappings;
}

/* Initialize with PDF stream containing a CMap */
Expand All @@ -29,12 +19,14 @@ extern NSValue *rangeValue(unsigned int from, unsigned int to);
- (id)initWithString:(NSString *)string;

/* Unicode mapping for character ID */
- (unichar)unicodeCharacter:(unichar)cid;
- (NSUInteger)unicodeCharacter:(unichar)cid;

- (unichar)cidCharacter:(unichar)unicode;
- (NSUInteger)cidCharacter:(unichar)unicode;

@property (nonatomic, retain) NSMutableArray *codeSpaceRanges;
@property (nonatomic, retain) NSMutableDictionary *characterMappings;
@property (nonatomic, retain) NSMutableDictionary *characterRangeMappings;

- (void)enumeratePDFStringCharacters:(CGPDFStringRef)pdfString usingBlock:(void (^)(NSUInteger, NSString *))block;

@end
Loading