Compile on macOS 10.10 and lower

This commit is contained in:
Ricardo Quesada 2016-07-27 07:44:00 -07:00
parent 4e278183ad
commit 9dcc1f8193
1 changed files with 20 additions and 8 deletions

View File

@ -133,9 +133,15 @@ static NSSize _calculateRealSizeForString(NSAttributedString **str, id font, NSS
NSMutableAttributedString *mutableString = [[*str mutableCopy] autorelease];
*str = __attributedStringWithFontSize(mutableString, fontSize);
CGSize fitSize = [*str boundingRectWithSize:CGSizeMake( CGFLOAT_MAX, CGFLOAT_MAX)
options:NSStringDrawingUsesLineFragmentOrigin
context:nil].size;
#ifdef __MAC_10_11
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= __MAC_10_11
CGSize fitSize = [*str boundingRectWithSize:CGSizeMake( CGFLOAT_MAX, CGFLOAT_MAX) options:NSStringDrawingUsesLineFragmentOrigin context:nil].size;
#else
CGSize fitSize = [*str boundingRectWithSize:CGSizeMake( CGFLOAT_MAX, CGFLOAT_MAX) options:NSStringDrawingUsesLineFragmentOrigin].size;
#endif
#else
CGSize fitSize = [*str boundingRectWithSize:CGSizeMake( CGFLOAT_MAX, CGFLOAT_MAX) options:NSStringDrawingUsesLineFragmentOrigin].size;
#endif
if(fitSize.width == 0 || fitSize.height == 0) continue;
actualSize.size = fitSize;
@ -160,9 +166,15 @@ static NSSize _calculateRealSizeForString(NSAttributedString **str, id font, NSS
NSMutableAttributedString *mutableString = [[*str mutableCopy] autorelease];
*str = __attributedStringWithFontSize(mutableString, fontSize);
CGSize fitSize = [*str boundingRectWithSize:CGSizeMake( constrainSize.width, CGFLOAT_MAX)
options:NSStringDrawingUsesLineFragmentOrigin
context:nil].size;
#ifdef __MAC_10_11
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= __MAC_10_11
CGSize fitSize = [*str boundingRectWithSize:CGSizeMake( constrainSize.width, CGFLOAT_MAX) options:NSStringDrawingUsesLineFragmentOrigin context:nil].size;
#else
CGSize fitSize = [*str boundingRectWithSize:CGSizeMake( constrainSize.width, CGFLOAT_MAX) options:NSStringDrawingUsesLineFragmentOrigin].size;
#endif
#else
CGSize fitSize = [*str boundingRectWithSize:CGSizeMake( constrainSize.width, CGFLOAT_MAX) options:NSStringDrawingUsesLineFragmentOrigin].size;
#endif
if(fitSize.width == 0 || fitSize.height == 0) continue;
actualSize.size = fitSize;