Permalink
Browse files

Modifications to avoid conflict with DTFoundation

  • Loading branch information...
1 parent cf6a447 commit c54be85db30f1c6c5623ff5388e0396e1a83ee63 @odrobnik odrobnik committed May 28, 2012
@@ -13,7 +13,7 @@
Determines the new zoom only computing if the sizeToFit is smaller than the originalSize. The zoom scale is computed by whichever resizing scale along the X or Y is smaller preserving the aspect ratio by respecting the axis with more room. The new size is then computed by multipliying the originalSize by that zoom scale.
@returns New size that fits the sizeToFit while still preserving the aspect ratio of the originalSize.
*/
-CGSize sizeThatFitsKeepingAspectRatio(CGSize originalSize, CGSize sizeToFit);
+CGSize sizeThatFitsKeepingAspectRatio2(CGSize originalSize, CGSize sizeToFit);
/**
Convenience method to find the center of a CGRect. Uses CGRectGetMidX and CGRectGetMidY.
@@ -75,7 +75,7 @@
// return retPath;
//}
-CGSize sizeThatFitsKeepingAspectRatio(CGSize originalSize, CGSize sizeToFit)
+CGSize sizeThatFitsKeepingAspectRatio2(CGSize originalSize, CGSize sizeToFit)
{
if (originalSize.width <= sizeToFit.width && originalSize.height <= sizeToFit.height)
{
@@ -8,6 +8,7 @@
#import "DTCoreText.h"
#import "DTAttributedTextCell.h"
+#import "DTCSSStylesheet.h"
@implementation DTAttributedTextCell
{
@@ -44,7 +44,7 @@
#import "DTWebVideoView.h"
#import "NSAttributedStringRunDelegates.h"
-#import "UIDevice+DTVersion.h"
+#import "UIDevice+DTSimpleVersion.h"
#import "DTAttributedTextCell.h"
#import "DTAttributedTextContentView.h"
@@ -9,7 +9,7 @@
#import "DTCoreTextFontDescriptor.h"
#if TARGET_OS_IPHONE
-#import "UIDevice+DTVersion.h"
+#import "UIDevice+DTSimpleVersion.h"
#endif
static NSCache *_fontCache = nil;
@@ -68,7 +68,7 @@ + (void)initialize
#if TARGET_OS_IPHONE
// workaround for iOS 5.x bug: global font cascade table has incorrect bold font for Chinese characters in Chinese locale
- DTVersion version = [[UIDevice currentDevice] osVersion];
+ DTSimpleVersion version = [[UIDevice currentDevice] osVersion];
if (version.major>4)
{
@@ -492,7 +492,7 @@ - (void)_buildLinesWithStandardFramesetter
//[self _correctLineOrigins];
// --- begin workaround for image squishing bug in iOS < 4.2
- DTVersion version = [[UIDevice currentDevice] osVersion];
+ DTSimpleVersion version = [[UIDevice currentDevice] osVersion];
if (version.major<4 || (version.major==4 && version.minor < 2))
{
@@ -165,7 +165,7 @@ + (DTTextAttachment *)textAttachmentWithElement:(DTHTMLElement *)element options
{
if (maxImageSize.width < displaySize.width || maxImageSize.height < displaySize.height)
{
- adjustedSize = sizeThatFitsKeepingAspectRatio(displaySize, maxImageSize);
+ adjustedSize = sizeThatFitsKeepingAspectRatio2(displaySize, maxImageSize);
}
// still no display size? use max size
@@ -1,28 +0,0 @@
-//
-// UIDevice+DTVersion.h
-// CoreTextExtensions
-//
-// Created by Oliver Drobnik on 5/30/11.
-// Copyright 2011 Drobnik.com. All rights reserved.
-//
-
-#import <UIKit/UIKit.h>
-
-
-typedef struct
-{
- NSInteger major;
- NSInteger minor;
- NSInteger point;
-} DTVersion;
-
-/** Convenience method to return the current OS version as a struct of three NSIntegers. Using UIDevice's `currentDevice` method and the current device's `systemVersion` returns a string delimited by a period which can then be split into an array. This method returns a struct storing each value instead of a string or array. Used in DTCoreTextLayoutFrame to workaround the way iOS 4.2 handles images.
- */
-@interface UIDevice (DTVersion)
-
-/**
- Returns the current OS version of the device.
- @returns A DTVersion struct with three fields each of type NSInteger storing the major, minor, and point numbers identifying this OS version. */
-- (DTVersion) osVersion;
-
-@end
@@ -1,32 +0,0 @@
-//
-// UIDevice+DTVersion.m
-// CoreTextExtensions
-//
-// Created by Oliver Drobnik on 5/30/11.
-// Copyright 2011 Drobnik.com. All rights reserved.
-//
-
-#import "UIDevice+DTVersion.h"
-
-@implementation UIDevice (DTVersion)
-
-- (DTVersion) osVersion
-{
- static DTVersion retVersion;
-
- static dispatch_once_t onceToken;
- dispatch_once(&onceToken, ^{
- NSString* versionString = [self systemVersion];
- NSArray *parts = [versionString componentsSeparatedByString:@"."];
-
- NSUInteger partCount = [parts count];
-
- retVersion.major = (partCount>0)?[[parts objectAtIndex:0] intValue]:0;
- retVersion.minor = (partCount>1)?[[parts objectAtIndex:1] intValue]:0;
- retVersion.point = (partCount>2)?[[parts objectAtIndex:2] intValue]:0;
- });
-
- return retVersion;
-}
-
-@end
@@ -161,10 +161,10 @@
A788CA0314863E8700E1AFD9 /* DTColor+HTML.h in Headers */ = {isa = PBXBuildFile; fileRef = A788C95214863E8700E1AFD9 /* DTColor+HTML.h */; settings = {ATTRIBUTES = (Public, ); }; };
A788CA0514863E8700E1AFD9 /* DTColor+HTML.m in Sources */ = {isa = PBXBuildFile; fileRef = A788C95314863E8700E1AFD9 /* DTColor+HTML.m */; };
A788CA0614863E8700E1AFD9 /* DTColor+HTML.m in Sources */ = {isa = PBXBuildFile; fileRef = A788C95314863E8700E1AFD9 /* DTColor+HTML.m */; };
- A788CA0C14863E8700E1AFD9 /* UIDevice+DTVersion.h in Headers */ = {isa = PBXBuildFile; fileRef = A788C95614863E8700E1AFD9 /* UIDevice+DTVersion.h */; settings = {ATTRIBUTES = (Public, ); }; };
- A788CA0D14863E8700E1AFD9 /* UIDevice+DTVersion.h in Headers */ = {isa = PBXBuildFile; fileRef = A788C95614863E8700E1AFD9 /* UIDevice+DTVersion.h */; settings = {ATTRIBUTES = (Public, ); }; };
- A788CA0F14863E8700E1AFD9 /* UIDevice+DTVersion.m in Sources */ = {isa = PBXBuildFile; fileRef = A788C95714863E8700E1AFD9 /* UIDevice+DTVersion.m */; };
- A788CA1014863E8700E1AFD9 /* UIDevice+DTVersion.m in Sources */ = {isa = PBXBuildFile; fileRef = A788C95714863E8700E1AFD9 /* UIDevice+DTVersion.m */; };
+ A788CA0C14863E8700E1AFD9 /* UIDevice+DTSimpleVersion.h in Headers */ = {isa = PBXBuildFile; fileRef = A788C95614863E8700E1AFD9 /* UIDevice+DTSimpleVersion.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ A788CA0D14863E8700E1AFD9 /* UIDevice+DTSimpleVersion.h in Headers */ = {isa = PBXBuildFile; fileRef = A788C95614863E8700E1AFD9 /* UIDevice+DTSimpleVersion.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ A788CA0F14863E8700E1AFD9 /* UIDevice+DTSimpleVersion.m in Sources */ = {isa = PBXBuildFile; fileRef = A788C95714863E8700E1AFD9 /* UIDevice+DTSimpleVersion.m */; };
+ A788CA1014863E8700E1AFD9 /* UIDevice+DTSimpleVersion.m in Sources */ = {isa = PBXBuildFile; fileRef = A788C95714863E8700E1AFD9 /* UIDevice+DTSimpleVersion.m */; };
A788CA1814863EC600E1AFD9 /* DTCoreText-Prefix.pch in Headers */ = {isa = PBXBuildFile; fileRef = A788CA1514863EC600E1AFD9 /* DTCoreText-Prefix.pch */; settings = {ATTRIBUTES = (Public, ); }; };
A788CA3A14863EF100E1AFD9 /* Alignment.html in Resources */ = {isa = PBXBuildFile; fileRef = A788CA1B14863EF100E1AFD9 /* Alignment.html */; };
A788CA3B14863EF100E1AFD9 /* APOD.html in Resources */ = {isa = PBXBuildFile; fileRef = A788CA1C14863EF100E1AFD9 /* APOD.html */; };
@@ -225,7 +225,7 @@
A788CAA0148648C700E1AFD9 /* NSScanner+HTML.m in Sources */ = {isa = PBXBuildFile; fileRef = A788C94714863E8700E1AFD9 /* NSScanner+HTML.m */; };
A788CAA1148648C700E1AFD9 /* NSString+HTML.m in Sources */ = {isa = PBXBuildFile; fileRef = A788C94914863E8700E1AFD9 /* NSString+HTML.m */; };
A788CAA2148648C700E1AFD9 /* NSString+Paragraphs.m in Sources */ = {isa = PBXBuildFile; fileRef = A788C94B14863E8700E1AFD9 /* NSString+Paragraphs.m */; };
- A788CAA4148648C700E1AFD9 /* UIDevice+DTVersion.m in Sources */ = {isa = PBXBuildFile; fileRef = A788C95714863E8700E1AFD9 /* UIDevice+DTVersion.m */; };
+ A788CAA4148648C700E1AFD9 /* UIDevice+DTSimpleVersion.m in Sources */ = {isa = PBXBuildFile; fileRef = A788C95714863E8700E1AFD9 /* UIDevice+DTSimpleVersion.m */; };
A788CAA5148648D700E1AFD9 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A76E5B4812DD9AF500711782 /* QuartzCore.framework */; };
A78C241115073BC50045651E /* TextBoxes.html in Resources */ = {isa = PBXBuildFile; fileRef = A78C241015073BC50045651E /* TextBoxes.html */; };
A7949A0014C6256B00A8CCDE /* libxml2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = A79499FF14C6256B00A8CCDE /* libxml2.dylib */; };
@@ -250,8 +250,6 @@
A7949A9E14CC566100A8CCDE /* DTCoreTextConstants.h in Headers */ = {isa = PBXBuildFile; fileRef = A7949A9C14CC565F00A8CCDE /* DTCoreTextConstants.h */; settings = {ATTRIBUTES = (Public, ); }; };
A7949AA214CC5BDC00A8CCDE /* DTHTMLAttributedStringBuilder.m in Sources */ = {isa = PBXBuildFile; fileRef = A7949A4614CAF58C00A8CCDE /* DTHTMLAttributedStringBuilder.m */; };
A7949AA314CC5BDF00A8CCDE /* DTHTMLAttributedStringBuilder.m in Sources */ = {isa = PBXBuildFile; fileRef = A7949A4614CAF58C00A8CCDE /* DTHTMLAttributedStringBuilder.m */; };
- A7949AA514CD3C5D00A8CCDE /* DTHTMLParser.m in Sources */ = {isa = PBXBuildFile; fileRef = A7949A4914CAF5A300A8CCDE /* DTHTMLParser.m */; };
- A7949AA614CD3C5E00A8CCDE /* DTHTMLParser.m in Sources */ = {isa = PBXBuildFile; fileRef = A7949A4914CAF5A300A8CCDE /* DTHTMLParser.m */; };
A7A672BA1532F2D100920A18 /* DTCompatibility.h in Headers */ = {isa = PBXBuildFile; fileRef = A7A672B91532F2D100920A18 /* DTCompatibility.h */; };
A7A672BB1532F2D100920A18 /* DTCompatibility.h in Headers */ = {isa = PBXBuildFile; fileRef = A7A672B91532F2D100920A18 /* DTCompatibility.h */; };
A7A95D9514F3F45E002E3F7E /* LineHeight.html in Resources */ = {isa = PBXBuildFile; fileRef = A7A95D9414F3F45E002E3F7E /* LineHeight.html */; };
@@ -459,8 +457,8 @@
A788C94D14863E8700E1AFD9 /* NSString+UTF8Cleaner.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+UTF8Cleaner.m"; sourceTree = "<group>"; };
A788C95214863E8700E1AFD9 /* DTColor+HTML.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = "DTColor+HTML.h"; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
A788C95314863E8700E1AFD9 /* DTColor+HTML.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = "DTColor+HTML.m"; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
- A788C95614863E8700E1AFD9 /* UIDevice+DTVersion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIDevice+DTVersion.h"; sourceTree = "<group>"; };
- A788C95714863E8700E1AFD9 /* UIDevice+DTVersion.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIDevice+DTVersion.m"; sourceTree = "<group>"; };
+ A788C95614863E8700E1AFD9 /* UIDevice+DTSimpleVersion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIDevice+DTSimpleVersion.h"; sourceTree = "<group>"; };
+ A788C95714863E8700E1AFD9 /* UIDevice+DTSimpleVersion.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIDevice+DTSimpleVersion.m"; sourceTree = "<group>"; };
A788CA1214863E9D00E1AFD9 /* UnitTest-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "UnitTest-Info.plist"; sourceTree = "<group>"; };
A788CA1314863E9D00E1AFD9 /* UnitTest-Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UnitTest-Prefix.pch"; sourceTree = "<group>"; };
A788CA1514863EC600E1AFD9 /* DTCoreText-Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "DTCoreText-Prefix.pch"; path = "Core/DTCoreText-Prefix.pch"; sourceTree = "<group>"; };
@@ -823,8 +821,8 @@
A788C94314863E8700E1AFD9 /* NSData+DTBase64.m */,
A788C94A14863E8700E1AFD9 /* NSString+Paragraphs.h */,
A788C94B14863E8700E1AFD9 /* NSString+Paragraphs.m */,
- A788C95614863E8700E1AFD9 /* UIDevice+DTVersion.h */,
- A788C95714863E8700E1AFD9 /* UIDevice+DTVersion.m */,
+ A788C95614863E8700E1AFD9 /* UIDevice+DTSimpleVersion.h */,
+ A788C95714863E8700E1AFD9 /* UIDevice+DTSimpleVersion.m */,
);
name = Utils;
sourceTree = "<group>";
@@ -960,7 +958,7 @@
A788C9EE14863E8700E1AFD9 /* NSString+Paragraphs.h in Headers */,
A788C9F314863E8700E1AFD9 /* NSString+UTF8Cleaner.h in Headers */,
A788CA0214863E8700E1AFD9 /* DTColor+HTML.h in Headers */,
- A788CA0C14863E8700E1AFD9 /* UIDevice+DTVersion.h in Headers */,
+ A788CA0C14863E8700E1AFD9 /* UIDevice+DTSimpleVersion.h in Headers */,
A70B4C9F1486558200873A4A /* DTCoreText.h in Headers */,
A7949A9D14CC566100A8CCDE /* DTCoreTextConstants.h in Headers */,
A7F5671414D841EA00D1F167 /* NSString+CSS.h in Headers */,
@@ -1000,7 +998,7 @@
A788C9DB14863E8700E1AFD9 /* NSData+DTBase64.h in Headers */,
A788C9EF14863E8700E1AFD9 /* NSString+Paragraphs.h in Headers */,
A788C9F414863E8700E1AFD9 /* NSString+UTF8Cleaner.h in Headers */,
- A788CA0D14863E8700E1AFD9 /* UIDevice+DTVersion.h in Headers */,
+ A788CA0D14863E8700E1AFD9 /* UIDevice+DTSimpleVersion.h in Headers */,
A788CA1814863EC600E1AFD9 /* DTCoreText-Prefix.pch in Headers */,
A7949A9E14CC566100A8CCDE /* DTCoreTextConstants.h in Headers */,
A7F5671514D841EA00D1F167 /* NSString+CSS.h in Headers */,
@@ -1343,10 +1341,9 @@
A788C9F114863E8700E1AFD9 /* NSString+Paragraphs.m in Sources */,
A788C9F614863E8700E1AFD9 /* NSString+UTF8Cleaner.m in Sources */,
A788CA0514863E8700E1AFD9 /* DTColor+HTML.m in Sources */,
- A788CA0F14863E8700E1AFD9 /* UIDevice+DTVersion.m in Sources */,
+ A788CA0F14863E8700E1AFD9 /* UIDevice+DTSimpleVersion.m in Sources */,
A7949A5014CC44D300A8CCDE /* DTCoreTextConstants.m in Sources */,
A7949AA314CC5BDF00A8CCDE /* DTHTMLAttributedStringBuilder.m in Sources */,
- A7949AA514CD3C5D00A8CCDE /* DTHTMLParser.m in Sources */,
A7C5D01714D7E3DC00AF1D75 /* DTImage+HTML.m in Sources */,
A7F5671614D841EA00D1F167 /* NSString+CSS.m in Sources */,
A7F5672914D8506C00D1F167 /* NSAttributedString+SmallCaps.m in Sources */,
@@ -1389,10 +1386,9 @@
A788C9F214863E8700E1AFD9 /* NSString+Paragraphs.m in Sources */,
A788C9F714863E8700E1AFD9 /* NSString+UTF8Cleaner.m in Sources */,
A788CA0614863E8700E1AFD9 /* DTColor+HTML.m in Sources */,
- A788CA1014863E8700E1AFD9 /* UIDevice+DTVersion.m in Sources */,
+ A788CA1014863E8700E1AFD9 /* UIDevice+DTSimpleVersion.m in Sources */,
A7949A5114CC44D300A8CCDE /* DTCoreTextConstants.m in Sources */,
A7949AA214CC5BDC00A8CCDE /* DTHTMLAttributedStringBuilder.m in Sources */,
- A7949AA614CD3C5E00A8CCDE /* DTHTMLParser.m in Sources */,
A7C5D01614D7E3DC00AF1D75 /* DTImage+HTML.m in Sources */,
A7F5671714D841EA00D1F167 /* NSString+CSS.m in Sources */,
A7F5672A14D8506C00D1F167 /* NSAttributedString+SmallCaps.m in Sources */,
@@ -1434,7 +1430,7 @@
A788CAA0148648C700E1AFD9 /* NSScanner+HTML.m in Sources */,
A788CAA1148648C700E1AFD9 /* NSString+HTML.m in Sources */,
A788CAA2148648C700E1AFD9 /* NSString+Paragraphs.m in Sources */,
- A788CAA4148648C700E1AFD9 /* UIDevice+DTVersion.m in Sources */,
+ A788CAA4148648C700E1AFD9 /* UIDevice+DTSimpleVersion.m in Sources */,
A7949A5214CC44D300A8CCDE /* DTCoreTextConstants.m in Sources */,
A7C1CC0914D6C4C3008D6468 /* NSAttributedString+HTML.m in Sources */,
A7C1CC0A14D6C4D8008D6468 /* DTHTMLAttributedStringBuilder.m in Sources */,

0 comments on commit c54be85

Please sign in to comment.