Skip to content
Browse files

Merge branch 'release-1.6.10'

  • Loading branch information...
2 parents 8a28291 + 2ce8db3 commit 1059330f7eb6c4b4016ccbfc74e1a410bf8c748e @odrobnik odrobnik committed Dec 18, 2013
View
2 .travis.yml
@@ -5,7 +5,7 @@ before_script:
- sudo easy_install cpp-coveralls
script:
- - xctool project DTCoreText.xcodeproj -scheme DemoApp build test -sdk iphonesimulator -arch i386 ONLY_ACTIVE_ARCH=NO
+ - xctool project DTCoreText.xcodeproj -scheme DemoApp build test -sdk iphonesimulator6.1 -arch i386 ONLY_ACTIVE_ARCH=NO
- xctool project DTCoreText.xcodeproj -scheme "Mac Framework" test -arch x86_64 ONLY_ACTIVE_ARCH=NO
after_success:
View
3 Core/Source/DTCoreTextConstants.h
@@ -73,6 +73,9 @@ extern NSString * const DTTextBlocksAttribute;
extern NSString * const DTFieldAttribute;
extern NSString * const DTCustomAttributesAttribute;
extern NSString * const DTAscentMultiplierAttribute;
+extern NSString * const DTBackgroundStrokeColorAttribute;
+extern NSString * const DTBackgroundStrokeWidthAttribute;
+extern NSString * const DTBackgroundCornerRadiusAttribute;
// field constants
View
3 Core/Source/DTCoreTextConstants.m
@@ -45,6 +45,9 @@
NSString * const DTFieldAttribute = @"DTField";
NSString * const DTCustomAttributesAttribute = @"DTCustomAttributes";
NSString * const DTAscentMultiplierAttribute = @"DTAscentMultiplierAttribute";
+NSString * const DTBackgroundStrokeColorAttribute = @"DTBackgroundStrokeColor";
+NSString * const DTBackgroundStrokeWidthAttribute = @"DTBackgroundStrokeWidth";
+NSString * const DTBackgroundCornerRadiusAttribute = @"DTBackgroundCornerRadius";
// field constants
NSString * const DTListPrefixField = @"{listprefix}";
View
19 Core/Source/DTHTMLElement.h
@@ -33,6 +33,10 @@
DTColor *_textColor;
DTColor *_backgroundColor;
+ DTColor *_backgroundStrokeColor;
+ CGFloat _backgroundStrokeWidth;
+ CGFloat _backgroundCornerRadius;
+
CTUnderlineStyle _underlineStyle;
NSString *_beforeContent;
@@ -153,6 +157,21 @@
@property (nonatomic, strong) DTColor *backgroundColor;
/**
+ Background stroke color in the receiver
+ */
+@property (nonatomic, strong) DTColor *backgroundStrokeColor;
+
+/**
+ Background stroke width in the receiver
+ */
+@property (nonatomic, assign) CGFloat backgroundStrokeWidth;
+
+/**
+ Background stroke width in the receiver
+ */
+@property (nonatomic, assign) CGFloat backgroundCornerRadius;
+
+/**
The custom letter spacing of the receiver, default is 0px
*/
@property (nonatomic, assign) CGFloat letterSpacing;
View
44 Core/Source/DTHTMLElement.m
@@ -296,6 +296,21 @@ - (NSDictionary *)attributesForAttributedStringRepresentation
{
[tmpDict setObject:_paragraphStyle.textBlocks forKey:DTTextBlocksAttribute];
}
+
+ if (_backgroundStrokeColor)
+ {
+ [tmpDict setObject:(id)[_backgroundStrokeColor CGColor] forKey:DTBackgroundStrokeColorAttribute];
+ }
+
+ if (_backgroundStrokeWidth)
+ {
+ [tmpDict setObject:DTNSNumberFromCGFloat(_backgroundStrokeWidth) forKey:DTBackgroundStrokeWidthAttribute];
+ }
+
+ if (_backgroundCornerRadius)
+ {
+ [tmpDict setObject:DTNSNumberFromCGFloat(_backgroundCornerRadius) forKey:DTBackgroundCornerRadiusAttribute];
+ }
return tmpDict;
}
@@ -1166,7 +1181,29 @@ - (void)applyStyleDictionary:(NSDictionary *)styles
}
}
- BOOL needsTextBlock = (_backgroundColor!=nil);
+ NSString *borderColor = [styles objectForKey:@"border-color"];
+ if (borderColor)
+ {
+ self.backgroundStrokeColor = DTColorCreateWithHTMLName(borderColor);
+ }
+ NSString *borderWidth = [[styles objectForKey:@"border-width"] lowercaseString];
+ if (borderWidth)
+ {
+ _backgroundStrokeWidth = [borderWidth floatValue];
+ }
+ else {
+ _backgroundStrokeWidth = 0.0f;
+ }
+ NSString *cornerRadius = [[styles objectForKey:@"border-radius"] lowercaseString];
+ if (cornerRadius)
+ {
+ _backgroundCornerRadius = [cornerRadius floatValue];
+ }
+ else {
+ _backgroundCornerRadius = 0.0f;
+ }
+
+ BOOL needsTextBlock = (_backgroundColor!=nil || _backgroundStrokeColor!=nil || _backgroundCornerRadius > 0 || _backgroundStrokeWidth > 0);
BOOL hasMargins = NO;
@@ -1355,6 +1392,11 @@ - (void)inheritAttributesFromElement:(DTHTMLElement *)element
_currentTextSize = element.currentTextSize;
_textScale = element.textScale;
+ _backgroundColor = element.backgroundColor;
+ _backgroundStrokeColor = element.backgroundStrokeColor;
+ _backgroundStrokeWidth = element.backgroundStrokeWidth;
+ _backgroundCornerRadius = element.backgroundCornerRadius;
+
// only inherit background-color from inline elements
if (element.displayStyle == DTHTMLElementDisplayStyleInline || element.displayStyle == DTHTMLElementDisplayStyleListItem)
{
View
35 Core/Source/NSDictionary+DTCoreText.m
@@ -221,4 +221,39 @@ - (CGFloat)kerning
return [kerningNum floatValue];
}
+- (DTColor *)backgroundStrokeColor
+{
+ CGColorRef cgColor = (__bridge CGColorRef)[self objectForKey:DTBackgroundStrokeColorAttribute];
+
+ if (cgColor)
+ {
+ return [DTColor colorWithCGColor:cgColor];
+ }
+ return nil;
+}
+
+- (CGFloat)backgroundStrokeWidth
+{
+ NSNumber *num = [self objectForKey:DTBackgroundStrokeWidthAttribute];
+
+ if (num)
+ {
+ return [num floatValue];
+ }
+
+ return 0.0f;
+}
+
+- (CGFloat)backgroundCornerRadius
+{
+ NSNumber *num = [self objectForKey:DTBackgroundCornerRadiusAttribute];
+
+ if (num)
+ {
+ return [num floatValue];
+ }
+
+ return 0.0f;
+}
+
@end
View
10 DTCoreText.podspec
@@ -1,21 +1,21 @@
Pod::Spec.new do |spec|
spec.name = 'DTCoreText'
- spec.version = '1.6.9'
+ spec.version = '1.6.10'
spec.platform = :ios, '4.3'
spec.license = 'BSD'
spec.source = { :git => 'https://github.com/Cocoanetics/DTCoreText.git', :tag => spec.version.to_s }
spec.source_files = 'Core/Source/*.{h,m,c}'
- spec.dependency 'DTFoundation/Core', '~>1.6.0'
- spec.dependency 'DTFoundation/UIKit', '~>1.6.0'
- spec.dependency 'DTFoundation/DTHTMLParser', '~>1.6.0'
+ spec.dependency 'DTFoundation/Core', '~>1.6.1'
+ spec.dependency 'DTFoundation/UIKit', '~>1.6.1'
+ spec.dependency 'DTFoundation/DTHTMLParser', '~>1.6.1'
spec.frameworks = 'MediaPlayer', 'QuartzCore', 'CoreText', 'CoreGraphics', 'ImageIO'
spec.requires_arc = true
spec.homepage = 'https://github.com/Cocoanetics/DTCoreText'
spec.summary = 'Methods to allow using HTML code with CoreText.'
spec.author = { 'Oliver Drobnik' => 'oliver@cocoanetics.com' }
spec.prefix_header_contents = '#import <CoreText/CoreText.h>'
spec.prepare_command = <<-CMD
- cd Core/Source
+ cd ./Core/Source
/usr/bin/xxd -i default.css default.css.c
CMD
end
2 Externals/DTFoundation
@@ -1 +1 @@
-Subproject commit fb64e5b266a8567428cf85da9175f91afa770227
+Subproject commit 5595cc49f0e2be2386c9dd201354b3e4ea8cbfe1
View
24 Readme.markdown
@@ -17,32 +17,12 @@ Documentation can be [browsed online](https://docs.cocoanetics.com/DTCoreText) o
A [Q&A](http://www.cocoanetics.com/2011/08/nsattributedstringhtml-qa/) answers some frequently asked questions.
+Changelog: [GitHub Releases](https://github.com/Cocoanetics/DTCoreText/releases)
+
There is also a [Programming Guide](Documentation/Programming Guide-template.markdown) with a set of solutions to common problems.
Follow [@cocoanetics](http://twitter.com/cocoanetics) on Twitter or subscribe to the [Cocoanetics Blog](http://www.cocoanetics.com) for news and updates.
-#### Changelog
-
-- [Version 1.6.9](http://www.cocoanetics.com/2013/11/dtcoretext-1-6-9/)
-- [Version 1.6.8](http://www.cocoanetics.com/2013/10/dtcoretext-1-6-8/)
-- [Version 1.6.7](http://www.cocoanetics.com/2013/09/dtcoretext-1-6-7/)
-- [Version 1.6.6](http://www.cocoanetics.com/2013/08/dtcoretext-1-6-6/)
-- [Version 1.6.5](http://www.cocoanetics.com/2013/08/dtcoretext-1-6-5/)
-- [Version 1.6.4](http://www.cocoanetics.com/2013/08/dtcoretext-1-6-4/)
-- [Version 1.6.3](http://www.cocoanetics.com/2013/08/dtcoretext-1-6-3-dtrichtexteditor-1-6-2/)
-- [Version 1.6.2](http://www.cocoanetics.com/2013/08/dtcoretext-1-6-2/)
-- [Version 1.6.1](http://www.cocoanetics.com/2013/07/dtcoretext-1-6-1/)
-- [Version 1.6.0](http://www.cocoanetics.com/2013/07/dtcoretext-1-6/)
-- [Version 1.5.3](http://www.cocoanetics.com/2013/06/dtcoretext-1-5-3/)
-- [Version 1.5.2](http://www.cocoanetics.com/2013/05/dtcoretext-1-5-2/)
-- [Version 1.5](http://www.cocoanetics.com/2013/05/rich-text-update-1-5/)
-- [Version 1.4.x](http://www.cocoanetics.com/2013/04/dtcoretext-1-4-2/)
-- [Version 1.4](http://www.cocoanetics.com/2013/04/rich-text-update-1-4/)
-- [Version 1.2](http://www.cocoanetics.com/2013/01/dtcoretext-1-2-0/)
-- [Version 1.1](http://www.cocoanetics.com/2012/12/dtcoretext-1-1/)
-- [Version 1.0.1](http://www.cocoanetics.com/2012/04/dtcoretext-1-0-1-linker-flags-and-rich-text-news/)
-- [Version 1.0](http://www.cocoanetics.com/2012/02/dtrichtexteditor-dtcoretext-news/)
-
License
-------

0 comments on commit 1059330

Please sign in to comment.
Something went wrong with that request. Please try again.