|
@@ -675,7 +675,16 @@ OSSpinLockUnlock(&_lock);
|
|
|
[lastLineText appendAttributedString:truncationToken];
|
|
|
CTLineRef ctLastLineExtend = CTLineCreateWithAttributedString((CFAttributedStringRef)lastLineText);
|
|
|
if (ctLastLineExtend) {
|
|
|
- CTLineRef ctTruncatedLine = CTLineCreateTruncatedLine(ctLastLineExtend, lastLine.width, type, truncationTokenLine);
|
|
|
+ CGFloat truncatedWidth = lastLine.width;
|
|
|
+ CGRect cgPathRect = CGRectZero;
|
|
|
+ if (CGPathIsRect(cgPath, &cgPathRect)) {
|
|
|
+ if (isVerticalForm) {
|
|
|
+ truncatedWidth = cgPathRect.size.height;
|
|
|
+ } else {
|
|
|
+ truncatedWidth = cgPathRect.size.width;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ CTLineRef ctTruncatedLine = CTLineCreateTruncatedLine(ctLastLineExtend, truncatedWidth, type, truncationTokenLine);
|
|
|
CFRelease(ctLastLineExtend);
|
|
|
if (ctTruncatedLine) {
|
|
|
truncatedLine = [YYTextLine lineWithCTLine:ctTruncatedLine position:lastLine.position vertical:isVerticalForm];
|