Skip to content

Commit

Permalink
Merge pull request #180 from maximkhatskevich/master
Browse files Browse the repository at this point in the history
64bit support and improved Gitignore file.
  • Loading branch information
AliSoftware committed Feb 11, 2014
2 parents e732f6c + f1fb7cf commit ec1a489
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 5 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@
xcuserdata
profile
*.moved-aside

DerivedData
.idea/
*.hmap
*.xcuserstate
*.xccheckout

# old school
.svn
Expand Down
2 changes: 2 additions & 0 deletions OHAttributedLabel/OHAttributedLabel.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@
09E159F7160F573A003025B4 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)";
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
Expand All @@ -314,6 +315,7 @@
09E159F8160F573A003025B4 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)";
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
Expand Down
8 changes: 6 additions & 2 deletions OHAttributedLabel/Source/NSAttributedString+Attributes.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@

#import "NSAttributedString+Attributes.h"

#include <tgmath.h>

#if ! defined(COCOAPODS) && ! defined(OHATTRIBUTEDLABEL_DEDICATED_PROJECT)
// Copying files in your project and thus compiling OHAttributedLabel under different build settings
// than the one provided is not recommended and increase risks of leaks (mixing ARC vs. MRC) or unwanted behaviors
Expand Down Expand Up @@ -71,7 +73,7 @@ -(CGSize)sizeConstrainedToSize:(CGSize)maxSize fitRange:(NSRange*)fitRange
{
CFRange fitCFRange = CFRangeMake(0,0);
sz = CTFramesetterSuggestFrameSizeWithConstraints(framesetter,CFRangeMake(0,0),NULL,maxSize,&fitCFRange);
sz = CGSizeMake( floorf(sz.width+1) , floorf(sz.height+1) ); // take 1pt of margin for security
sz = CGSizeMake( floor(sz.width+1) , floor(sz.height+1) ); // take 1pt of margin for security
CFRelease(framesetter);

if (fitRange)
Expand Down Expand Up @@ -348,7 +350,9 @@ -(void)setCharacterSpacing:(CGFloat)chracterSpacing
}
-(void)setCharacterSpacing:(CGFloat)chracterSpacing range:(NSRange)range
{
[self addAttribute:(NSString *)kCTKernAttributeName value:[NSNumber numberWithFloat:chracterSpacing] range:range];
[self addAttribute:(NSString *)kCTKernAttributeName
value:@(chracterSpacing) // http://stackoverflow.com/a/17067994
range:range];
}

-(void)modifyParagraphStylesWithBlock:(void(^)(OHParagraphStyle* paragraphStyle))block
Expand Down
4 changes: 3 additions & 1 deletion OHAttributedLabel/Source/OHAttributedLabel.m
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
#import "CoreTextUtils.h"
#import "OHTouchesGestureRecognizer.h"

#include <tgmath.h>

#ifndef OHATTRIBUTEDLABEL_WARN_ABOUT_KNOWN_ISSUES
#define OHATTRIBUTEDLABEL_WARN_ABOUT_KNOWN_ISSUES 1
#endif
Expand Down Expand Up @@ -556,7 +558,7 @@ - (void)drawTextInRect:(CGRect)aRect
CGSize sz = CTFramesetterSuggestFrameSizeWithConstraints(framesetter,CFRangeMake(0,0),NULL,CGSizeMake(drawingRect.size.width,CGFLOAT_MAX),NULL);
if (self.extendBottomToFit)
{
CGFloat delta = MAX(0.f , ceilf(sz.height - drawingRect.size.height)) + 10 /* Security margin */;
CGFloat delta = MAX(0.f , ceil(sz.height - drawingRect.size.height)) + 10 /* Security margin */;
drawingRect.origin.y -= delta;
drawingRect.size.height += delta;
}
Expand Down
4 changes: 3 additions & 1 deletion OHAttributedLabel/Source/OHTouchesGestureRecognizer.m
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@

#import <UIKit/UIGestureRecognizerSubclass.h>

#include <tgmath.h>

@interface OHTouchesGestureRecognizer ()

@property (nonatomic, assign) CGPoint startPoint;
Expand All @@ -49,7 +51,7 @@ - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
CGPoint currentPoint = [touch locationInView:self.view];
CGFloat distanceX = (currentPoint.x - _startPoint.x);
CGFloat distanceY = (currentPoint.y - _startPoint.y);
CGFloat distance = sqrtf(distanceX * distanceX + distanceY * distanceY);
CGFloat distance = sqrt(distanceX * distanceX + distanceY * distanceY);
if (distance > 10.0f) {
self.state = UIGestureRecognizerStateCancelled;
} else {
Expand Down

0 comments on commit ec1a489

Please sign in to comment.