Skip to content

Commit

Permalink
Merge branch 'release-1.6.26'
Browse files Browse the repository at this point in the history
  • Loading branch information
odrobnik committed Jun 29, 2021
2 parents dcb893d + 7c6240a commit 8d0ff0a
Show file tree
Hide file tree
Showing 20 changed files with 282 additions and 224 deletions.
18 changes: 4 additions & 14 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,7 @@
language: objective-c
osx_image: xcode7

before_install:
- curl -sL https://gist.github.com/henrikhodne/7ac6d02ff9a24a94720c/raw/install_appledoc.sh | sh

install:
- sudo easy_install cpp-coveralls
osx_image: xcode12

script:
- xctool -project DTCoreText.xcodeproj -scheme DemoApp build -sdk iphonesimulator -arch i386 ONLY_ACTIVE_ARCH=NO
- xctool -project DTCoreText.xcodeproj -scheme "DTCoreText (iOS)" test -sdk iphonesimulator
- xctool -project DTCoreText.xcodeproj -scheme "DTCoreText (Mac)" build
- appledoc -o /tmp .

after_success:
- ./coveralls.rb --extension m --exclude-folder Demo --exclude-folder Test --exclude-folder Externals
- xcodebuild -project DTCoreText.xcodeproj -scheme DemoApp build -sdk iphonesimulator -arch i386 ONLY_ACTIVE_ARCH=NO | xcpretty -s
- xcodebuild -project DTCoreText.xcodeproj -scheme "DTCoreText (iOS)" build test -sdk iphonesimulator | xcpretty -s
- xcodebuild -project DTCoreText.xcodeproj -scheme "DTCoreText (Mac)" build | xcpretty -s
4 changes: 3 additions & 1 deletion Core/Source/DTAccessibilityElement.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@

#if TARGET_OS_IPHONE && !TARGET_OS_WATCH

#import <DTFoundation/DTWeakSupport.h>

static const CGPoint DTAccessibilityElementNullActivationPoint = {CGFLOAT_MAX, CGFLOAT_MAX};

@interface DTAccessibilityElement()
@property (nonatomic, unsafe_unretained) UIView *parentView;
@property (nonatomic, DT_WEAK_PROPERTY) UIView *parentView;
@end

@implementation DTAccessibilityElement
Expand Down
3 changes: 2 additions & 1 deletion Core/Source/DTAccessibilityViewProxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#if TARGET_OS_IPHONE && !TARGET_OS_WATCH

#import "DTTextAttachment.h"
#import <DTFoundation/DTWeakSupport.h>

@protocol DTAccessibilityViewProxyDelegate;

Expand All @@ -23,7 +24,7 @@
/**
The delegate for the proxy
*/
@property (nonatomic, unsafe_unretained, readonly) id<DTAccessibilityViewProxyDelegate> delegate;
@property (nonatomic, DT_WEAK_PROPERTY, readonly) id<DTAccessibilityViewProxyDelegate> delegate;

