Permalink
Browse files

Mac Compatibility Mode: for Mac based UnitTest to compare generated o…

…utput with origin initWithHTML.
  • Loading branch information...
1 parent df66dc0 commit afd603b4d04bce1f974479661470cde0fae26be4 @odrobnik odrobnik committed Jan 31, 2012
Showing with 992 additions and 503 deletions.
  1. +2 −1 Core/Source/DTAttributedTextCell.m
  2. +4 −4 Core/Source/DTAttributedTextContentView.m
  3. +10 −10 Core/Source/DTAttributedTextView.m
  4. +2 −0 Core/Source/DTCSSListStyle.h
  5. +8 −5 Core/Source/DTCSSListStyle.m
  6. +1 −0 Core/Source/DTCSSStylesheet.h
  7. +5 −5 Core/Source/DTCSSStylesheet.m
  8. +38 −0 Core/Source/DTColor+HTML.h
  9. +237 −35 Core/Source/{UIColor+HTML.m → DTColor+HTML.m}
  10. +40 −17 Core/Source/DTCoreText.h
  11. +11 −1 Core/Source/DTCoreTextConstants.h
  12. +3 −1 Core/Source/DTCoreTextConstants.m
  13. +5 −2 Core/Source/DTCoreTextLayoutFrame.m
  14. +0 −1 Core/Source/DTHTMLAttributedStringBuilder.h
  15. +11 −21 Core/Source/DTHTMLAttributedStringBuilder.m
  16. +5 −3 Core/Source/DTHTMLElement.h
  17. +25 −16 Core/Source/DTHTMLElement.m
  18. +23 −0 Core/Source/DTImage+HTML.h
  19. +37 −0 Core/Source/DTImage+HTML.m
  20. +1 −2 Core/Source/DTLazyImageView.h
  21. +1 −1 Core/Source/DTLinkButton.m
  22. +8 −6 Core/Source/DTTextAttachment.m
  23. +0 −3 Core/Source/NSAttributedString+HTML.h
  24. +3 −44 Core/Source/NSAttributedString+HTML.m
  25. +16 −0 Core/Source/NSAttributedString+SmallCaps.h
  26. +54 −0 Core/Source/NSAttributedString+SmallCaps.m
  27. +2 −0 Core/Source/NSAttributedStringRunDelegates.h
  28. +1 −1 Core/Source/NSCharacterSet+HTML.h
  29. +1 −5 Core/Source/NSMutableAttributedString+HTML.m
  30. +1 −0 Core/Source/NSScanner+HTML.h
  31. +19 −0 Core/Source/NSString+CSS.h
  32. +227 −0 Core/Source/NSString+CSS.m
  33. +1 −8 Core/Source/NSString+HTML.h
  34. +2 −217 Core/Source/NSString+HTML.m
  35. +0 −19 Core/Source/UIColor+HTML.h
  36. +6 −0 Core/Test/MacUnitTest-Prefix.pch
  37. +23 −6 Core/Test/MacUnitTest.m
  38. +19 −19 Core/Test/UIColorHTMLTest.m
  39. +139 −49 DTCoreText.xcodeproj/project.pbxproj
  40. +1 −1 Demo/Source/DemoTextViewController.m
