diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..241bda6 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.svn +.DS_Store \ No newline at end of file diff --git a/FontReplacer Demo.xcodeproj/project.pbxproj b/FontReplacer Demo.xcodeproj/project.pbxproj index f69b126..1042f4f 100644 --- a/FontReplacer Demo.xcodeproj/project.pbxproj +++ b/FontReplacer Demo.xcodeproj/project.pbxproj @@ -10,6 +10,16 @@ 6FB0365D14BFFEC900626500 /* AdjustmentViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6FB0365C14BFFEC900626500 /* AdjustmentViewController.m */; }; 6FB0366014BFFEF500626500 /* AdjustmentViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6FB0365F14BFFEF500626500 /* AdjustmentViewController.xib */; }; 6FB0366414C0030200626500 /* OBSlider.m in Sources */ = {isa = PBXBuildFile; fileRef = 6FB0366314C0030200626500 /* OBSlider.m */; }; + C394CE3D16F074440008BDEF /* img_grid_cell_white.png in Resources */ = {isa = PBXBuildFile; fileRef = C394CE3B16F074440008BDEF /* img_grid_cell_white.png */; }; + C394CE3E16F074440008BDEF /* img_grid_cell_white@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = C394CE3C16F074440008BDEF /* img_grid_cell_white@2x.png */; }; + C394CE4116F093D00008BDEF /* UIImage+Replacement.m in Sources */ = {isa = PBXBuildFile; fileRef = C394CE4016F093D00008BDEF /* UIImage+Replacement.m */; }; + C394CE4216F093D00008BDEF /* UIImage+Replacement.m in Sources */ = {isa = PBXBuildFile; fileRef = C394CE4016F093D00008BDEF /* UIImage+Replacement.m */; }; + C394CE4916F09FE60008BDEF /* UIColor+Replacement.m in Sources */ = {isa = PBXBuildFile; fileRef = C394CE4816F09FE60008BDEF /* UIColor+Replacement.m */; }; + C394CE4A16F09FE60008BDEF /* UIColor+Replacement.m in Sources */ = {isa = PBXBuildFile; fileRef = C394CE4816F09FE60008BDEF /* UIColor+Replacement.m */; }; + C394CE4D16F0AA1D0008BDEF /* img_grid_cell_pattern.png in Resources */ = {isa = PBXBuildFile; fileRef = C394CE4B16F0AA1D0008BDEF /* img_grid_cell_pattern.png */; }; + C394CE4E16F0AA1D0008BDEF /* img_grid_cell_pattern@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = C394CE4C16F0AA1D0008BDEF /* img_grid_cell_pattern@2x.png */; }; + C3FFA0FC16E90838003A6F1C /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DA98620013F01BCE006DEC9A /* Foundation.framework */; }; + C3FFA10716E9084C003A6F1C /* UIFont+Replacement.m in Sources */ = {isa = PBXBuildFile; fileRef = DA98621B13F01E63006DEC9A /* UIFont+Replacement.m */; }; DA336B6B13F01F5D00A60EA6 /* DemoViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = DA336B6A13F01F5D00A60EA6 /* DemoViewController.xib */; }; DA4C182113F446120015A600 /* FontsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = DA4C181F13F446110015A600 /* FontsViewController.m */; }; DA6C855713F02703007060AF /* CaviarDreams.ttf in Resources */ = {isa = PBXBuildFile; fileRef = DA6C855213F02703007060AF /* CaviarDreams.ttf */; }; @@ -24,12 +34,33 @@ DA98621C13F01E63006DEC9A /* UIFont+Replacement.m in Sources */ = {isa = PBXBuildFile; fileRef = DA98621B13F01E63006DEC9A /* UIFont+Replacement.m */; }; /* End PBXBuildFile section */ +/* Begin PBXCopyFilesBuildPhase section */ + C3FFA0F916E90838003A6F1C /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = "include/${PRODUCT_NAME}"; + dstSubfolderSpec = 16; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + /* Begin PBXFileReference section */ 6FB0365B14BFFEC900626500 /* AdjustmentViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AdjustmentViewController.h; sourceTree = ""; }; 6FB0365C14BFFEC900626500 /* AdjustmentViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AdjustmentViewController.m; sourceTree = ""; }; 6FB0365F14BFFEF500626500 /* AdjustmentViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = AdjustmentViewController.xib; sourceTree = ""; }; 6FB0366214C0030200626500 /* OBSlider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OBSlider.h; sourceTree = ""; }; 6FB0366314C0030200626500 /* OBSlider.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OBSlider.m; sourceTree = ""; }; + C394CE3B16F074440008BDEF /* img_grid_cell_white.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = img_grid_cell_white.png; sourceTree = ""; }; + C394CE3C16F074440008BDEF /* img_grid_cell_white@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "img_grid_cell_white@2x.png"; sourceTree = ""; }; + C394CE3F16F093D00008BDEF /* UIImage+Replacement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "UIImage+Replacement.h"; path = "UIImageNibPlaceholder+Replacement/UIImage+Replacement.h"; sourceTree = SOURCE_ROOT; }; + C394CE4016F093D00008BDEF /* UIImage+Replacement.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "UIImage+Replacement.m"; path = "UIImageNibPlaceholder+Replacement/UIImage+Replacement.m"; sourceTree = SOURCE_ROOT; }; + C394CE4716F09FE60008BDEF /* UIColor+Replacement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIColor+Replacement.h"; sourceTree = ""; }; + C394CE4816F09FE60008BDEF /* UIColor+Replacement.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIColor+Replacement.m"; sourceTree = ""; }; + C394CE4B16F0AA1D0008BDEF /* img_grid_cell_pattern.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = img_grid_cell_pattern.png; sourceTree = ""; }; + C394CE4C16F0AA1D0008BDEF /* img_grid_cell_pattern@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "img_grid_cell_pattern@2x.png"; sourceTree = ""; }; + C3FFA0FB16E90838003A6F1C /* libFontReplacer.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libFontReplacer.a; sourceTree = BUILT_PRODUCTS_DIR; }; DA336B6A13F01F5D00A60EA6 /* DemoViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = DemoViewController.xib; sourceTree = ""; }; DA4C181E13F446110015A600 /* FontsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FontsViewController.h; sourceTree = ""; }; DA4C181F13F446110015A600 /* FontsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FontsViewController.m; sourceTree = ""; }; @@ -51,6 +82,14 @@ /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ + C3FFA0F816E90838003A6F1C /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + C3FFA0FC16E90838003A6F1C /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; DA9861F713F01BCE006DEC9A /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -73,6 +112,35 @@ path = "FontReplacer Demo/OBSlider"; sourceTree = ""; }; + C394CE3A16F074440008BDEF /* Images */ = { + isa = PBXGroup; + children = ( + C394CE4B16F0AA1D0008BDEF /* img_grid_cell_pattern.png */, + C394CE4C16F0AA1D0008BDEF /* img_grid_cell_pattern@2x.png */, + C394CE3B16F074440008BDEF /* img_grid_cell_white.png */, + C394CE3C16F074440008BDEF /* img_grid_cell_white@2x.png */, + ); + path = Images; + sourceTree = ""; + }; + C394CE4316F094000008BDEF /* UIImageNibPlaceholder+Replacement */ = { + isa = PBXGroup; + children = ( + C394CE3F16F093D00008BDEF /* UIImage+Replacement.h */, + C394CE4016F093D00008BDEF /* UIImage+Replacement.m */, + ); + name = "UIImageNibPlaceholder+Replacement"; + sourceTree = ""; + }; + C394CE4616F09FE60008BDEF /* UIColor+Replacement */ = { + isa = PBXGroup; + children = ( + C394CE4716F09FE60008BDEF /* UIColor+Replacement.h */, + C394CE4816F09FE60008BDEF /* UIColor+Replacement.m */, + ); + path = "UIColor+Replacement"; + sourceTree = ""; + }; DA6C855113F02703007060AF /* CaviarDreams */ = { isa = PBXGroup; children = ( @@ -89,6 +157,8 @@ children = ( 6FB0366114C0030200626500 /* OBSlider */, DA98621913F01E55006DEC9A /* UIFont+Replacement */, + C394CE4316F094000008BDEF /* UIImageNibPlaceholder+Replacement */, + C394CE4616F09FE60008BDEF /* UIColor+Replacement */, DA98620213F01BCE006DEC9A /* FontReplacer Demo */, DA9861FD13F01BCE006DEC9A /* Frameworks */, DA9861FB13F01BCE006DEC9A /* Products */, @@ -100,6 +170,7 @@ isa = PBXGroup; children = ( DA9861FA13F01BCE006DEC9A /* FontReplacer Demo.app */, + C3FFA0FB16E90838003A6F1C /* libFontReplacer.a */, ); name = Products; sourceTree = ""; @@ -125,6 +196,7 @@ DA4C181E13F446110015A600 /* FontsViewController.h */, DA4C181F13F446110015A600 /* FontsViewController.m */, DA6C855113F02703007060AF /* CaviarDreams */, + C394CE3A16F074440008BDEF /* Images */, DA98620313F01BCE006DEC9A /* Supporting Files */, ); path = "FontReplacer Demo"; @@ -153,6 +225,23 @@ /* End PBXGroup section */ /* Begin PBXNativeTarget section */ + C3FFA0FA16E90838003A6F1C /* FontReplacer */ = { + isa = PBXNativeTarget; + buildConfigurationList = C3FFA10416E90838003A6F1C /* Build configuration list for PBXNativeTarget "FontReplacer" */; + buildPhases = ( + C3FFA0F716E90838003A6F1C /* Sources */, + C3FFA0F816E90838003A6F1C /* Frameworks */, + C3FFA0F916E90838003A6F1C /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = FontReplacer; + productName = FontReplacer; + productReference = C3FFA0FB16E90838003A6F1C /* libFontReplacer.a */; + productType = "com.apple.product-type.library.static"; + }; DA9861F913F01BCE006DEC9A /* FontReplacer Demo */ = { isa = PBXNativeTarget; buildConfigurationList = DA98621613F01BCE006DEC9A /* Build configuration list for PBXNativeTarget "FontReplacer Demo" */; @@ -192,6 +281,7 @@ projectRoot = ""; targets = ( DA9861F913F01BCE006DEC9A /* FontReplacer Demo */, + C3FFA0FA16E90838003A6F1C /* FontReplacer */, ); }; /* End PBXProject section */ @@ -208,12 +298,26 @@ DA6C855A13F02703007060AF /* CaviarDreams_Italic.ttf in Resources */, DA6C856513F035EA007060AF /* Icon@2x.png in Resources */, 6FB0366014BFFEF500626500 /* AdjustmentViewController.xib in Resources */, + C394CE3D16F074440008BDEF /* img_grid_cell_white.png in Resources */, + C394CE3E16F074440008BDEF /* img_grid_cell_white@2x.png in Resources */, + C394CE4D16F0AA1D0008BDEF /* img_grid_cell_pattern.png in Resources */, + C394CE4E16F0AA1D0008BDEF /* img_grid_cell_pattern@2x.png in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ + C3FFA0F716E90838003A6F1C /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + C3FFA10716E9084C003A6F1C /* UIFont+Replacement.m in Sources */, + C394CE4216F093D00008BDEF /* UIImage+Replacement.m in Sources */, + C394CE4A16F09FE60008BDEF /* UIColor+Replacement.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; DA9861F613F01BCE006DEC9A /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -224,12 +328,55 @@ DA4C182113F446120015A600 /* FontsViewController.m in Sources */, 6FB0365D14BFFEC900626500 /* AdjustmentViewController.m in Sources */, 6FB0366414C0030200626500 /* OBSlider.m in Sources */, + C394CE4116F093D00008BDEF /* UIImage+Replacement.m in Sources */, + C394CE4916F09FE60008BDEF /* UIColor+Replacement.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin XCBuildConfiguration section */ + C3FFA10516E90838003A6F1C /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + DSTROOT = /tmp/FontReplacer.dst; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + IPHONEOS_DEPLOYMENT_TARGET = 6.1; + ONLY_ACTIVE_ARCH = NO; + OTHER_LDFLAGS = "-ObjC"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + }; + name = Debug; + }; + C3FFA10616E90838003A6F1C /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + DSTROOT = /tmp/FontReplacer.dst; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + IPHONEOS_DEPLOYMENT_TARGET = 6.1; + OTHER_LDFLAGS = "-ObjC"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + }; + name = Release; + }; DA98621413F01BCE006DEC9A /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -298,6 +445,15 @@ /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ + C3FFA10416E90838003A6F1C /* Build configuration list for PBXNativeTarget "FontReplacer" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + C3FFA10516E90838003A6F1C /* Debug */, + C3FFA10616E90838003A6F1C /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; DA9861F413F01BCD006DEC9A /* Build configuration list for PBXProject "FontReplacer Demo" */ = { isa = XCConfigurationList; buildConfigurations = ( diff --git a/FontReplacer Demo.xcodeproj/project.xcworkspace/xcuserdata/bransnw6.xcuserdatad/UserInterfaceState.xcuserstate b/FontReplacer Demo.xcodeproj/project.xcworkspace/xcuserdata/bransnw6.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..848a8fc Binary files /dev/null and b/FontReplacer Demo.xcodeproj/project.xcworkspace/xcuserdata/bransnw6.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/FontReplacer Demo.xcodeproj/xcuserdata/bransnw6.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist b/FontReplacer Demo.xcodeproj/xcuserdata/bransnw6.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist new file mode 100644 index 0000000..c18c67a --- /dev/null +++ b/FontReplacer Demo.xcodeproj/xcuserdata/bransnw6.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist @@ -0,0 +1,20 @@ + + + + + + + diff --git a/FontReplacer Demo.xcodeproj/xcuserdata/bransnw6.xcuserdatad/xcschemes/FontReplacer Demo.xcscheme b/FontReplacer Demo.xcodeproj/xcuserdata/bransnw6.xcuserdatad/xcschemes/FontReplacer Demo.xcscheme new file mode 100644 index 0000000..5f34725 --- /dev/null +++ b/FontReplacer Demo.xcodeproj/xcuserdata/bransnw6.xcuserdatad/xcschemes/FontReplacer Demo.xcscheme @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/FontReplacer Demo.xcodeproj/xcuserdata/bransnw6.xcuserdatad/xcschemes/FontReplacer.xcscheme b/FontReplacer Demo.xcodeproj/xcuserdata/bransnw6.xcuserdatad/xcschemes/FontReplacer.xcscheme new file mode 100644 index 0000000..bebacb7 --- /dev/null +++ b/FontReplacer Demo.xcodeproj/xcuserdata/bransnw6.xcuserdatad/xcschemes/FontReplacer.xcscheme @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/FontReplacer Demo.xcodeproj/xcuserdata/bransnw6.xcuserdatad/xcschemes/xcschememanagement.plist b/FontReplacer Demo.xcodeproj/xcuserdata/bransnw6.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..e9a85ea --- /dev/null +++ b/FontReplacer Demo.xcodeproj/xcuserdata/bransnw6.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,42 @@ + + + + + SchemeUserState + + FontReplacer Demo.xcscheme + + orderHint + 0 + + FontReplacer.xcscheme + + orderHint + 1 + + + SuppressBuildableAutocreation + + C35996AB16E8FDC90082110C + + primary + + + C3FFA0E816E902E6003A6F1C + + primary + + + C3FFA0FA16E90838003A6F1C + + primary + + + DA9861F913F01BCE006DEC9A + + primary + + + + + diff --git a/FontReplacer Demo/DemoViewController.xib b/FontReplacer Demo/DemoViewController.xib index 92ace5a..c02f62b 100644 --- a/FontReplacer Demo/DemoViewController.xib +++ b/FontReplacer Demo/DemoViewController.xib @@ -1,20 +1,21 @@ - 1280 - 10K549 - 1910 - 1038.36 - 461.00 + 1552 + 12C2034 + 3084 + 1187.34 + 625.00 com.apple.InterfaceBuilder.IBCocoaTouchPlugin - 911 + 2083 YES IBProxyObject - IBUIView + IBUIImageView IBUILabel + IBUIView YES @@ -44,7 +45,6 @@ 292 {{20, 20}, {280, 60}} - NO YES @@ -55,6 +55,7 @@ 1 MCAwIDAAA + darkTextColor 1 @@ -69,13 +70,13 @@ 14 16 + 280 292 {{20, 112}, {280, 22}} - NO YES @@ -105,7 +106,6 @@ 292 {{20, 149}, {280, 22}} - NO YES @@ -135,7 +135,6 @@ 292 {{20, 186}, {280, 22}} - NO YES @@ -165,8 +164,7 @@ 292 {{20, 223}, {280, 22}} - - + NO YES 7 @@ -190,17 +188,28 @@ 16 + + + 256 + {{103, 288}, {114, 114}} + + + NO + YES + YES + IBCocoaTouchFramework + + NSImage + img_grid_cell_white.png + + {{0, 20}, {320, 460}} - - 3 - MC43NQA - - 2 - + 1 + MC41ODgyMzUyOTQxIDAuNTg4MjM1Mjk0MSAwLjU4ODIzNTI5NDEAA NO @@ -251,6 +260,7 @@ + @@ -279,6 +289,11 @@ + + 13 + + + @@ -292,11 +307,12 @@ 10.IBPluginDependency 11.IBPluginDependency 12.IBPluginDependency + 13.IBPluginDependency 6.IBPluginDependency 8.IBPluginDependency 9.IBPluginDependency - + YES ViewController com.apple.InterfaceBuilder.IBCocoaTouchPlugin @@ -308,6 +324,7 @@ com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin @@ -322,7 +339,7 @@ - 12 + 13 0 @@ -333,6 +350,10 @@ YES 3 - 911 + + img_grid_cell_white.png + {2, 2} + + 2083 diff --git a/FontReplacer Demo/FontReplacer Demo-Info.plist b/FontReplacer Demo/FontReplacer Demo-Info.plist index 4f4116a..757a360 100644 --- a/FontReplacer Demo/FontReplacer Demo-Info.plist +++ b/FontReplacer Demo/FontReplacer Demo-Info.plist @@ -28,10 +28,15 @@ ReplacementFonts - ArialMT + Arial-BoldItalicMT Name - CaviarDreams + CaviarDreams-BoldItalic + + Arial-BoldMT + + Name + CaviarDreams-Bold Arial-ItalicMT @@ -40,19 +45,33 @@ Offset 0.3 - Arial-BoldMT + ArialMT Name - CaviarDreams-Bold + CaviarDreams - Arial-BoldItalicMT + + ReplacementImages + + img_grid_cell_white.png - Name - CaviarDreams-BoldItalic + Insets + {0.0,0.0,1.0,1.0} + Tile + + + + ReplacementColors + + {150,150,150} + + Image + img_grid_cell_pattern.png UIAppFonts + Interstate-Bold.otf CaviarDreams.ttf CaviarDreams_Italic.ttf CaviarDreams_Bold.ttf diff --git a/FontReplacer Demo/Images/img_grid_cell_pattern.png b/FontReplacer Demo/Images/img_grid_cell_pattern.png new file mode 100644 index 0000000..09d440f Binary files /dev/null and b/FontReplacer Demo/Images/img_grid_cell_pattern.png differ diff --git a/FontReplacer Demo/Images/img_grid_cell_pattern@2x.png b/FontReplacer Demo/Images/img_grid_cell_pattern@2x.png new file mode 100644 index 0000000..8614bf3 Binary files /dev/null and b/FontReplacer Demo/Images/img_grid_cell_pattern@2x.png differ diff --git a/FontReplacer Demo/Images/img_grid_cell_white.png b/FontReplacer Demo/Images/img_grid_cell_white.png new file mode 100644 index 0000000..d2f2026 Binary files /dev/null and b/FontReplacer Demo/Images/img_grid_cell_white.png differ diff --git a/FontReplacer Demo/Images/img_grid_cell_white@2x.png b/FontReplacer Demo/Images/img_grid_cell_white@2x.png new file mode 100644 index 0000000..44e3987 Binary files /dev/null and b/FontReplacer Demo/Images/img_grid_cell_white@2x.png differ diff --git a/UIColor+Replacement/UIColor+Replacement.h b/UIColor+Replacement/UIColor+Replacement.h new file mode 100644 index 0000000..69d61f3 --- /dev/null +++ b/UIColor+Replacement/UIColor+Replacement.h @@ -0,0 +1,13 @@ +// +// UIImageNibPlaceholder+Replacement.h +// FontReplacer Demo +// +// Created by Nick Bransby-Williams on 13/03/2013. +// +// + +#import + +@interface UIColor (Replacement) + +@end diff --git a/UIColor+Replacement/UIColor+Replacement.m b/UIColor+Replacement/UIColor+Replacement.m new file mode 100644 index 0000000..7518748 --- /dev/null +++ b/UIColor+Replacement/UIColor+Replacement.m @@ -0,0 +1,93 @@ +// +// UIColor+Replacement.m +// FontReplacer Demo +// +// Created by Nick Bransby-Williams on 13/03/2013. +// +// + +#import "UIColor+Replacement.h" +#import + +@implementation UIColor (Replacement) + +static NSDictionary *replacementDictionary = nil; + +static void initializeReplacementColors() +{ + static BOOL initialized = NO; + if (initialized) + return; + initialized = YES; + + NSDictionary *replacementDictionary = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"ReplacementColors"]; + NSLog(@"ReplacementColors = %@", replacementDictionary); + [UIColor setReplacementDictionary:replacementDictionary]; +} + ++ (void) load +{ + Method initWithRedGreenBlueAlpha = class_getInstanceMethod([UIColor class], @selector(initWithRed:green:blue:alpha:)); + Method replacementInitWithRedGreenBlueAlpha = class_getInstanceMethod([UIColor class], @selector(replacement_initWithRed:green:blue:alpha:)); + + if (initWithRedGreenBlueAlpha && replacementInitWithRedGreenBlueAlpha && strcmp(method_getTypeEncoding(initWithRedGreenBlueAlpha), method_getTypeEncoding(replacementInitWithRedGreenBlueAlpha)) == 0) + method_exchangeImplementations(initWithRedGreenBlueAlpha, replacementInitWithRedGreenBlueAlpha); +} + +- (UIColor *)replacementColorForString:(NSString*)string +{ + NSDictionary* info = [replacementDictionary objectForKey:string]; + NSLog(@"Found replacement color %@ for %@", info, string); + if (!replacementDictionary) + return nil; + return [[UIColor colorWithPatternImage:[UIImage imageNamed:[info objectForKey:@"Image"]]] retain]; +} + + +- (UIColor *)replacement_initWithRed:(CGFloat)red green:(CGFloat)green blue:(CGFloat)blue alpha:(CGFloat)alpha +{ + initializeReplacementColors(); + NSString* string = [NSString stringWithFormat:@"{%d,%d,%d}", (int)ceilf(red*255), (int)ceilf(green*255), (int)ceilf(blue*255)]; + return [self replacementColorForString:string] ?: [self replacement_initWithRed:red green:green blue:blue alpha:alpha]; +} + ++ (NSDictionary *) replacementDictionary +{ + return replacementDictionary; +} + ++ (void) setReplacementDictionary:(NSDictionary *)aReplacementDictionary +{ + if (aReplacementDictionary == replacementDictionary) + return; + + for (id key in [aReplacementDictionary allKeys]) + { + if (![key isKindOfClass:[NSString class]]) + { + NSLog(@"ERROR: Replacement color key must be a string."); + return; + } + + NSString *colorName = (NSString *)key; + id value = [aReplacementDictionary valueForKey:colorName]; + if (![value isKindOfClass:[NSDictionary class]]) + { + NSLog(@"ERROR: Replacement color value must be a dictionary."); + return; + } + + NSDictionary *replacementInfo = (NSDictionary *)value; + NSString *replacementImage = [replacementInfo objectForKey:@"Image"]; + if (!replacementImage) + { + NSLog(@"ERROR: Missing image name for color '%@'", colorName); + return; + } + + } + [replacementDictionary release]; + replacementDictionary = [aReplacementDictionary retain]; +} + +@end diff --git a/UIFont+Replacement/UIFont+Replacement.m b/UIFont+Replacement/UIFont+Replacement.m index df96dd4..ad0f401 100644 --- a/UIFont+Replacement/UIFont+Replacement.m +++ b/UIFont+Replacement/UIFont+Replacement.m @@ -22,6 +22,7 @@ static void initializeReplacementFonts() initialized = YES; NSDictionary *replacementDictionary = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"ReplacementFonts"]; + NSLog(@"ReplacementFonts = %@", replacementDictionary); [UIFont setReplacementDictionary:replacementDictionary]; } diff --git a/UIImageNibPlaceholder+Replacement/UIImage+Replacement.h b/UIImageNibPlaceholder+Replacement/UIImage+Replacement.h new file mode 100644 index 0000000..76ea941 --- /dev/null +++ b/UIImageNibPlaceholder+Replacement/UIImage+Replacement.h @@ -0,0 +1,13 @@ +// +// UIImage+Replacement.h +// FontReplacer Demo +// +// Created by Nick Bransby-Williams on 13/03/2013. +// +// + +#import + +@interface UIImage (Replacement) + +@end diff --git a/UIImageNibPlaceholder+Replacement/UIImage+Replacement.m b/UIImageNibPlaceholder+Replacement/UIImage+Replacement.m new file mode 100644 index 0000000..b67b21e --- /dev/null +++ b/UIImageNibPlaceholder+Replacement/UIImage+Replacement.m @@ -0,0 +1,105 @@ +// +// UIImage+Replacement.m +// FontReplacer Demo +// +// Created by Nick Bransby-Williams on 13/03/2013. +// +// + +#import "UIImage+Replacement.h" +#import + +@implementation UIImage (Replacement) + +static NSDictionary *replacementDictionary = nil; + +static void initializeReplacementImages() +{ + static BOOL initialized = NO; + if (initialized) + return; + initialized = YES; + + NSDictionary *replacementDictionary = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"ReplacementImages"]; + NSLog(@"ReplacementImages = %@", replacementDictionary); + [UIImage setReplacementDictionary:replacementDictionary]; +} + ++ (void) load +{ + Class class = NSClassFromString(@"UIImageNibPlaceholder"); + Method initWithCoder = class_getInstanceMethod(class, @selector(initWithCoder:)); + Method replacementInitWithCoder = class_getInstanceMethod(class, @selector(replacement_initWithCoder:)); + + if (initWithCoder && replacementInitWithCoder && strcmp(method_getTypeEncoding(initWithCoder), method_getTypeEncoding(replacementInitWithCoder)) == 0) + method_exchangeImplementations(initWithCoder, replacementInitWithCoder); +} + ++ (NSDictionary *) replacementInfoForImageNamed:(NSString *)imageName +{ + if (!replacementDictionary) + return nil; + + return [replacementDictionary objectForKey:imageName]; +} + ++ (UIEdgeInsets) capInsetsForInfo:(NSDictionary *)info +{ + NSString* string = [info objectForKey:@"Insets"]; + return string ? UIEdgeInsetsFromString(string) : UIEdgeInsetsZero; +} + ++ (UIImageResizingMode) resizingModeForInfo:(NSDictionary *)info +{ + return [info[@"Stretch"] isEqual:@YES] || [info[@"Tile"] isEqual:@NO] ? UIImageResizingModeStretch : UIImageResizingModeTile; +} + +- (id) replacement_initWithCoder:(NSCoder *)coder +{ + initializeReplacementImages(); + UIImage* image = [self replacement_initWithCoder:coder]; + NSString * imageName = [coder decodeObjectForKey:@"UIResourceName"]; + NSDictionary* info = [UIImage replacementInfoForImageNamed:imageName]; + return info == nil ? image : [[image resizableImageWithCapInsets:[UIImage capInsetsForInfo:info] resizingMode:[UIImage resizingModeForInfo:info]] retain]; +} + ++ (NSDictionary *) replacementDictionary +{ + return replacementDictionary; +} + ++ (void) setReplacementDictionary:(NSDictionary *)aReplacementDictionary +{ + if (aReplacementDictionary == replacementDictionary) + return; + + for (id key in [aReplacementDictionary allKeys]) + { + if (![key isKindOfClass:[NSString class]]) + { + NSLog(@"ERROR: Replacement image key must be a string."); + return; + } + + NSString *imageName = (NSString *)key; + id value = [aReplacementDictionary valueForKey:imageName]; + if (![value isKindOfClass:[NSDictionary class]]) + { + NSLog(@"ERROR: Replacement image value must be a dictionary."); + return; + } + + NSDictionary *replacementInfo = (NSDictionary *)value; + NSString *replacementImageInsets = [replacementInfo objectForKey:@"Insets"]; + if (!replacementImageInsets) + { + NSLog(@"ERROR: Missing cap insets name for image '%@'", imageName); + return; + } + + } + [replacementDictionary release]; + replacementDictionary = [aReplacementDictionary retain]; +} + +@end