/**
The text attachment represented by the proxy
Expand Down
25 changes: 15 additions & 10 deletions Core/Source/DTAttributedTextView.m
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,12 @@ - (void)dealloc

- (void)layoutSubviews
{
(void)[self attributedTextContentView];
[super layoutSubviews];

self.attributedTextContentView.edgeInsets = self.contentInset;

// layout custom subviews for visible area
[_attributedTextContentView layoutSubviewsInRect:self.bounds];

[super layoutSubviews];
}

- (void)awakeFromNib
Expand All @@ -71,6 +71,11 @@ - (void)awakeFromNib
[self _setup];
}

- (void)safeAreaInsetsDidChange
{
[super safeAreaInsetsDidChange];
}

// default
- (void)_setup
{
Expand Down Expand Up @@ -287,14 +292,14 @@ - (void)setBackgroundColor:(DTColor *)newColor

- (void)setContentInset:(UIEdgeInsets)contentInset
{
if (!UIEdgeInsetsEqualToEdgeInsets(self.contentInset, contentInset))
[super setContentInset:contentInset];

// height does not matter, that will be determined anyhow
CGRect contentFrame = CGRectMake(0, 0, self.frame.size.width - self.contentInset.left - self.contentInset.right, _attributedTextContentView.frame.size.height);

if (CGRectEqualToRect(contentFrame, self.attributedTextContentView.frame))
{
[super setContentInset:contentInset];

// height does not matter, that will be determined anyhow
CGRect contentFrame = CGRectMake(0, 0, self.frame.size.width - self.contentInset.left - self.contentInset.right, _attributedTextContentView.frame.size.height);

_attributedTextContentView.frame = contentFrame;
self.attributedTextContentView.frame = contentFrame;
}
}

Expand Down
35 changes: 33 additions & 2 deletions Core/Source/DTCoreTextFontDescriptor.m
Original file line number Diff line number Diff line change
Expand Up @@ -655,8 +655,39 @@ - (CTFontRef)_findOrMakeMatchingFont
CFRelease(searchingFontDescriptor);
searchingFontDescriptor = CTFontDescriptorCreateWithAttributes((__bridge CFDictionaryRef)mutableAttributes);

// do the relaxed search
matchingFontDescriptor = CTFontDescriptorCreateMatchingFontDescriptor(searchingFontDescriptor, NULL);
if (matchingFontDescriptors)
{
CFRelease(matchingFontDescriptors);
}

matchingFontDescriptors = CTFontDescriptorCreateMatchingFontDescriptors(searchingFontDescriptor, NULL);
if (matchingFontDescriptors) {
CFIndex count = CFArrayGetCount(matchingFontDescriptors);
if (count == 1) {
matchingFontDescriptor = CTFontDescriptorCreateMatchingFontDescriptor(searchingFontDescriptor, (__bridge CFSetRef)mandatoryAttributes);
} else {
CFIndex i = 0;
for (i=0; i<count; i++) {
CTFontDescriptorRef currentFontDescriptor = CFArrayGetValueAtIndex(matchingFontDescriptors, i);
CFDictionaryRef traits = CTFontDescriptorCopyAttribute(currentFontDescriptor, kCTFontTraitsAttribute);
NSDictionary *traitsDictionary = CFBridgingRelease(traits);

BOOL hasSlantValue = [traitsDictionary[@"NSCTFontSlantTrait"] boolValue];
BOOL hasBoldValue = [traitsDictionary[@"NSCTFontWeightTrait"] boolValue];

BOOL hasMatchingBoldTrait = hasBoldValue == self.boldTrait;
BOOL hasMatchingItalicTrait = hasSlantValue == self.italicTrait;

if (hasMatchingBoldTrait && hasMatchingItalicTrait) {
matchingFontDescriptor = currentFontDescriptor;
CFRetain(matchingFontDescriptor);

// take first one that fits
break;
}
}
}
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion Core/Source/DTCoreTextGlyphRun.m
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#import "DTCoreTextParagraphStyle.h"
#import "DTCoreTextFunctions.h"
#import "NSDictionary+DTCoreText.h"
#import "DTWeakSupport.h"
#import <DTFoundation/DTWeakSupport.h>

#import <DTFoundation/DTLog.h>

Expand Down
2 changes: 1 addition & 1 deletion Core/Source/DTCoreTextParagraphStyle.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#import "DTCoreTextParagraphStyle.h"
#import "DTTextBlock.h"
#import "DTCSSListStyle.h"
#import "DTWeakSupport.h"
#import <DTFoundation/DTWeakSupport.h>
#import "DTCoreTextFunctions.h"

@implementation DTCoreTextParagraphStyle
Expand Down
6 changes: 3 additions & 3 deletions Core/Source/DTHTMLElement.m
Original file line number Diff line number Diff line change
Expand Up @@ -760,15 +760,15 @@ - (void)applyStyleDictionary:(NSDictionary *)styles
{
if ([directionStr isEqualToString:@"rtl"])
{
_paragraphStyle.baseWritingDirection = NSWritingDirectionRightToLeft;
_paragraphStyle.baseWritingDirection = kCTWritingDirectionRightToLeft;
}
else if ([directionStr isEqualToString:@"ltr"])
{
_paragraphStyle.baseWritingDirection = NSWritingDirectionLeftToRight;
_paragraphStyle.baseWritingDirection = kCTWritingDirectionLeftToRight;
}
else if ([directionStr isEqualToString:@"auto"])
{
_paragraphStyle.baseWritingDirection = NSWritingDirectionNatural; // that's also default
_paragraphStyle.baseWritingDirection = kCTWritingDirectionNatural; // that's also default
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion Core/Source/DTHTMLParserNode.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#import "DTHTMLParserNode.h"
#import "DTHTMLParserTextNode.h"
#import "DTWeakSupport.h"
#import <DTFoundation/DTWeakSupport.h>

@implementation DTHTMLParserNode
{
Expand Down
2 changes: 1 addition & 1 deletion Core/Source/DTWeakSupport.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@
#define DT_WEAK_VARIABLE
#define DT_WEAK_PROPERTY assign

#endif
#endif
2 changes: 1 addition & 1 deletion DTCoreText.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |spec|
spec.name = 'DTCoreText'
spec.version = '1.6.25'
spec.version = '1.6.26'
spec.platforms = {:ios => '4.3', :tvos => '9.0' }
spec.license = 'BSD'
spec.source = { :git => 'https://github.com/Cocoanetics/DTCoreText.git', :tag => spec.version.to_s }
Expand Down
Loading

0 comments on commit 8d0ff0a

Please sign in to comment.