View
3 Core/Source/DTAttributedTextCell.m
@@ -8,6 +8,7 @@
#import "DTAttributedTextCell.h"
#import "DTAttributedTextContentView.h"
+#import "DTColor+HTML.h"
@implementation DTAttributedTextCell
{
@@ -54,7 +55,7 @@ - (void)willMoveToSuperview:(UIView *)newSuperview
if (tableView.style == UITableViewStyleGrouped)
{
// need no background because otherwise this would overlap the rounded corners
- _attributedTextContextView.backgroundColor = [UIColor clearColor];
+ _attributedTextContextView.backgroundColor = [DTColor clearColor];
}
[super willMoveToSuperview:newSuperview];
View
8 Core/Source/DTAttributedTextContentView.m
@@ -12,7 +12,7 @@
#import "DTTextAttachment.h"
#import "NSString+HTML.h"
-#import "UIColor+HTML.h"
+#import "DTColor+HTML.h"
#import "DTLinkButton.h"
@@ -104,7 +104,7 @@ - (void)setup
// possibly already set in NIB
if (!self.backgroundColor)
{
- self.backgroundColor = [UIColor whiteColor];
+ self.backgroundColor = [DTColor whiteColor];
}
// set tile size if applicable
@@ -596,11 +596,11 @@ - (void)setShouldDrawImages:(BOOL)newSetting
}
}
-- (void)setBackgroundColor:(UIColor *)newColor
+- (void)setBackgroundColor:(DTColor *)newColor
{
super.backgroundColor = newColor;
- if ([newColor alpha]<1.0)
+ if ([newColor alphaComponent]<1.0)
{
self.opaque = NO;
}
View
20 Core/Source/DTAttributedTextView.m
@@ -9,7 +9,7 @@
#import "DTAttributedTextView.h"
#import "DTAttributedTextContentView.h"
-#import "UIColor+HTML.h"
+#import "DTColor+HTML.h"
@interface DTAttributedTextView ()
@@ -63,12 +63,12 @@ - (void)setup
{
if (!self.backgroundColor)
{
- self.backgroundColor = [UIColor whiteColor];
+ self.backgroundColor = [DTColor whiteColor];
self.opaque = YES;
return;
}
- CGFloat alpha = [self.backgroundColor alpha];
+ CGFloat alpha = [self.backgroundColor alphaComponent];
if (alpha < 1.0)
{
@@ -124,12 +124,12 @@ - (DTAttributedTextContentView *)contentView
return contentView;
}
-- (void)setBackgroundColor:(UIColor *)newColor
+- (void)setBackgroundColor:(DTColor *)newColor
{
- if ([newColor alpha]<1.0)
+ if ([newColor alphaComponent]<1.0)
{
super.backgroundColor = newColor;
- contentView.backgroundColor = [UIColor clearColor];
+ contentView.backgroundColor = [DTColor clearColor];
self.opaque = NO;
}
else
@@ -148,15 +148,15 @@ - (UIView *)backgroundView
if (!backgroundView)
{
backgroundView = [[UIView alloc] initWithFrame:self.bounds];
- backgroundView.backgroundColor = [UIColor whiteColor];
+ backgroundView.backgroundColor = [DTColor whiteColor];
// default is no interaction because background should have no interaction
backgroundView.userInteractionEnabled = NO;
[self insertSubview:backgroundView belowSubview:self.contentView];
// make content transparent so that we see the background
- contentView.backgroundColor = [UIColor clearColor];
+ contentView.backgroundColor = [DTColor clearColor];
contentView.opaque = NO;
}
@@ -175,12 +175,12 @@ - (void)setBackgroundView:(UIView *)newBackgroundView
if (backgroundView)
{
// make content transparent so that we see the background
- contentView.backgroundColor = [UIColor clearColor];
+ contentView.backgroundColor = [DTColor clearColor];
contentView.opaque = NO;
}
else
{
- contentView.backgroundColor = [UIColor whiteColor];
+ contentView.backgroundColor = [DTColor whiteColor];
contentView.opaque = YES;
}
}
View
2 Core/Source/DTCSSListStyle.h
@@ -6,6 +6,8 @@
// Copyright 2011 Drobnik.com. All rights reserved.
//
+#import <Foundation/Foundation.h>
+
typedef enum
{
DTCSSListStyleTypeInherit = 0,
View
13 Core/Source/DTCSSListStyle.m
@@ -7,8 +7,11 @@
//
#import "DTCSSListStyle.h"
+
+#import "DTCoreTextConstants.h"
+
#import "NSScanner+HTML.h"
-#import "NSString+HTML.h"
+//#import "NSString+HTML.h"
@@ -81,7 +84,7 @@ + (DTCSSListStyleType)listStyleTypeFromString:(NSString *)string
{
if (!string)
{
- return NSNotFound;
+ return DTCSSListStyleTypeNone;
}
// always compare lower case
@@ -129,15 +132,15 @@ + (DTCSSListStyleType)listStyleTypeFromString:(NSString *)string
}
else
{
- return NSNotFound;
+ return DTCSSListStyleTypeNone;
}
}
+ (DTCSSListStylePosition)listStylePositionFromString:(NSString *)string
{
if (!string)
{
- return NSNotFound;
+ return DTCSSListStylePositionInherit;
}
// always compare lower case
@@ -157,7 +160,7 @@ + (DTCSSListStylePosition)listStylePositionFromString:(NSString *)string
}
else
{
- return NSNotFound;
+ return DTCSSListStylePositionInherit;
}
}
View
1 Core/Source/DTCSSStylesheet.h
@@ -6,6 +6,7 @@
// Copyright (c) 2011 Drobnik.com. All rights reserved.
//
+#import <Foundation/Foundation.h>
@class DTHTMLElement;
View
10 Core/Source/DTCSSStylesheet.m
@@ -10,8 +10,8 @@
#import "DTCSSListStyle.h"
#import "DTHTMLElement.h"
-#import "NSString+HTML.h"
#import "NSScanner+HTML.h"
+#import "NSString+CSS.h"
@interface DTCSSStylesheet ()
@@ -78,8 +78,8 @@ - (void)uncompressShorthands:(NSMutableDictionary *)styles
BOOL typeWasSet = NO;
BOOL positionWasSet = NO;
- DTCSSListStyleType listStyleType = NSNotFound;
- DTCSSListStylePosition listStylePosition = NSNotFound;
+ DTCSSListStyleType listStyleType = DTCSSListStyleTypeNone;
+ DTCSSListStylePosition listStylePosition = DTCSSListStylePositionInherit;
for (NSString *oneComponent in components)
{
@@ -164,11 +164,11 @@ - (void)addStyleRule:(NSString *)rule withSelector:(NSString*)selectors
- (void)parseStyleBlock:(NSString*)css
{
- int braceLevel = 0, braceMarker = 0;
+ NSUInteger braceLevel = 0, braceMarker = 0;
NSString* selector;
- for (int i = 0, l = [css length]; i < l; i++) {
+ for (NSUInteger i = 0, l = [css length]; i < l; i++) {
unichar c = [css characterAtIndex:i];
View
38 Core/Source/DTColor+HTML.h
@@ -0,0 +1,38 @@
+//
+// DTColor+HTML.h
+// CoreTextExtensions
+//
+// Created by Oliver Drobnik on 1/9/11.
+// Copyright 2011 Drobnik.com. All rights reserved.
+//
+
+#if TARGET_OS_IPHONE
+
+@interface UIColor (HTML)
+
+typedef UIColor DTColor;
+
++ (UIColor *)colorWithHexString:(NSString *)hex;
++ (UIColor *)colorWithHTMLName:(NSString *)name;
+- (NSString *)htmlHexString;
+
+- (CGFloat)alphaComponent;
+
+@end
+
+#else
+
+typedef NSColor DTColor;
+
+@interface NSColor (HTML)
+
++ (NSColor *)colorWithHexString:(NSString *)hex;
++ (NSColor *)colorWithHTMLName:(NSString *)name;
+- (NSString *)htmlHexString;
+
+// pass through
+- (NSColor *)CGColor;
+
+@end
+
+#endif
View
272 Core/Source/UIColor+HTML.m → Core/Source/DTColor+HTML.m
@@ -1,16 +1,18 @@
//
-// UIColor+HTML.m
+// DTColor+HTML.m
// CoreTextExtensions
//
// Created by Oliver Drobnik on 1/9/11.
// Copyright 2011 Drobnik.com. All rights reserved.
//
-#import "UIColor+HTML.h"
+#import "DTColor+HTML.h"
#import "NSString+HTML.h"
static NSDictionary *colorLookup = nil;
+#if TARGET_OS_IPHONE
+
@implementation UIColor (HTML)
+ (UIColor *)colorWithHexString:(NSString *)hex
@@ -226,39 +228,6 @@ + (UIColor *)colorWithHTMLName:(NSString *)name
return [UIColor colorWithHexString:hexString];
}
-- (CGFloat)alpha
-{
- return CGColorGetAlpha(self.CGColor);
-}
-
-- (UIColor *)invertedColor
-{
- CGColorRef color = self.CGColor;
- size_t count = CGColorGetNumberOfComponents(color);
- const CGFloat *components = CGColorGetComponents(color);
-
- if (count==2)
- {
- // grayscale
- CGFloat white = components[0];
- CGFloat alpha = components[1];
-
- return [UIColor colorWithWhite:1.0f - white alpha:alpha];
- }
- else if (count==4)
- {
- // grayscale
- CGFloat red = components[0];
- CGFloat green = components[1];
- CGFloat blue = components[2];
- CGFloat alpha = components[3];
-
- return [UIColor colorWithRed:1.0f - red green:1.0f - green blue:1.0f - blue alpha:alpha];
- }
-
- return nil;
-}
-
- (NSString *)htmlHexString
{
CGColorRef color = self.CGColor;
@@ -285,4 +254,237 @@ - (NSString *)htmlHexString
return nil;
}
+- (CGFloat)alphaComponent
+{
+ return CGColorGetAlpha(self.CGColor);
+}
+
+@end
+
+#else
+
+@implementation NSColor (HTML)
+
++ (NSColor *)colorWithHexString:(NSString *)hex
+{
+ if ([hex length]!=6 && [hex length]!=3)
+ {
+ return nil;
+ }
+
+ NSUInteger digits = [hex length]/3;
+ CGFloat maxValue = (digits==1)?15.0:255.0;
+
+ CGFloat red = [[hex substringWithRange:NSMakeRange(0, digits)] integerValueFromHex]/maxValue;
+ CGFloat green = [[hex substringWithRange:NSMakeRange(digits, digits)] integerValueFromHex]/maxValue;
+ CGFloat blue = [[hex substringWithRange:NSMakeRange(2*digits, digits)] integerValueFromHex]/maxValue;
+
+ return [NSColor colorWithDeviceRed:red green:green blue:blue alpha:1.0];
+}
+
+
+// Source: http://www.w3schools.com/html/html_colornames.asp
++ (NSColor *)colorWithHTMLName:(NSString *)name
+{
+ if ([name hasPrefix:@"#"])
+ {
+ return [NSColor colorWithHexString:[name substringFromIndex:1]];
+ }
+
+ if ([name hasPrefix:@"rgba"]) {
+ NSString *rgbaName = [name stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"rgba() "]];
+ NSArray *rgba = [rgbaName componentsSeparatedByString:@","];
+
+ if ([rgba count] != 4) {
+ // Incorrect syntax
+ return nil;
+ }
+
+ return [NSColor colorWithDeviceRed:[[rgba objectAtIndex:0] floatValue] / 255
+ green:[[rgba objectAtIndex:1] floatValue] / 255
+ blue:[[rgba objectAtIndex:2] floatValue] / 255
+ alpha:[[rgba objectAtIndex:3] floatValue]];
+ }
+
+ if([name hasPrefix:@"rgb"])
+ {
+ NSString * rgbName = [name stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"rbg() "]];
+ NSArray* rbg = [rgbName componentsSeparatedByCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@","]];
+ if ([rbg count] != 3) {
+ // Incorrect syntax
+ return nil;
+ }
+ return [NSColor colorWithDeviceRed:[[rbg objectAtIndex:0]floatValue]/255
+ green:[[rbg objectAtIndex:1]floatValue] /255
+ blue:[[rbg objectAtIndex:2]floatValue] /255
+ alpha:1.0];
+ }
+
+ static dispatch_once_t predicate;
+ dispatch_once(&predicate, ^{
+ colorLookup = [[NSDictionary alloc] initWithObjectsAndKeys:
+ @"F0F8FF", @"aliceblue",
+ @"FAEBD7", @"antiquewhite",
+ @"00FFFF", @"aqua",
+ @"7FFFD4", @"aquamarine",
+ @"F0FFFF", @"azure",
+ @"F5F5DC", @"beige",
+ @"FFE4C4", @"bisque",
+ @"000000", @"black",
+ @"FFEBCD", @"blanchedalmond",
+ @"0000FF", @"blue",
+ @"8A2BE2", @"blueviolet",
+ @"A52A2A", @"brown",
+ @"DEB887", @"burlywood",
+ @"5F9EA0", @"cadetblue",
+ @"7FFF00", @"chartreuse",
+ @"D2691E", @"chocolate",
+ @"FF7F50", @"coral",
+ @"6495ED", @"cornflowerblue",
+ @"FFF8DC", @"cornsilk",
+ @"DC143C", @"crimson",
+ @"00FFFF", @"cyan",
+ @"00008B", @"darkblue",
+ @"008B8B", @"darkcyan",
+ @"B8860B", @"darkgoldenrod",
+ @"A9A9A9", @"darkgray",
+ @"A9A9A9", @"darkgrey",
+ @"006400", @"darkgreen",
+ @"BDB76B", @"darkkhaki",
+ @"8B008B", @"darkmagenta",
+ @"556B2F", @"darkolivegreen",
+ @"FF8C00", @"darkorange",
+ @"9932CC", @"darkorchid",
+ @"8B0000", @"darkred",
+ @"E9967A", @"darksalmon",
+ @"8FBC8F", @"darkseagreen",
+ @"483D8B", @"darkslateblue",
+ @"2F4F4F", @"darkslategray",
+ @"2F4F4F", @"darkslategrey",
+ @"00CED1", @"darkturquoise",
+ @"9400D3", @"darkviolet",
+ @"FF1493", @"deeppink",
+ @"00BFFF", @"deepskyblue",
+ @"696969", @"dimgray",
+ @"696969", @"dimgrey",
+ @"1E90FF", @"dodgerblue",
+ @"B22222", @"firebrick",
+ @"FFFAF0", @"floralwhite",
+ @"228B22", @"forestgreen",
+ @"FF00FF", @"fuchsia",
+ @"DCDCDC", @"gainsboro",
+ @"F8F8FF", @"ghostwhite",
+ @"FFD700", @"gold",
+ @"DAA520", @"goldenrod",
+ @"808080", @"gray",
+ @"808080", @"grey",
+ @"008000", @"green",
+ @"ADFF2F", @"greenyellow",
+ @"F0FFF0", @"honeydew",
+ @"FF69B4", @"hotpink",
+ @"CD5C5C", @"indianred",
+ @"4B0082", @"indigo",
+ @"FFFFF0", @"ivory",
+ @"F0E68C", @"khaki",
+ @"E6E6FA", @"lavender",
+ @"FFF0F5", @"lavenderblush",
+ @"7CFC00", @"lawngreen",
+ @"FFFACD", @"lemonchiffon",
+ @"ADD8E6", @"lightblue",
+ @"F08080", @"lightcoral",
+ @"E0FFFF", @"lightcyan",
+ @"FAFAD2", @"lightgoldenrodyellow",
+ @"D3D3D3", @"lightgray",
+ @"D3D3D3", @"lightgrey",
+ @"90EE90", @"lightgreen",
+ @"FFB6C1", @"lightpink",
+ @"FFA07A", @"lightsalmon",
+ @"20B2AA", @"lightseagreen",
+ @"87CEFA", @"lightskyblue",
+ @"778899", @"lightslategray",
+ @"778899", @"lightslategrey",
+ @"B0C4DE", @"lightsteelblue",
+ @"FFFFE0", @"lightyellow",
+ @"00FF00", @"lime",
+ @"32CD32", @"limegreen",
+ @"FAF0E6", @"linen",
+ @"FF00FF", @"magenta",
+ @"800000", @"maroon",
+ @"66CDAA", @"mediumaquamarine",
+ @"0000CD", @"mediumblue",
+ @"BA55D3", @"mediumorchid",
+ @"9370D8", @"mediumpurple",
+ @"3CB371", @"mediumseagreen",
+ @"7B68EE", @"mediumslateblue",
+ @"00FA9A", @"mediumspringgreen",
+ @"48D1CC", @"mediumturquoise",
+ @"C71585", @"mediumvioletred",
+ @"191970", @"midnightblue",
+ @"F5FFFA", @"mintcream",
+ @"FFE4E1", @"mistyrose",
+ @"FFE4B5", @"moccasin",
+ @"FFDEAD", @"navajowhite",
+ @"000080", @"navy",
+ @"FDF5E6", @"oldlace",
+ @"808000", @"olive",
+ @"6B8E23", @"olivedrab",
+ @"FFA500", @"orange",
+ @"FF4500", @"orangered",
+ @"DA70D6", @"orchid",
+ @"EEE8AA", @"palegoldenrod",
+ @"98FB98", @"palegreen",
+ @"AFEEEE", @"paleturquoise",
+ @"D87093", @"palevioletred",
+ @"FFEFD5", @"papayawhip",
+ @"FFDAB9", @"peachpuff",
+ @"CD853F", @"peru",
+ @"FFC0CB", @"pink",
+ @"DDA0DD", @"plum",
+ @"B0E0E6", @"powderblue",
+ @"800080", @"purple",
+ @"FF0000", @"red",
+ @"BC8F8F", @"rosybrown",
+ @"4169E1", @"royalblue",
+ @"8B4513", @"saddlebrown",
+ @"FA8072", @"salmon",
+ @"F4A460", @"sandybrown",
+ @"2E8B57", @"seagreen",
+ @"FFF5EE", @"seashell",
+ @"A0522D", @"sienna",
+ @"C0C0C0", @"silver",
+ @"87CEEB", @"skyblue",
+ @"6A5ACD", @"slateblue",
+ @"708090", @"slategray",
+ @"708090", @"slategrey",
+ @"FFFAFA", @"snow",
+ @"00FF7F", @"springgreen",
+ @"4682B4", @"steelblue",
+ @"D2B48C", @"tan",
+ @"008080", @"teal",
+ @"D8BFD8", @"thistle",
+ @"FF6347", @"tomato",
+ @"40E0D0", @"turquoise",
+ @"EE82EE", @"violet",
+ @"F5DEB3", @"wheat",
+ @"FFFFFF", @"white",
+ @"F5F5F5", @"whitesmoke",
+ @"FFFF00", @"yellow",
+ @"9ACD32", @"yellowgreen",
+ nil];
+ });
+
+ NSString *hexString = [colorLookup objectForKey:[name lowercaseString]];
+
+ return [NSColor colorWithHexString:hexString];
+}
+
+// pass through
+- (NSColor *)CGColor
+{
+ return self;
+}
+
+
@end
+
+#endif
View
57 Core/Source/DTCoreText.h
@@ -1,31 +1,54 @@
+
+// global constants
+#import "DTCoreTextConstants.h"
+
+// common utilities
#import "CGUtils.h"
-#import "DTAttributedTextCell.h"
-#import "DTAttributedTextContentView.h"
-#import "DTAttributedTextView.h"
+
+// common classes
#import "DTCSSListStyle.h"
#import "DTCSSStylesheet.h"
#import "DTCoreText.h"
-#import "DTCoreTextFontCollection.h"
#import "DTCoreTextFontDescriptor.h"
-#import "DTCoreTextGlyphRun.h"
-#import "DTCoreTextLayoutFrame.h"
-#import "DTCoreTextLayoutLine.h"
-#import "DTCoreTextLayouter.h"
-#import "DTCoreTextParagraphStyle.h"
#import "DTHTMLElement.h"
-#import "DTLazyImageView.h"
-#import "DTLinkButton.h"
#import "DTTextAttachment.h"
-#import "DTWebVideoView.h"
-#import "NSAttributedString+HTML.h"
-#import "NSAttributedStringRunDelegates.h"
#import "NSCharacterSet+HTML.h"
#import "NSData+DTBase64.h"
-#import "NSMutableAttributedString+HTML.h"
#import "NSScanner+HTML.h"
+#import "NSString+CSS.h"
#import "NSString+HTML.h"
#import "NSString+Paragraphs.h"
#import "NSString+UTF8Cleaner.h"
#import "NSURL+HTML.h"
-#import "UIColor+HTML.h"
-#import "UIDevice+DTVersion.h"
+#import "DTCoreTextParagraphStyle.h"
+#import "NSMutableAttributedString+HTML.h"
+#import "NSAttributedString+SmallCaps.h"
+
+// DTColor is UIColor on iOS, NSColor on Mac
+#import "DTColor+HTML.h"
+
+// DTImage is UIImage on iOS, NSImage on Mac
+#import "DTImage+HTML.h"
+
+// These classes only work with UIKit on iOS
+#if TARGET_OS_IPHONE
+
+#import "NSAttributedString+HTML.h"
+
+#import "DTLazyImageView.h"
+#import "DTLinkButton.h"
+#import "DTWebVideoView.h"
+#import "NSAttributedStringRunDelegates.h"
+
+#import "UIDevice+DTVersion.h"
+
+#import "DTAttributedTextCell.h"
+#import "DTAttributedTextContentView.h"
+#import "DTAttributedTextView.h"
+#import "DTCoreTextFontCollection.h"
+#import "DTCoreTextGlyphRun.h"
+#import "DTCoreTextLayoutFrame.h"
+#import "DTCoreTextLayoutLine.h"
+#import "DTCoreTextLayouter.h"
+
+#endif
View
12 Core/Source/DTCoreTextConstants.h
@@ -1,3 +1,6 @@
+#define UNICODE_OBJECT_PLACEHOLDER @"\ufffc"
+#define UNICODE_LINE_FEED @"\u2028"
+
extern NSString *NSBaseURLDocumentOption;
extern NSString *NSTextEncodingNameDocumentOption;
extern NSString *NSTextSizeMultiplierDocumentOption;
@@ -14,4 +17,11 @@ extern NSString *DTDefaultFirstLineHeadIndent;
extern NSString *DTDefaultHeadIndent;
extern NSString *DTDefaultListIndent;
-extern NSString *DTDefaultStyleSheet;
+extern NSString *DTDefaultStyleSheet;
+
+#define IS_WHITESPACE(_c) (_c == ' ' || _c == '\t' || _c == 0xA || _c == 0xB || _c == 0xC || _c == 0xD || _c == 0x85)
+
+
+
+
+
View
4 Core/Source/DTCoreTextConstants.m
@@ -15,4 +15,6 @@
NSString *DTDefaultHeadIndent = @"DTDefaultHeadIndent";
NSString *DTDefaultListIndent = @"DTDefaultListIndent";
-NSString *DTDefaultStyleSheet = @"DTDefaultStyleSheet";
+NSString *DTDefaultStyleSheet = @"DTDefaultStyleSheet";
+
+
View
7 Core/Source/DTCoreTextLayoutFrame.m
@@ -15,6 +15,9 @@
#import "UIDevice+DTVersion.h"
#import "NSString+Paragraphs.h"
+#import "DTColor+HTML.h"
+#import "DTImage+HTML.h"
+
// global flag that shows debug frames
static BOOL _DTCoreTextLayoutFramesShouldDrawDebugFrames = NO;
@@ -230,7 +233,7 @@ - (CGPathRef)path
- (void)setShadowInContext:(CGContextRef)context fromDictionary:(NSDictionary *)dictionary
{
- UIColor *color = [dictionary objectForKey:@"Color"];
+ DTColor *color = [dictionary objectForKey:@"Color"];
CGSize offset = [[dictionary objectForKey:@"Offset"] CGSizeValue];
CGFloat blur = [[dictionary objectForKey:@"Blur"] floatValue];
@@ -491,7 +494,7 @@ - (void)drawInContext:(CGContextRef)context drawImages:(BOOL)drawImages
{
if (attachment.contentType == DTTextAttachmentTypeImage)
{
- UIImage *image = (id)attachment.contents;
+ DTImage *image = (id)attachment.contents;
CGPoint origin = oneRun.frame.origin;
origin.y = self.frame.size.height - origin.y - oneRun.ascent;
View
1 Core/Source/DTHTMLAttributedStringBuilder.h
@@ -6,7 +6,6 @@
// Copyright (c) 2012 Drobnik.com. All rights reserved.
//
-#import <Foundation/Foundation.h>
#import "DTHTMLParser.h"
@class DTHTMLElement;
View
32 Core/Source/DTHTMLAttributedStringBuilder.m
@@ -1,27 +1,17 @@
//
-// DTHTMLDocument.m
+// DTHTMLAttributedStringBuilder.m
// DTCoreText
//
// Created by Oliver Drobnik on 21.01.12.
// Copyright (c) 2012 Drobnik.com. All rights reserved.
//
#import "DTHTMLAttributedStringBuilder.h"
-#import "DTHTMLParser.h"
+#import "DTCoreText.h"
-#import "NSString+UTF8Cleaner.h"
-#import "NSString+HTML.h"
-#import "UIColor+HTML.h"
-#import "DTCSSStylesheet.h"
+#import "DTColor+HTML.h"
+#import "DTImage+HTML.h"
-#import "DTCoreTextConstants.h"
-
-#import "DTCoreTextFontDescriptor.h"
-#import "DTCoreTextParagraphStyle.h"
-#import "DTHTMLElement.h"
-#import "DTTextAttachment.h"
-
-#import "NSMutableAttributedString+HTML.h"
@interface DTHTMLAttributedStringBuilder ()
@@ -38,7 +28,7 @@ @implementation DTHTMLAttributedStringBuilder
// settings for parsing
CGFloat textScale;
- UIColor *defaultLinkColor;
+ DTColor *defaultLinkColor;
DTCSSStylesheet *_globalStyleSheet;
NSURL *baseURL;
DTCoreTextFontDescriptor *defaultFontDescriptor;
@@ -224,10 +214,10 @@ - (BOOL)buildString
if ([defaultLinkColor isKindOfClass:[NSString class]])
{
// convert from string to color
- defaultLinkColor = [UIColor colorWithHTMLName:(NSString *)defaultLinkColor];
+ defaultLinkColor = [DTColor colorWithHTMLName:(NSString *)defaultLinkColor];
}
- // get hex code for the passed color
+ // get hex code for t he passed color
NSString *colorHex = [defaultLinkColor htmlHexString];
// overwrite the style
@@ -291,15 +281,15 @@ - (BOOL)buildString
id defaultColor = [_options objectForKey:DTDefaultTextColor];
if (defaultColor)
{
- if ([defaultColor isKindOfClass:[UIColor class]])
+ if ([defaultColor isKindOfClass:[DTImage class]])
{
- // already a UIColor
+ // already a DTColor
defaultTag.textColor = defaultColor;
}
else
{
// need to convert first
- defaultTag.textColor = [UIColor colorWithHTMLName:defaultColor];
+ defaultTag.textColor = [DTColor colorWithHTMLName:defaultColor];
}
}
@@ -643,7 +633,7 @@ - (void)_registerTagStartHandlers
if (color)
{
- currentTag.textColor = [UIColor colorWithHTMLName:color];
+ currentTag.textColor = [DTColor colorWithHTMLName:color];
}
};
View
8 Core/Source/DTHTMLElement.h
@@ -6,13 +6,15 @@
// Copyright 2011 Drobnik.com. All rights reserved.
//
-
+#import "DTCoreText.h"
+#import "DTColor+HTML.h"
@class DTCoreTextParagraphStyle;
@class DTCoreTextFontDescriptor;
@class DTTextAttachment;
@class DTCSSListStyle;
+
typedef enum
{
DTHTMLElementDisplayStyleInline = 0, // default
@@ -42,8 +44,8 @@ typedef enum
@property (nonatomic, copy) DTCoreTextParagraphStyle *paragraphStyle;
@property (nonatomic, strong) DTTextAttachment *textAttachment;
@property (nonatomic, copy) NSURL *link;
-@property (nonatomic, strong) UIColor *textColor;
-@property (nonatomic, strong) UIColor *backgroundColor;
+@property (nonatomic, strong) DTColor *textColor;
+@property (nonatomic, strong) DTColor *backgroundColor;
@property (nonatomic, copy) NSString *tagName;
@property (nonatomic, copy) NSString *text;
@property (nonatomic, copy) NSArray *shadows;
View
41 Core/Source/DTHTMLElement.m
@@ -9,16 +9,23 @@
#import "DTHTMLElement.h"
#import "DTCoreTextParagraphStyle.h"
#import "DTCoreTextFontDescriptor.h"
-#import "NSAttributedStringRunDelegates.h"
#import "NSString+HTML.h"
-#import "UIColor+HTML.h"
+#import "DTColor+HTML.h"
#import "NSCharacterSet+HTML.h"
#import "DTTextAttachment.h"
#import "NSAttributedString+HTML.h"
#import "NSMutableAttributedString+HTML.h"
#import "DTCSSListStyle.h"
+#import "DTCoreTextConstants.h"
+#import "DTImage+HTML.h"
+#import "DTColor+HTML.h"
+
+#if TARGET_OS_IPHONE
+#import "NSAttributedStringRunDelegates.h"
+#endif
+
@interface DTHTMLElement ()
@property (nonatomic, strong) NSMutableDictionary *fontCache;
@@ -38,8 +45,8 @@ @implementation DTHTMLElement
DTTextAttachment *textAttachment;
NSURL *link;
- UIColor *_textColor;
- UIColor *backgroundColor;
+ DTColor *_textColor;
+ DTColor *backgroundColor;
CTUnderlineStyle underlineStyle;
@@ -105,11 +112,12 @@ - (NSDictionary *)attributesDictionary
// add text attachment
if (textAttachment)
{
- // need run delegate for sizing
+#ifndef TARGET_OS_MAC
+ // need run delegate for sizing (only supported on iOS)
CTRunDelegateRef embeddedObjectRunDelegate = createEmbeddedObjectRunDelegate(textAttachment);
[tmpDict setObject:CFBridgingRelease(embeddedObjectRunDelegate) forKey:(id)kCTRunDelegateAttributeName];
- //CFRelease(embeddedObjectRunDelegate);
-
+#endif
+
// add attachment
[tmpDict setObject:textAttachment forKey:@"DTTextAttachment"];
@@ -126,7 +134,7 @@ - (NSDictionary *)attributesDictionary
if (shouldAddFont)
{
// try font cache first
- NSNumber *key = [NSNumber numberWithInt:[fontDescriptor hash]];
+ NSNumber *key = [NSNumber numberWithUnsignedInteger:[fontDescriptor hash]];
CTFontRef font = (__bridge CTFontRef)[self.fontCache objectForKey:key];
if (!font)
@@ -167,7 +175,7 @@ - (NSDictionary *)attributesDictionary
[tmpDict setObject:[NSNumber numberWithInteger:underlineStyle] forKey:(id)kCTUnderlineStyleAttributeName];
// we could set an underline color as well if we wanted, but not supported by HTML
- // [attributes setObject:(id)[UIColor redColor].CGColor forKey:(id)kCTUnderlineColorAttributeName];
+ // [attributes setObject:(id)[DTImage redColor].CGColor forKey:(id)kCTUnderlineColorAttributeName];
}
if (_textColor)
@@ -182,7 +190,7 @@ - (NSDictionary *)attributesDictionary
if (superscriptStyle)
{
- [tmpDict setObject:(id)[NSNumber numberWithInt:superscriptStyle] forKey:(id)kCTSuperscriptAttributeName];
+ [tmpDict setObject:(id)[NSNumber numberWithInteger:superscriptStyle] forKey:(id)kCTSuperscriptAttributeName];
}
// add paragraph style
@@ -290,11 +298,11 @@ - (NSAttributedString *)prefixForListItem
if (prefix)
{
- UIImage *image = nil;
+ DTImage *image = nil;
if (calculatedListStyle.imageName)
{
- image = [UIImage imageNamed:calculatedListStyle.imageName];
+ image = [DTImage imageNamed:calculatedListStyle.imageName];
if (!image)
{
@@ -316,10 +324,11 @@ - (NSAttributedString *)prefixForListItem
attachment.contentType = DTTextAttachmentTypeImage;
attachment.displaySize = image.size;
+#ifndef TARGET_OS_MAC
// need run delegate for sizing
CTRunDelegateRef embeddedObjectRunDelegate = createEmbeddedObjectRunDelegate(attachment);
[attributes setObject:CFBridgingRelease(embeddedObjectRunDelegate) forKey:(id)kCTRunDelegateAttributeName];
- //CFRelease(embeddedObjectRunDelegate);
+#endif
// add attachment
[attributes setObject:attachment forKey:@"DTTextAttachment"];
@@ -402,13 +411,13 @@ - (void)applyStyleDictionary:(NSDictionary *)styles
NSString *color = [styles objectForKey:@"color"];
if (color)
{
- self.textColor = [UIColor colorWithHTMLName:color];
+ self.textColor = [DTColor colorWithHTMLName:color];
}
NSString *bgColor = [styles objectForKey:@"background-color"];
if (bgColor)
{
- self.backgroundColor = [UIColor colorWithHTMLName:bgColor];
+ self.backgroundColor = [DTColor colorWithHTMLName:bgColor];
}
NSString *floatString = [styles objectForKey:@"float"];
@@ -878,7 +887,7 @@ - (NSMutableDictionary *)fontCache
return _fontCache;
}
-- (void)setTextColor:(UIColor *)textColor
+- (void)setTextColor:(DTColor *)textColor
{
if (_textColor != textColor)
{
View
23 Core/Source/DTImage+HTML.h
@@ -0,0 +1,23 @@
+
+
+#if TARGET_OS_IPHONE
+
+typedef UIImage DTImage;
+
+@interface UIImage (HTML)
+
+- (NSData *)dataForPNGRepresentation;
+
+@end
+
+#else
+
+typedef NSImage DTImage;
+
+@interface NSImage (HTML)
+
+- (NSData *)dataForPNGRepresentation;
+
+@end
+
+#endif
View
37 Core/Source/DTImage+HTML.m
@@ -0,0 +1,37 @@
+//
+// DTImage+HTML.m
+// DTCoreText
+//
+// Created by Oliver Drobnik on 31.01.12.
+// Copyright (c) 2012 Drobnik.com. All rights reserved.
+//
+
+#import "DTImage+HTML.h"
+
+#if TARGET_OS_IPHONE
+
+@implementation UIImage (HTML)
+
+- (NSData *)dataForPNGRepresentation
+{
+ return UIImagePNGRepresentation(self);
+}
+
+@end
+
+#else
+
+@implementation NSImage (HTML)
+
+- (NSData *)dataForPNGRepresentation
+{
+ [self lockFocus];
+ NSBitmapImageRep *bitmapRep = [[NSBitmapImageRep alloc] initWithFocusedViewRect:NSMakeRect(0, 0, self.size.width, self.size.height)];
+ [self unlockFocus];
+
+ return [bitmapRep representationUsingType:NSPNGFileType properties:Nil];
+}
+
+@end
+
+#endif
View
3 Core/Source/DTLazyImageView.h
@@ -16,8 +16,7 @@
- (void)lazyImageView:(DTLazyImageView *)lazyImageView didChangeImageSize:(CGSize)size;
@end
-@interface DTLazyImageView : UIImageView
-
+@interface DTLazyImageView : UIImageView
@property (nonatomic, strong) NSURL *url;
@property (nonatomic, assign) BOOL shouldShowProgressiveDownload;
View
2 Core/Source/DTLinkButton.m
@@ -8,7 +8,7 @@
#import "DTLinkButton.h"
#import "CGUtils.h"
-#import "UIColor+HTML.h"
+#import "DTColor+HTML.h"
@interface DTLinkButton ()
View
14 Core/Source/DTTextAttachment.m
@@ -11,6 +11,7 @@
#import "CGUtils.h"
#import "NSAttributedString+HTML.h"
#import "NSData+DTBase64.h"
+#import "DTImage+HTML.h"
@implementation DTTextAttachment
{
@@ -71,7 +72,7 @@ + (DTTextAttachment *)textAttachmentWithElement:(DTHTMLElement *)element options
NSString *src = [element attributeForKey:@"src"];
NSURL *contentURL = nil;
- UIImage *decodedImage = nil;
+ DTImage *decodedImage = nil;
// decode content URL
@@ -84,7 +85,7 @@ + (DTTextAttachment *)textAttachmentWithElement:(DTHTMLElement *)element options
NSString *encodedData = [src substringFromIndex:range.location + range.length];
NSData *decodedData = [NSData dataFromBase64String:encodedData];
- decodedImage = [UIImage imageWithData:decodedData];
+ decodedImage = [[DTImage alloc] initWithData:decodedData];
if (!displaySize.width || !displaySize.height)
{
@@ -126,7 +127,7 @@ + (DTTextAttachment *)textAttachmentWithElement:(DTHTMLElement *)element options
// inspect local file
if ([contentURL isFileURL])
{
- UIImage *image = [UIImage imageWithContentsOfFile:[contentURL path]];
+ DTImage *image = [[DTImage alloc] initWithContentsOfFile:[contentURL path]];
originalSize = image.size;
if (!displaySize.width || !displaySize.height)
@@ -186,12 +187,13 @@ + (DTTextAttachment *)textAttachmentWithElement:(DTHTMLElement *)element options
// makes a data URL of the image
- (NSString *)dataURLRepresentation
{
- if (!contents || contentType != DTTextAttachmentTypeImage)
+ if ((contents==nil) || contentType != DTTextAttachmentTypeImage)
{
return nil;
}
- NSData *data = UIImagePNGRepresentation(contents);
+ DTImage *image = (DTImage *)contents;
+ NSData *data = [image dataForPNGRepresentation];
NSString *encoded = [data base64EncodedString];
return [@"data:image/png;base64," stringByAppendingString:encoded];
@@ -212,7 +214,7 @@ - (id)contents
{
if (contentType == DTTextAttachmentTypeImage && _contentURL && [_contentURL isFileURL])
{
- UIImage *image = [UIImage imageWithContentsOfFile:[_contentURL path]];
+ DTImage *image = [[DTImage alloc] initWithContentsOfFile:[_contentURL path]];
return image;
}
View
3 Core/Source/NSAttributedString+HTML.h
@@ -19,9 +19,6 @@
// convenience methods
+ (NSAttributedString *)attributedStringWithHTML:(NSData *)data options:(NSDictionary *)options;
-// utilities
-+ (NSAttributedString *)synthesizedSmallCapsAttributedStringWithText:(NSString *)text attributes:(NSDictionary *)attributes;
-
// attachment handling
- (NSArray *)textAttachmentsWithPredicate:(NSPredicate *)predicate;
View
47 Core/Source/NSAttributedString+HTML.m
@@ -13,7 +13,7 @@
#import "NSMutableAttributedString+HTML.h"
#import "NSString+HTML.h"
-#import "UIColor+HTML.h"
+#import "DTColor+HTML.h"
#import "NSScanner+HTML.h"
#import "NSCharacterSet+HTML.h"
#import "NSAttributedStringRunDelegates.h"
@@ -89,47 +89,6 @@ + (NSAttributedString *)attributedStringWithHTML:(NSData *)data options:(NSDicti
}
#pragma mark Utlities
-
-+ (NSAttributedString *)synthesizedSmallCapsAttributedStringWithText:(NSString *)text attributes:(NSDictionary *)attributes
-{
- CTFontRef normalFont = (__bridge CTFontRef)[attributes objectForKey:(id)kCTFontAttributeName];
-
- DTCoreTextFontDescriptor *smallerFontDesc = [DTCoreTextFontDescriptor fontDescriptorForCTFont:normalFont];
- smallerFontDesc.pointSize *= 0.7;
- CTFontRef smallerFont = [smallerFontDesc newMatchingFont];
-
- NSMutableDictionary *smallAttributes = [attributes mutableCopy];
- [smallAttributes setObject:CFBridgingRelease(smallerFont) forKey:(id)kCTFontAttributeName];
- //CFRelease(smallerFont);
-
- NSMutableAttributedString *tmpString = [[NSMutableAttributedString alloc] init];
- NSScanner *scanner = [NSScanner scannerWithString:text];
- [scanner setCharactersToBeSkipped:nil];
-
- NSCharacterSet *lowerCaseChars = [NSCharacterSet lowercaseLetterCharacterSet];
-
- while (![scanner isAtEnd])
- {
- NSString *part;
-
- if ([scanner scanCharactersFromSet:lowerCaseChars intoString:&part])
- {
- part = [part uppercaseString];
- NSAttributedString *partString = [[NSAttributedString alloc] initWithString:part attributes:smallAttributes];
- [tmpString appendAttributedString:partString];
- }
-
- if ([scanner scanUpToCharactersFromSet:lowerCaseChars intoString:&part])
- {
- NSAttributedString *partString = [[NSAttributedString alloc] initWithString:part attributes:attributes];
- [tmpString appendAttributedString:partString];
- }
- }
-
-
- return tmpString;
-}
-
- (NSArray *)textAttachmentsWithPredicate:(NSPredicate *)predicate
{
NSMutableArray *tmpArray = [NSMutableArray array];
@@ -397,15 +356,15 @@ - (NSString *)htmlString
CGColorRef textColor = (__bridge CGColorRef)[attributes objectForKey:(id)kCTForegroundColorAttributeName];
if (textColor)
{
- UIColor *color = [UIColor colorWithCGColor:textColor];
+ DTColor *color = [DTColor colorWithCGColor:textColor];
fontStyle = [fontStyle stringByAppendingFormat:@"color:#%@;", [color htmlHexString]];
}
CGColorRef backgroundColor = (__bridge CGColorRef)[attributes objectForKey:@"DTBackgroundColor"];
if (backgroundColor)
{
- UIColor *color = [UIColor colorWithCGColor:backgroundColor];
+ DTColor *color = [DTColor colorWithCGColor:backgroundColor];
fontStyle = [fontStyle stringByAppendingFormat:@"background-color:#%@;", [color htmlHexString]];
}
View
16 Core/Source/NSAttributedString+SmallCaps.h
@@ -0,0 +1,16 @@
+//
+// NSAttributedString+SmallCaps.h
+// DTCoreText
+//
+// Created by Oliver Drobnik on 31.01.12.
+// Copyright (c) 2012 Drobnik.com. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+
+@interface NSAttributedString (SmallCaps)
+
+// utilities
++ (NSAttributedString *)synthesizedSmallCapsAttributedStringWithText:(NSString *)text attributes:(NSDictionary *)attributes;
+
+@end
View
54 Core/Source/NSAttributedString+SmallCaps.m
@@ -0,0 +1,54 @@
+//
+// NSAttributedString+SmallCaps.m
+// DTCoreText
+//
+// Created by Oliver Drobnik on 31.01.12.
+// Copyright (c) 2012 Drobnik.com. All rights reserved.
+//
+
+#import "NSAttributedString+SmallCaps.h"
+#import "DTCoreText.h"
+
+@implementation NSAttributedString (SmallCaps)
+
++ (NSAttributedString *)synthesizedSmallCapsAttributedStringWithText:(NSString *)text attributes:(NSDictionary *)attributes
+{
+ CTFontRef normalFont = (__bridge CTFontRef)[attributes objectForKey:(id)kCTFontAttributeName];
+
+ DTCoreTextFontDescriptor *smallerFontDesc = [DTCoreTextFontDescriptor fontDescriptorForCTFont:normalFont];
+ smallerFontDesc.pointSize *= 0.7;
+ CTFontRef smallerFont = [smallerFontDesc newMatchingFont];
+
+ NSMutableDictionary *smallAttributes = [attributes mutableCopy];
+ [smallAttributes setObject:CFBridgingRelease(smallerFont) forKey:(id)kCTFontAttributeName];
+ //CFRelease(smallerFont);
+
+ NSMutableAttributedString *tmpString = [[NSMutableAttributedString alloc] init];
+ NSScanner *scanner = [NSScanner scannerWithString:text];
+ [scanner setCharactersToBeSkipped:nil];
+
+ NSCharacterSet *lowerCaseChars = [NSCharacterSet lowercaseLetterCharacterSet];
+
+ while (![scanner isAtEnd])
+ {
+ NSString *part;
+
+ if ([scanner scanCharactersFromSet:lowerCaseChars intoString:&part])
+ {
+ part = [part uppercaseString];
+ NSAttributedString *partString = [[NSAttributedString alloc] initWithString:part attributes:smallAttributes];
+ [tmpString appendAttributedString:partString];
+ }
+
+ if ([scanner scanUpToCharactersFromSet:lowerCaseChars intoString:&part])
+ {
+ NSAttributedString *partString = [[NSAttributedString alloc] initWithString:part attributes:attributes];
+ [tmpString appendAttributedString:partString];
+ }
+ }
+
+
+ return tmpString;
+}
+
+@end
View
2 Core/Source/NSAttributedStringRunDelegates.h
@@ -6,7 +6,9 @@
// Copyright 2011 Drobnik.com. All rights reserved.
//
+#if TARGET_OS_IPHONE
#import <CoreText/CoreText.h>
+#endif
void embeddedObjectDeallocCallback(void *context);
CGFloat embeddedObjectGetAscentCallback(void *context);
View
2 Core/Source/NSCharacterSet+HTML.h
@@ -6,7 +6,7 @@
// Copyright 2011 Drobnik.com. All rights reserved.
//
-
+#import <Foundation/Foundation.h>
@interface NSCharacterSet (HTML)
View
6 Core/Source/NSMutableAttributedString+HTML.m
@@ -8,11 +8,7 @@
#import "NSMutableAttributedString+HTML.h"
-#import <CoreText/CoreText.h>
-#import "DTCoreTextParagraphStyle.h"
-
-//#import "DTRangedAttributesOptimizer.h"
-
+#import "DTCoreText.h"
@implementation NSMutableAttributedString (HTML)
View
1 Core/Source/NSScanner+HTML.h
@@ -16,3 +16,4 @@
- (void)logPosition;
@end
+
View
19 Core/Source/NSString+CSS.h
@@ -0,0 +1,19 @@
+//
+// NSString+CSS.h
+// DTCoreText
+//
+// Created by Oliver Drobnik on 31.01.12.
+// Copyright (c) 2012 Drobnik.com. All rights reserved.
+//
+
+#import "DTCoreText.h"
+#import "DTColor+HTML.h"
+
+@interface NSString (CSS)
+
+- (NSDictionary *)dictionaryOfCSSStyles;
+- (CGFloat)pixelSizeOfCSSMeasureRelativeToCurrentTextSize:(CGFloat)textSize;
+- (NSArray *)arrayOfCSSShadowsWithCurrentTextSize:(CGFloat)textSize currentColor:(DTColor *)color;
+- (CGFloat)CSSpixelSize;
+
+@end
View
227 Core/Source/NSString+CSS.m
@@ -0,0 +1,227 @@
+//
+// NSString+CSS.m
+// DTCoreText
+//
+// Created by Oliver Drobnik on 31.01.12.
+// Copyright (c) 2012 Drobnik.com. All rights reserved.
+//
+
+#import "NSString+CSS.h"
+
+#import "DTColor+HTML.h"
+
+@implementation NSString (CSS)
+
+#pragma mark CSS
+
+- (NSDictionary *)dictionaryOfCSSStyles
+{
+ // font-size:14px;
+ NSScanner *scanner = [NSScanner scannerWithString:self];
+
+ NSString *name = nil;
+ NSString *value = nil;
+
+ NSMutableDictionary *tmpDict = [NSMutableDictionary dictionary];
+
+ while ([scanner scanCSSAttribute:&name value:&value])
+ {
+ [tmpDict setObject:value forKey:name];
+ }
+
+ // converting to non-mutable costs 37.5% of method
+ // return [NSDictionary dictionaryWithDictionary:tmpDict];
+ return tmpDict;
+}
+
+- (CGFloat)pixelSizeOfCSSMeasureRelativeToCurrentTextSize:(CGFloat)textSize
+{
+ NSUInteger stringLength = [self length];
+ unichar *_characters = calloc(stringLength, sizeof(unichar));
+ [self getCharacters:_characters range:NSMakeRange(0, stringLength)];
+
+ CGFloat value = 0;
+
+ BOOL commaSeen = NO;
+ NSUInteger digitsPastComma = 0;
+
+ NSUInteger i=0;
+
+ for (; i<stringLength; i++)
+ {
+ unichar ch = _characters[i];
+
+ if (ch>='0' && ch<='9')
+ {
+ float digit = (float)(ch-'0');
+ value *= 10.0f;
+ value += digit;
+
+ if (commaSeen)
+ {
+ digitsPastComma++;
+ }
+ }
+ else if (ch=='.')
+ {
+ commaSeen = YES;
+ }
+ else
+ {
+ // non-numeric character
+ break;
+ }
+ }
+
+ if (commaSeen)
+ {
+ value /= powf(10.0f, digitsPastComma);
+ }
+
+ // skip whitespace
+ while (i<stringLength && IS_WHITESPACE(_characters[i]))
+ {
+ i++;
+ }
+
+ if (i<stringLength)
+ {
+ unichar ch = _characters[i++];
+
+ if (ch == '%')
+ {
+ // percent value
+ value *= textSize / 100.0f;
+ }
+ else if (ch == 'e')
+ {
+ if (i<stringLength)
+ {
+ if (_characters[i] == 'm')
+ {
+ // em value
+ value *= textSize;
+ }
+ }
+ }
+ }
+
+ free(_characters);
+ return value;
+}
+
+- (NSArray *)arrayOfCSSShadowsWithCurrentTextSize:(CGFloat)textSize currentColor:(DTColor *)color
+{
+ NSArray *shadows = [self componentsSeparatedByString:@","];
+
+ NSMutableArray *tmpArray = [NSMutableArray array];
+
+ for (NSString *oneShadow in shadows)
+ {
+ NSScanner *scanner = [NSScanner scannerWithString:oneShadow];
+
+
+ NSString *element = nil;
+
+ if ([scanner scanUpToCharactersFromSet:[NSCharacterSet whitespaceAndNewlineCharacterSet] intoString:&element])
+ {
+ // check if first element is a color
+
+ DTColor *shadowColor = [DTColor colorWithHTMLName:element];
+
+ NSString *offsetXString = nil;
+ NSString *offsetYString = nil;
+ NSString *blurString = nil;
+ NSString *colorString = nil;
+
+ if (shadowColor)
+ {
+ // format: <color> <length> <length> <length>?
+
+ if ([scanner scanUpToCharactersFromSet:[NSCharacterSet whitespaceAndNewlineCharacterSet] intoString:&offsetXString])
+ {
+ if ([scanner scanUpToCharactersFromSet:[NSCharacterSet whitespaceAndNewlineCharacterSet] intoString:&offsetYString])
+ {
+ // blur is optional
+ [scanner scanUpToCharactersFromSet:[NSCharacterSet whitespaceAndNewlineCharacterSet] intoString:&blurString];
+
+
+ CGFloat offset_x = [offsetXString pixelSizeOfCSSMeasureRelativeToCurrentTextSize:textSize];
+ CGFloat offset_y = [offsetYString pixelSizeOfCSSMeasureRelativeToCurrentTextSize:textSize];
+ CGSize offset = CGSizeMake(offset_x, offset_y);
+ CGFloat blur = [blurString pixelSizeOfCSSMeasureRelativeToCurrentTextSize:textSize];
+
+ NSDictionary *shadowDict = [NSDictionary dictionaryWithObjectsAndKeys:[NSValue valueWithCGSize:offset], @"Offset",
+ [NSNumber numberWithFloat:blur], @"Blur",
+ shadowColor, @"Color", nil];
+
+ [tmpArray addObject:shadowDict];
+ }
+ }
+ }
+ else
+ {
+ // format: <length> <length> <length>? <color>?
+
+ offsetXString = element;
+
+ if ([scanner scanUpToCharactersFromSet:[NSCharacterSet whitespaceAndNewlineCharacterSet] intoString:&offsetYString])
+ {
+ // blur is optional
+ if ([scanner scanUpToCharactersFromSet:[NSCharacterSet whitespaceAndNewlineCharacterSet] intoString:&blurString])
+ {
+ // check if it's a color
+ shadowColor = [DTColor colorWithHTMLName:blurString];
+
+ if (shadowColor)
+ {
+ blurString = nil;
+ }
+ }
+
+ // color is optional, or we might already have one from the blur position
+ if (!shadowColor && [scanner scanUpToCharactersFromSet:[NSCharacterSet whitespaceAndNewlineCharacterSet] intoString:&colorString])
+ {
+ shadowColor = [DTColor colorWithHTMLName:colorString];
+ }
+
+ // if we still don't have a color, it's the current color attributed
+ if (!shadowColor)
+ {
+ // color is same as color attribute of style
+ shadowColor = color;
+ }
+
+ CGFloat offset_x = [offsetXString pixelSizeOfCSSMeasureRelativeToCurrentTextSize:textSize];
+ CGFloat offset_y = [offsetYString pixelSizeOfCSSMeasureRelativeToCurrentTextSize:textSize];
+ CGSize offset = CGSizeMake(offset_x, offset_y);
+ CGFloat blur = [blurString pixelSizeOfCSSMeasureRelativeToCurrentTextSize:textSize];
+
+ NSDictionary *shadowDict = [NSDictionary dictionaryWithObjectsAndKeys:[NSValue valueWithCGSize:offset], @"Offset",
+ [NSNumber numberWithFloat:blur], @"Blur",
+ shadowColor, @"Color", nil];
+
+ [tmpArray addObject:shadowDict];
+
+
+ }
+
+ }
+ }
+ }
+
+
+ return [NSArray arrayWithArray:tmpArray];
+}
+
+- (CGFloat)CSSpixelSize
+{
+ if ([self hasSuffix:@"px"])
+ {
+ return [self floatValue];
+ }
+
+ return [self floatValue];
+}
+
+@end
View
9 Core/Source/NSString+HTML.h
@@ -6,9 +6,8 @@
// Copyright 2011 Drobnik.com. All rights reserved.
//
+//#import <Foundation/Foundation.h>
-#define UNICODE_OBJECT_PLACEHOLDER @"\ufffc"
-#define UNICODE_LINE_FEED @"\u2028"
@interface NSString (HTML)
@@ -22,12 +21,6 @@
- (NSString *)stringByAddingHTMLEntities;
- (NSString *)stringByReplacingHTMLEntities;
-// CSS
-- (NSDictionary *)dictionaryOfCSSStyles;
-- (CGFloat)pixelSizeOfCSSMeasureRelativeToCurrentTextSize:(CGFloat)textSize;
-- (NSArray *)arrayOfCSSShadowsWithCurrentTextSize:(CGFloat)textSize currentColor:(UIColor *)color;
-- (CGFloat)CSSpixelSize;
-
// Utility
+ (NSString *)guid;
View
219 Core/Source/NSString+HTML.m
@@ -7,15 +7,12 @@
//
#import "NSString+HTML.h"
-#import "NSScanner+HTML.h"
-#import "UIColor+HTML.h"
-#import "NSCharacterSet+HTML.h"
+#import "DTCoreText.h"
+
static NSDictionary *entityLookup = nil;
static NSDictionary *entityReverseLookup = nil;
-#define IS_WHITESPACE(_c) (_c == ' ' || _c == '\t' || _c == 0xA || _c == 0xB || _c == 0xC || _c == 0xD || _c == 0x85)
-
@implementation NSString (HTML)
- (NSUInteger)integerValueFromHex
@@ -695,218 +692,6 @@ - (NSString *)stringByReplacingHTMLEntities
return [NSString stringWithString:output];
}
-#pragma mark CSS
-
-- (NSDictionary *)dictionaryOfCSSStyles
-{
- // font-size:14px;
- NSScanner *scanner = [NSScanner scannerWithString:self];
-
- NSString *name = nil;
- NSString *value = nil;
-
- NSMutableDictionary *tmpDict = [NSMutableDictionary dictionary];
-
- while ([scanner scanCSSAttribute:&name value:&value])
- {
- [tmpDict setObject:value forKey:name];
- }
-
- // converting to non-mutable costs 37.5% of method
- // return [NSDictionary dictionaryWithDictionary:tmpDict];
- return tmpDict;
-}
-
-- (CGFloat)pixelSizeOfCSSMeasureRelativeToCurrentTextSize:(CGFloat)textSize
-{
- NSUInteger stringLength = [self length];
- unichar *_characters = calloc(stringLength, sizeof(unichar));
- [self getCharacters:_characters range:NSMakeRange(0, stringLength)];
-
- CGFloat value = 0;
-
- BOOL commaSeen = NO;
- NSUInteger digitsPastComma = 0;
-
- NSUInteger i=0;
-
- for (; i<stringLength; i++)
- {
- unichar ch = _characters[i];
-
- if (ch>='0' && ch<='9')
- {
- float digit = (float)(ch-'0');
- value *= 10.0f;
- value += digit;
-
- if (commaSeen)
- {
- digitsPastComma++;
- }
- }
- else if (ch=='.')
- {
- commaSeen = YES;
- }
- else
- {
- // non-numeric character
- break;
- }
- }
-
- if (commaSeen)
- {
- value /= powf(10.0f, digitsPastComma);
- }
-
- // skip whitespace
- while (i<stringLength && IS_WHITESPACE(_characters[i]))
- {
- i++;
- }
-
- if (i<stringLength)
- {
- unichar ch = _characters[i++];
-
- if (ch == '%')
- {
- // percent value
- value *= textSize / 100.0f;
- }
- else if (ch == 'e')
- {
- if (i<stringLength)
- {
- if (_characters[i] == 'm')
- {
- // em value
- value *= textSize;
- }
- }
- }
- }
-
- free(_characters);
- return value;
-}
-
-- (NSArray *)arrayOfCSSShadowsWithCurrentTextSize:(CGFloat)textSize currentColor:(UIColor *)color
-{
- NSArray *shadows = [self componentsSeparatedByString:@","];
-
- NSMutableArray *tmpArray = [NSMutableArray array];
-
- for (NSString *oneShadow in shadows)
- {
- NSScanner *scanner = [NSScanner scannerWithString:oneShadow];
-
-
- NSString *element = nil;
-
- if ([scanner scanUpToCharactersFromSet:[NSCharacterSet whitespaceAndNewlineCharacterSet] intoString:&element])
- {
- // check if first element is a color
-
- UIColor *shadowColor = [UIColor colorWithHTMLName:element];
-
- NSString *offsetXString = nil;
- NSString *offsetYString = nil;
- NSString *blurString = nil;
- NSString *colorString = nil;
-
- if (shadowColor)
- {
- // format: <color> <length> <length> <length>?
-
- if ([scanner scanUpToCharactersFromSet:[NSCharacterSet whitespaceAndNewlineCharacterSet] intoString:&offsetXString])
- {
- if ([scanner scanUpToCharactersFromSet:[NSCharacterSet whitespaceAndNewlineCharacterSet] intoString:&offsetYString])
- {
- // blur is optional
- [scanner scanUpToCharactersFromSet:[NSCharacterSet whitespaceAndNewlineCharacterSet] intoString:&blurString];
-
-
- CGFloat offset_x = [offsetXString pixelSizeOfCSSMeasureRelativeToCurrentTextSize:textSize];
- CGFloat offset_y = [offsetYString pixelSizeOfCSSMeasureRelativeToCurrentTextSize:textSize];
- CGSize offset = CGSizeMake(offset_x, offset_y);
- CGFloat blur = [blurString pixelSizeOfCSSMeasureRelativeToCurrentTextSize:textSize];
-
- NSDictionary *shadowDict = [NSDictionary dictionaryWithObjectsAndKeys:[NSValue valueWithCGSize:offset], @"Offset",
- [NSNumber numberWithFloat:blur], @"Blur",
- shadowColor, @"Color", nil];
-
- [tmpArray addObject:shadowDict];
- }
- }
- }
- else
- {
- // format: <length> <length> <length>? <color>?
-
- offsetXString = element;
-
- if ([scanner scanUpToCharactersFromSet:[NSCharacterSet whitespaceAndNewlineCharacterSet] intoString:&offsetYString])
- {
- // blur is optional
- if ([scanner scanUpToCharactersFromSet:[NSCharacterSet whitespaceAndNewlineCharacterSet] intoString:&blurString])
- {
- // check if it's a color
- shadowColor = [UIColor colorWithHTMLName:blurString];
-
- if (shadowColor)
- {
- blurString = nil;
- }
- }
-
- // color is optional, or we might already have one from the blur position
- if (!shadowColor && [scanner scanUpToCharactersFromSet:[NSCharacterSet whitespaceAndNewlineCharacterSet] intoString:&colorString])
- {
- shadowColor = [UIColor colorWithHTMLName:colorString];
- }
-
- // if we still don't have a color, it's the current color attributed
- if (!shadowColor)
- {
- // color is same as color attribute of style
- shadowColor = color;
- }
-
- CGFloat offset_x = [offsetXString pixelSizeOfCSSMeasureRelativeToCurrentTextSize:textSize];
- CGFloat offset_y = [offsetYString pixelSizeOfCSSMeasureRelativeToCurrentTextSize:textSize];
- CGSize offset = CGSizeMake(offset_x, offset_y);
- CGFloat blur = [blurString pixelSizeOfCSSMeasureRelativeToCurrentTextSize:textSize];
-
- NSDictionary *shadowDict = [NSDictionary dictionaryWithObjectsAndKeys:[NSValue valueWithCGSize:offset], @"Offset",
- [NSNumber numberWithFloat:blur], @"Blur",
- shadowColor, @"Color", nil];
-
- [tmpArray addObject:shadowDict];
-
-
- }
-
- }
- }
- }
-
-
- return [NSArray arrayWithArray:tmpArray];
-}
-
-- (CGFloat)CSSpixelSize
-{
- if ([self hasSuffix:@"px"])
- {
- return [self floatValue];
- }
-
- return [self floatValue];
-}
-
#pragma mark Utility
+ (NSString *)guid
{
View
19 Core/Source/UIColor+HTML.h
@@ -1,19 +0,0 @@
-//
-// UIColor+HTML.h
-// CoreTextExtensions
-//
-// Created by Oliver Drobnik on 1/9/11.
-// Copyright 2011 Drobnik.com. All rights reserved.
-//
-
-@interface UIColor (HTML)
-
-+ (UIColor *)colorWithHexString:(NSString *)hex;
-+ (UIColor *)colorWithHTMLName:(NSString *)name;
-
-- (CGFloat)alpha;
-- (UIColor *)invertedColor;
-
-- (NSString *)htmlHexString;
-
-@end
View
6 Core/Test/MacUnitTest-Prefix.pch
@@ -4,4 +4,10 @@
#ifdef __OBJC__
#import <Cocoa/Cocoa.h>
+ #import <Foundation/Foundation.h>
+ #import <AppKit/AppKit.h>
+#import "DTCoreText.h"
#endif
+
+#define CGSizeValue sizeValue
+#define valueWithCGSize valueWithSize
View
29 Core/Test/MacUnitTest.m
@@ -93,12 +93,12 @@ - (void)internalTestCaseWithURL:(NSURL *)URL withTempPath:(NSString *)tempPath
NSString *macString = [macAttributedString string];
-// // our own builder
-// DTHTMLAttributedStringBuilder *doc = [[DTHTMLAttributedStringBuilder alloc] initWithHTML:testData options:nil documentAttributes:NULL];
-//
-// [doc buildString];
-//
-// NSString *iosString = [doc generatedAttributedString];
+ // our own builder
+ DTHTMLAttributedStringBuilder *doc = [[DTHTMLAttributedStringBuilder alloc] initWithHTML:testData options:nil documentAttributes:NULL];
+
+ [doc buildString];
+
+ NSAttributedString *iosString = [doc generatedAttributedString];
// Create characters view
NSMutableString *dumpOutput = [[NSMutableString alloc] init];
@@ -111,8 +111,25 @@ - (void)internalTestCaseWithURL:(NSURL *)URL withTempPath:(NSString *)tempPath
[dumpOutput appendFormat:@"%x %c\n", b, b];
}
+ NSDictionary *attributes = nil;
+ NSRange effectiveRange = NSMakeRange(0, 0);
+
+ while ((attributes = [macAttributedString attributesAtIndex:effectiveRange.location effectiveRange:&effectiveRange]))
+ {
+ [dumpOutput appendFormat:@"Range: (%d, %d), %@\n\n", effectiveRange.location, effectiveRange.length, attributes];
+ effectiveRange.location += effectiveRange.length;
+
+ if (effectiveRange.location >= [macString length])
+ {
+ break;
+ }
+ }
+
NSLog(@"%@", dumpOutput);
+
+
+
// NSLog(@"%@", iosString);
}
View
38 Core/Test/UIColorHTMLTest.m
@@ -7,57 +7,57 @@
//
#import "UIColorHTMLTest.h"
-#import "UIColor+HTML.h"
+#import "DTColor+HTML.h"
@implementation UIColorHTMLTest
- (void) testValidColorWithHexString
{
- UIColor *htmlColor;
- UIColor *namedColor;
+ DTColor *htmlColor;
+ DTColor *namedColor;
- namedColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1.0];
- htmlColor = [UIColor colorWithHexString:@"000000"];
+ namedColor = [DTColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1.0];
+ htmlColor = [DTColor colorWithHexString:@"000000"];
STAssertNotNil(htmlColor, @"Failed to create black color");
STAssertEqualObjects(namedColor, htmlColor, @"Hmmm... black is not black");
- namedColor = [UIColor colorWithRed:1.0 green:1.0 blue:1.0 alpha:1.0];
- htmlColor = [UIColor colorWithHexString:@"FFFFFF"];
+ namedColor = [DTColor colorWithRed:1.0 green:1.0 blue:1.0 alpha:1.0];
+ htmlColor = [DTColor colorWithHexString:@"FFFFFF"];
STAssertNotNil(htmlColor, @"Failed to create white color");
STAssertEqualObjects(namedColor, htmlColor, @"Hmmm... white is not white");
- namedColor = [UIColor colorWithRed:1.0 green:0.0 blue:0.0 alpha:1.0];
- htmlColor = [UIColor colorWithHexString:@"FF0000"];
+ namedColor = [DTColor colorWithRed:1.0 green:0.0 blue:0.0 alpha:1.0];
+ htmlColor = [DTColor colorWithHexString:@"FF0000"];
STAssertNotNil(htmlColor, @"Failed to create red color");
STAssertEqualObjects(namedColor, htmlColor, @"Hmmm... red is not red");
- namedColor = [UIColor colorWithRed:0.0 green:1.0 blue:0.0 alpha:1.0];
- htmlColor = [UIColor colorWithHexString:@"00FF00"];
+ namedColor = [DTColor colorWithRed:0.0 green:1.0 blue:0.0 alpha:1.0];
+ htmlColor = [DTColor colorWithHexString:@"00FF00"];
STAssertNotNil(htmlColor, @"Failed to create green color");
STAssertEqualObjects(namedColor, htmlColor, @"Hmmm... green is not green");
- namedColor = [UIColor colorWithRed:0.0 green:0.0 blue:1.0 alpha:1.0];
- htmlColor = [UIColor colorWithHexString:@"0000FF"];
+ namedColor = [DTColor colorWithRed:0.0 green:0.0 blue:1.0 alpha:1.0];
+ htmlColor = [DTColor colorWithHexString:@"0000FF"];
STAssertNotNil(htmlColor, @"Failed to create blue color");
STAssertEqualObjects(namedColor, htmlColor, @"Hmmm... blue is not blue");
- namedColor = [UIColor colorWithRed:1.0 green:0.0 blue:1.0 alpha:1.0];
- htmlColor = [UIColor colorWithHexString:@"F0F"];
+ namedColor = [DTColor colorWithRed:1.0 green:0.0 blue:1.0 alpha:1.0];
+ htmlColor = [DTColor colorWithHexString:@"F0F"];
STAssertNotNil(htmlColor, @"Failed to create purple color");
STAssertEqualObjects(namedColor, htmlColor, @"Hmmm... purple is not purple");
}
- (void) testColorHTMLHexString {
- UIColor *red = [UIColor redColor];
+ DTColor *red = [DTColor redColor];
STAssertEqualObjects([red htmlHexString], @"ff0000", nil);
- UIColor *green = [UIColor greenColor];
+ DTColor *green = [DTColor greenColor];
STAssertEqualObjects([green htmlHexString], @"00ff00", nil);
- UIColor *blue = [UIColor blueColor];
+ DTColor *blue = [DTColor blueColor];
STAssertEqualObjects([blue htmlHexString], @"0000ff", nil);
- UIColor *white = [UIColor whiteColor];
+ DTColor *white = [DTColor whiteColor];
STAssertEqualObjects([white htmlHexString], @"ffffff", nil);
}
View
188 DTCoreText.xcodeproj/project.pbxproj
@@ -129,10 +129,10 @@
A788C9FE14863E8700E1AFD9 /* NSURL+HTML.h in Headers */ = {isa = PBXBuildFile; fileRef = A788C95014863E8700E1AFD9 /* NSURL+HTML.h */; settings = {ATTRIBUTES = (Public, ); }; };
A788CA0014863E8700E1AFD9 /* NSURL+HTML.m in Sources */ = {isa = PBXBuildFile; fileRef = A788C95114863E8700E1AFD9 /* NSURL+HTML.m */; };
A788CA0114863E8700E1AFD9 /* NSURL+HTML.m in Sources */ = {isa = PBXBuildFile; fileRef = A788C95114863E8700E1AFD9 /* NSURL+HTML.m */; };
- A788CA0214863E8700E1AFD9 /* UIColor+HTML.h in Headers */ = {isa = PBXBuildFile; fileRef = A788C95214863E8700E1AFD9 /* UIColor+HTML.h */; settings = {ATTRIBUTES = (Public, ); }; };
- A788CA0314863E8700E1AFD9 /* UIColor+HTML.h in Headers */ = {isa = PBXBuildFile; fileRef = A788C95214863E8700E1AFD9 /* UIColor+HTML.h */; settings = {ATTRIBUTES = (Public, ); }; };
- A788CA0514863E8700E1AFD9 /* UIColor+HTML.m in Sources */ = {isa = PBXBuildFile; fileRef = A788C95314863E8700E1AFD9 /* UIColor+HTML.m */; };
- A788CA0614863E8700E1AFD9 /* UIColor+HTML.m in Sources */ = {isa = PBXBuildFile; fileRef = A788C95314863E8700E1AFD9 /* UIColor+HTML.m */; };
+ A788CA0214863E8700E1AFD9 /* DTColor+HTML.h in Headers */ = {isa = PBXBuildFile; fileRef = A788C95214863E8700E1AFD9 /* DTColor+HTML.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 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 */; };
A788CA0F14863E8700E1AFD9 /* UIDevice+DTVersion.m in Sources */ = {isa = PBXBuildFile; fileRef = A788C95714863E8700E1AFD9 /* UIDevice+DTVersion.m */; };
@@ -168,7 +168,7 @@
A788CA7C148645A600E1AFD9 /* SenTestingKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A788CA7B148645A600E1AFD9 /* SenTestingKit.framework */; };
A788CA7D148646EA00E1AFD9 /* NSAttributedStringHTMLTest.m in Sources */ = {isa = PBXBuildFile; fileRef = A788CA581486407800E1AFD9 /* NSAttributedStringHTMLTest.m */; };
A788CA7E148646EA00E1AFD9 /* NSStringHTMLTest.m in Sources */ = {isa = PBXBuildFile; fileRef = A788CA5A1486407800E1AFD9 /* NSStringHTMLTest.m */; };
- A788CA7F1486474D00E1AFD9 /* UIColor+HTML.m in Sources */ = {isa