Skip to content

Commit

Permalink
Fix loop in YYTextDrawInnerShadow()
Browse files Browse the repository at this point in the history
  • Loading branch information
yanyin1986 committed Jan 8, 2020
1 parent b144f1f commit 234eca2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion YYText/Component/YYTextLayout.m
Original file line number Diff line number Diff line change
Expand Up @@ -3098,7 +3098,10 @@ static void YYTextDrawInnerShadow(YYTextLayout *layout, CGContextRef context, CG
CTRunGetPositions(run, CFRangeMake(0, 1), &runPosition);
CGRect runImageBounds = CTRunGetImageBounds(run, context, CFRangeMake(0, 0));
runImageBounds.origin.x += runPosition.x;
if (runImageBounds.size.width < 0.1 || runImageBounds.size.height < 0.1) continue;
if (runImageBounds.size.width < 0.1 || runImageBounds.size.height < 0.1) {
shadow = shadow.subShadow;
continue;
}

CFDictionaryRef runAttrs = CTRunGetAttributes(run);
NSValue *glyphTransformValue = CFDictionaryGetValue(runAttrs, (__bridge const void *)(YYTextGlyphTransformAttributeName));
Expand Down

0 comments on commit 234eca2

Please sign in to comment.